Browse Source

Merge branch 'dev_oper_role' into dev

master
sunyuchao 4 years ago
parent
commit
0fbad9d495
  1. 5
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleDTO.java
  2. 10
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleTemplateDTO.java
  3. 5
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleEntity.java
  4. 10
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleTemplateEntity.java
  5. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/RoleInfoResultDTO.java
  6. 3
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java
  7. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffRoleResultDTO.java
  8. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java
  9. 30
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpGovRoleFormDTO.java
  10. 23
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java
  11. 10
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleTemplateDTO.java
  12. 42
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java
  13. 18
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java
  14. 22
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleTemplateDao.java
  15. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleEntity.java
  16. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleTemplateEntity.java
  17. 33
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java
  18. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  19. 99
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java
  20. 9
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.13__alter_gov_staff_role.sql
  21. 47
      epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml
  22. 48
      epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleTemplateDao.xml

5
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleDTO.java

@ -93,6 +93,11 @@ public class GovStaffRoleDTO implements Serializable {
*/
private Integer fullTimeOnly;
/**
* 角色对应的职责说明
*/
private String description;
/**
* 排序
*/

10
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleTemplateDTO.java

@ -58,6 +58,16 @@ public class GovStaffRoleTemplateDTO implements Serializable {
*/
private Integer fullTimeOnly;
/**
* 角色对应的职责说明
*/
private String description;
/**
* 排序
*/
private String sort;
/**
*
*/

5
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleEntity.java

@ -63,6 +63,11 @@ public class GovStaffRoleEntity extends BaseEpmetEntity {
*/
private Integer fullTimeOnly;
/**
* 角色对应的职责说明
*/
private String description;
/**
* 排序
*/

10
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleTemplateEntity.java

@ -58,4 +58,14 @@ public class GovStaffRoleTemplateEntity extends BaseEpmetEntity {
*/
private Integer fullTimeOnly;
/**
* 角色对应的职责说明
*/
private String description;
/**
* 排序
*/
private String sort;
}

2
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/RoleInfoResultDTO.java

@ -31,4 +31,6 @@ public class RoleInfoResultDTO implements Serializable{
private Boolean fullTimeOnly = false;
private String roleKey;
private String description;
}

3
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java

@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author zhaoqifeng
@ -37,4 +38,6 @@ public class StaffInfoResultDTO implements Serializable {
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String roleName;
List<String> roles;
}

2
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffRoleResultDTO.java

@ -30,4 +30,6 @@ public class StaffRoleResultDTO implements Serializable {
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private Boolean selected;
private String description;
}

5
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java

@ -63,6 +63,11 @@ public class GovStaffRoleDTO implements Serializable {
* */
private Boolean fullTimeOnly;
/**
* 角色对应的职责说明
*/
private String description;
/**
* 排序
* */

30
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpGovRoleFormDTO.java

@ -0,0 +1,30 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
@Data
public class UpGovRoleFormDTO {
/**
* 角色表id
*/
@NotEmpty(message = "角色Id不能为空", groups = {Update.class})
private String roleId;
/**
* 角色名称
*/
private String roleName;
/**
* 职责描述
*/
private String description;
/**
* token中userId
*/
private String userId;
public interface Update extends CustomerClientShowGroup {}
}

23
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java

@ -17,6 +17,7 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
@ -64,4 +65,26 @@ public class GovStaffRoleResultDTO implements Serializable {
private String mobile;
private String gender;
/**
* 职责描述
*/
private String description;
/**
* 角色key[默认值]
*/
private String defRoleKey;
/**
* 角色名称[默认值]
*/
private String defRoleName;
/**
* 职责描述[默认值]
*/
private String defDescription;
/**
* 排序
*/
@JsonIgnore
private Integer sort;
}

10
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleTemplateDTO.java

@ -58,6 +58,16 @@ public class GovStaffRoleTemplateDTO implements Serializable {
* */
private Boolean fullTimeOnly;
/**
* 角色对应的职责说明
*/
private String description;
/**
* 排序
*/
private String sort;
/**
*
*/

42
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java

@ -6,6 +6,7 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.GovStaffRoleFormDTO;
import com.epmet.dto.form.UpGovRoleFormDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.dto.result.GovStaffRoleTemplateDTO;
import com.epmet.dto.result.ResiGovRoleListResultDTO;
@ -76,15 +77,14 @@ public class GovStaffRoleController {
/**
* 更新客户的指定角色
* @param form
* @param formDTO
* @return
*/
@PostMapping("update-role")
public Result updateRole(@RequestBody GovStaffRoleFormDTO form) {
ValidatorUtils.validateEntity(form, GovStaffRoleFormDTO.UpdateRoleGroup.class);
if (govStaffRoleService.updateRole(form.getRoleId(), form.getRoleName()) == 0) {
throw new RenException("修改角色信息失败");
}
public Result updateRole(@LoginUser TokenDto tokenDTO, @RequestBody UpGovRoleFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, UpGovRoleFormDTO.Update.class);
formDTO.setUserId(tokenDTO.getUserId());
govStaffRoleService.updateCustomerRole(formDTO);
return new Result();
}
@ -94,10 +94,9 @@ public class GovStaffRoleController {
* @return
*/
@PostMapping("save-sortorder")
public Result saveSortOrder(@RequestBody GovStaffRoleFormDTO form) {
public Result saveSortOrder(@LoginUser TokenDto tokenDTO, @RequestBody GovStaffRoleFormDTO form) {
ValidatorUtils.validateEntity(form, GovStaffRoleFormDTO.SaveRoleOrderGroup.class);
List<String> roleIdList = form.getRoleIdList();
govStaffRoleService.saveSortOrder(roleIdList);
govStaffRoleService.saveSortOrder(tokenDTO.getUserId(), form.getRoleIdList());
return new Result();
}
@ -124,4 +123,29 @@ public class GovStaffRoleController {
Result<List<RoleInfoResultDTO>> queryCustomerGovRoleList(@PathVariable("customerId") String customerId){
return new Result<List<RoleInfoResultDTO>>().ok(govStaffRoleService.queryCustomerGovRoleList(customerId));
}
/**
* @param formDTO
* @Description 默认权限保存排序
* @Author sun
**/
@PostMapping("savedefaultsort")
public Result saveDefaultSort(@LoginUser TokenDto tokenDTO, @RequestBody GovStaffRoleFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, GovStaffRoleFormDTO.SaveRoleOrderGroup.class);
govStaffRoleService.saveDefaultSort(tokenDTO.getUserId(), formDTO.getRoleIdList());
return new Result();
}
/**
* @param formDTO
* @Description 修改角色名称或职责描述
* @Author sun
**/
@PostMapping("updatedefaultrole")
public Result updateDefaultRole(@LoginUser TokenDto tokenDTO, @RequestBody UpGovRoleFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, UpGovRoleFormDTO.Update.class);
formDTO.setUserId(tokenDTO.getUserId());
govStaffRoleService.updateDefaultRole(formDTO);
return new Result();
}
}

18
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java

@ -19,6 +19,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.GovStaffRoleDTO;
import com.epmet.dto.form.UpGovRoleFormDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.dto.result.RoleInfoResultDTO;
import com.epmet.dto.result.RoleKeyValueResultDTO;
@ -46,6 +47,14 @@ public interface GovStaffRoleDao extends BaseDao<GovStaffRoleEntity> {
*/
List<GovStaffRoleEntity> listRolesByStaffId(@Param("staffId") String staffId, @Param("orgId") String orgId);
/**
* 根据staffId查询具有的角色列表
* @param staffId
* @param orgId
* @return
*/
List<GovStaffRoleEntity> getStaffRoles(@Param("staffIds") List<String> staffId, @Param("orgId") String orgId);
/**
* 获取客户机关角色列表
* @param params
@ -75,7 +84,7 @@ public interface GovStaffRoleDao extends BaseDao<GovStaffRoleEntity> {
int updateColumnsById(@Param("roleId") String roleId, @Param("roleName") String roleName);
int updateSortById(@Param("roleId") String roleId, @Param("sort") int sort);
int updateSortById(@Param("roleId") String roleId, @Param("sort") int sort, @Param("userId") String userId);
List<GovStaffRoleResultDTO> listRolesByRoleKey(@Param("roleKey") String roleKey);
@ -88,4 +97,11 @@ public interface GovStaffRoleDao extends BaseDao<GovStaffRoleEntity> {
* @date 2021/6/15 2:35 下午
*/
List<RoleKeyValueResultDTO> selectRoleKeyName(@Param("roleIds")List<String> roleIds);
/**
* @param formDTO
* @Description 修改客户角色名称或职责描述
* @Author sun
**/
int upNameOrDescription(UpGovRoleFormDTO formDTO);
}

22
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleTemplateDao.java

@ -18,10 +18,13 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.UpGovRoleFormDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.dto.result.GovStaffRoleTemplateDTO;
import com.epmet.dto.result.ResiGovRoleResultDTO;
import com.epmet.entity.GovStaffRoleTemplateEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -45,4 +48,23 @@ public interface GovStaffRoleTemplateDao extends BaseDao<GovStaffRoleTemplateEnt
* @Description 获取工作端角色列表
*/
List<ResiGovRoleResultDTO> selectGovRoleList();
/**
* @author sun
* @Description 获取工作端默认角色列表
*/
List<GovStaffRoleResultDTO> defaultRoleList();
/**
* @author sun
* @Description 修改默认权限排序
*/
int updateSortById(@Param("roleId") String roleId, @Param("sort") int sort, @Param("userId") String userId);
/**
* @param formDTO
* @Description 修改角色名称或职责描述
* @Author sun
**/
int upNameOrDescription(UpGovRoleFormDTO formDTO);
}

5
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleEntity.java

@ -63,6 +63,11 @@ public class GovStaffRoleEntity extends BaseEpmetEntity {
* */
private Boolean fullTimeOnly;
/**
* 角色对应的职责说明
*/
private String description;
/**
* 排序
* */

10
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleTemplateEntity.java

@ -58,4 +58,14 @@ public class GovStaffRoleTemplateEntity extends BaseEpmetEntity {
* */
private Boolean fullTimeOnly;
/**
* 角色对应的职责说明
*/
private String description;
/**
* 排序
*/
private String sort;
}

33
epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java

@ -20,6 +20,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.GovStaffRoleDTO;
import com.epmet.dto.form.UpGovRoleFormDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.dto.result.GovStaffRoleTemplateDTO;
import com.epmet.dto.result.ResiGovRoleListResultDTO;
@ -104,6 +105,16 @@ public interface GovStaffRoleService extends BaseService<GovStaffRoleEntity> {
*/
List<GovStaffRoleEntity> listRolesByStaffId(String staffId, String orgId);
/**
* 查询用户角色
* @author zhaoqifeng
* @date 2021/7/1 15:30
* @param staffIds
* @param orgId
* @return java.util.Map<java.lang.String,java.util.List<java.lang.String>>
*/
Map<String, List<String>> getStaffRoles(List<String> staffIds, String orgId);
/**
* 获取当前机关下的角色列表
* @param dto
@ -138,7 +149,7 @@ public interface GovStaffRoleService extends BaseService<GovStaffRoleEntity> {
int updateRole(String roleId, String roleName);
void saveSortOrder(List<String> roleIdList);
void saveSortOrder(String userId, List<String> roleIdList);
List<GovStaffRoleResultDTO> listRolesByRoleKey(String roleKey);
@ -150,4 +161,24 @@ public interface GovStaffRoleService extends BaseService<GovStaffRoleEntity> {
* @Date 2021/3/29 15:37
**/
List<RoleInfoResultDTO> queryCustomerGovRoleList(String customerId);
/**
* @Description 默认权限保存排序
* @Author sun
**/
void saveDefaultSort(String userId, List<String> roleIdList);
/**
* @param formDTO
* @Description 修改角色名称或职责描述
* @Author sun
**/
void updateDefaultRole(UpGovRoleFormDTO formDTO);
/**
* @param formDTO
* @Description 修改客户角色名称或职责描述
* @Author sun
**/
void updateCustomerRole(UpGovRoleFormDTO formDTO);
}

8
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

@ -226,6 +226,12 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
if (null == list) {
list = new ArrayList<>();
}
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list)) {
Map<String, List<String>> map = govStaffRoleService.getStaffRoles(fromDTO.getStaffList(), fromDTO.getAgencyId());
list.forEach(item -> {
item.setRoles(map.get(item.getStaffId()));
});
}
return new Result<List<StaffInfoResultDTO>>().ok(list);
}
@ -245,6 +251,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
staffRoleResultDTO.setRoleId(p.getId());
staffRoleResultDTO.setRoleName(p.getRoleName());
staffRoleResultDTO.setFullTimeOnly(p.getFullTimeOnly());
staffRoleResultDTO.setDescription(p.getDescription());
return staffRoleResultDTO;
}).collect(Collectors.toList());
return new Result<List<RoleInfoResultDTO>>().ok(staffRoleList);
@ -277,6 +284,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
staffRoleResultDTO.setRoleId(p.getId());
staffRoleResultDTO.setRoleName(p.getRoleName());
staffRoleResultDTO.setFullTimeOnly(p.getFullTimeOnly());
staffRoleResultDTO.setDescription(p.getDescription());
staffRoleResultDTO.setSelected(false);
return staffRoleResultDTO;
}).collect(Collectors.toList());

