UnionShareMessageMapper.xml
3.97 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?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.yoho.unions.dal.UnionShareMessageMapper" >
<resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.UnionShareMessage" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="content" property="content" jdbcType="VARCHAR" />
<result column="image" property="image" jdbcType="VARCHAR" />
<result column="url" property="url" jdbcType="VARCHAR" />
<result column="priority" property="priority" jdbcType="INTEGER" />
<result column="start_time" property="startTime" jdbcType="INTEGER" />
<result column="end_time" property="endTime" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, content, image, url, priority, start_time, end_time,
create_time, update_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from union_share_message
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from union_share_message
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.unions.dal.model.UnionShareMessage" >
insert into union_share_message (content, image, url, priority, start_time, end_time,
create_time, update_time)
values (#{content,jdbcType=VARCHAR}, #{image,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{priority,jdbcType=INTEGER},
#{startTime,jdbcType=INTEGER}, #{endTime,jdbcType=INTEGER}, #{createTime,jdbcType=INTEGER},
#{updateTime,jdbcType=INTEGER}
)
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.unions.dal.model.UnionShareMessage" >
update union_share_message
<set >
<if test="content != null" >
content = #{content,jdbcType=VARCHAR},
</if>
<if test="image != null" >
image = #{image,jdbcType=VARCHAR},
</if>
<if test="url != null" >
url = #{url,jdbcType=VARCHAR},
</if>
<if test="priority != null" >
priority = #{priority,jdbcType=INTEGER},
</if>
<if test="startTime != null" >
start_time = #{startTime,jdbcType=INTEGER},
</if>
<if test="endTime != null" >
end_time = #{endTime,jdbcType=INTEGER},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=DECIMAL},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<sql id="Query_Message_Sql" >
<if test="startTime != null and endTime == null">
and start_time >= #{startTime}
</if>
<if test="startTime == null and endTime != null">
and end_time <= #{endTime}
</if>
<if test="startTime != null and endTime != null">
and start_time <= #{startTime} and end_time >= #{endTime}
</if>
<if test="isEffective != null and isEffective==true">
and start_time <= UNIX_TIMESTAMP() and end_time >=UNIX_TIMESTAMP()
</if>
</sql>
<select id="selectTotalByCondition" resultType="java.lang.Integer"
parameterType="com.yoho.service.model.union.request.UnionShareMessageReqBO">
select count(id)
from union_share_message
where 1=1
<include refid="Query_Message_Sql" />
</select>
<select id="selectByCondition" resultMap="BaseResultMap"
parameterType="com.yoho.service.model.union.request.UnionShareMessageReqBO">
select <include refid="Base_Column_List" />
from union_share_message
where 1=1
<include refid="Query_Message_Sql" />
order by priority desc, update_time desc
<if test="start!=null and size != null">
limit #{start},#{size}
</if>
</select>
</mapper>