Mybatis的分支选择:

<choose>
   <when test="patientNo != null and patientNo != ''">
      and ipi.patient_no = #{patientNo}
   </when>
   <otherwise>
      <if test="patientName != null and patientName != ''">
         and ipi.patient_name like CONCAT('%',#{patientName},'%')
      </if>
      <trim prefix="where" prefixOverrides="and">
         <if test="printTimeBegin != null and printTimeBegin != ''">
            and mrm.print_time >= #{printTimeBegin}
         </if>
         <if test="printTimeEnd != null and printTimeEnd != ''">
            and mrm.print_time  &lt;=  #{printTimeEnd}
         </if>
      </trim>
   </otherwise>
</choose>

循环In:

<if test='depts!=null and depts.size()>0'>
   and ioh.department_id IN
   <foreach item="item" index="index" collection="depts" open="(" separator="," close=")">
      #{item}
   </foreach>
</if>

相关文章:

  • 2022-12-23
  • 2021-07-02
  • 2021-08-25
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2022-02-25
猜你喜欢
  • 2022-12-23
  • 2021-12-11
  • 2022-12-23
  • 2021-08-31
  • 2022-12-23
  • 2022-02-06
  • 2021-09-19
相关资源
相似解决方案