Browse Source

事件赋值得分相关

dev
zhaoqifeng 3 years ago
parent
commit
adc1995985
  1. 6
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/form/EventCategoryFormDTO.java
  2. 44
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/result/OrgEventScoreResultDTO.java
  3. 12
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/PingYinEventController.java
  4. 15
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/PingYinEventDao.java
  5. 11
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/PingYinEventService.java
  6. 43
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/impl/PingYinEventServiceImpl.java
  7. 235
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/PingYinEventDao.xml

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

@ -30,7 +30,11 @@ public class EventCategoryFormDTO implements Serializable {
* 组织类型 组织agency网格grid * 组织类型 组织agency网格grid
*/ */
private String orgType; private String orgType;
private String areaCode;
/**
* 组织级别
*/
private String orgLevel;
@NotBlank(message = "结束时间不能为空",groups = {EventCategoryForm.class,CategoryEventExportForm.class}) @NotBlank(message = "结束时间不能为空",groups = {EventCategoryForm.class,CategoryEventExportForm.class})
private String endTime; private String endTime;

44
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/evaluationindex/result/OrgEventScoreResultDTO.java

@ -0,0 +1,44 @@
package com.epmet.dataaggre.dto.evaluationindex.result;/**
* @author ZhaoQiFeng
* @date 2022/12/14
* @apiNote
*/
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @Author zhaoqifeng
* @Date 2022/12/14 13:39
*/
@Data
public class OrgEventScoreResultDTO implements Serializable {
private static final long serialVersionUID = 2570384890580378137L;
private String orgName;
/**
* 上报事件数
*/
private String projectCount;
/**
* 上报事件总分
*/
private String projectScore;
/**
* 例行工作数
*/
private String workCount;
/**
* 例行工作总分
*/
private String workScore;
/**
* 网格员数量
*/
private String memberCount;
/**
* 考核得分
*/
private String aveScore;
}

12
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/PingYinEventController.java

@ -1,6 +1,6 @@
package com.epmet.dataaggre.controller; package com.epmet.dataaggre.controller;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.metadata.fill.FillConfig; import com.alibaba.excel.write.metadata.fill.FillConfig;
@ -19,6 +19,7 @@ import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryFormDTO;
import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryListFormDTO; import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryListFormDTO;
import com.epmet.dataaggre.dto.evaluationindex.result.EventCategoryListResultDTO; import com.epmet.dataaggre.dto.evaluationindex.result.EventCategoryListResultDTO;
import com.epmet.dataaggre.dto.evaluationindex.result.EventScoreTotalResultDTO; import com.epmet.dataaggre.dto.evaluationindex.result.EventScoreTotalResultDTO;
import com.epmet.dataaggre.dto.evaluationindex.result.OrgEventScoreResultDTO;
import com.epmet.dataaggre.service.evaluationindex.PingYinEventService; import com.epmet.dataaggre.service.evaluationindex.PingYinEventService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -141,8 +142,8 @@ public class PingYinEventController {
//分类统计 //分类统计
List<EventCategoryResultDTO> categoryList = pingYinEventService.getEventCategorySoreExport(tokenDto, formDTO); List<EventCategoryResultDTO> categoryList = pingYinEventService.getEventCategorySoreExport(tokenDto, formDTO);
//设置输出流和模板信息 //设置输出流和模板信息
excelWriter = EasyExcel.write(outputStream).withTemplate(inputStream).build(); excelWriter = EasyExcelFactory.write(outputStream).withTemplate(inputStream).build();
WriteSheet writeSheet = EasyExcel.writerSheet(0) WriteSheet writeSheet = EasyExcelFactory.writerSheet(0)
.registerWriteHandler(new CustomMergeStrategy(categoryList.stream().map(EventCategoryResultDTO::getEventType).collect(Collectors.toList()), 0)) .registerWriteHandler(new CustomMergeStrategy(categoryList.stream().map(EventCategoryResultDTO::getEventType).collect(Collectors.toList()), 0))
.registerWriteHandler(new CustomMergeStrategy(categoryList.stream().map(EventCategoryResultDTO::getParentCategoryName).collect(Collectors.toList()), 1)) .registerWriteHandler(new CustomMergeStrategy(categoryList.stream().map(EventCategoryResultDTO::getParentCategoryName).collect(Collectors.toList()), 1))
.build(); .build();
@ -150,6 +151,11 @@ public class PingYinEventController {
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build(); FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
excelWriter.fill(categoryList, fillConfig, writeSheet); excelWriter.fill(categoryList, fillConfig, writeSheet);
excelWriter.fill(scoreTotal, writeSheet); excelWriter.fill(scoreTotal, writeSheet);
List<OrgEventScoreResultDTO> orgScoreList = pingYinEventService.getOrgEventScoreList(formDTO);
WriteSheet writeSheet1 = EasyExcelFactory.writerSheet(1).build();
excelWriter.fill(orgScoreList, fillConfig, writeSheet1);
excelWriter.fill(scoreTotal, writeSheet1);
} catch (EpmetException e) { } catch (EpmetException e) {
response.reset(); response.reset();
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");

15
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/evaluationindex/PingYinEventDao.java

@ -21,6 +21,7 @@ import com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO;
import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryFormDTO; import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryFormDTO;
import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryListFormDTO; import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryListFormDTO;
import com.epmet.dataaggre.dto.evaluationindex.result.EventCategoryListResultDTO; import com.epmet.dataaggre.dto.evaluationindex.result.EventCategoryListResultDTO;
import com.epmet.dataaggre.dto.evaluationindex.result.OrgEventScoreResultDTO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -139,4 +140,18 @@ public interface PingYinEventDao {
* @Date 2022/12/9 13:41 * @Date 2022/12/9 13:41
*/ */
List<EventCategoryResultDTO> selectWorkCategoryForExport(); List<EventCategoryResultDTO> selectWorkCategoryForExport();
/**
* 下级得分
*
* @Param formDTO
* @Return {@link List< OrgEventScoreResultDTO>}
* @Author zhaoqifeng
* @Date 2022/12/15 9:31
*/
List<OrgEventScoreResultDTO> selectOrgEventScoreList(EventCategoryFormDTO formDTO);
List<OrgEventScoreResultDTO> selectGridEventScoreList(EventCategoryFormDTO formDTO);
String getAreaCode(@Param("agencyId")String agencyId);
} }

11
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/evaluationindex/PingYinEventService.java

@ -7,6 +7,7 @@ import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryFormDTO;
import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryListFormDTO; import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryListFormDTO;
import com.epmet.dataaggre.dto.evaluationindex.result.EventCategoryListResultDTO; import com.epmet.dataaggre.dto.evaluationindex.result.EventCategoryListResultDTO;
import com.epmet.dataaggre.dto.evaluationindex.result.EventScoreTotalResultDTO; import com.epmet.dataaggre.dto.evaluationindex.result.EventScoreTotalResultDTO;
import com.epmet.dataaggre.dto.evaluationindex.result.OrgEventScoreResultDTO;
import java.util.List; import java.util.List;
@ -56,4 +57,14 @@ public interface PingYinEventService {
* @Date 2022/12/9 9:55 * @Date 2022/12/9 9:55
*/ */
List<EventCategoryResultDTO> getEventCategorySoreExport (TokenDto tokenDto, EventCategoryFormDTO formDTO); List<EventCategoryResultDTO> getEventCategorySoreExport (TokenDto tokenDto, EventCategoryFormDTO formDTO);
/**
* 下级得分
*
* @Param formDTO
* @Return {@link List< OrgEventScoreResultDTO>}
* @Author zhaoqifeng
* @Date 2022/12/15 11:05
*/
List<OrgEventScoreResultDTO> getOrgEventScoreList(EventCategoryFormDTO formDTO);
} }

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

@ -11,12 +11,14 @@ import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dataaggre.constant.DataSourceConstant; import com.epmet.dataaggre.constant.DataSourceConstant;
import com.epmet.dataaggre.constant.EventConstant; import com.epmet.dataaggre.constant.EventConstant;
import com.epmet.dataaggre.constant.OrgConstant;
import com.epmet.dataaggre.dao.evaluationindex.PingYinEventDao; import com.epmet.dataaggre.dao.evaluationindex.PingYinEventDao;
import com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO; import com.epmet.dataaggre.dto.evaluationindex.EventCategoryResultDTO;
import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryFormDTO; import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryFormDTO;
import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryListFormDTO; import com.epmet.dataaggre.dto.evaluationindex.form.EventCategoryListFormDTO;
import com.epmet.dataaggre.dto.evaluationindex.result.EventCategoryListResultDTO; import com.epmet.dataaggre.dto.evaluationindex.result.EventCategoryListResultDTO;
import com.epmet.dataaggre.dto.evaluationindex.result.EventScoreTotalResultDTO; import com.epmet.dataaggre.dto.evaluationindex.result.EventScoreTotalResultDTO;
import com.epmet.dataaggre.dto.evaluationindex.result.OrgEventScoreResultDTO;
import com.epmet.dataaggre.service.evaluationindex.PingYinEventService; import com.epmet.dataaggre.service.evaluationindex.PingYinEventService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
@ -29,6 +31,7 @@ import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
@ -151,7 +154,6 @@ public class PingYinEventServiceImpl implements PingYinEventService {
*/ */
@Override @Override
public EventScoreTotalResultDTO getEventScoreTotal(EventCategoryFormDTO formDTO) { public EventScoreTotalResultDTO getEventScoreTotal(EventCategoryFormDTO formDTO) {
formDTO.setCustomerId("6f203e30de1a65aab7e69c058826cd80");
EventScoreTotalResultDTO result = new EventScoreTotalResultDTO(); EventScoreTotalResultDTO result = new EventScoreTotalResultDTO();
Long projectScore = pingYinEventDao.getProjectTotalScore(formDTO); Long projectScore = pingYinEventDao.getProjectTotalScore(formDTO);
Long workScore = pingYinEventDao.getWorkTotalScore(formDTO); Long workScore = pingYinEventDao.getWorkTotalScore(formDTO);
@ -191,7 +193,6 @@ public class PingYinEventServiceImpl implements PingYinEventService {
formDTO.setOrgType("agency"); formDTO.setOrgType("agency");
} }
formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setCustomerId("6f203e30de1a65aab7e69c058826cd80");
//获取项目分类 //获取项目分类
List<EventCategoryResultDTO> projectCategoryList = pingYinEventDao.selectProjectCategoryForExport(formDTO.getCustomerId()); List<EventCategoryResultDTO> projectCategoryList = pingYinEventDao.selectProjectCategoryForExport(formDTO.getCustomerId());
//获取项目赋值得分统计 //获取项目赋值得分统计
@ -220,4 +221,42 @@ public class PingYinEventServiceImpl implements PingYinEventService {
result.addAll(workCategoryList); result.addAll(workCategoryList);
return result; return result;
} }
/**
* 下级得分
*
* @param formDTO
* @Param formDTO
* @Return {@link List< OrgEventScoreResultDTO >}
* @Author zhaoqifeng
* @Date 2022/12/15 11:05
*/
@Override
public List<OrgEventScoreResultDTO> getOrgEventScoreList(EventCategoryFormDTO formDTO) {
if (OrgConstant.GRID.equals((formDTO.getOrgLevel()))) {
return Collections.emptyList();
}
List<OrgEventScoreResultDTO> result;
//获取areacode
if (StringUtils.isBlank(formDTO.getAreaCode())) {
formDTO.setAreaCode(pingYinEventDao.getAreaCode(formDTO.getOrgId()));
}
if (OrgConstant.COMMUNITY.equals(formDTO.getOrgLevel())) {
result = pingYinEventDao.selectGridEventScoreList(formDTO);
} else {
result = pingYinEventDao.selectOrgEventScoreList(formDTO);
}
result.forEach(item -> {
item.setAveScore("0.00");
if (!NumConstant.ZERO_STR.equals(item.getMemberCount())) {
BigDecimal projectScore = new BigDecimal(item.getProjectScore());
BigDecimal workScore = new BigDecimal(item.getWorkScore());
BigDecimal total = projectScore.add(workScore);
BigDecimal count = new BigDecimal(item.getMemberCount());
BigDecimal ave = total.divide(count, NumConstant.TWO, RoundingMode.HALF_UP);
item.setAveScore(ave.toString());
}
});
return result;
}
} }