99
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java

@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
@ -30,6 +31,7 @@ import com.epmet.dao.GovStaffRoleTemplateDao;
import com.epmet.dao.RoleDao;
import com.epmet.dto.GovStaffRoleDTO;
import com.epmet.dto.form.InitDefaultOperationsFormDTO;
import com.epmet.dto.form.UpGovRoleFormDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.GovStaffRoleEntity;
import com.epmet.feign.GovAccessFeignClient;
@ -42,10 +44,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 政府端角色表
@ -135,6 +137,22 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl<GovStaffRoleDao, Go
return baseDao.listRolesByStaffId(staffId, orgId);
}
/**
* 查询用户角色
*
* @param staffIds
* @param orgId
* @return java.util.Map<java.lang.String, java.util.List < java.lang.String>>
* @author zhaoqifeng
* @date 2021/7/1 15:30
*/
@Override
public Map<String, List<String>> getStaffRoles(List<String> staffIds, String orgId) {
List<GovStaffRoleEntity> staffRoleList = baseDao.getStaffRoles(staffIds, orgId);
return staffRoleList.stream().collect(Collectors.groupingBy(GovStaffRoleEntity::getCustomerId,
Collectors.mapping(GovStaffRoleEntity :: getId, Collectors.toList())));
}
@Override
public List<GovStaffRoleDTO> getGovStaffRoleList(GovStaffRoleDTO dto) {
return baseDao.selectGovStaffRoleList(dto);
@ -182,7 +200,34 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl<GovStaffRoleDao, Go
@Override
public List<GovStaffRoleResultDTO> listRolesByCustomer(String customerId) {
return govStaffRoleDao.listRolesByCustomer(customerId);
List<GovStaffRoleResultDTO> resultList = new ArrayList<>();
//1.查询系统默认角色列表数据
resultList = govStaffRoleTemplateDao.defaultRoleList();
//2.查询客户角色权限列表数据
List<GovStaffRoleResultDTO> cuList = govStaffRoleDao.listRolesByCustomer(customerId);
//3.封装数据并返回
resultList.forEach(re -> {
cuList.forEach(cu -> {
if (re.getDefRoleKey().equals(cu.getRoleKey())) {
re.setCustomerId(cu.getCustomerId());
re.setRoleId(cu.getRoleId());
re.setRoleKey(cu.getRoleKey());
re.setRoleName(cu.getRoleName());
re.setDescription(cu.getDescription());
re.setSort(cu.getSort());
}
});
});
//4.按客户权限顺序排序
if(cuList.size()>NumConstant.ZERO){
Collections.sort(resultList, new Comparator<GovStaffRoleResultDTO>() {
@Override
public int compare(GovStaffRoleResultDTO o1, GovStaffRoleResultDTO o2) {
return o1.getSort().compareTo(o2.getSort());
}
});
}
return resultList;
}
@Override
@ -221,12 +266,11 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl<GovStaffRoleDao, Go
return govStaffRoleDao.updateColumnsById(roleId, roleName);
}
@Transactional(rollbackFor = Exception.class)
@Override
public void saveSortOrder(List<String> roleIdList) {
@Transactional(rollbackFor = Exception.class)
public void saveSortOrder(String userId, List<String> roleIdList) {
for (int i = 0 ; i < roleIdList.size() ; i++) {
int r = govStaffRoleDao.updateSortById(roleIdList.get(i), i);
System.out.println(r);
int r = govStaffRoleDao.updateSortById(roleIdList.get(i), i, userId);
}
}
@ -264,4 +308,41 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl<GovStaffRoleDao, Go
});
return resultList;
}
/**
* @Description 默认权限保存排序
* @Author sun
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void saveDefaultSort(String userId, List<String> roleIdList) {
for (int i = 0; i < roleIdList.size(); i++) {
govStaffRoleTemplateDao.updateSortById(roleIdList.get(i), i, userId);
}
}
/**
* @param formDTO
* @Description 修改角色名称或职责描述
* @Author sun
**/
@Override
public void updateDefaultRole(UpGovRoleFormDTO formDTO) {
if (govStaffRoleTemplateDao.upNameOrDescription(formDTO) < NumConstant.ONE) {
throw new RenException("修改角色信息失败");
}
}
/**
* @param formDTO
* @Description 修改客户角色名称或职责描述
* @Author sun
**/
@Override
public void updateCustomerRole(UpGovRoleFormDTO formDTO) {
if (govStaffRoleDao.upNameOrDescription(formDTO) < NumConstant.ONE) {
throw new RenException("修改角色信息失败");
}
}
}

