where标签作用:
会自动向sql语句中添加where关键字
而且会自动去掉第一个条件前面的and关键字
<select id="findSearch" resultType="com.shiro.shirodemo.entity.Outbound">
SELECT
outbound.outboundID as outBoundId,
outbound.equipmentID as equipmentId,
outbound.encodingID as encodingId,
outbound.classes as classes,
outbound.foursID as foursId,
outbound.outname as outName,
outbound.outstate as outState,
outbound.outtime as outTime,
outbound.printtime as printTime,
outbound.printstate as printState
FROM
outbound,
`order`
<where>
<if test="outState != null">and outstate=#{outState}</if>
<if test="printState != null"> and printstate=#{printState}</if>
<if test="classes != null"> and classes=#{classes}</if>
<if test="foursId != null"> and foursID=#{foursId}</if>
</where>
ORDER BY
order_foursshop.ordertime DESC
</select>