puhanshu
2022-07-26 fa2fb4d1985e71b6bdd04ed012ed776d7104f7f4
双争双评优化
2个文件已添加
10个文件已修改
574 ■■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/common/PagePbCheckUnitCommonDto.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/common/PbCheckUnitStatisticsVo.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/partybuilding/PagePartyOrganizationVO.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/partybuilding/PartyBuildingMemberVO.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/partybuilding/ComPbCheckUnitFeign.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ComPbCheckUnitApi.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/api/ComPbCheckUnitController.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/dao/ComPbCheckUnitMapper.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/ComPbCheckUnitService.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/ComPbCheckUnitServiceImpl.java 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/resources/mapper/ComPbCheckUnitMapper.xml 167 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/resources/mapper/ComPbMemberMapper.xml 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/common/PagePbCheckUnitCommonDto.java
New file
@@ -0,0 +1,33 @@
package com.panzhihua.common.model.dtos.common;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @title: PagePbCheckUnitCommonDto
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 报到单位/报到党员统计公共请求参数
 * @author: hans
 * @date: 2022/07/25 15:41
 */
@Data
@ApiModel("报到单位/报到党员统计公共请求参数")
public class PagePbCheckUnitCommonDto {
    @ApiModelProperty(value = "社区id")
    private Long communityId;
    @ApiModelProperty(value = "分页每页数量", example = "10")
    private Long pageSize = 10L;
    @ApiModelProperty(value = "分页当前记录数", example = "1")
    private Long pageNum = 1L;
    @ApiModelProperty("单位归属")
    private String belongTo;
    @ApiModelProperty("单位性质")
    private String natureName;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/common/PbCheckUnitStatisticsVo.java
New file
@@ -0,0 +1,33 @@
package com.panzhihua.common.model.vos.common;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @title: PbCheckUnitStatisticsTopVo
 * @projectName: 成都呐喊信息技术有限公司-智慧社区项目
 * @description: 报到单位统计返回参数
 * @author: hans
 * @date: 2022/07/25 10:51
 */
@Data
@ApiModel("报到单位统计返回参数")
public class PbCheckUnitStatisticsVo {
    @ApiModelProperty(value = "单位归属")
    private String belongTo;
    @ApiModelProperty(value = "报到单位总数")
    private Integer unitTotal;
    @ApiModelProperty(value = "已报到机关单位")
    private Integer organTotal;
    @ApiModelProperty(value = "已报到企事业单位")
    private Integer businessTotal;
    @ApiModelProperty(value = "已报到党员")
    private Integer partyMemberTotal;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/partybuilding/PagePartyOrganizationVO.java
@@ -62,4 +62,10 @@
    @ApiModelProperty("归属区")
    private String belongTo;
    @ApiModelProperty("单位性质")
    private String natureName;
    @ApiModelProperty("是否注册小程序(1.是 0.否)")
    private Integer isRegister;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/partybuilding/PartyBuildingMemberVO.java
@@ -131,4 +131,6 @@
    private String unitHelpCommunityContactsName;
    @ApiModelProperty("区级")
    private String belongTo;
    @ApiModelProperty("微信昵称")
    private String nickName;
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/partybuilding/ComPbCheckUnitFeign.java
@@ -98,4 +98,54 @@
    @PostMapping("/importCheckUnit")
    R importCheckUnit(@RequestBody List<ComPbCheckUnitExcelVO> list,@RequestParam(value = "communityId") Long communityId
            ,@RequestParam(value = "userId") Long userId);
    /**
     * 报到单位统计-顶部数据
     * @param communityId
     * @param belongTo
     * @param choice
     * @return
     */
    @GetMapping("/statistics/top")
    R unitStatisticsTop(@RequestParam(value = "communityId", required = false) Long communityId,
                        @RequestParam(value = "belongTo") String belongTo,
                        @RequestParam(value = "choice", required = false) String choice);
    /**
     * 报到单位统计
     * @param commonDto
     * @return
     */
    @PostMapping("/statistics")
    R unitStatistics(@RequestBody PagePbCheckUnitCommonDto commonDto);
    /**
     * 报到党员统计-顶部数据
     * @param communityId
     * @param belongTo
     * @param choice
     * @param checkUnitId
     * @return
     */
    @GetMapping("/pbStatistics/top")
    R pbStatisticsTop(@RequestParam(value = "communityId", required = false) Long communityId,
                      @RequestParam(value = "belongTo") String belongTo,
                      @RequestParam(value = "choice", required = false) String choice,
                      @RequestParam(value = "checkUnitId", required = false) Long checkUnitId);
    /**
     * 报到党员统计-按单位归属统计
     * @param commonDto
     * @return
     */
    @PostMapping("/pbStatistics/belong")
    R pbStatisticsBelong(@RequestBody PagePbCheckUnitCommonDto commonDto);
    /**
     * 报到党员统计-按单位统计
     * @param commonDto
     * @return
     */
    @PostMapping("/pbStatistics/unit")
    R pbStatisticsUnit(@RequestBody PagePbCheckUnitCommonDto commonDto);
}
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ComPbCheckUnitApi.java
@@ -7,22 +7,23 @@
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.alibaba.fastjson.JSONArray;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.listen.ComMngPopulationServeExcelListen;
import com.panzhihua.common.listen.ComPbCheckUnitExcelListen;
import com.panzhihua.common.model.dtos.FtpConfig;
import com.panzhihua.common.model.dtos.common.AddComPbCheckUnitDto;
import com.panzhihua.common.model.dtos.common.EditComPbCheckUnitDto;
import com.panzhihua.common.model.dtos.common.PageComPbCheckUnitDto;
import com.panzhihua.common.model.dtos.common.PagePbCheckUnitCommonDto;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.common.ComPbCheckUnitVo;
import com.panzhihua.common.model.vos.common.PbCheckUnitStatisticsVo;
import com.panzhihua.common.model.vos.partybuilding.excel.ComPbCheckUnitErrorExcelVO;
import com.panzhihua.common.model.vos.partybuilding.excel.ComPbCheckUnitExcelVO;
import com.panzhihua.common.service.partybuilding.ComPbCheckUnitFeign;
import com.panzhihua.common.utlis.DateUtils;
import com.panzhihua.common.utlis.SFTPUtil;
import com.panzhihua.community_backstage.config.SFTPConfig;
import com.panzhihua.community_backstage.excel.CustomSheetWriteHandler;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.StringRedisTemplate;
@@ -237,4 +238,68 @@
    public R exportElder() {
        return R.ok(sftpConfig.getExcelUrl() + "党组织导入模板.xlsx");
    }
    @ApiOperation(value = "报到单位统计-顶部数据", response = PbCheckUnitStatisticsVo.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "communityId", value = "社区id"),
            @ApiImplicitParam(name = "choice", value = "单位归属选择")
    })
    @GetMapping("/statistics/top")
    public R unitStatisticsTop(@RequestParam(value = "communityId", required = false) Long communityId,
                               @RequestParam(value = "belongTo", required = false) String choice) {
        String belongTo = "";
        String[] area={"东区","仁和区","米易县","盐边县"};
        if(ArrayUtil.contains(area,this.getLoginUserInfo().getName())){
            belongTo = this.getLoginUserInfo().getName();
        }
        return this.comPbCheckUnitService.unitStatisticsTop(communityId, belongTo, choice);
    }
    @ApiOperation(value = "报到单位统计", response = PbCheckUnitStatisticsVo.class)
    @PostMapping("/statistics")
    public R unitStatistics(@RequestBody PagePbCheckUnitCommonDto commonDto) {
        String[] area={"东区","仁和区","米易县","盐边县"};
        if(ArrayUtil.contains(area,this.getLoginUserInfo().getName())){
            commonDto.setBelongTo(this.getLoginUserInfo().getName());
        }
        return this.comPbCheckUnitService.unitStatistics(commonDto);
    }
    @ApiOperation(value = "报到党员统计-顶部数据", response = PbCheckUnitStatisticsVo.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "communityId", value = "社区id"),
            @ApiImplicitParam(name = "choice", value = "单位归属选择"),
            @ApiImplicitParam(name = "checkUnitId", value = "单位id")
    })
    @GetMapping("/pbStatistics/top")
    public R pbStatisticsTop(@RequestParam(value = "communityId", required = false) Long communityId,
                             @RequestParam(value = "choice", required = false) String choice,
                             @RequestParam(value = "checkUnitId", required = false) Long checkUnitId) {
        String belongTo = "";
        String[] area={"东区","仁和区","米易县","盐边县"};
        if(ArrayUtil.contains(area,this.getLoginUserInfo().getName())){
            belongTo = this.getLoginUserInfo().getName();
        }
        return this.comPbCheckUnitService.pbStatisticsTop(communityId, belongTo, choice, checkUnitId);
    }
    @ApiOperation(value = "报到党员统计-按单位归属统计", response = PbCheckUnitStatisticsVo.class)
    @PostMapping("/pbStatistics/belong")
    public R pbStatisticsBelong(@RequestBody PagePbCheckUnitCommonDto commonDto) {
        String[] area={"东区","仁和区","米易县","盐边县"};
        if(ArrayUtil.contains(area,this.getLoginUserInfo().getName())){
            commonDto.setBelongTo(this.getLoginUserInfo().getName());
        }
        return this.comPbCheckUnitService.pbStatisticsBelong(commonDto);
    }
    @ApiOperation(value = "报到党员统计-按单位统计", response = ComPbCheckUnitVo.class)
    @PostMapping("/pbStatistics/unit")
    public R pbStatisticsUnit(@RequestBody PagePbCheckUnitCommonDto commonDto) {
        String[] area={"东区","仁和区","米易县","盐边县"};
        if(ArrayUtil.contains(area,this.getLoginUserInfo().getName())){
            commonDto.setBelongTo(this.getLoginUserInfo().getName());
        }
        return this.comPbCheckUnitService.pbStatisticsUnit(commonDto);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/api/ComPbCheckUnitController.java
@@ -129,5 +129,64 @@
        return this.comPbCheckUnitService.importCheckUnit(list,communityId,userId);
    }
    /**
     * 报到单位统计-顶部数据
     * @param communityId
     * @param belongTo
     * @param choice
     * @return
     */
    @GetMapping("/statistics/top")
    public R unitStatisticsTop(@RequestParam(value = "communityId", required = false) Long communityId,
                               @RequestParam(value = "belongTo") String belongTo,
                               @RequestParam(value = "belongTo", required = false) String choice) {
        return comPbCheckUnitService.unitStatisticsTop(communityId, belongTo, choice);
    }
    /**
     * 报到单位统计
     * @param commonDto
     * @return
     */
    @PostMapping("/statistics")
    public R unitStatistics(@RequestBody PagePbCheckUnitCommonDto commonDto) {
        return comPbCheckUnitService.unitStatistics(commonDto);
    }
    /**
     * 报到党员统计-顶部数据
     * @param communityId
     * @param belongTo
     * @param choice
     * @param checkUnitId
     * @return
     */
    @GetMapping("/pbStatistics/top")
    public R pbStatisticsTop(@RequestParam(value = "communityId", required = false) Long communityId,
                             @RequestParam(value = "belongTo") String belongTo,
                             @RequestParam(value = "choice", required = false) String choice,
                             @RequestParam(value = "checkUnitId", required = false) Long checkUnitId) {
        return comPbCheckUnitService.pbStatisticsTop(communityId, belongTo, choice, checkUnitId);
    }
    /**
     * 报到党员统计-按单位归属统计
     * @param commonDto
     * @return
     */
    @PostMapping("/pbStatistics/belong")
    public R pbStatisticsBelong(@RequestBody PagePbCheckUnitCommonDto commonDto) {
        return comPbCheckUnitService.pbStatisticsBelong(commonDto);
    }
    /**
     * 报到党员统计-按单位统计
     * @param commonDto
     * @return
     */
    @PostMapping("/pbStatistics/unit")
    public R pbStatisticsUnit(@RequestBody PagePbCheckUnitCommonDto commonDto) {
        return comPbCheckUnitService.pbStatisticsUnit(commonDto);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/dao/ComPbCheckUnitMapper.java
@@ -56,5 +56,48 @@
    List<ComPbCheckUnitVo> queryAllByList(@Param("dto") PageComPbCheckUnitDto comPbCheckUnit);
    Long selectCommunityId(@Param("area") String area,@Param("town")String town,@Param("community")String community);
    /**
     * 报到单位统计-顶部数据
     * @param communityId
     * @param belongTo
     * @param choice
     * @return
     */
    PbCheckUnitStatisticsVo unitStatisticsTop(@Param("communityId") Long communityId, @Param("belongTo") String belongTo, @Param("choice") String choice);
    /**
     * 报到单位统计
     * @param commonDto
     * @param page
     * @return
     */
    IPage<PbCheckUnitStatisticsVo> unitStatistics(@Param("commonDto") PagePbCheckUnitCommonDto commonDto, @Param("page") Page page);
    /**
     * 报到党员统计-顶部数据
     * @param communityId
     * @param belongTo
     * @param choice
     * @param checkUnitId
     * @return
     */
    PbCheckUnitStatisticsVo pbStatisticsTop(@Param("communityId") Long communityId, @Param("belongTo") String belongTo, @Param("choice") String choice, @Param("checkUnitId") Long checkUnitId);
    /**
     * 报到党员统计-按单位归属统计
     * @param commonDto
     * @param page
     * @return
     */
    IPage<PbCheckUnitStatisticsVo> pbStatisticsBelong(@Param("commonDto") PagePbCheckUnitCommonDto commonDto, @Param("page") Page page);
    /**
     * 报到党员统计-按单位统计
     * @param commonDto
     * @param page
     * @return
     */
    IPage<ComPbCheckUnitVo> pbStatisticsUnit(@Param("commonDto") PagePbCheckUnitCommonDto commonDto, @Param("page") Page page);
}
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/ComPbCheckUnitService.java
@@ -94,4 +94,43 @@
     */
    R detailByPhone(String phone);
    /**
     * 报到单位统计-顶部数据
     * @param communityId
     * @param belongTo
     * @param choice
     * @return
     */
    R unitStatisticsTop(Long communityId, String belongTo, String choice);
    /**
     * 报到单位统计
     * @param commonDto
     * @return
     */
    R unitStatistics(PagePbCheckUnitCommonDto commonDto);
    /**
     * 报到党员统计-顶部数据
     * @param communityId
     * @param belongTo
     * @param choice
     * @param checkUnitId
     * @return
     */
    R pbStatisticsTop(Long communityId, String belongTo, String choice, Long checkUnitId);
    /**
     * 报到党员统计-按单位归属统计
     * @param commonDto
     * @return
     */
    R pbStatisticsBelong(PagePbCheckUnitCommonDto commonDto);
    /**
     * 报到党员统计-按单位统计
     * @param commonDto
     * @return
     */
    R pbStatisticsUnit(PagePbCheckUnitCommonDto commonDto);
}
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/ComPbCheckUnitServiceImpl.java
@@ -5,7 +5,6 @@
import com.google.common.collect.Lists;
import com.panzhihua.common.enums.ComPbCheckUnitTypeEnum;
import com.panzhihua.common.model.vos.common.ComPbCheckUnitVo;
import com.panzhihua.common.model.vos.partybuilding.PartyBuildingMemberVO;
import com.panzhihua.common.model.vos.partybuilding.excel.ComPbCheckUnitErrorExcelVO;
import com.panzhihua.common.model.vos.partybuilding.excel.ComPbCheckUnitExcelVO;
import com.panzhihua.common.utlis.StringUtils;
@@ -237,4 +236,59 @@
        }
        return R.ok();
    }
    /**
     * 报到单位统计-顶部数据
     * @param communityId
     * @param belongTo
     * @param choice
     * @return
     */
    @Override
    public R unitStatisticsTop(Long communityId, String belongTo, String choice) {
        return R.ok(this.baseMapper.unitStatisticsTop(communityId, belongTo, choice));
    }
    /**
     * 报到单位统计
     * @param commonDto
     * @return
     */
    @Override
    public R unitStatistics(PagePbCheckUnitCommonDto commonDto) {
        return R.ok(this.baseMapper.unitStatistics(commonDto, new Page(commonDto.getPageNum(), commonDto.getPageSize())));
    }
    /**
     * 报到党员统计-顶部数据
     * @param communityId
     * @param belongTo
     * @param choice
     * @param checkUnitId
     * @return
     */
    @Override
    public R pbStatisticsTop(Long communityId, String belongTo, String choice, Long checkUnitId) {
        return R.ok(this.baseMapper.pbStatisticsTop(communityId, belongTo, choice, checkUnitId));
    }
    /**
     * 报到党员统计-按单位归属统计
     * @param commonDto
     * @return
     */
    @Override
    public R pbStatisticsBelong(PagePbCheckUnitCommonDto commonDto) {
        return R.ok(this.baseMapper.pbStatisticsBelong(commonDto, new Page(commonDto.getPageNum(), commonDto.getPageSize())));
    }
    /**
     * 报到党员统计-按单位统计
     * @param commonDto
     * @return
     */
    @Override
    public R pbStatisticsUnit(PagePbCheckUnitCommonDto commonDto) {
        return R.ok(this.baseMapper.pbStatisticsUnit(commonDto, new Page(commonDto.getPageNum(), commonDto.getPageSize())));
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/resources/mapper/ComPbCheckUnitMapper.xml
@@ -52,7 +52,7 @@
                and cpcu.belong_to =#{dto.belongTo}
            </if>
            <if test="dto.natureName != null and dto.natureName != ''">
                and cpcu.nature_name =#{dto.natureName}
                and cpcu.nature_name = #{dto.natureName}
            </if>
        </where>
        order by cpcu.create_at desc
@@ -91,6 +91,171 @@
    <select id="selectCommunityId" resultType="Long">
        select community_id from com_area_town_community where area=#{area} and town=#{town} and community=#{community}
    </select>
    <select id="unitStatisticsTop"
            resultType="com.panzhihua.common.model.vos.common.PbCheckUnitStatisticsVo">
        SELECT
        (SELECT COUNT( id ) FROM com_pb_check_unit WHERE 1=1
            <if test="communityId != null">
                AND community_id = #{communityId}
            </if>
            <if test="belongTo != null and belongTo != ''">
                AND belong_to = #{belongTo}
            </if>
            <if test="choice != null and choice != ''">
                AND belong_to = #{choice}
            </if>
        ) AS unitTotal,
        (SELECT COUNT( id ) FROM com_pb_check_unit WHERE nature_name = '机关单位'
            <if test="communityId != null">
                AND community_id = #{communityId}
            </if>
            <if test="belongTo != null and belongTo != ''">
                AND belong_to = #{belongTo}
            </if>
            <if test="choice != null and choice != ''">
                AND belong_to = #{choice}
            </if>
        ) AS organTotal,
        (SELECT COUNT( id ) FROM com_pb_check_unit WHERE nature_name = '企事业单位'
            <if test="communityId != null">
                AND community_id = #{communityId}
            </if>
            <if test="belongTo != null and belongTo != ''">
                AND belong_to = #{belongTo}
            </if>
            <if test="choice != null and choice != ''">
                AND belong_to = #{choice}
            </if>
        ) AS businessTotal,
        (SELECT COUNT( m.id ) FROM com_pb_member m LEFT JOIN com_pb_check_unit as cpcu ON m.check_unit_id = cpcu.id WHERE m.audit_result = 1
            <if test="communityId != null">
                AND m.community_id = #{communityId}
            </if>
            <if test="belongTo != null and belongTo != ''">
                AND cpcu.belong_to = #{belongTo}
            </if>
            <if test="choice != null and choice != ''">
                AND cpcu.belong_to = #{choice}
            </if>
        ) AS partyMemberTotal
    </select>
    <select id="unitStatistics" resultType="com.panzhihua.common.model.vos.common.PbCheckUnitStatisticsVo">
        SELECT temp.*,
        (SELECT COUNT( id ) FROM com_pb_check_unit WHERE nature_name = '机关单位'
            <if test="commonDto.communityId != null">
                AND community_id = #{commonDto.communityId}
            </if>
         AND belong_to = temp.belong_to) AS organTotal,
        (SELECT COUNT( id ) FROM com_pb_check_unit WHERE nature_name = '企事业单位'
            <if test="commonDto.communityId != null">
                AND community_id = #{commonDto.communityId}
            </if>
        AND belong_to = temp.belong_to) AS businessTotal,
        (SELECT COUNT( m.id ) FROM com_pb_member m LEFT JOIN com_pb_check_unit as cpcu ON m.check_unit_id = cpcu.id WHERE m.audit_result = 1
            <if test="commonDto.communityId != null">
                AND m.community_id = #{commonDto.communityId}
            </if>
         AND cpcu.belong_to = temp.belong_to) AS partyMemberTotal
        FROM (SELECT belong_to,COUNT( id ) AS unitTotal FROM com_pb_check_unit WHERE 1=1
        <if test="commonDto.communityId != null">
            AND community_id = #{commonDto.communityId}
        </if>
        <if test="commonDto.belongTo != null and commonDto.belongTo != ''">
            AND belong_to = #{commonDto.belongTo}
        </if>
        GROUP BY belong_to) temp
    </select>
    <select id="pbStatisticsTop" resultType="com.panzhihua.common.model.vos.common.PbCheckUnitStatisticsVo">
        SELECT
        (SELECT COUNT( m.id ) FROM com_pb_member m LEFT JOIN com_pb_check_unit as cpcu ON m.check_unit_id = cpcu.id WHERE m.audit_result = 1
        AND cpcu.nature_name = '机关单位'
        <if test="communityId != null">
            AND m.community_id = #{communityId}
        </if>
        <if test="belongTo != null and belongTo != ''">
            AND cpcu.belong_to = #{belongTo}
        </if>
        <if test="choice != null and choice != ''">
            AND cpcu.belong_to = #{choice}
        </if>
        <if test="checkUnitId != null">
            AND m.check_unit_id = #{checkUnitId}
        </if>
        ) AS organTotal,
        (SELECT COUNT( m.id ) FROM com_pb_member m LEFT JOIN com_pb_check_unit as cpcu ON m.check_unit_id = cpcu.id WHERE m.audit_result = 1
        AND cpcu.nature_name = '企事业单位'
        <if test="communityId != null">
            AND m.community_id = #{communityId}
        </if>
        <if test="belongTo != null and belongTo != ''">
            AND cpcu.belong_to = #{belongTo}
        </if>
        <if test="choice != null and choice != ''">
            AND cpcu.belong_to = #{choice}
        </if>
        <if test="checkUnitId != null">
            AND m.check_unit_id = #{checkUnitId}
        </if>
        ) AS businessTotal,
        (SELECT COUNT( m.id ) FROM com_pb_member m LEFT JOIN com_pb_check_unit as cpcu ON m.check_unit_id = cpcu.id WHERE m.audit_result = 1
        <if test="communityId != null">
            AND m.community_id = #{communityId}
        </if>
        <if test="belongTo != null and belongTo != ''">
            AND cpcu.belong_to = #{belongTo}
        </if>
        <if test="choice != null and choice != ''">
            AND cpcu.belong_to = #{choice}
        </if>
        <if test="checkUnitId != null">
            AND m.check_unit_id = #{checkUnitId}
        </if>
        ) AS partyMemberTotal
    </select>
    <select id="pbStatisticsBelong" resultType="com.panzhihua.common.model.vos.common.PbCheckUnitStatisticsVo">
        SELECT temp.*,
        (SELECT COUNT( m.id ) FROM com_pb_member m LEFT JOIN com_pb_check_unit as cpcu ON m.check_unit_id = cpcu.id WHERE m.audit_result = 1
            <if test="commonDto.communityId != null">
                AND m.community_id = #{commonDto.communityId}
            </if>
        AND cpcu.nature_name = '机关单位' AND cpcu.belong_to = temp.belong_to) AS organTotal,
        (SELECT COUNT( m.id ) FROM com_pb_member m LEFT JOIN com_pb_check_unit as cpcu ON m.check_unit_id = cpcu.id WHERE m.audit_result = 1
            <if test="commonDto.communityId != null">
                AND m.community_id = #{commonDto.communityId}
            </if>
        AND cpcu.nature_name = '企事业单位' AND cpcu.belong_to = temp.belong_to) AS businessTotal
        FROM (SELECT cpcu.belong_to,COUNT( m.id ) AS partyMemberTotal FROM com_pb_member m LEFT JOIN com_pb_check_unit as cpcu ON m.check_unit_id = cpcu.id WHERE m.audit_result = 1
        <if test="commonDto.communityId != null">
            AND m.community_id = #{commonDto.communityId}
        </if>
        <if test="commonDto.belongTo != null and commonDto.belongTo != ''">
            AND cpcu.belong_to = #{commonDto.belongTo}
        </if>
        GROUP BY belong_to) temp
    </select>
    <select id="pbStatisticsUnit" resultType="com.panzhihua.common.model.vos.common.ComPbCheckUnitVo">
        SELECT
        cpcu.id,
        cpcu.`name`,
        cpcu.nature_name,
        cpcu.belong_to,
        cpcu.help_community_name,
        cpcu.village_name,
        COUNT( m.id ) AS count
        FROM
        com_pb_member m
        LEFT JOIN com_pb_check_unit AS cpcu ON m.check_unit_id = cpcu.id
        WHERE
        m.audit_result = 1
        <if test="commonDto.communityId != null">
            AND m.community_id = #{commonDto.communityId}
        </if>
        <if test="commonDto.belongTo != null and commonDto.belongTo != ''">
            AND cpcu.belong_to = #{commonDto.belongTo}
        </if>
        GROUP BY
        cpcu.`name`
    </select>
</mapper>
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/resources/mapper/ComPbMemberMapper.xml
@@ -58,9 +58,11 @@
        TIMESTAMPDIFF(
        YEAR,
        m.employment_time,
        DATE_FORMAT( NOW(), '%Y-%m-%d' )) as partyAge
        DATE_FORMAT( NOW(), '%Y-%m-%d' )) as partyAge,
        su.nick_name
        from com_pb_member as m
        LEFT JOIN com_pb_org o ON m.org_id = o.id
        LEFT JOIN sys_user su ON m.user_id = su.user_id
        LEFT JOIN com_pb_check_unit as cpcu ON m.check_unit_id = cpcu.id
        LEFT JOIN com_mng_village cmv on m.village_id = cmv.village_id
        LEFT JOIN com_act ca on m.community_id = ca.community_id
@@ -107,6 +109,17 @@
            <if test="dto.belongTo !=null and dto.belongTo !=''">
                and cpcu.belong_to = #{dto.belongTo}
            </if>
            <if test="dto.natureName !=null and dto.natureName !=''">
                and cpcu.nature_name = #{dto.natureName}
            </if>
            <if test="dto.isRegister !=null">
                <if test="dto.isRegister == 1">
                    and m.user_id IS NOT NULL
                </if>
                <if test="dto.isRegister == 0">
                    and m.user_id IS NULL
                </if>
            </if>
        </where>
        order by m.create_at desc
    </select>