SalesmanQuotationPeerMapper.xml
2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?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.lframework.xingyun.sc.procurement.mappers.quotation.SalesmanQuotationPeerMapper">
<resultMap id="SalesmanQuotationPeer" type="com.lframework.xingyun.sc.procurement.entity.SalesmanQuotationPeer">
<id column="id" property="id"/>
<result column="peer_name" property="peerName"/>
<result column="peer_product_id" property="peerProductId"/>
<result column="peer_product_name" property="peerProductName"/>
<result column="peer_product_code" property="peerProductCode"/>
<result column="peer_price" property="peerPrice"/>
<result column="remark" property="remark"/>
<result column="create_by_id" property="createById"/>
<result column="create_by" property="createBy"/>
<result column="update_by_id" property="updateById"/>
<result column="update_by" property="updateBy"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<sql id="SalesmanQuotationPeerSql">
SELECT
tb.id,
tb.peer_name,
tb.peer_product_id,
br.product_name AS peer_product_name,
br.code AS peer_product_code,
tb.peer_price,
tb.remark,
tb.create_by_id,
tb.create_by,
tb.update_by_id,
tb.update_by,
tb.create_time,
tb.update_time
FROM procurement_salesman_quotation_peer tb
LEFT JOIN base_data_breed_relationship br ON br.id = tb.peer_product_id
</sql>
<select id="query" resultMap="SalesmanQuotationPeer">
<include refid="SalesmanQuotationPeerSql"/>
<where>
<if test="vo.id != null and vo.id != ''">
AND tb.id = #{vo.id}
</if>
<if test="vo.peerName != null and vo.peerName != ''">
AND tb.peer_name LIKE CONCAT('%', #{vo.peerName}, '%')
</if>
<if test="vo.peerProductName != null and vo.peerProductName != ''">
AND br.product_name LIKE CONCAT('%', #{vo.peerProductName}, '%')
</if>
<if test="vo.createDateStart != null">
AND DATE(tb.create_time) <![CDATA[ >= ]]> #{vo.createDateStart}
</if>
<if test="vo.createDateEnd != null">
AND DATE(tb.create_time) <![CDATA[ <= ]]> #{vo.createDateEnd}
</if>
</where>
ORDER BY tb.create_time DESC
</select>
<select id="queryCurrentDayList" resultMap="SalesmanQuotationPeer">
<include refid="SalesmanQuotationPeerSql"/>
WHERE DATE(tb.create_time) = #{day}
ORDER BY tb.create_time DESC, tb.id DESC
</select>
</mapper>