Esempio n. 1
0
 /**
  * 对用户基本信息进行删除操作
  *
  * @return
  * @throws IOException
  */
 public String deptuserDelete() throws Exception {
   SqlSession sqlSession = null;
   try {
     sqlSession = DbSessionFactory.getOracleSession();
     C_T_Sys_Dept_UserMapper mapper = sqlSession.getMapper(C_T_Sys_Dept_UserMapper.class);
     // 如果没有选中的数据的ID则不作任何处理
     if (!"".equals(checkedIds)) {
       String[] arrUserids;
       arrUserids = checkedIds.split("%2C");
       C_T_Sys_Dept_UserExample example = new C_T_Sys_Dept_UserExample();
       // 循环遍历选中的数据的ID
       for (String tempUserid : arrUserids) {
         // 将ID作为条件加入条件集合中
         example.or().andUuidEqualTo(tempUserid);
       }
       // 根据条件删除对应的数据
       mapper.deleteByExample(example);
       sqlSession.commit();
     }
     jsonResult = Constants.DISP_OPERATION_SUCCESSFUL;
   } catch (Exception e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
     return ERROR;
   } finally {
     if (sqlSession != null) {
       sqlSession.close();
       sqlSession = null;
     }
   }
   return SUCCESS;
 }
Esempio n. 2
0
  public String deptuserDetailsLoad() throws Exception {
    SqlSession sqlSession = null;
    try {
      sqlSession = DbSessionFactory.getOracleSession();
      allPermission = "*";
      C_T_Sys_Dept_UserMapper mapper = sqlSession.getMapper(C_T_Sys_Dept_UserMapper.class);
      C_T_Sys_UserMapper usermapper = sqlSession.getMapper(C_T_Sys_UserMapper.class);

      // 根据主键取得流程基本信息
      c_T_Sys_Dept_User = (C_T_Sys_Dept_User) mapper.selectByPrimaryKey(uuid);
      C_T_Sys_User user = null;
      if (c_T_Sys_Dept_User != null) {
        user = (C_T_Sys_User) usermapper.selectByPrimaryKey(c_T_Sys_Dept_User.getUserSysName());
        userName = user.getUserName();
      }

      // 取得部门基本信息
      listDept = GetBaseInfor.getDepartmentBaseInfor("sort", sqlSession);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      return ERROR;
    } finally {
      if (sqlSession != null) {
        sqlSession.close();
        sqlSession = null;
      }
    }
    return SUCCESS;
  }
Esempio n. 3
0
 /**
  * 对用户基本信息进行更新操作
  *
  * @return
  * @throws IOException
  */
 public void deptuserUpdate() throws Exception {
   SqlSession sqlSession = null;
   try {
     sqlSession = DbSessionFactory.getOracleSession();
     C_T_Sys_Dept_UserMapper mapper = sqlSession.getMapper(C_T_Sys_Dept_UserMapper.class);
     C_T_Sys_UserMapper usermapper = sqlSession.getMapper(C_T_Sys_UserMapper.class);
     // 创建需要更新的记录集合
     C_T_Sys_Dept_User record = new C_T_Sys_Dept_User();
     C_T_Sys_User user =
         (C_T_Sys_User) usermapper.selectByPrimaryKey(c_T_Sys_Dept_User.getUserSysName());
     if (user != null) {
       // c_T_Sys_Dept_User.setDeptId(user.getDeptId());
       c_T_Sys_Dept_User.setUnitId(user.getUnitId());
     }
     if (null == c_T_Sys_Dept_User.getUuid() || "".equals(c_T_Sys_Dept_User.getUuid().trim())) {
       // 将画面上的数据赋值给需要更新的数据(如果不是单主键的话需要手动给主键赋值)
       String uuid = new GUID().toString();
       c_T_Sys_Dept_User.setUuid(uuid);
       DbSetData.setPerporyData(c_T_Sys_Dept_User, record, 2);
       // DbOperationFation.insert(C_T_Sys_UserMapper.class, record);
       mapper.insertSelective(record);
     } else {
       // 将画面上的数据赋值给需要更新的数据(如果不是单主键的话需要手动给主键赋值)
       DbSetData.setPerporyData(c_T_Sys_Dept_User, record, 1);
       mapper.updateByPrimaryKeySelective(record);
     }
     sqlSession.commit();
   } catch (Exception e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } finally {
     if (sqlSession != null) {
       sqlSession.close();
       sqlSession = null;
     }
   }
   // jsonResult=Constants.DISP_OPERATION_SUCCESSFUL;
   // return SUCCESS;
 }