<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.wms_admin.server.mapper.OutProductMapper">
|
<resultMap id="SelectOutProductPageResultMap" type="com.wms_admin.server.entity.OutProduct">
|
<result property="id" column="id"/>
|
<result property="customerOrderNumber" column="customer_order_number"/>
|
<result property="escortBillNumber" column="escort_bill_number"/>
|
<result property="unit" column="unit"/>
|
<result property="consignor" column="consignor"/>
|
<result property="outboundQuantity" column="outbound_quantity"/>
|
<result property="deliveryDate" column="delivery_date"/>
|
<result property="customerName" column="customer_name"/>
|
<result property="arrivalAddress" column="arrival_address"/>
|
<result property="receivingContact" column="receiving_contact"/>
|
<result property="recipientPhone" column="recipient_phone"/>
|
<result property="orderNumber" column="order_number"/>
|
</resultMap>
|
<!--多表多条件拼接查询-->
|
<select id="SelectOutProductPage" resultMap="SelectOutProductPageResultMap">
|
SELECT s1.`id`,s1.`out_person`,s1.`outbound_quantity`, s1.`unit`, s1.`create_time`,
|
s2.`product_name` productName,s3.`product_model` productModel,s3.`product_code` productCode
|
FROM out_product s1, product_name s2, product_model s3
|
WHERE s1.`product_name_id` = s2.`id`
|
AND s1.`product_model_id` = s3.`id`
|
<if test="startTime != null">
|
AND s1.create_time >= #{startTime}
|
</if>
|
<if test="endTime != null">
|
-- 在mybatis中小于号不能使用,需要使用方法转义:<![CDATA[<=]]>
|
AND s1.create_time <![CDATA[<=]]> #{endTime}
|
</if>
|
<if test="productModel != null">
|
AND s1.`product_model_id` = (SELECT p.`id` FROM product_model p WHERE p.`product_model` = #{productModel})
|
</if>
|
ORDER BY s1.create_time DESC
|
</select>
|
</mapper>
|