Browse Source

Merge remote-tracking branch 'origin/dev_staff_info' into dev_staff_info

dev_shibei_match
yinzuomei 4 years ago
parent
commit
ea1bba0ace
  1. 6
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/ListStaffFormDTO.java
  2. 21
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/ListStaffResultDTO.java
  3. 2
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/ReceiverDTO.java
  4. 45
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/StaffOrgNameResultDTO.java
  5. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java
  6. 33
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetmessage/InfoReceiversDao.java
  7. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java
  8. 16
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffRoleDao.java
  9. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java
  10. 58
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetmessage/InfoReceiversEntity.java
  11. 43
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/impl/EpmetMessageServiceImpl.java
  12. 59
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java
  13. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
  14. 10
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  15. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetmessage/InfoReceiversDao.xml
  16. 20
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml
  17. 23
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffRoleDao.xml
  18. 85
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml

6
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/form/ListStaffFormDTO.java

@ -15,10 +15,14 @@ public class ListStaffFormDTO implements Serializable {
private static final long serialVersionUID = -3381286960911634231L;
/**
* 客户Id
* 待检索姓名
*/
@NotBlank(message = "姓名不能为空", groups = ListStaffFormDTO.Staff.class)
private String realName;
/**
* token中客户Id
*/
private String customerId;
public interface Staff extends CustomerClientShowGroup {}
}

21
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/ListStaffResultDTO.java

@ -3,9 +3,10 @@ package com.epmet.dataaggre.dto.epmetuser.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description 对外接口--通讯录姓名检索工作人员-接口返参
* @Description 通讯录姓名检索工作人员-接口返参
* @Auth sun
*/
@Data
@ -15,14 +16,18 @@ public class ListStaffResultDTO implements Serializable {
//工作人员用户id
private String staffId = "";
//工作人员姓名
private String staffName = "";
private String name = "";
//性别
private String gender = "";
//头像
private String headPhoto = "";
//手机号
private String mobile = "";
//用户所属组织id
private String agencyId = "";
//用户所属组织全路径名称
private String agencyAllName = "";
//客户Id
private String customerId = "";
//未禁用enable,已禁用disabled
private String enableFlag = "";
//人员新增所属组织名【组织-组织,组织-部门,组织-网格】
private String orgName = "";
//职责名称列表
private List<String> roles;
}

2
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/ReceiverDTO.java

@ -31,7 +31,7 @@ public class ReceiverDTO implements Serializable {
/**
* 1已读0未读
*/
private String readFlag;
private Boolean readFlag;
/**
* 1男2女0未知
*/

45
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/result/StaffOrgNameResultDTO.java

@ -0,0 +1,45 @@
/**
* 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.dataaggre.dto.govorg.result;
import lombok.Data;
import java.io.Serializable;
/**
* 查询工作人员注册组织信息
* @author sun
*/
@Data
public class StaffOrgNameResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
//工作人员所属组织Id
private String agencyId = "";
//人员Id
private String staffId = "";
//人员注册时所属组织名【组织-组织,组织-部门,组织-网格】
private String orgName = "";
//工作人员添加入口Id(agencyId;deptId;gridId)
private String orgId = "";
//工作人员添加入口类型(组织:agency;部门:dept;网格:gridId)
private String orgname = "";
}

2
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java

@ -211,7 +211,7 @@ public class EpmetUserController {
@PostMapping("stafflistbyrealname")
public Result<List<ListStaffResultDTO>> staffListByRealName(@LoginUser TokenDto tokenDto, @RequestBody ListStaffFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ListStaffFormDTO.Staff.class);
//formDTO.setCustomerId(formDTO.getCustomerId());
formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<List<ListStaffResultDTO>>().ok(epmetUserService.listStaff(formDTO));
}

33
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetmessage/InfoReceiversDao.java

@ -0,0 +1,33 @@
/**
* 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.dataaggre.dao.epmetmessage;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.entity.epmetmessage.InfoReceiversEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 消息接收人记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-08-18
*/
@Mapper
public interface InfoReceiversDao extends BaseDao<InfoReceiversEntity> {
}

7
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/CustomerStaffDao.java

@ -19,6 +19,7 @@ package com.epmet.dataaggre.dao.epmetuser;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.epmetuser.CustomerStaffDTO;
import com.epmet.dataaggre.dto.epmetuser.result.ListStaffResultDTO;
import com.epmet.dataaggre.entity.epmetuser.CustomerStaffEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -44,4 +45,10 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
* @author sun
*/
List<CustomerStaffDTO> selectByStaffIds(@Param("staffIds") List<String> staffIds, @Param("realName") String realName);
/**
* @Description 模糊查询用户角色信息
* @author sun
*/
List<ListStaffResultDTO> selectByRealName(@Param("customerId") String customerId, @Param("realName") String realName);
}

