liyg 2 năm trước cách đây
mục cha
commit
e3c9126f45
1 tập tin đã thay đổi với 64 bổ sung23 xóa
  1. 64 23
      src/main/resources/com/steerinfo/dil/mapper/UniversalMapper.xml

+ 64 - 23
src/main/resources/com/steerinfo/dil/mapper/UniversalMapper.xml

@@ -79,6 +79,7 @@
 
     <!--  边输边查公司  -->
     <select id="getCompanyMesByLike" resultType="java.util.Map">
+        select * from(
         select * from(
         select
         RC.SSO_ID "ssoId",
@@ -99,16 +100,30 @@
             <if test="index!=null and index!=''">
                 AND REGEXP_LIKE("label", #{index})
             </if>
-           <if test="id!=null and id.size>0 and !(index!=null and index!='')">
-                AND "id" in
-                <foreach collection="id" item="item"  open="(" close=")" separator="," >
-                    #{item}
-                </foreach>
-            </if>
         </where>
         FETCH NEXT 10 ROWS ONLY
+        )
+        <if test="id!=null and id.size>0">
+        UNION
+            select
+            RC.SSO_ID "ssoId",
+            RC.SSO_CODE "ssoCode",
+            RC.COMPANY_ID "id",
+            RC.COMPANY_ID "value",
+            <if test="companyType==null">
+                RC.COMPANY_TYPE || '-' ||
+            </if>
+            RC.COMPANY_NAME "label",
+            RC.COMPANY_NAME "text"
+            from RMS_COMPANY RC
+            where RC.COMPANY_ID in
+            <foreach collection="id" item="item"  open="(" close=")" separator="," >
+                #{item}
+            </foreach>
+        </if>
     </select>
     <select id="getMaterialTypeByLike" resultType="java.util.Map">
+        select * from(
         select * from(
         select
         MATERIAL_TYPE_ID "materialTypeId",
@@ -128,14 +143,25 @@
             <if test="remark!=null and remark!=''">
                 AND REGEXP_LIKE("remark", #{remark})
             </if>
-           <if test="id!=null and id.size>0 and !(index!=null and index!='')">
-                AND "id" in
-                <foreach collection="id" item="item"  open="(" close=")" separator="," >
-                    #{item}
-                </foreach>
-            </if>
         </where>
         FETCH NEXT 10 ROWS ONLY
+        )
+        <if test="id!=null and id.size>0">
+        UNION
+            select
+            MATERIAL_TYPE_ID "materialTypeId",
+            MATERIAL_TYPE_NAME "materialTypeName",
+            MATERIAL_TYPE_ID "id",
+            MATERIAL_TYPE_ID "value",
+            MATERIAL_TYPE_NAME "label",
+            MATERIAL_TYPE_NAME "text",
+            REMARK "remark"
+            from RMS_MATERIAL_TYPE
+            where MATERIAL_TYPE_ID in
+            <foreach collection="id" item="item"  open="(" close=")" separator="," >
+                #{item}
+            </foreach>
+        </if>
     </select>
     <select id="getEmissionStandardByLike" resultType="java.util.Map">
         select * from (
@@ -525,10 +551,11 @@
         </where>
     </select>
     <select id="getBusinessTypeLike" resultType="java.util.Map">
+        select * from(
         select * from(
         select
-        DBT.BUSINESS_TYPE_ID  "businessTypeId",
-        DBT.BUSINESS_TYPE_ID  "id",
+        DBT.BUSINESS_TYPE_ID "businessTypeId",
+        DBT.BUSINESS_TYPE_ID "id",
         DBT.BUSINESS_TYPE_ID "value",
         DBT.BUSINESS_TYPE_NAME "text",
         DBT.BUSINESS_TYPE_NAME "businessTypeName",
@@ -543,10 +570,10 @@
                 AND REGEXP_LIKE("label", #{index})
             </if>
             <if test="businessType!=null and businessType!=''">
-                AND  "businessTypeId" = #{businessType}
+                AND "businessTypeId" = #{businessType}
             </if>
             <if test="businessScene!=null and businessScene!=''">
-                AND  "businessScene" = #{businessScene}
+                AND "businessScene" = #{businessScene}
             </if>
             <if test="transportType!=null and transportType!=''">
                 AND REGEXP_LIKE("transportType", #{transportType})
@@ -554,14 +581,28 @@
             <if test="materialTypeName!=null and materialTypeName!=''">
                 AND REGEXP_LIKE("materialTypeName", #{materialTypeName})
             </if>
-            <if test="id!=null and id.size > 0 and !(index!=null and index!='')">
-                AND "id" in
-                <foreach collection="id" item="item"  open="(" close=")" separator="," >
-                    #{item}
-                </foreach>
-            </if>
+
         </where>
         FETCH NEXT 10 ROWS ONLY
+    )
+    <if test="id!=null and id.size > 0">
+        UNION
+        select
+        DBT.BUSINESS_TYPE_ID "businessTypeId",
+        DBT.BUSINESS_TYPE_ID "id",
+        DBT.BUSINESS_TYPE_ID "value",
+        DBT.BUSINESS_TYPE_NAME "text",
+        DBT.BUSINESS_TYPE_NAME "businessTypeName",
+        DBT.BUSINESS_SCENE "businessScene",
+        DBT.BUSINESS_TYPE_NAME "label",
+        DBT.ALTERNATE_FIELDS1 "transportType",
+        DBT.ALTERNATE_FIELDS2 "materialTypeName"
+        from DIL_BUSINESS_TYPE DBT
+        WHERE DBT.BUSINESS_TYPE_ID in
+        <foreach collection="id" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+    </if>
     </select>
     <select id="findTrainWeight" resultType="java.util.Map">
         <foreach collection="list" item="item"  separator=" UNION " >
@@ -651,7 +692,7 @@
                 AND REGEXP_LIKE("label", #{index})
             </if>
         </where>
-        FETCH NEXT 10 ROWS ONLY
+        FETCH NEXT 1 ROWS ONLY
     </select>
     <select id="getDemandRulesCode" resultType="java.util.Map">
         SELECT * FROM (