shiqian 3 gadi atpakaļ
vecāks
revīzija
c37a53dd56

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

@@ -85,5 +85,5 @@ public interface CzrkMapper {
 
     List<Czrk> listIsRl(@Param("type") int type, @Param("areaId") Long areaId, @Param("userName") String userName);
 
-//    int stsByWrl(@Param("deptIdList") List<Long> deptIdList, @Param("userName") String userName);
+    List<Czrk> stsByAppletCz(@Param("type") int type, @Param("areaId") Long areaId, @Param("userName") String userName);
 }

+ 2 - 7
boman-web-core/src/main/java/com/boman/web/core/service/czrk/CzrkServiceImpl.java

@@ -426,13 +426,8 @@ public class CzrkServiceImpl implements ICzrkService {
             wrl = czrkMapper.stsByWrl(type, areaId, userName);
         } else {
             // 常住
-            // 所有的czrkId
-            List<Long> jzdzs = czrkJzdzService.listCzrkIdByTypeAreaIdUserName(type, areaId, userName);
-            // id 和 isRl
-            List<Czrk> rls = czrkMapper.listIsRl(type, areaId, userName);
-            // 满足搜索条件的czrk
-            List<Czrk> filter = filter(rls, czrk -> jzdzs.contains(czrk.getId()));
-            for (Czrk czrk : filter) {
+            List<Czrk> rls = czrkMapper.stsByAppletCz(type, areaId, userName);
+            for (Czrk czrk : rls) {
                 if ("是".equals(czrk.getIsRl())) {
                     yrl++;
                 } else if ("否".equals(czrk.getIsRl())) {

+ 36 - 0
boman-web-core/src/main/resources/mapper/CzrkMapper.xml

@@ -542,4 +542,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           , update_time   = sysdate()
         where id = #{id}
     </update>
+
+    <select id="stsByAppletCz" resultMap="CzrkResult">
+        SELECT
+            czrk.id,
+            czrk.is_rl
+        from czrk
+        left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
+        <where>
+            czrk.is_del = 'N'
+            <if test="userName != null  and userName != ''">
+                and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
+            </if>
+
+            <choose>
+                <when test="type == 1">and jzdz.province_id = #{areaId}</when>
+                <when test="type == 2">and jzdz.city_id = #{areaId}</when>
+                <when test="type == 3">and jzdz.region_id = #{areaId}</when>
+                <when test="type == 4">and jzdz.village_towns_id = #{areaId}</when>
+                <when test="type == 5">and jzdz.village_id = #{areaId}</when>
+            </choose>
+
+           <!-- <if test="provinceIdXjd != null  and provinceIdXjd != ''"> and jzdz.province_id = #{areaId}</if>
+            <if test="cityIdXjd != null  and cityIdXjd != ''"> and jzdz.city_id = #{areaId}</if>
+            <if test="regionIdXjd != null  and regionIdXjd != ''"> and jzdz.region_id = #{areaId}</if>
+            <if test="villageTownsIdXjd != null  and villageTownsIdXjd != ''"> and jzdz.town_id = #{areaId}</if>
+            <if test="villageIdXjd != null  and villageIdXjd != ''"> and jzdz.village_id = #{areaId}</if>-->
+
+           <!-- <if test="provinceId != null  and provinceId != ''"> and czrk.province_id = #{areaId}</if>
+            <if test="cityId != null  and cityId != ''"> and czrk.city_id = #{areaId}</if>
+            <if test="regionId != null  and regionId != ''"> and czrk.region_id = #{areaId}</if>
+            <if test="villageTownsId != null  and villageTownsId != ''"> and czrk.village_towns_id = #{areaId}</if>
+            <if test="villageId != null  and villageId != ''"> and czrk.village_id = #{areaId}</if>
+            <if test="villagerGroupId != null  and villagerGroupId != ''"> and czrk.villager_group_id = #{villagerGroupId}</if>-->
+        </where>
+        GROUP BY czrk.id
+    </select>
 </mapper>