Browse Source

1.修改根据角色和orgId查询人员的接口,增加角色名称,角色key的返回

dev_shibei_match
wxz 5 years ago
parent
commit
e359eafb80
  1. 56
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java
  2. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java
  3. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java
  4. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java
  5. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java
  6. 5
      epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml

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

@ -0,0 +1,56 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 政府端角色表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-04-22
*/
@Data
public class GovStaffRoleResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 角色ID
*/
private String roleId;
/**
* 人员id
*/
private String staffId;
/**
* 角色key
*/
private String roleKey;
/**
* 角色名称
*/
private String roleName;
}

8
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java

@ -3,8 +3,8 @@ package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.GovStaffRoleDTO;
import com.epmet.dto.StaffRoleDTO;
import com.epmet.dto.form.StaffRoleFormDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.entity.GovStaffRoleEntity;
import com.epmet.service.GovStaffRoleService;
import com.epmet.service.StaffRoleService;
@ -61,12 +61,12 @@ public class StaffRoleController {
*/
@PostMapping("staffsinrole")
//@RequirePermission(key = "org_staff_list")
public Result<List<StaffRoleDTO>> getStaffsInRole(@RequestBody StaffRoleFormDTO staffRoleFormDTO) {
public Result<List<GovStaffRoleResultDTO>> getStaffsInRole(@RequestBody StaffRoleFormDTO staffRoleFormDTO) {
ValidatorUtils.validateEntity(staffRoleFormDTO, StaffRoleFormDTO.GetStaffsInRole.class);
String roleKey = staffRoleFormDTO.getRoleKey();
String orgId = staffRoleFormDTO.getOrgId();
List<StaffRoleDTO> staffRoleDTOS = staffRoleService.listStaffsInRole(roleKey, orgId);
return new Result<List<StaffRoleDTO>>().ok(staffRoleDTOS);
List<GovStaffRoleResultDTO> staffRoleDTOS = staffRoleService.listStaffsInRole(roleKey, orgId);
return new Result<List<GovStaffRoleResultDTO>>().ok(staffRoleDTOS);
}
}

4
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java

@ -18,7 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.StaffRoleDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.entity.StaffRoleEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -39,5 +39,5 @@ public interface StaffRoleDao extends BaseDao<StaffRoleEntity> {
* @param orgId
* @return
*/
List<StaffRoleDTO> listStaffIdsByRoleKeyAndOrgId(@Param("roleKey") String roleKey, @Param("orgId") String orgId);
List<GovStaffRoleResultDTO> listStaffIdsByRoleKeyAndOrgId(@Param("roleKey") String roleKey, @Param("orgId") String orgId);
}

3
epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.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.StaffRoleDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.entity.StaffRoleEntity;
import java.util.List;
@ -99,5 +100,5 @@ public interface StaffRoleService extends BaseService<StaffRoleEntity> {
* @param orgId
* @return
*/
List<StaffRoleDTO> listStaffsInRole(String roleKey, String orgId);
List<GovStaffRoleResultDTO> listStaffsInRole(String roleKey, String orgId);
}

3
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java

@ -25,6 +25,7 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.StaffRoleDao;
import com.epmet.dto.StaffRoleDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.entity.StaffRoleEntity;
import com.epmet.redis.StaffRoleRedis;
import com.epmet.service.StaffRoleService;
@ -109,7 +110,7 @@ public class StaffRoleServiceImpl extends BaseServiceImpl<StaffRoleDao, StaffRol
*/
@Override
//@DataFilter
public List<StaffRoleDTO> listStaffsInRole(String roleKey, String orgId) {
public List<GovStaffRoleResultDTO> listStaffsInRole(String roleKey, String orgId) {
return baseDao.listStaffIdsByRoleKeyAndOrgId(roleKey, orgId);
}

5
epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml

@ -18,9 +18,8 @@
<!--查询具有某角色的staff列表-->
<select id="listStaffIdsByRoleKeyAndOrgId" resultType="com.epmet.dto.StaffRoleDTO">
SELECT
sr.*
<select id="listStaffIdsByRoleKeyAndOrgId" resultType="com.epmet.dto.result.GovStaffRoleResultDTO">
SELECT sr.STAFF_ID, sr.ROLE_ID, r.ROLE_NAME, r.ROLE_KEY
FROM
staff_role sr
INNER JOIN gov_staff_role r ON ( sr.ROLE_ID = r.ID )

Loading…
Cancel
Save