16
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/StaffRoleDao.java

@ -18,6 +18,7 @@
package com.epmet.dataaggre.dao.epmetuser;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.epmetuser.result.RoleListResultDTO;
import com.epmet.dataaggre.dto.epmetuser.result.StaffRoleListResultDTO;
import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO;
import com.epmet.dataaggre.entity.epmetuser.StaffRoleEntity;
@ -48,4 +49,19 @@ public interface StaffRoleDao extends BaseDao<StaffRoleEntity> {
**/
List<StaffRoleListResultDTO> selectStaffRoleList(@Param("customerId") String customerId, @Param("staffId") String staffId);
/**
* @Description 查询工作人员拥有的角色名称列表
* @Author sun
**/
List<String> selectByStaffId(@Param("staffId") String staffId);
/**
* @Description 角色人数
* @Param customerId
* @Return {@link List< RoleListResultDTO>}
* @Author zhaoqifeng
* @Date 2021/8/19 17:16
*/
List<RoleListResultDTO> getRoleCountList(@Param("customerId") String customerId);
}

7
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerAgencyDao.java

@ -20,6 +20,7 @@ package com.epmet.dataaggre.dao.govorg;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.dto.govorg.result.AgencyGridResultDTO;
import com.epmet.dataaggre.dto.govorg.result.StaffAgencyGridListResultDTO;
import com.epmet.dataaggre.dto.govorg.result.StaffOrgNameResultDTO;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -59,4 +60,10 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
* @Description 递归查询当前组织的直属下级组织列表
**/
List<StaffAgencyGridListResultDTO> selectSubAgencyList(@Param("subAgencyPids") String subAgencyPids);
/**
* @Description 批量查询工作人员注册组织信息
* @author sun
*/
List<StaffOrgNameResultDTO> selelctStaffOrg(@Param("staffIdList") List<String> staffIdList);
}

58
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/epmetmessage/InfoReceiversEntity.java

@ -0,0 +1,58 @@
/**
* 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.dataaggre.entity.epmetmessage;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 消息接收人记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-08-18
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("info_receivers")
public class InfoReceiversEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 消息主表.id
*/
private String infoId;
/**
* 工作人员id
*/
private String staffId;
/**
* 已读1;未读0
*/
private Boolean readFlag;
}

43
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/impl/EpmetMessageServiceImpl.java

@ -1,13 +1,27 @@
package com.epmet.dataaggre.service.epmetmessage.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.dao.epmetmessage.InfoReceiversDao;
import com.epmet.dataaggre.dto.govorg.ReceiverDTO;
import com.epmet.dataaggre.dto.govorg.form.ReceiversFormDTO;
import com.epmet.dataaggre.dto.govorg.result.ReceiversResultDTO;
import com.epmet.dataaggre.entity.epmetmessage.InfoReceiversEntity;
import com.epmet.dataaggre.service.epmetmessage.EpmetMessageService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Description
* @Author zhaoqifeng
@ -17,6 +31,10 @@ import org.springframework.stereotype.Service;
@DataSource(DataSourceConstant.EPMET_MESSAGE)
@Slf4j
public class EpmetMessageServiceImpl implements EpmetMessageService {
@Resource
private InfoReceiversDao infoReceiversDao;
/**
* @param formDTO
* @Description 获取已读未读人员列表
@ -27,6 +45,29 @@ public class EpmetMessageServiceImpl implements EpmetMessageService {
*/
@Override
public ReceiversResultDTO getReceiverList(ReceiversFormDTO formDTO) {
return null;
ReceiversResultDTO result = new ReceiversResultDTO();
//检索已读/未读人员列表,并分页
LambdaQueryWrapper<InfoReceiversEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(InfoReceiversEntity :: getInfoId, formDTO.getInfoId());
wrapper.eq(StringUtils.isNotBlank(formDTO.getReadFlag()), InfoReceiversEntity :: getReadFlag, NumConstant.ONE_STR.equals(formDTO.getReadFlag()));
Page<InfoReceiversEntity> page = new Page<>(formDTO.getPageNo(), formDTO.getPageSize());
IPage<InfoReceiversEntity> iPage = infoReceiversDao.selectPage(page, wrapper);
List<InfoReceiversEntity> list = iPage.getRecords();
result.setTotal((int) iPage.getTotal());
//结果为空,返回
if (CollectionUtils.isEmpty(list)) {
result.setDataList(Collections.emptyList());
return result;
}
//构建人员列表
List<ReceiverDTO> dataList = list.stream().map(item -> {
ReceiverDTO dto = new ReceiverDTO();
dto.setStaffId(item.getStaffId());
dto.setReadFlag(item.getReadFlag());
//TODO redis获取用户信息
return dto;
}).collect(Collectors.toList());
result.setDataList(dataList);
return result;
}
}

