ContentGroupManagementMapper.xml
4.0 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.zhonglai.luhui.order.service.mapper.ContentGroupManagementMapper">
<resultMap type="ContentGroupManagement" id="ContentGroupManagementResult">
<result property="content" column="content" />
<result property="create_time" column="create_time" />
<result property="group_name" column="group_name" />
<result property="id" column="id" />
<result property="sort" column="sort" />
<result property="update_time" column="update_time" />
<result property="phone" column="phone" />
</resultMap>
<sql id="selectContentGroupManagementVo">
select `content`, `create_time`, `group_name`, `id`, `sort`,`update_time`,`phone` from content_group_management
</sql>
<select id="selectContentGroupManagementList" parameterType="ContentGroupManagement" resultMap="ContentGroupManagementResult">
<include refid="selectContentGroupManagementVo"/>
<where>
<if test="params.beginCreate_time != null and params.beginCreate_time != '' and params.endCreate_time != null and params.endCreate_time != ''"> and create_time between #{params.beginCreate_time} and #{params.endCreate_time}</if>
<if test="group_name != null and group_name != ''"> and group_name like concat('%', #{group_name}, '%')</if>
<if test="id != null "> and id = #{id}</if>
<if test="phone != null and phone != ''">
AND phone like concat('%', #{phone}, '%')
</if>
</where>
order by `sort` desc,create_time desc
</select>
<select id="selectContentGroupManagementById" parameterType="Integer" resultMap="ContentGroupManagementResult">
<include refid="selectContentGroupManagementVo"/>
where id = #{id}
</select>
<insert id="insertContentGtroupManagement" parameterType="ContentGroupManagement" useGeneratedKeys="true" keyProperty="id">
insert into content_group_management
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="content != null and content != ''">content,</if>
<if test="create_time != null">create_time,</if>
<if test="group_name != null and group_name != ''">group_name,</if>
<if test="sort != null">sort,</if>
<if test="phone != null">phone,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="content != null and content != ''">#{content},</if>
<if test="create_time != null">#{create_time},</if>
<if test="group_name != null and group_name != ''">#{group_name},</if>
<if test="sort != null">#{sort},</if>
<if test="phone != null">#{phone},</if>
</trim>
</insert>
<update id="updateContentGroupManagement" parameterType="ContentGroupManagement">
update content_group_management
<trim prefix="SET" suffixOverrides=",">
<if test="content != null and content != ''">content = #{content},</if>
<if test="create_time != null">create_time = #{create_time},</if>
<if test="group_name != null and group_name != ''">group_name = #{group_name},</if>
<if test="sort != null">sort = #{sort},</if>
<if test="update_time != null">update_time = #{update_time},</if>
<if test="phone != null">phone = #{phone},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteContentGroupManagementById" parameterType="Integer">
delete from content_group_management where id = #{id}
</delete>
<delete id="deleteContentGroupManagementByIds" parameterType="String">
delete from content_group_management where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>