IMAdvertMapper.xml
2.7 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
73
74
75
76
77
78
79
80
<?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.IMWebAdvertDao">
<select id="pagerImAdvert" resultMap="listIMAdvert">
SELECT
g.im_advert_id, g.type_id, g.im_product_id, g.name, g.image_url,g.link_url,g.is_show, g.sort_index
FROM
im_advert g
WHERE
g.delete_flag = 1
ORDER BY
sort_index asc,IFNULL(update_dt,create_dt) DESC
LIMIT ${pageNow}, ${pageSize}
</select>
<select id="listAppImAdvert" resultMap="listIMAdvert">
SELECT
g.im_advert_id, g.type_id, g.im_product_id, g.name, g.image_url,g.link_url
FROM
im_advert g
WHERE
g.is_show = 1 and g.delete_flag = 1
ORDER BY
sort_index asc,IFNULL(update_dt,create_dt) DESC
LIMIT 0,5
</select>
<select id="countAdvert" resultType="int">
select count(*) from im_advert where delete_flag = 1
</select>
<select id="getAdvert" resultMap="listIMAdvert" parameterType="String">
SELECT
g.im_advert_id, g.type_id, g.im_product_id, g.name, g.image_url,g.link_url,g.is_show, g.sort_index
FROM
im_advert g
WHERE
g.im_advert_id = #{advertId}
LIMIT 1
</select>
<insert id="addAdvert" parameterType="IMAdvertBean">
insert into im_advert (
im_advert_id,
type_id,
im_product_id,
name,
image_url,
link_url,
sort_index,
is_show,
create_member_id,
create_dt
) value(#{imAdvertId}, #{typeId}, #{imProductId}, #{name}, #{imageUrl}, #{linkUrl}, #{sortIndex}, #{isShow}, #{createMemberId}, now())
</insert>
<update id="editAdvert" parameterType="IMAdvertBean">
update im_advert set type_id=#{typeId}, im_product_id=#{imProductId}, name=#{name},
image_url=#{imageUrl}, link_url=#{linkUrl}, sort_index=#{sortIndex}, is_show=#{isShow},update_dt=#{updateDt}
where im_advert_id=#{imAdvertId}
</update>
<update id="deleteAdvert" parameterType="String">
update im_advert set delete_flag = 0 where im_advert_id=#{imAdvertId}
</update>
<resultMap type="IMAdvertBean" id="listIMAdvert">
<result column="im_advert_id" property="imAdvertId" />
<result column="type_id" property="typeId" />
<result column="im_product_id" property="imProductId" />
<result column="name" property="name" />
<result column="image_url" property="imageUrl" />
<result column="link_url" property="linkUrl"/>
<result column="is_show" property="isShow"/>
<result column="sort_index" property="sortIndex"/>
</resultMap>
</mapper>