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; }
/** * 对用户基本信息进行更新操作 * * @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; }