Browse Source

1.修复:查询角色下的用户列表接口

master
wxz 5 years ago
parent
commit
3a4bf0d93e
  1. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java
  2. 28
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java
  3. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java
  4. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java
  5. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java
  6. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java
  7. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java
  8. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java
  9. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java
  10. 14
      epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml
  11. 11
      epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml

5
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java

@ -3,6 +3,7 @@ package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.feign.EpmetUserFeignClient;
@ -16,6 +17,10 @@ import java.util.List;
*/
@Component
public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient {
@Override
public Result<CustomerStaffDTO> getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffInfoByUserId", formDTO);
}
@Override
public Result<List<StaffGridListDTO>> getStaffGridList(List<CustomerStaffGridDTO> customerStaffGridDTOS) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffGridList", customerStaffGridDTOS);

28
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java

@ -1,28 +0,0 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.StaffGridListDTO;
import com.epmet.feign.EpmetUserFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Auther zxc
* @Create 2020-04-23 14:10
*/
@Component
public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient {
@Override
public Result<CustomerStaffDTO> getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffInfoByUserId", formDTO);
}
@Override
public Result<List<StaffGridListDTO>> getStaffGridList(List<CustomerStaffGridDTO> customerStaffGridDTOS) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffGridList", customerStaffGridDTOS);
}
}

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

@ -3,9 +3,11 @@ 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.entity.GovStaffRoleEntity;
import com.epmet.service.GovStaffRoleService;
import com.epmet.service.StaffRoleService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
@ -30,6 +32,9 @@ public class StaffRoleController {
@Autowired
private GovStaffRoleService govStaffRoleService;
@Autowired
private StaffRoleService staffRoleService;
/**
* 查询工作人员具有的角色列表
* @return
@ -55,12 +60,12 @@ public class StaffRoleController {
* @return
*/
@PostMapping("staffsinrole")
public Result<List<GovStaffRoleDTO>> getStaffsInRole(@RequestBody StaffRoleFormDTO staffRoleFormDTO) {
public Result<List<StaffRoleDTO>> getStaffsInRole(@RequestBody StaffRoleFormDTO staffRoleFormDTO) {
ValidatorUtils.validateEntity(staffRoleFormDTO, StaffRoleFormDTO.GetStaffsInRole.class);
String roleKey = staffRoleFormDTO.getRoleKey();
String orgId = staffRoleFormDTO.getOrgId();
List<GovStaffRoleDTO> roleDTOS = govStaffRoleService.listStaffsInRole(roleKey, orgId);
return new Result<List<GovStaffRoleDTO>>().ok(roleDTOS);
List<StaffRoleDTO> staffRoleDTOS = staffRoleService.listStaffsInRole(roleKey, orgId);
return new Result<List<StaffRoleDTO>>().ok(staffRoleDTOS);
}
}

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

@ -18,7 +18,6 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.GovStaffRoleDTO;
import com.epmet.entity.GovStaffRoleEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -42,11 +41,4 @@ public interface GovStaffRoleDao extends BaseDao<GovStaffRoleEntity> {
*/
List<GovStaffRoleEntity> listRolesByStaffId(@Param("staffId") String staffId, @Param("orgId") String orgId);
/**
* 查询具有某角色的staff列表
* @param roleKey
* @param orgId
* @return
*/
List<GovStaffRoleDTO> listStaffsByRoleKeyAndOrgId(@Param("roleKey") String roleKey, @Param("orgId") String orgId);
}

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

@ -18,8 +18,12 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.StaffRoleDTO;
import com.epmet.entity.StaffRoleEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 工作人员-角色关系表
@ -29,5 +33,11 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface StaffRoleDao extends BaseDao<StaffRoleEntity> {
/**
* 查询具有某角色的staff列表
* @param roleKey
* @param orgId
* @return
*/
List<StaffRoleDTO> listStaffIdsByRoleKeyAndOrgId(@Param("roleKey") String roleKey, @Param("orgId") String orgId);
}

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

@ -99,12 +99,4 @@ public interface GovStaffRoleService extends BaseService<GovStaffRoleEntity> {
* @return
*/
List<GovStaffRoleEntity> listRolesByStaffId(String staffId, String orgId);
/**
* 查询具有某角色的staff列表
* @param roleKey
* @param orgId
* @return
*/
List<GovStaffRoleDTO> listStaffsInRole(String roleKey, String orgId);
}

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

@ -92,4 +92,12 @@ public interface StaffRoleService extends BaseService<StaffRoleEntity> {
* @date 2020-04-22
*/
void delete(String[] ids);
/**
* 查询具有某角色的staff列表
* @param roleKey
* @param orgId
* @return
*/
List<StaffRoleDTO> listStaffsInRole(String roleKey, String orgId);
}

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

@ -110,16 +110,4 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl<GovStaffRoleDao, Go
public List<GovStaffRoleEntity> listRolesByStaffId(String staffId, String orgId) {
return baseDao.listRolesByStaffId(staffId, orgId);
}
/**
* 查询具有某角色的staff列表
* @param roleKey
* @param orgId
* @return
*/
@Override
public List<GovStaffRoleDTO> listStaffsInRole(String roleKey, String orgId) {
return baseDao.listStaffsByRoleKeyAndOrgId(roleKey, orgId);
}
}

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

@ -101,4 +101,15 @@ public class StaffRoleServiceImpl extends BaseServiceImpl<StaffRoleDao, StaffRol
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* 查询具有某角色的staff列表
* @param roleKey
* @param orgId
* @return
*/
@Override
public List<StaffRoleDTO> listStaffsInRole(String roleKey, String orgId) {
return baseDao.listStaffIdsByRoleKeyAndOrgId(roleKey, orgId);
}
}

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

@ -28,18 +28,4 @@
sr.STAFF_ID = #{staffId}
AND sr.ORG_ID = #{orgId}
</select>
<!--查询具有某角色的staff列表-->
<select id="listStaffsByRoleKeyAndOrgId" resultType="com.epmet.dto.GovStaffRoleDTO">
SELECT
r.*
FROM
staff_role sr
INNER JOIN gov_staff_role r ON ( sr.ROLE_ID = r.ID )
WHERE
r.ROLE_KEY = #{roleKey}
AND sr.ORG_ID = #{orgId}
</select>
</mapper>

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

@ -17,4 +17,15 @@
</resultMap>
<!--查询具有某角色的staff列表-->
<select id="listStaffIdsByRoleKeyAndOrgId" resultType="com.epmet.dto.StaffRoleDTO">
SELECT
sr.*
FROM
staff_role sr
INNER JOIN gov_staff_role r ON ( sr.ROLE_ID = r.ID )
WHERE
r.ROLE_KEY = #{roleKey}
AND sr.ORG_ID = #{orgId}
</select>
</mapper>
Loading…
Cancel
Save