9
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.13__alter_gov_staff_role.sql

@ -0,0 +1,9 @@
ALTER TABLE `gov_staff_role_template`
ADD COLUMN `DESCRIPTION` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色对应的职责说明' AFTER `FULL_TIME_ONLY`,
ADD COLUMN `SORT` int(11) NULL DEFAULT NULL COMMENT '排序' AFTER `DESCRIPTION`;
ALTER TABLE `gov_staff_role`
MODIFY COLUMN `FULL_TIME_ONLY` tinyint(1) NULL DEFAULT 1 COMMENT '是否只有全职 1对应true 0对应false' AFTER `ORG_TYPE`,
MODIFY COLUMN `SORT` int(11) NULL DEFAULT NULL COMMENT '排序' AFTER `FULL_TIME_ONLY`,
ADD COLUMN `DESCRIPTION` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '角色对应的职责说明' AFTER `FULL_TIME_ONLY`;

47
epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml

@ -25,9 +25,12 @@
<!--更新排序序号-->
<update id="updateSortById">
update gov_staff_role
set SORT = #{sort}
where ID = #{roleId}
UPDATE gov_staff_role
SET sort = #{sort},
updated_by = #{userId},
updated_time = NOW()
WHERE
id = #{roleId}
</update>
<!--根据staffId查询具有的角色列表-->
@ -69,7 +72,9 @@
r.CUSTOMER_ID AS customerId,
r.ROLE_KEY AS roleKey,
r.ROLE_NAME AS roleName,
r.ORG_TYPE AS orgType
r.ORG_TYPE AS orgType,
r.DESCRIPTION AS description,
r.SORT AS sort
FROM gov_staff_role r
WHERE r.CUSTOMER_ID = #{customerId}
ORDER BY r.SORT asc
@ -133,4 +138,38 @@
</foreach>
)
</select>
<select id="getStaffRoles" resultType="com.epmet.entity.GovStaffRoleEntity">
SELECT
sr.STAFF_ID AS customerId,
r.ID,
r.ROLE_KEY,
r.ROLE_NAME
FROM
staff_role sr
INNER JOIN gov_staff_role r ON ( sr.ROLE_ID = r.ID ) AND r.DEL_FLAG = '0'
WHERE
sr.DEL_FLAG = '0'
AND sr.ORG_ID = #{orgId}
<foreach collection="staffIds" item="staffId" open="AND ( " separator=" OR " close=" ) ">
sr.STAFF_ID = #{staffId}
</foreach>
ORDER BY r.SORT asc
</select>
<update id="upNameOrDescription">
UPDATE gov_staff_role
<set>
<if test='null != roleName'>
role_name = #{roleName},
</if>
<if test='null != description'>
description = #{description},
</if>
updated_by = #{userId},
updated_time = NOW()
</set>
WHERE
id = #{roleId}
</update>
</mapper>

