Browse Source

优化sql

wangfeng 5 years ago
parent
commit
8c3f34cb30

+ 1 - 1
mrman-service/src/main/resources/mapper/MedBehospitalInfoMapper.xml

@@ -52,7 +52,7 @@
             AND beh_dept_id = #{deptId}
         </if>
         <if test="deptName!=null and deptName!=''">
-            AND beh_dept_name LIKE CONCAT('%',#{deptName},'%')
+            AND UPPER(beh_dept_name) LIKE CONCAT('%', UPPER(trim(#{deptName})), '%')
         </if>
         GROUP BY beh_dept_id
 

+ 4 - 4
mrman-service/src/main/resources/mapper/StdBehospitalInfoMapper.xml

@@ -57,7 +57,7 @@
         AND b.is_deleted = "N"
         AND a.hospital_id = b.id
         <if test="behospitalCode !=null and behospitalCode !=''">
-            AND a.behospital_code LIKE CONCAT('%', #{behospitalCode}, '%')
+            AND UPPER(a.behospital_code) LIKE CONCAT('%', UPPER(trim(#{behospitalCode})), '%')
         </if>
         <if test="deptId != null and deptId !=''">
             AND a.beh_dept_id = #{deptId}
@@ -66,7 +66,7 @@
             AND a.hospital_id = #{hospitalId}
         </if>
         <if test="name != null and name!= ''">
-            AND a.name LIKE CONCAT('%', #{name}, '%')
+            AND UPPER(a.name) LIKE CONCAT('%', UPPER(trim(#{name})), '%')
         </if>
         <if test="leaveHosDateStart != null">
             <![CDATA[ and a.leave_hospital_date >= #{leaveHosDateStart}]]>
@@ -137,10 +137,10 @@
             AND d.cases_id= #{casesId}
         </if>
         <if test="entryCode!=null and entryCode!=''">
-            AND d.code LIKE CONCAT('%',#{entryCode},'%')
+            AND UPPER(d.code) LIKE CONCAT('%', UPPER(trim(#{entryCode})), '%')
         </if>
         <if test="entryName!=null and entryName!=''">
-            AND d.name LIKE CONCAT('%',#{entryName},'%')
+            AND UPPER(d.name) LIKE CONCAT('%', UPPER(trim(#{entryName})), '%')
         </if>
 
         ) t1

+ 2 - 2
mrman-service/src/main/resources/mapper/StdMissionDetailMapper.xml

@@ -50,10 +50,10 @@
             AND a.cases_id =#{casesId}
         </if>
         <if test="entryName!=null and entryName !=''">
-            AND a.entry_name LIKE CONCAT('%',#{entryName},'%')
+            AND UPPER(a.entry_name) LIKE CONCAT('%', UPPER(trim(#{entryName})), '%')
         </if>
         <if test="entryCode!=null and entryCode!=''">
-            AND a.entry_code LIKE CONCAT('%',#{entryCode},'%')
+            AND UPPER(a.entry_code) LIKE CONCAT('%', UPPER(trim(#{entryCode})), '%')
         </if>
         <if test="status!=null">
             AND a.status = #{status}

+ 1 - 1
mrman-service/src/main/resources/mapper/StdMissionInfoMapper.xml

@@ -20,7 +20,7 @@
         SELECT id,mission_name as missionName,remark FROM std_mission_info
         WHERE is_deleted = "N"
         <if test="missionName!=null and missionName!=''">
-            AND mission_name LIKE CONCAT('%',#{missionName},'%')
+            AND UPPER(mission_name) LIKE CONCAT('%', UPPER(trim(#{missionName})), '%')
         </if>
         ORDER BY gmt_modified DESC
     </select>