diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleDTO.java index 9e569488d2..b6d866eda6 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleDTO.java +++ b/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; + /** * 排序 */ diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleTemplateDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleTemplateDTO.java index 5c38ca8a2c..731a3de81d 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/GovStaffRoleTemplateDTO.java +++ b/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; + /** * */ diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleEntity.java index d10c281e10..be03ad7913 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleEntity.java +++ b/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; + /** * 排序 */ diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleTemplateEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleTemplateEntity.java index 24e77d5ef3..aa6b1e6db9 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetuser/GovStaffRoleTemplateEntity.java +++ b/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; + } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/RoleInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/RoleInfoResultDTO.java index 81498e5586..b26db57327 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/RoleInfoResultDTO.java +++ b/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; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java index 3e6647a9a0..7828cc0bad 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffInfoResultDTO.java +++ b/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 roles; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffRoleResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffRoleResultDTO.java index 9d596bca43..b39085d40c 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/StaffRoleResultDTO.java +++ b/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; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java index 7021efac58..44845e753f 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GovStaffRoleDTO.java +++ b/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; + /** * 排序 * */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpGovRoleFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpGovRoleFormDTO.java new file mode 100644 index 0000000000..62dcf50a26 --- /dev/null +++ b/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 {} +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java index 1708d17f32..3302c18b97 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java +++ b/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; } \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleTemplateDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleTemplateDTO.java index fa17be450f..6a83a0b552 100755 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleTemplateDTO.java +++ b/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; + /** * */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java index 37df7c9140..01bb8ca3f3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java +++ b/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 roleIdList = form.getRoleIdList(); - govStaffRoleService.saveSortOrder(roleIdList); + govStaffRoleService.saveSortOrder(tokenDTO.getUserId(), form.getRoleIdList()); return new Result(); } @@ -124,4 +123,29 @@ public class GovStaffRoleController { Result> queryCustomerGovRoleList(@PathVariable("customerId") String customerId){ return new Result>().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(); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java index f717b678c8..9753829066 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java +++ b/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 { */ List listRolesByStaffId(@Param("staffId") String staffId, @Param("orgId") String orgId); + /** + * 根据staffId查询具有的角色列表 + * @param staffId + * @param orgId + * @return + */ + List getStaffRoles(@Param("staffIds") List staffId, @Param("orgId") String orgId); + /** * 获取客户机关角色列表 * @param params @@ -75,7 +84,7 @@ public interface GovStaffRoleDao extends BaseDao { 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 listRolesByRoleKey(@Param("roleKey") String roleKey); @@ -88,4 +97,11 @@ public interface GovStaffRoleDao extends BaseDao { * @date 2021/6/15 2:35 下午 */ List selectRoleKeyName(@Param("roleIds")List roleIds); + + /** + * @param formDTO + * @Description 修改客户角色名称或职责描述 + * @Author sun + **/ + int upNameOrDescription(UpGovRoleFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleTemplateDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleTemplateDao.java index 62af0e097c..974a358e17 100755 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleTemplateDao.java +++ b/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 selectGovRoleList(); + + /** + * @author sun + * @Description 获取工作端默认角色列表 + */ + List 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); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleEntity.java index 6950c65256..6ac107e80a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleEntity.java +++ b/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; + /** * 排序 * */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleTemplateEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleTemplateEntity.java index 34a4844ad9..cd87413736 100755 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GovStaffRoleTemplateEntity.java +++ b/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; + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java index 6ee17905c2..58ebf19e6f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java +++ b/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 { */ List listRolesByStaffId(String staffId, String orgId); + /** + * 查询用户角色 + * @author zhaoqifeng + * @date 2021/7/1 15:30 + * @param staffIds + * @param orgId + * @return java.util.Map> + */ + Map> getStaffRoles(List staffIds, String orgId); + /** * 获取当前机关下的角色列表 * @param dto @@ -138,7 +149,7 @@ public interface GovStaffRoleService extends BaseService { int updateRole(String roleId, String roleName); - void saveSortOrder(List roleIdList); + void saveSortOrder(String userId, List roleIdList); List listRolesByRoleKey(String roleKey); @@ -150,4 +161,24 @@ public interface GovStaffRoleService extends BaseService { * @Date 2021/3/29 15:37 **/ List queryCustomerGovRoleList(String customerId); + + /** + * @Description 默认权限保存排序 + * @Author sun + **/ + void saveDefaultSort(String userId, List roleIdList); + + /** + * @param formDTO + * @Description 修改角色名称或职责描述 + * @Author sun + **/ + void updateDefaultRole(UpGovRoleFormDTO formDTO); + + /** + * @param formDTO + * @Description 修改客户角色名称或职责描述 + * @Author sun + **/ + void updateCustomerRole(UpGovRoleFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index aea728c458..8a8764e5b0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -226,6 +226,12 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl(); } + if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list)) { + Map> map = govStaffRoleService.getStaffRoles(fromDTO.getStaffList(), fromDTO.getAgencyId()); + list.forEach(item -> { + item.setRoles(map.get(item.getStaffId())); + }); + } return new Result>().ok(list); } @@ -245,6 +251,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl>().ok(staffRoleList); @@ -277,6 +284,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl> + * @author zhaoqifeng + * @date 2021/7/1 15:30 + */ + @Override + public Map> getStaffRoles(List staffIds, String orgId) { + List staffRoleList = baseDao.getStaffRoles(staffIds, orgId); + return staffRoleList.stream().collect(Collectors.groupingBy(GovStaffRoleEntity::getCustomerId, + Collectors.mapping(GovStaffRoleEntity :: getId, Collectors.toList()))); + } + @Override public List getGovStaffRoleList(GovStaffRoleDTO dto) { return baseDao.selectGovStaffRoleList(dto); @@ -182,7 +200,34 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl listRolesByCustomer(String customerId) { - return govStaffRoleDao.listRolesByCustomer(customerId); + List resultList = new ArrayList<>(); + //1.查询系统默认角色列表数据 + resultList = govStaffRoleTemplateDao.defaultRoleList(); + //2.查询客户角色权限列表数据 + List 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() { + @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 roleIdList) { + @Transactional(rollbackFor = Exception.class) + public void saveSortOrder(String userId, List 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 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("修改角色信息失败"); + } + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.13__alter_gov_staff_role.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.13__alter_gov_staff_role.sql new file mode 100644 index 0000000000..40aed783d8 --- /dev/null +++ b/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`; diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml index 17f537f182..42ad1a45ab 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml @@ -25,9 +25,12 @@ - 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} @@ -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 @@ ) + + + + UPDATE gov_staff_role + + + role_name = #{roleName}, + + + description = #{description}, + + updated_by = #{userId}, + updated_time = NOW() + + WHERE + id = #{roleId} + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleTemplateDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleTemplateDao.xml index a06b408917..9e2cf5d596 100755 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleTemplateDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleTemplateDao.xml @@ -18,9 +18,14 @@ + + + + UPDATE gov_staff_role_template + SET sort = #{sort}, + updated_by = #{userId}, + updated_time = NOW() + WHERE + id = #{roleId} + + + + UPDATE gov_staff_role_template + + + role_name = #{roleName}, + + + description = #{description}, + + updated_by = #{userId}, + updated_time = NOW() + + WHERE + id = #{roleId} + \ No newline at end of file