IMProductEntryMapper.xml
2.6 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
68
69
70
71
72
<?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.sibu.orderHelper.integral.web.dao.IMWebProductEntryDao">
<select id="pagerProductEntry" resultMap="listIMProductEntry">
SELECT
ipe.entry_id,
ipe.entry_username,
ipe.entry_phone,
ipe.entry_wechat,
ipe.entry_product_stock,
ipe.create_dt,
imp.im_product_id,
imp.name
FROM im_product_entry ipe
INNER JOIN im_product imp ON ipe.entry_product_id=imp.im_product_id
where imp.`im_product_id` IN(
select product_id from im_product_supplier where supplier_id=#{supplierId}
)
<if test="keyword != null and keyword !=''">
and imp.name like concat('%',#{keyword},'%')
</if>
<if test="isShow != null and isShow !=''">
and imp.is_show = ${isShow}
</if>
ORDER BY ipe.create_dt desc
LIMIT ${pageNow}, ${pageSize}
</select>
<select id="countProductEntry" resultType="int">
select count(*) FROM im_product_entry ipe
INNER JOIN im_product imp ON ipe.entry_product_id=imp.im_product_id
where imp.`im_product_id` IN(
select product_id from im_product_supplier where supplier_id=#{supplierId}
)
<if test="keyword != null and keyword !=''">
and imp.name like concat('%',#{keyword},'%')
</if>
<if test="isShow != null and isShow !=''">
and imp.is_show = ${isShow}
</if>
</select>
<insert id="addProductEntry" parameterType="IMProductEntryBean">
insert into im_product_entry (
entry_id,
entry_username,
entry_phone,
entry_wechat,
entry_product_id,
entry_product_stock,
create_dt
) value(#{entryId}, #{entryUsername}, #{entryPhone}, #{entryWechat}, #{entryProductId}, #{entryProductStock}, now())
</insert>
<resultMap type="IMProductEntryBean" id="listIMProductEntry">
<result column="entry_id" property="entryId" />
<result column="entry_username" property="entryUsername" />
<result column="entry_phone" property="entryPhone" />
<result column="entry_wechat" property="entryWechat" />
<result column="entry_product_stock" property="entryProductStock" />
<result column="create_dt" property="createDt" />
<result column="supplierId" property="supplierId"/>
<result column="supplierName" property="supplierName"/>
<association property="product" column="entry_product_id" javaType="IMProductBean">
<result column="im_product_id" property="imProductId" />
<result column="name" property="name" />
</association>
</resultMap>
</mapper>