59
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java

@ -16,8 +16,11 @@ import com.epmet.dataaggre.dto.epmetuser.result.*;
import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO;
import com.epmet.dataaggre.dto.govorg.CustomerGridDTO;
import com.epmet.dataaggre.dto.govorg.result.GridStaffResultDTO;
import com.epmet.dataaggre.dto.govorg.result.StaffOrgNameResultDTO;
import com.epmet.dataaggre.entity.epmetuser.CustomerStaffEntity;
import com.epmet.dataaggre.entity.epmetuser.GovStaffRoleEntity;
import com.epmet.dataaggre.entity.epmetuser.ResiUserBadgeEntity;
import com.epmet.dataaggre.entity.epmetuser.StaffRoleEntity;
import com.epmet.dataaggre.service.epmetuser.EpmetUserService;
import com.epmet.dataaggre.service.epmetuser.StaffPatrolDetailService;
import com.epmet.dataaggre.service.epmetuser.StaffPatrolRecordService;
@ -61,6 +64,8 @@ public class EpmetUserServiceImpl implements EpmetUserService {
private ResiUserBadgeDao resiUserBadgeDao;
@Autowired
private GovProjectService govProjectService;
@Resource
private GovStaffRoleDao govStaffRoleDao;
/**
* @Description 根据UserIds查询
@ -426,15 +431,28 @@ public class EpmetUserServiceImpl implements EpmetUserService {
/**
* @Param formDTO
* @Description 通讯录姓名检索工作人员
* @Description 通讯录姓名检索工作人员
* @author sun
*/
@Override
public List<ListStaffResultDTO> listStaff(ListStaffFormDTO formDTO) {
//1.模糊查询用户、角色信息
List<ListStaffResultDTO> resultList = customerStaffDao.selectByRealName(formDTO.getCustomerId(), formDTO.getRealName());
if (null == resultList || resultList.size() < NumConstant.ONE) {
return new ArrayList<>();
}
//2.查询用户注册组织信息
List<String> staffIdList = resultList.stream().map(ListStaffResultDTO::getStaffId).collect(Collectors.toList());
List<StaffOrgNameResultDTO> orgList = govOrgService.getStaffOrgName(staffIdList);
return null;
//3.封装数据并返回
resultList.forEach(re -> orgList.stream().filter(l -> re.getStaffId().equals(l.getStaffId())).forEach(s -> re.setOrgName(s.getOrgName())));
return resultList;
}
/**
* 根据角色查询人员列表
*
@ -446,7 +464,19 @@ public class EpmetUserServiceImpl implements EpmetUserService {
*/
@Override
public List<RoleUsersResultDTO> getRoleUsers(RoleUsersFormDTO formDTO) {
return null;
LambdaQueryWrapper<StaffRoleEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(StaffRoleEntity :: getCustomerId, formDTO.getCustomerId());
wrapper.eq(StaffRoleEntity::getRoleId, formDTO.getRoleId());
List<StaffRoleEntity> staffRoleList = staffRoleDao.selectList(wrapper);
if (CollectionUtils.isEmpty(staffRoleList)) {
return Collections.emptyList();
}
return staffRoleList.stream().map(item -> {
RoleUsersResultDTO dto = new RoleUsersResultDTO();
dto.setStaffId(item.getStaffId());
//TODO 从redis获取用户信息
return dto;
}).collect(Collectors.toList());
}
/**
@ -459,7 +489,28 @@ public class EpmetUserServiceImpl implements EpmetUserService {
*/
@Override
public List<RoleListResultDTO> getRoleList(String customerId) {
return null;
//获取角色列表
LambdaQueryWrapper<GovStaffRoleEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(GovStaffRoleEntity :: getCustomerId, customerId);
wrapper.orderByAsc(GovStaffRoleEntity ::getSort);
List<GovStaffRoleEntity> list = govStaffRoleDao.selectList(wrapper);
//获取角色人数
List<RoleListResultDTO> countList = staffRoleDao.getRoleCountList(customerId);
Map<String, Integer> map = new HashMap<>();
if (CollectionUtils.isNotEmpty(countList)) {
map = countList.stream().collect(Collectors.toMap(RoleListResultDTO :: getRoleId, RoleListResultDTO :: getStaffNum));
}
Map<String, Integer> finalMap = map;
//构建返回值
return list.stream().map(item -> {
RoleListResultDTO dto = new RoleListResultDTO();
dto.setRoleId(item.getId());
dto.setRoleKey(item.getRoleKey());
dto.setRoleName(item.getRoleName());
dto.setDescription(item.getDescription());
dto.setStaffNum(null == finalMap.get(item.getId())?NumConstant.ZERO:finalMap.get(item.getId()));
return dto;
}).collect(Collectors.toList());
}
@Override

7
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java

@ -103,4 +103,11 @@ public interface GovOrgService {
* @Date 2021/8/19 15:12
*/
SubOrgResultDTO getSubOrg(SubOrgFormDTO formDTO);
/**
* @Description 批量查询工作人员注册组织信息
* @author sun
*/
List<StaffOrgNameResultDTO> getStaffOrgName(List<String> staffIdList);
}

10
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java

@ -405,4 +405,14 @@ public class GovOrgServiceImpl implements GovOrgService {
return null;
}
/**
* @Description 批量查询工作人员注册组织信息
* @author sun
*/
@Override
public List<StaffOrgNameResultDTO> getStaffOrgName(List<String> staffIdList) {
List<StaffOrgNameResultDTO> resultList = customerAgencyDao.selelctStaffOrg(staffIdList);
return resultList;
}
}

