@Override public UserEntity selectEntity(Integer primaryKey) { UserEntity entity = super.selectEntity(primaryKey); entity.setUserExtEntity(userExtMapper.selectEntity(primaryKey)); entity.setRoleList(selectRoleList(entity.getF_id())); entity.setMenuList(selectMenuList(entity.getF_id())); return entity; }
public void updateEntity(UserEntity entity) { if (null != entity.getUserExtEntity()) { entity.getUserExtEntity().setF_id(entity.getF_id()); if (userExtMapper.updateEntity(entity.getUserExtEntity()) == 0) { userExtMapper.insertEntity(entity.getUserExtEntity()); } } deleteRoleList(entity.getF_id()); deleteMenuList(entity.getF_id()); insertRoleList(entity); insertMenuList(entity); super.updateEntity(entity); }
private void insertMenuList(UserEntity user) { List<MapEntity> menuList = user.getMenuList(); if (!HelpUtil.isEmptyCollection(menuList)) { for (MapEntity map : menuList) { map.put("f_user_id", user.getF_id()); } userMenuMapper.insertEntities(menuList); } }
private void insertRoleList(UserEntity user) { List<MapEntity> roleList = user.getRoleList(); if (!HelpUtil.isEmptyCollection(roleList)) { for (MapEntity map : roleList) { map.put("f_user_id", user.getF_id()); } userRoleMapper.insertEntities(roleList); } }
@Override public void insertEntity(UserEntity entity) { entity.setF_create_time(HelpUtil.getNowTime()); entity.setF_password(passwordEncoder.encode("pkpm")); // TODO entity.setF_status(1); super.insertEntity(entity); if (null != entity.getUserExtEntity()) { entity.getUserExtEntity().setF_id(entity.getF_id()); userExtMapper.insertEntity(entity.getUserExtEntity()); } insertRoleList(entity); insertMenuList(entity); }