Browse Source

条件判断修改

chengyao 4 years ago
parent
commit
cd5254764a
1 changed files with 9 additions and 12 deletions
  1. 9 12
      src/main/resources/mapper/DoctorAdviceMapper.xml

+ 9 - 12
src/main/resources/mapper/DoctorAdviceMapper.xml

@@ -62,18 +62,15 @@
         <if test="doctorAdviceVO.hospitalId != null">
             and t.hospital_id = #{doctorAdviceVO.hospitalId}
         </if>
-        <choose>
-            <when test="doctorAdviceVO.medicineType != null and doctorAdviceVO.medicineType ==0 "  >
-                and (t.medicine_type = "普药" or t.medicine_type = #{doctorAdviceVO.medicineType})
-            </when>
-            <when test="doctorAdviceVO.medicineType != null and doctorAdviceVO.medicineType ==1 "  >
-                and (t.medicine_type = "抗生素" or t.medicine_type = #{doctorAdviceVO.medicineType})
-            </when>
-            <when test="doctorAdviceVO.medicineType != null and doctorAdviceVO.medicineType ==2 "  >
-                and (t.medicine_type = "激素" or t.medicine_type = #{doctorAdviceVO.medicineType})
-            </when>
-        </choose>
-
+        <if test="doctorAdviceVO.medicineType != null and doctorAdviceVO.medicineType != '' and doctorAdviceVO.medicineType == 0"  >
+            and (t.medicine_type = "普药" or t.medicine_type = #{doctorAdviceVO.medicineType})
+        </if>
+        <if test="doctorAdviceVO.medicineType != null and doctorAdviceVO.medicineType != '' and doctorAdviceVO.medicineType == 1 "  >
+            and (t.medicine_type = "抗生素" or t.medicine_type = #{doctorAdviceVO.medicineType})
+        </if>
+        <if test="doctorAdviceVO.medicineType != null and doctorAdviceVO.medicineType != '' and doctorAdviceVO.medicineType == 2 "  >
+            and (t.medicine_type = "激素" or t.medicine_type = #{doctorAdviceVO.medicineType})
+        </if>
         <if test="doctorAdviceVO.behospitalCode != null and doctorAdviceVO.behospitalCode != ''">
             and t.behospital_code = #{doctorAdviceVO.behospitalCode}
         </if>