8
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetmessage/InfoReceiversDao.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dataaggre.dao.epmetmessage.InfoReceiversDao">
</mapper>

20
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml

@ -31,4 +31,24 @@
</if>
</select>
<resultMap id="staffList" type="com.epmet.dataaggre.dto.epmetuser.result.ListStaffResultDTO">
<result property="staffId" column="user_id"/>
<result property="name" column="real_name"/>
<result property="gender" column="gender"/>
<result property="headPhoto" column="head_photo"/>
<result property="mobile" column="mobile"/>
<result property="enableFlag" column="enable_flag"/>
<association property="roles" column="user_id" select="com.epmet.dataaggre.dao.epmetuser.StaffRoleDao.selectByStaffId"/>
</resultMap>
<select id="selectByRealName" resultMap="staffList">
SELECT
*
FROM
customer_staff
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND real_name LIKE CONCAT('%', #{realName}, '%')
</select>
</mapper>

23
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffRoleDao.xml

@ -46,4 +46,27 @@
</if>
</select>
<select id="selectByStaffId" resultType="java.lang.String">
SELECT
gsr.role_name
FROM
staff_role sr
INNER JOIN gov_staff_role gsr ON sr.role_id = gsr.id
WHERE
sr.staff_id = #{staffId}
ORDER BY
gsr.sort ASC
</select>
<select id="getRoleCountList" resultType="com.epmet.dataaggre.dto.epmetuser.result.RoleListResultDTO">
SELECT
ROLE_ID,
count( STAFF_ID ) AS staffNum
FROM
staff_role
WHERE
CUSTOMER_ID = #{customerId}
GROUP BY
ROLE_ID
</select>
</mapper>

85
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerAgencyDao.xml

@ -62,4 +62,89 @@
created_time DESC
</select>
<select id="selelctStaffOrg" resultType="com.epmet.dataaggre.dto.govorg.result.StaffOrgNameResultDTO">
SELECT
ca.id agencyId,
sor.staff_id staffId,
IF(
ca.pid = '0',
ca.organization_name,
CONCAT(
(select organization_name from customer_agency where id = ca.pid),
'-',
ca.organization_name
)
)orgName,
sor.org_id orgId,
'agency' orgname
FROM
staff_org_relation sor
INNER JOIN customer_agency ca ON sor.org_id = ca.id
WHERE
sor.org_type = 'agency'
<if test="staffIdList != null and staffIdList.size() > 0">
sor.staff_id IN (
<foreach collection="staffIdList" item="staffId" separator=",">
#{staffId}
</foreach>
)
</if>
UNION
SELECT
ca.ID agencyId,
sor.staff_id staffId,
IF(
ca.pid = '0',
cd.department_name,
CONCAT(
ca.organization_name,
'-',
cd.department_name
)
)orgName,
sor.org_id orgId,
'dept' orgname
FROM
staff_org_relation sor
INNER JOIN customer_department cd ON sor.org_id = cd.id
INNER JOIN customer_agency ca ON cd.agency_id = ca.id
WHERE
sor.org_type = 'dept'
<if test="staffIdList != null and staffIdList.size() > 0">
sor.staff_id IN (
<foreach collection="staffIdList" item="staffId" separator=",">
#{staffId}
</foreach>
)
</if>
UNION
SELECT
ca.ID agencyId,
sor.staff_id staffId,
IF(
ca.pid = '0',
cg.grid_name,
CONCAT(
ca.organization_name,
'-',
cg.grid_name
)
)orgName,
sor.org_id orgId,
'grid' orgname
FROM
staff_org_relation sor
INNER JOIN customer_grid cg ON sor.org_id = cg.id
INNER JOIN customer_agency ca ON cg.pid = ca.id
WHERE
sor.org_type = 'grid'
<if test="staffIdList != null and staffIdList.size() > 0">
sor.staff_id IN (
<foreach collection="staffIdList" item="staffId" separator=",">
#{staffId}
</foreach>
)
</if>
</select>
</mapper>
Loading…
Cancel
Save