Quellcode durchsuchen

优化模糊查询

java110 vor 4 Jahren
Ursprung
Commit
df7a30aca9

+ 18 - 0
java110-db/src/main/resources/mapper/user/OwnerServiceDaoImplMapper.xml

@@ -383,6 +383,12 @@
         <if test="ownerTypeCd !=null and ownerTypeCd != ''">
             and t.owner_type_cd= #{ownerTypeCd}
         </if>
+        <if test="ownerTypeCds != null ">
+            and t.owner_type_cd in
+            <foreach collection="ownerTypeCds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
 
 
     </select>
@@ -432,6 +438,12 @@
         <if test="ownerTypeCd !=null and ownerTypeCd != ''">
             and t.owner_type_cd= #{ownerTypeCd}
         </if>
+        <if test="ownerTypeCds != null ">
+            and t.owner_type_cd in
+            <foreach collection="ownerTypeCds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
 
 
     </select>
@@ -492,6 +504,12 @@
         <if test="ownerTypeCd !=null and ownerTypeCd != ''">
             and t.owner_type_cd= #{ownerTypeCd}
         </if>
+        <if test="ownerTypeCds != null ">
+            and t.owner_type_cd in
+            <foreach collection="ownerTypeCds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
         </if>

+ 1 - 1
service-user/src/main/java/com/java110/user/cmd/owner/QueryOwnersCmd.java

@@ -137,7 +137,7 @@ public class QueryOwnersCmd extends AbstractServiceCmdListener {
         //获取当前用户id
         String ownerTypeCd = reqJson.getString("ownerTypeCd");
         OwnerDto tmpOwnerDto = BeanConvertUtil.covertBean(reqJson, OwnerDto.class);
-        if(!StringUtil.isEmpty(ownerTypeCd)&& ownerTypeCd.contains(",")){
+        if(!StringUtil.isEmpty(ownerTypeCd) && ownerTypeCd.contains(",")){
             tmpOwnerDto.setOwnerTypeCd("");
             tmpOwnerDto.setOwnerTypeCds(ownerTypeCd.split(","));
         }