选择关键字类型查询

<select id="getDnOrder" resultType="com.shinho.dc3.order.dto.doOrder.DnOrderRes" parameterType="com.shinho.dc3.order.dto.doOrder.DnOrderSearch" >
SELECT
A.VBELN,
A.VBELN VBELNCOPY,
A.VBELN AS VBELN1,
A.DO_VBELN,
A.ERDAT,
A.SHDAT,
A.NAME,
A.GROSS_BOX I_COUNT,
A.GROSS_AMT G_PRICE,
A.GROSS_AMT,
A.ADDR,
A.PERSON_NAME,
A.SFA_CAR_NUM,
SFA_NAME,
A.INSDT,
A.REMARK,
A.KUNNR,
A.LINKMAN,
A.LINKTEL,
A.SALE_TYPE,
A.STATUS,
A.SOURCE,
A.GROSS_ZK_AMT,
A.WAREHOUSE_ID,
A.ATX,
A.ZK_TYPE,
A.ZK_AMT,
A.UPDATEDT,
A.DID,
A.VL02N_DAT,
A.SFA_STATUS,
A.PRINT_COUNT,
A.dn_type AS dnType,
A.userid
from dn_order A -- 交货单
where A.fyfs in (60001,60003)
<if test="did != null" >
and A.did = #{did,jdbcType=VARCHAR}
</if>
<if test="dateStart != null and dateStart != ''" >
and SUBSTR(A.erdat FROM 0 FOR 10) &gt; #{dateStart}
</if>
<if test="dateEnd != null and dateEnd!='' " >
and SUBSTR(A.erdat FROM 0 FOR 10) &lt; #{dateEnd}
</if>
<if test="statusList != null" >
and A.STATUS in
<foreach collection="statusList" item="status" index="index" open="(" close=")" separator=",">
#{status}
</foreach>
</if>
<if test="wOrderType != null" >
and A.dn_type =#{wOrderType}
</if>
<if test="key == '交货单号'" >
AND A.vbeln like CONCAT('%',#{keyWord},'%')
</if>
<if test="key == '创建人'" >
AND A.name like CONCAT('%',#{keyWord},'%')
</if>
<if test="key == '业务员'" >
AND A.person_name like CONCAT('%',#{keyWord},'%')
</if>
<if test="key == '业务员'" >
AND (A.vbeln like CONCAT('%',#{keyWord},'%')
OR A.name like CONCAT('%',#{keyWord},'%')
OR A.person_name like CONCAT('%',#{keyWord},'%')
)
</if>
<if test="sfaStatus != null and sfaStatus!=''" >
and A.SFA_STATUS=#{sfaStatus}
</if>
<if test="sfaStatus eq 'B'" >
order by A.insdt,B.warehouse_name,BA.name
</if>
<if test="sfaStatus neq 'B'" >
order by A.insdt desc
</if>
</select>

猜你喜欢

转载自www.cnblogs.com/pan-my/p/10775330.html