235
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/evaluationindex/PingYinEventDao.xml

@ -287,7 +287,7 @@
</select> </select>
<select id="getMemberCount" resultType="java.lang.Long"> <select id="getMemberCount" resultType="java.lang.Long">
SELECT SELECT
IFNULL(COUNT(ID), 0) IFNULL(COUNT(DISTINCT STAFF_ID), 0)
FROM FROM
screen_py_grid_staff screen_py_grid_staff
WHERE WHERE
@ -348,4 +348,237 @@
ORDER BY p1.SORT, p2.SORT ORDER BY p1.SORT, p2.SORT
</select> </select>
<select id="selectOrgEventScoreList" resultType="com.epmet.dataaggre.dto.evaluationindex.result.OrgEventScoreResultDTO">
SELECT
a.orgName,
projectCount,
projectScore,
workCount,
workScore,
memberCount
FROM
(
SELECT
a.AGENCY_ID,
a.AGENCY_NAME AS orgName,
IFNULL( SUM( b.eventCount ), 0 ) AS projectCount,
IFNULL( SUM( b.eventScore ), 0 ) AS projectScore
FROM
screen_customer_agency a
LEFT JOIN (
SELECT
a.PIDS,
COUNT( a.EVENT_ID ) AS eventCount,
SUM( b.SCORE ) AS eventScore
FROM
screen_py_event_data a
INNER JOIN customer_project_category_dict b ON a.CATEGORY_CODE = b.CATEGORY_CODE
AND b.CUSTOMER_ID = #{customerId}
AND b.IS_DISABLE = 'enable'
WHERE
a.EVENT_TYPE = 'project'
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) &lt;= #{endTime}
</if>
<if test="name != null and name != ''">
AND a.STAFF_NAME LIKE CONCAT('%', #{name}, '%')
</if>
<if test="mobile != null and mobile != ''">
AND a.MOBILE LIKE CONCAT('%', #{mobile}, '%')
</if>
GROUP BY
a.PIDS
) b ON b.PIDS LIKE CONCAT( '%', a.AGENCY_ID, '%' )
WHERE
a.DEL_FLAG = '0'
AND a.PARENT_AREA_CODE = #{areaCode}
GROUP BY
a.AGENCY_ID
) a
INNER JOIN (
SELECT
a.AGENCY_ID,
a.AGENCY_NAME AS orgName,
IFNULL( SUM( c.eventCount ), 0 ) AS workCount,
IFNULL( SUM( c.eventScore ), 0 ) AS workScore
FROM
screen_customer_agency a
LEFT JOIN (
SELECT
a.PIDS,
COUNT( a.EVENT_ID ) AS eventCount,
SUM( b.SCORE ) AS eventScore
FROM
screen_py_event_data a
INNER JOIN customer_patrol_work_type_dict b ON a.CATEGORY_CODE = b.CATEGORY_CODE
AND b.IS_DISABLE = 'enable'
WHERE
a.EVENT_TYPE = 'work'
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) &lt;= #{endTime}
</if>
<if test="name != null and name != ''">
AND a.STAFF_NAME LIKE CONCAT('%', #{name}, '%')
</if>
<if test="mobile != null and mobile != ''">
AND a.MOBILE LIKE CONCAT('%', #{mobile}, '%')
</if>
GROUP BY
a.PIDS
) c ON c.PIDS LIKE CONCAT( '%', a.AGENCY_ID, '%' )
WHERE
a.DEL_FLAG = '0'
AND a.PARENT_AREA_CODE = #{areaCode}
GROUP BY
a.AGENCY_ID
) b ON a.AGENCY_ID = b.AGENCY_ID
INNER JOIN (
SELECT
a.AGENCY_ID,
a.AGENCY_NAME AS orgName,
IFNULL( COUNT( DISTINCT d.STAFF_ID ), 0 ) AS memberCount
FROM
screen_customer_agency a
LEFT JOIN screen_py_grid_staff d ON d.DEL_FLAG = '0'
AND IS_LEAVE = 'N'
AND d.PIDS LIKE CONCAT( '%', a.AGENCY_ID, '%' )
<if test="name != null and name != ''">
AND d.STAFF_NAME LIKE CONCAT('%', #{name}, '%')
</if>
<if test="mobile != null and mobile != ''">
AND d.MOBILE LIKE CONCAT('%', #{mobile}, '%')
</if>
WHERE
a.DEL_FLAG = '0'
AND a.PARENT_AREA_CODE = #{areaCode}
GROUP BY
a.AGENCY_ID
) c ON a.AGENCY_ID = c.AGENCY_ID
</select>
<select id="selectGridEventScoreList" resultType="com.epmet.dataaggre.dto.evaluationindex.result.OrgEventScoreResultDTO">
SELECT
a.orgName,
projectCount,
projectScore,
workCount,
workScore,
memberCount
FROM
(
SELECT
a.GRID_ID,
a.GRID_NAME AS orgName,
IFNULL( SUM( b.eventCount ), 0 ) AS projectCount,
IFNULL( SUM( b.eventScore ), 0 ) AS projectScore
FROM
screen_customer_grid a
LEFT JOIN (
SELECT
a.ORG_ID,
COUNT( a.EVENT_ID ) AS eventCount,
SUM( b.SCORE ) AS eventScore
FROM
screen_py_event_data a
INNER JOIN customer_project_category_dict b ON a.CATEGORY_CODE = b.CATEGORY_CODE
AND b.CUSTOMER_ID = #{customerId}
AND b.IS_DISABLE = 'enable'
WHERE
a.EVENT_TYPE = 'project'
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) &lt;= #{endTime}
</if>
<if test="name != null and name != ''">
AND a.STAFF_NAME LIKE CONCAT('%', #{name}, '%')
</if>
<if test="mobile != null and mobile != ''">
AND a.MOBILE LIKE CONCAT('%', #{mobile}, '%')
</if>
GROUP BY
a.ORG_ID
) b ON b.ORG_ID = a.GRID_ID
WHERE
a.DEL_FLAG = '0'
AND a.PARENT_AGENCY_ID = #{orgId}
GROUP BY
a.GRID_ID
) a
INNER JOIN (
SELECT
a.GRID_ID,
a.GRID_NAME AS orgName,
IFNULL( SUM( c.eventCount ), 0 ) AS workCount,
IFNULL( SUM( c.eventScore ), 0 ) AS workScore
FROM
screen_customer_grid a
LEFT JOIN (
SELECT
a.ORG_ID,
COUNT( a.EVENT_ID ) AS eventCount,
SUM( b.SCORE ) AS eventScore
FROM
screen_py_event_data a
INNER JOIN customer_patrol_work_type_dict b ON a.CATEGORY_CODE = b.CATEGORY_CODE
AND b.IS_DISABLE = 'enable'
WHERE
a.EVENT_TYPE = 'work'
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT( a.EVENT_CREATE_TIME, '%Y%m%d' ) &lt;= #{endTime}
</if>
<if test="name != null and name != ''">
AND a.STAFF_NAME LIKE CONCAT('%', #{name}, '%')
</if>
<if test="mobile != null and mobile != ''">
AND a.MOBILE LIKE CONCAT('%', #{mobile}, '%')
</if>
GROUP BY
a.ORG_ID
) c ON c.ORG_ID = a.GRID_ID
WHERE
a.DEL_FLAG = '0'
AND a.PARENT_AGENCY_ID = #{orgId}
GROUP BY
a.GRID_ID
) b ON a.GRID_ID = b.GRID_ID
INNER JOIN (
SELECT
a.GRID_ID,
a.GRID_NAME AS orgName,
IFNULL( COUNT( DISTINCT d.STAFF_ID ), 0 ) AS memberCount
FROM
screen_customer_grid a
LEFT JOIN screen_py_grid_staff d ON d.DEL_FLAG = '0'
AND IS_LEAVE = 'N'
AND d.GRID_ID = a.GRID_ID
<if test="name != null and name != ''">
AND d.STAFF_NAME LIKE CONCAT('%', #{name}, '%')
</if>
<if test="mobile != null and mobile != ''">
AND d.MOBILE LIKE CONCAT('%', #{mobile}, '%')
</if>
WHERE
a.DEL_FLAG = '0'
AND a.PARENT_AGENCY_ID = #{orgId}
GROUP BY
a.GRID_ID
) c ON a.GRID_ID = c.GRID_ID
</select>
<select id="getAreaCode" resultType="java.lang.String">
SELECT AREA_CODE
FROM screen_customer_agency
WHERE DEL_FLAG = '0'
AND AGENCY_ID = #{agencyId}
</select>
</mapper> </mapper>

Loading…
Cancel
Save