48
epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleTemplateDao.xml

@ -18,9 +18,14 @@
<!--列出有效的角色字典-->
<select id="listValidateRoles" resultType="com.epmet.dto.result.GovStaffRoleTemplateDTO">
SELECT *
FROM gov_staff_role_template
WHERE DEL_FLAG = 0
SELECT
*
FROM
gov_staff_role_template
WHERE
del_flag = '0'
ORDER BY
sort ASC
</select>
<select id="selectGovRoleList" resultType="com.epmet.dto.result.ResiGovRoleResultDTO">
@ -32,5 +37,42 @@
ORDER BY full_time_only DESC
</select>
<select id="defaultRoleList" resultType="com.epmet.dto.result.GovStaffRoleResultDTO">
SELECT
role_key AS "defRoleKey",
role_name AS "defRoleName",
description AS "defDescription"
FROM
gov_staff_role_template
WHERE
del_flag = '0'
ORDER BY
sort ASC
</select>
<update id="updateSortById">
UPDATE gov_staff_role_template
SET sort = #{sort},
updated_by = #{userId},
updated_time = NOW()
WHERE
id = #{roleId}
</update>
<update id="upNameOrDescription">
UPDATE gov_staff_role_template
<set>
<if test='null != roleName'>
role_name = #{roleName},
</if>
<if test='null != description'>
description = #{description},
</if>
updated_by = #{userId},
updated_time = NOW()
</set>
WHERE
id = #{roleId}
</update>
</mapper>
Loading…
Cancel
Save