Преглед на файлове

fix 小程序人员认领统计

tjf преди 3 години
родител
ревизия
a35a62d13f

+ 3 - 3
boman-web-core/src/main/java/com/boman/web/core/controller/RyrlController.java

@@ -87,9 +87,9 @@ public class RyrlController extends BaseController {
      *
      * @return com.boman.domain.dto.AjaxResult
      */
-    @GetMapping("/sts")
-    public AjaxResult stsByApplet(Long provinceId, Long cityId, Long regionId, Long townId, Long villageId, String idCard,String userName, String queryType, String houseType,String isConfirm) {
-        return AjaxResult.success("成功", czrkService.stsByApplet(provinceId, cityId, regionId, townId, villageId, idCard, userName,queryType, houseType,isConfirm));
+    @PostMapping("/sts")
+    public AjaxResult stsByApplet(@RequestBody Czrk czrk) {
+        return AjaxResult.success("成功", czrkService.stsByApplet(czrk));
     }
 
     /**

+ 3 - 2
boman-web-core/src/main/java/com/boman/web/core/mapper/CzrkMapper.java

@@ -92,8 +92,9 @@ public interface CzrkMapper {
 
     List<Czrk> listByCodeSynchronization(String code);
 
-    int stsByYrl(@Param("type") int type, @Param("areaId") Long areaId, @Param("idCard") String idCard,@Param("userName") String userName, @Param("houseType") String houseType,@Param("isConfirm")String isConfirm);
-    int stsByWrl(@Param("type") int type, @Param("areaId") Long areaId, @Param("idCard") String idCard,@Param("userName") String userName, @Param("houseType") String houseType,@Param("isConfirm")String isConfirm);
+    int stsByYrl(Czrk czrk);
+    int stsByWrl(Czrk czrk);
+    int stsByAll(Czrk czrk);
 
     List<Czrk> listIsRl(@Param("type") int type, @Param("areaId") Long areaId, @Param("userName") String userName);
 

+ 84 - 85
boman-web-core/src/main/java/com/boman/web/core/service/czrk/CzrkServiceImpl.java

@@ -43,6 +43,7 @@ import java.sql.Timestamp;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
 
 import static com.boman.common.core.utils.StringUtils.isNotEmpty;
 import static com.boman.common.core.utils.fieldTranslator.IdCardUtils.getSex;
@@ -103,6 +104,7 @@ public class CzrkServiceImpl implements ICzrkService {
 
     /**
      * 2022/3/24修复人员认领中常住人员接口列表,逻辑:所有人都能看到所有没有确认,没有认领的人员
+     *
      * @param czrk
      * @return
      */
@@ -135,7 +137,7 @@ public class CzrkServiceImpl implements ICzrkService {
         String villageTownsId = czrk.getVillageTownsIdXjd();
         String villageId = czrk.getVillageIdXjd();
         //设置查询列表权限
-        setQueryRole(czrk,sysUser,Czrk.HJ);
+        setQueryRole(czrk, sysUser, Czrk.HJ);
         //如果查询参数有居住地址,进行连表查询
         if (StringUtils.isNotBlank(provinceId) || StringUtils.isNotBlank(cityId) || StringUtils.isNotBlank(regionId) || StringUtils.isNotBlank(villageTownsId) || StringUtils.isNotBlank(villageId)) {
             long startTimeSql = System.currentTimeMillis();
@@ -168,7 +170,7 @@ public class CzrkServiceImpl implements ICzrkService {
         setAgeScope(czrk);
 
         //设置权限
-        setQueryRole(czrk,sysUser,Czrk.HJ);
+        setQueryRole(czrk, sysUser, Czrk.HJ);
         startPage();
         long startTimeSql = System.currentTimeMillis();
         List<Czrk> czrks = czrkMapper.unusualList(czrk);
@@ -369,7 +371,7 @@ public class CzrkServiceImpl implements ICzrkService {
         List<CzrkJzdz> czrkJzdzList = czrk.getCzrkJzdzList();
         if (isEmpty(czrkJzdzList)) return AjaxResult.error("该人员常住地址未添加");
         //一开始就判断是否是户籍和所有居住地址是否都不在权限之下
-        if (setInsertRole(czrk,sysUser)) {
+        if (setInsertRole(czrk, sysUser)) {
             return AjaxResult.error(HttpStatus.NOT_IMPLEMENTED, "当前填写的户籍地址和居住地址均不属于权限范围");
         }
         String houseType = czrk.getHouseType();
@@ -431,7 +433,7 @@ public class CzrkServiceImpl implements ICzrkService {
         List<CzrkJzdz> czrkJzdzList = czrk.getCzrkJzdzList();
         if (isEmpty(czrkJzdzList)) return AjaxResult.error("该人员常住地址未添加");
         //一开始就判断是否是户籍和所有居住地址是否都不在权限之下
-        if (setInsertRole(czrk,sysUser)) {
+        if (setInsertRole(czrk, sysUser)) {
             return AjaxResult.error(HttpStatus.NOT_IMPLEMENTED, "当前填写的户籍地址和居住地址均不属于权限范围");
         }
         //看是否是户主,且有户主号需要去查看该家庭是否有户主
@@ -480,7 +482,8 @@ public class CzrkServiceImpl implements ICzrkService {
             czrkJzdz.setSort(++sort);
             czrkJzdz.setUserName(czrk.getUserName());
             czrkJzdz.setIdCard(czrk.getIdCard());
-            czrkJzdz.setCreateBy(username);;
+            czrkJzdz.setCreateBy(username);
+            ;
             childCount += czrkJzdzService.insertCzrkJzdz(czrkJzdz);
         }
 
@@ -640,7 +643,7 @@ public class CzrkServiceImpl implements ICzrkService {
     /**
      * 2022/3/24修改的根据czrkId查询该用户信息
      *
-     * @param
+     * @param s
      * @return
      */
     @Override
@@ -774,6 +777,7 @@ public class CzrkServiceImpl implements ICzrkService {
 
     /**
      * 功能描述: 人员认领菜单中认领接口
+     *
      * @param czrk
      * @return
      */
@@ -785,7 +789,7 @@ public class CzrkServiceImpl implements ICzrkService {
         List<CzrkJzdz> czrkJzdzList = czrk.getCzrkJzdzList();
         if (isEmpty(czrkJzdzList)) return AjaxResult.error("该人员常住地址未添加");
         //一开始就判断是否是户籍和所有居住地址是否都不在权限之下
-        if (setInsertRole(czrk,sysUser)) {
+        if (setInsertRole(czrk, sysUser)) {
             return AjaxResult.error(HttpStatus.NOT_IMPLEMENTED, "当前填写的户籍地址和居住地址均不属于权限范围,请先修改后认领");
         }
         //看是否是户主,且有户主号需要去查看该家庭是否有户主
@@ -822,63 +826,55 @@ public class CzrkServiceImpl implements ICzrkService {
     }
 
     /**
-     * 小程序接口统计认领人员
+     * 2022/3/25修改小程序接口统计认领人员
      *
-     * @param provinceId
-     * @param cityId
-     * @param regionId
-     * @param townId
-     * @param villageId
-     * @param idCard
-     * @param userName
-     * @param queryType
-     * @param houseType
-     * @param isConfirm
+     * @param czrk
      * @return
      */
     @Override
-    public JSONObject stsByApplet(Long provinceId, Long cityId, Long regionId, Long townId, Long villageId, String idCard, String userName, String queryType, String houseType, String isConfirm) {
-        //todo 需要增加用户权限,根据sys_dept表中area_id来进行关联
-        Long areaId = null;
-        int type = 0, yrl = 0, wrl = 0;
-        if (ObjectUtils.isNotEmpty(provinceId)) {
-            areaId = provinceId;
-            type = 1;
-        } else if (ObjectUtils.isNotEmpty(cityId)) {
-            areaId = cityId;
-            type = 2;
-        } else if (ObjectUtils.isNotEmpty(regionId)) {
-            areaId = regionId;
-            type = 3;
-        } else if (ObjectUtils.isNotEmpty(townId)) {
-            areaId = townId;
-            type = 4;
-        } else if (ObjectUtils.isNotEmpty(villageId)) {
-            areaId = villageId;
-            type = 5;
-        }
-
+    public JSONObject stsByApplet(Czrk czrk) {
+        SysUser sysUser = AuthUtils.getLoginUser().getSysUser();
+        log.info("{}于{}人员认领:{}"
+                , sysUser.getUserName(), DateUtils.dateTimeNow(), JSON.toJSONString(czrk));
+        String queryType = czrk.getQueryType();
+        long total = 0, yrl = 0, wrl = 0;
+        //搜索常住人口全部未认领人员需要在设置权限之前
+        wrl = czrkMapper.stsByWrl(czrk);
+        //设置查询权限
+        setQueryRole(czrk, sysUser, queryType);
+        //拆分搜索接口中年龄字段
+        setAgeScope(czrk);
         if (Czrk.HJ.equals(queryType)) {
-            // 户籍
-            //todo areaId不能是Long类型改为String 不然走不上索引
-            yrl = czrkMapper.stsByYrl(type, areaId, idCard, userName, houseType, isConfirm);
-            wrl = czrkMapper.stsByWrl(type, areaId, idCard, userName, houseType, isConfirm);
-        } else {
-            // 常住
-            List<Czrk> rls = czrkMapper.stsByAppletCz(type, areaId, idCard, userName, houseType, isConfirm);
-            for (Czrk czrk : rls) {
-                if ("是".equals(czrk.getIsRl())) {
-                    yrl++;
-                } else if ("否".equals(czrk.getIsRl())) {
-                    wrl++;
-                }
+            //获取到居住地的查询条件
+            String provinceId = czrk.getProvinceIdXjd();
+            String cityId = czrk.getCityIdXjd();
+            String regionId = czrk.getRegionIdXjd();
+            String villageTownsId = czrk.getVillageTownsIdXjd();
+            String villageId = czrk.getVillageIdXjd();
+            List<Czrk> czrks = new ArrayList<>();
+            //如果查询参数有居住地址,进行连表查询
+            if (StringUtils.isNotBlank(provinceId) || StringUtils.isNotBlank(cityId) || StringUtils.isNotBlank(regionId) || StringUtils.isNotBlank(villageTownsId) || StringUtils.isNotBlank(villageId)) {
+                czrks = czrkMapper.listCzrkByJzdz(czrk);
+            } else {
+                //没有搜索居住地址的条件,进行单表查询
+                czrks = czrkMapper.listByCzrk(czrk);
+            }
+            if (czrks != null && czrks.size() > 0){
+                //户籍人口全部人员
+                total = czrks.size();
+                //户籍人口已认领
+                yrl = czrks.stream().filter(e -> StringUtils.isNotBlank(e.getIsRl()) && "是".equals(e.getIsRl())).count();
             }
+        } else {
+            //常住人口全部人员
+            total = czrkMapper.stsByAll(czrk);
+            //常住人口已认领
+            yrl = czrkMapper.stsByYrl(czrk);
         }
-
         JSONObject result = new JSONObject(3);
         result.put("yrl", yrl);
         result.put("wrl", wrl);
-        result.put("total", wrl + yrl);
+        result.put("total", total);
         return result;
     }
 
@@ -1062,7 +1058,7 @@ public class CzrkServiceImpl implements ICzrkService {
 
                 //查找潜山市户籍人口总数
                 List<Czrk> czrkList = czrkMapper.getAllCzrkRegionId("340882000000");
-                if(czrkList==null){
+                if (czrkList == null) {
                     czrkList = new ArrayList<>();
                 }
                 //潜山市户籍人口总数
@@ -1075,14 +1071,14 @@ public class CzrkServiceImpl implements ICzrkService {
 
                 //循环所有人判断当前总人数,该镇 户籍人口今日新增,该镇 户籍人口今日减少
                 for (Czrk czrk : czrkList) {
-                    if("Y".equals(czrk.getIsDel())){
+                    if ("Y".equals(czrk.getIsDel())) {
                         hjzrs--;
                     }
                     //判断是否是在今天操作的人员信息
-                    if(s.before(czrk.getCreateTime()) && czrk.getCreateTime().before(e)){
-                        if("Y".equals(czrk.getIsDel())){
+                    if (s.before(czrk.getCreateTime()) && czrk.getCreateTime().before(e)) {
+                        if ("Y".equals(czrk.getIsDel())) {
                             hjjs++;
-                        }else{
+                        } else {
                             hjxz++;
                         }
                     }
@@ -1098,7 +1094,7 @@ public class CzrkServiceImpl implements ICzrkService {
 
                 //查找潜山市常驻人口信息
                 List<CzrkJzdz> czrkJzdzList = czrkJzdzService.selectCzrkJzdzListByRegionId("340882000000");
-                if(czrkJzdzList==null){
+                if (czrkJzdzList == null) {
                     czrkJzdzList = new ArrayList<>();
                 }
                 //潜山市居住人口总数
@@ -1111,14 +1107,14 @@ public class CzrkServiceImpl implements ICzrkService {
 
                 //循环所有人判断当前总人数,该镇 户籍人口今日新增,该镇 户籍人口今日减少
                 for (CzrkJzdz czrkJzdz : czrkJzdzList) {
-                    if("N".equals(czrkJzdz.getStatus())){
+                    if ("N".equals(czrkJzdz.getStatus())) {
                         czzrs--;
                     }
                     //判断是否是在今天操作的人员信息
-                    if(s.before(czrkJzdz.getCreateTime()) && czrkJzdz.getCreateTime().before(e)){
-                        if("N".equals(czrkJzdz.getStatus())){
+                    if (s.before(czrkJzdz.getCreateTime()) && czrkJzdz.getCreateTime().before(e)) {
+                        if ("N".equals(czrkJzdz.getStatus())) {
                             czjs++;
-                        }else{
+                        } else {
                             czxz++;
                         }
                     }
@@ -1154,7 +1150,7 @@ public class CzrkServiceImpl implements ICzrkService {
                 for (SysDept townsDept : townsDepts) {
                     JSONObject townsResult = new JSONObject(16);
                     ///townSts(townsResult, townsDept.getId(), townsDept.getDeptName(), false);
-                    townSts(townsResult, townsDept, czrkList, czrkJzdzList,hjzrs, czzrs);
+                    townSts(townsResult, townsDept, czrkList, czrkJzdzList, hjzrs, czzrs);
                     towsDataList.add(townsResult);
                 }
 
@@ -1176,33 +1172,33 @@ public class CzrkServiceImpl implements ICzrkService {
 
                 //查找潜山市户籍人口总数
                 List<Czrk> czrkList = czrkMapper.getAllCzrkRegionId("340882000000");
-                if(czrkList==null){
+                if (czrkList == null) {
                     czrkList = new ArrayList<>();
                 }
                 //潜山市户籍人口总数
                 int hjzrs = czrkList.size();
                 //循环所有人判断当前总人数,该镇 户籍人口今日新增,该镇 户籍人口今日减少
                 for (Czrk czrk : czrkList) {
-                    if("Y".equals(czrk.getIsDel())){
+                    if ("Y".equals(czrk.getIsDel())) {
                         hjzrs--;
                     }
                 }
                 //查找潜山市常驻人口信息
                 List<CzrkJzdz> czrkJzdzList = czrkJzdzService.selectCzrkJzdzListByRegionId("340882000000");
-                if(czrkJzdzList==null){
+                if (czrkJzdzList == null) {
                     czrkJzdzList = new ArrayList<>();
                 }
                 //潜山市居住人口总数
                 int czzrs = czrkJzdzList.size();
                 //循环所有人判断当前总人数,该镇 户籍人口今日新增,该镇 户籍人口今日减少
                 for (CzrkJzdz czrkJzdz : czrkJzdzList) {
-                    if("N".equals(czrkJzdz.getStatus())){
+                    if ("N".equals(czrkJzdz.getStatus())) {
                         czzrs--;
                     }
                 }
 
 
-                townSts(result, sysUser.getDept(), czrkList, czrkJzdzList,hjzrs, czzrs);
+                townSts(result, sysUser.getDept(), czrkList, czrkJzdzList, hjzrs, czzrs);
 //                redisService.setCacheObject(packRedisKey("town:" + deptId), result, 1L, TimeUnit.DAYS);
                 setIntoRedis(packRedisKey("town:" + deptId), result);
             });
@@ -1248,7 +1244,7 @@ public class CzrkServiceImpl implements ICzrkService {
         return result;
     }
 
-    private void townSts(JSONObject result, SysDept sysDept, List<Czrk> czrkList, List<CzrkJzdz> czrkJzdzList ,int shjzrs, int sczzrs) {
+    private void townSts(JSONObject result, SysDept sysDept, List<Czrk> czrkList, List<CzrkJzdz> czrkJzdzList, int shjzrs, int sczzrs) {
         String startTime = DateUtils.getTodayStartStr();
         String endTime = DateUtils.getTodayEndStr();
         Timestamp s = Timestamp.valueOf(startTime);
@@ -1284,7 +1280,7 @@ public class CzrkServiceImpl implements ICzrkService {
             zrs = czrkMapper.countAll();
         }*/
 
-        if(czrkList==null){
+        if (czrkList == null) {
             czrkList = new ArrayList<>();
         }
         //该镇户籍人口总数
@@ -1297,15 +1293,15 @@ public class CzrkServiceImpl implements ICzrkService {
 
         //循环所有人判断当前总人数,该镇 户籍人口今日新增,该镇 户籍人口今日减少
         for (Czrk czrk : czrkList) {
-            if(StringUtils.isNotEmpty(czrk.getVillageTownsId()) && String.valueOf(czrk.getVillageTownsId()).equals(areaId)){
-                if("N".equals(czrk.getIsDel())){
+            if (StringUtils.isNotEmpty(czrk.getVillageTownsId()) && String.valueOf(czrk.getVillageTownsId()).equals(areaId)) {
+                if ("N".equals(czrk.getIsDel())) {
                     hjzrs++;
                 }
                 //判断是否是在今天操作的人员信息
-                if(s.before(czrk.getCreateTime()) && czrk.getCreateTime().before(e)){
-                    if("Y".equals(czrk.getIsDel())){
+                if (s.before(czrk.getCreateTime()) && czrk.getCreateTime().before(e)) {
+                    if ("Y".equals(czrk.getIsDel())) {
                         hjjs++;
-                    }else{
+                    } else {
                         hjxz++;
                     }
                 }
@@ -1317,7 +1313,7 @@ public class CzrkServiceImpl implements ICzrkService {
         result.put("hjbfb", NumberUtils.percent(hjzrs, shjzrs));
 
 
-        if(czrkJzdzList==null){
+        if (czrkJzdzList == null) {
             czrkJzdzList = new ArrayList<>();
         }
         //该镇户籍人口总数
@@ -1330,15 +1326,15 @@ public class CzrkServiceImpl implements ICzrkService {
 
         //循环所有人判断当前总人数,该镇 户籍人口今日新增,该镇 户籍人口今日减少
         for (CzrkJzdz czrkJzdz : czrkJzdzList) {
-            if(StringUtils.isNotEmpty(czrkJzdz.getTownId()) && czrkJzdz.getTownId().equals(areaId)){
-                if("Y".equals(czrkJzdz.getStatus())){
+            if (StringUtils.isNotEmpty(czrkJzdz.getTownId()) && czrkJzdz.getTownId().equals(areaId)) {
+                if ("Y".equals(czrkJzdz.getStatus())) {
                     czzrs++;
                 }
                 //判断是否是在今天操作的人员信息
-                if(s.before(czrkJzdz.getCreateTime()) && czrkJzdz.getCreateTime().before(e)){
-                    if("N".equals(czrkJzdz.getStatus())){
+                if (s.before(czrkJzdz.getCreateTime()) && czrkJzdz.getCreateTime().before(e)) {
+                    if ("N".equals(czrkJzdz.getStatus())) {
                         czjs++;
-                    }else{
+                    } else {
                         czxz++;
                     }
                 }
@@ -1514,7 +1510,11 @@ public class CzrkServiceImpl implements ICzrkService {
         result.put("czbfb", NumberUtils.percent(czzrs, zrs));*//*
 
         result.put("zhen", deptName);
-        *//** **//*
+        */
+
+    /**
+     *
+     **//*
 
 
         // 常住人口信息
@@ -1552,7 +1552,6 @@ public class CzrkServiceImpl implements ICzrkService {
 //        String hjbfb = NumberUtils.percent(hjzrs, zrs);
 //        result.put("hjbfb", hjbfb);
     }*/
-
     @Override
     public JSONObject hjczLine() {
         JSONObject resultData = new JSONObject(5);

+ 1 - 1
boman-web-core/src/main/java/com/boman/web/core/service/czrk/ICzrkService.java

@@ -95,7 +95,7 @@ public interface ICzrkService {
     AjaxResult addRlry(Czrk czrk);
     AjaxResult editRlry(Czrk czrk);
 
-    JSONObject stsByApplet(Long provinceId, Long cityId, Long regionId, Long townId, Long villageId, String idCard,String userName, String queryType, String houseType, String isConfirm);
+    JSONObject stsByApplet(Czrk czrk);
     JSONObject stsByCzrk();
     JSONObject stsByCzrkHomePage();
 

+ 1 - 1
boman-web-core/src/main/java/com/boman/web/core/utils/CzrkUtils.java

@@ -61,11 +61,11 @@ public class CzrkUtils {
      * @param type 查询常住还是户籍
      */
     public static void setQueryRole(Czrk czrk, SysUser sysUser,String type) {
-        //todo 从部门中获取行政区域规划id
         SysDept dept = sysUser.getDept();
         if (dept == null){
             throw new BaseException("对不起,未获相关部门信息");
         }
+        // 从部门中获取行政区域规划id
         String areaId = dept.getAreaId();
         if (StringUtils.isBlank(areaId)){
             throw new BaseException(dept.getDeptName() + "当前未获取到部门下行政区域id" );

+ 81 - 50
boman-web-core/src/main/resources/mapper/CzrkMapper.xml

@@ -103,7 +103,7 @@
 
     <select id="listByCzrk" resultMap="CzrkResult">
         select id, user_name, phone_num, id_card, gender, province, city, region, village_towns, village,
-        villager_group, grid_id, house_type, update_by, code,
+        villager_group, grid_id, house_type, code,is_rl,
         rlr,rlr_nike,now_in,is_confirm,confirm_info_user,confirm_info_nike_user,confirm_info_user_time
         from czrk
         <where>
@@ -142,7 +142,7 @@
     <select id="listCzrkByJzdz" resultMap="CzrkResult">
         select c.id, c.user_name, c.phone_num,c.dept_id, c.id_card,
         c.province, c.city ,c.region , c.village_towns, c.village ,c.now_in,
-        c.gender, c.grid_id, c.house_type, c.update_by, c.code, c.rlr,c.rlr_nike,
+        c.gender, c.grid_id, c.house_type, c.update_by, c.code,c.is_rl, c.rlr,c.rlr_nike,
         c.is_confirm,c.confirm_info_user,c.confirm_info_nike_user,c.confirm_info_user_time
         from czrk c left join czrk_jzdz z on c.id =z.czrk_id
         <where>
@@ -557,30 +557,32 @@
     </select>
 
     <select id="stsByYrl" resultType="int">
-        select count(vi.id)
-        from czrk vi
-        where vi.is_del = 'N'
-        <!-- 已认领 -->
-        and vi.is_rl = '是'
-        <if test="idCard != null  and idCard != ''">
-            and vi.id_card = #{idCard}
-        </if>
-        <if test="houseType != null  and houseType != ''">
-            and vi.house_type = #{houseType}
-        </if>
-        <if test="isConfirm != null  and isConfirm != ''">
-            and vi.is_confirm = #{isConfirm}
-        </if>
-        <if test="userName != null  and userName != ''">
-            and vi.user_name like concat(#{userName}, '%')
-        </if>
-        <choose>
-            <when test="type == 1">and vi.province_id = #{areaId}</when>
-            <when test="type == 2">and vi.city_id = #{areaId}</when>
-            <when test="type == 3">and vi.region_id = #{areaId}</when>
-            <when test="type == 4">and vi.village_towns_id = #{areaId}</when>
-            <when test="type == 5">and vi.village_id = #{areaId}</when>
-        </choose>
+        select count(1)
+        from czrk c left join czrk_jzdz z on c.id =z.czrk_id
+        <where>
+            c.is_del = 'N'
+            and c.status = '1'
+            and c.is_rl = '是'
+            <if test="userName != null  and userName != ''">
+                and c.user_name like concat(#{userName}, '%')
+            </if>
+            <if test="params.startAge != null  and params.startAge != ''">and c.age &gt;= #{params.startAge}</if>
+            <if test="params.endAge != null  and params.endAge != ''">and c.age &lt;= #{params.endAge}</if>
+            <if test="idCard != null  and idCard != ''">and c.id_card = #{idCard}</if>
+            <if test="phoneNum != null  and phoneNum != ''">and c.phone_num = #{phoneNum}</if>
+            <if test="houseType != null  and houseType != ''">and c.house_type = #{houseType}</if>
+            <if test="provinceId != null  and provinceId != ''">and c.province_id = #{provinceId}</if>
+            <if test="cityId != null  and cityId != ''">and c.city_id = #{cityId}</if>
+            <if test="regionId != null  and regionId != ''">and c.region_id = #{regionId}</if>
+            <if test="villageTownsId != null  and villageTownsId != ''">and c.village_towns_id = #{villageTownsId}</if>
+            <if test="villageId != null  and villageId != ''">and c.village_id = #{villageId}</if>
+            <if test="isConfirm != null  and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
+            <if test="provinceIdXjd != null and provinceIdXjd != ''">and z.province_id = #{provinceIdXjd}</if>
+            <if test="cityIdXjd != null and cityIdXjd != ''">and z.city_id = #{cityIdXjd}</if>
+            <if test="regionIdXjd != null and regionIdXjd != ''">and z.region_id = #{regionIdXjd}</if>
+            <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and z.town_id = #{villageTownsIdXjd}</if>
+            <if test="villageIdXjd != null and villageIdXjd != ''">and z.village_id = #{villageIdXjd}</if>
+        </where>
     </select>
 
     <select id="listIsRl" resultMap="CzrkResult">
@@ -612,30 +614,59 @@
     </select>
 
     <select id="stsByWrl" resultType="int">
-        select count(vi.id)
-        from czrk vi
-        where vi.is_del = 'N'
-        <!-- 未认领 -->
-        and vi.is_rl = '否'
-        <if test="idCard != null  and idCard != ''">
-            and vi.id_card = #{idCard}
-        </if>
-        <if test="houseType != null  and houseType != ''">
-            and vi.house_type = #{houseType}
-        </if>
-        <if test="isConfirm != null  and isConfirm != ''">
-            and vi.is_confirm = #{isConfirm}
-        </if>
-        <if test="userName != null  and userName != ''">
-            and vi.user_name like concat(#{userName}, '%')
-        </if>
-        <choose>
-            <when test="type == 1">and vi.province_id = #{areaId}</when>
-            <when test="type == 2">and vi.city_id = #{areaId}</when>
-            <when test="type == 3">and vi.region_id = #{areaId}</when>
-            <when test="type == 4">and vi.village_towns_id = #{areaId}</when>
-            <when test="type == 5">and vi.village_id = #{areaId}</when>
-        </choose>
+        select count(1)
+        from czrk c  left join czrk_jzdz z on c.id = z.czrk_id
+        <where>
+            c.is_del = 'N'
+            and c.is_rl = '否'
+            and c.is_confirm = 'N'
+            and c.status = '1'
+            <if test="userName != null  and userName != ''">
+                and c.user_name like concat(#{userName}, '%')
+            </if>
+            <if test="params.startAge != null  and params.startAge != ''">and c.age &gt;= #{params.startAge}</if>
+            <if test="params.endAge != null  and params.endAge != ''">and c.age &lt;= #{params.endAge}</if>
+            <if test="idCard != null  and idCard != ''">and c.id_card = #{idCard}</if>
+            <if test="phoneNum != null  and phoneNum != ''">and c.phone_num = #{phoneNum}</if>
+            <if test="provinceId != null  and provinceId != ''">and c.province_id = #{provinceId}</if>
+            <if test="cityId != null  and cityId != ''">and c.city_id = #{cityId}</if>
+            <if test="regionId != null  and regionId != ''">and c.region_id = #{regionId}</if>
+            <if test="villageTownsId != null  and villageTownsId != ''">and c.village_towns_id = #{villageTownsId}</if>
+            <if test="villageId != null  and villageId != ''">and c.village_id = #{villageId}</if>
+            <if test="provinceIdXjd != null and provinceIdXjd != ''">and z.province_id = #{provinceIdXjd}</if>
+            <if test="cityIdXjd != null and cityIdXjd != ''">and z.city_id = #{cityIdXjd}</if>
+            <if test="regionIdXjd != null and regionIdXjd != ''">and z.region_id = #{regionIdXjd}</if>
+            <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and z.town_id = #{villageTownsIdXjd}</if>
+            <if test="villageIdXjd != null and villageIdXjd != ''">and z.village_id = #{villageIdXjd}</if>
+        </where>
+    </select>
+    <select id="stsByAll" resultType="int">
+        select count(1)
+        from czrk c left join czrk_jzdz z on c.id =z.czrk_id
+        <where>
+            c.is_del = 'N'
+            and c.status = '1'
+            <if test="isRl != null and isRl != ''">and c.is_rl = #{isRl}</if>
+            <if test="userName != null  and userName != ''">
+                and c.user_name like concat(#{userName}, '%')
+            </if>
+            <if test="params.startAge != null  and params.startAge != ''">and c.age &gt;= #{params.startAge}</if>
+            <if test="params.endAge != null  and params.endAge != ''">and c.age &lt;= #{params.endAge}</if>
+            <if test="idCard != null  and idCard != ''">and c.id_card = #{idCard}</if>
+            <if test="phoneNum != null  and phoneNum != ''">and c.phone_num = #{phoneNum}</if>
+            <if test="houseType != null  and houseType != ''">and c.house_type = #{houseType}</if>
+            <if test="provinceId != null  and provinceId != ''">and c.province_id = #{provinceId}</if>
+            <if test="cityId != null  and cityId != ''">and c.city_id = #{cityId}</if>
+            <if test="regionId != null  and regionId != ''">and c.region_id = #{regionId}</if>
+            <if test="villageTownsId != null  and villageTownsId != ''">and c.village_towns_id = #{villageTownsId}</if>
+            <if test="villageId != null  and villageId != ''">and c.village_id = #{villageId}</if>
+            <if test="isConfirm != null  and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
+            <if test="provinceIdXjd != null and provinceIdXjd != ''">and z.province_id = #{provinceIdXjd}</if>
+            <if test="cityIdXjd != null and cityIdXjd != ''">and z.city_id = #{cityIdXjd}</if>
+            <if test="regionIdXjd != null and regionIdXjd != ''">and z.region_id = #{regionIdXjd}</if>
+            <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and z.town_id = #{villageTownsIdXjd}</if>
+            <if test="villageIdXjd != null and villageIdXjd != ''">and z.village_id = #{villageIdXjd}</if>
+        </where>
     </select>