chengf
2025-08-14 be3ee34512e5c5b4a7d91484c7256c5fd5013675
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<?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="smallProgramAdvertServiceDaoImpl">
 
    <sql id="Base_Column_List">
        id,
        `position`,
        adverts_name as 'advertsName',
        pic_url as 'picUrl',
        url,
        sort,
        supplier_name as 'supplierName',
        `desc`,
        online_time as 'onlineTime',
        offline_time as 'offlineTime',
        `status`,
        create_time as 'createTime',
        update_time as 'updateTime',
        create_user_id as 'createUserId',
        update_user_id as 'updateUserId'
    </sql>
 
    <select id="selectSmallProgramAdvertInfo" parameterType="Map" resultType="Map">
        select
        <include refid="Base_Column_List" />
        from business_small_program_advertisement
        where id = #{id}
    </select>
 
    <insert id="saveSmallProgramAdvertInfo" parameterType="Map">
        insert into business_small_program_advertisement
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="position != null">
                `position`,
            </if>
            <if test="advertsName != null">
                adverts_name,
            </if>
            <if test="picUrl != null">
                pic_url,
            </if>
            <if test="url != null">
                url,
            </if>
            <if test="sort != null">
                sort,
            </if>
            <if test="supplierName != null">
                supplier_name,
            </if>
            <if test="desc != null">
                `desc`,
            </if>
            <if test="onlineTime != null">
                online_time,
            </if>
            <if test="offlineTime != null">
                offline_time,
            </if>
            <if test="status != null">
                `status`,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
            <if test="updateTime != null">
                update_time,
            </if>
            <if test="createUserId != null">
                create_user_id,
            </if>
            <if test="updateUserId != null">
                update_user_id,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=VARCHAR},
            </if>
            <if test="position != null">
                #{position,jdbcType=VARCHAR},
            </if>
            <if test="advertsName != null">
                #{advertsName,jdbcType=VARCHAR},
            </if>
            <if test="picUrl != null">
                #{picUrl,jdbcType=VARCHAR},
            </if>
            <if test="url != null">
                #{url,jdbcType=VARCHAR},
            </if>
            <if test="sort != null">
                #{sort,jdbcType=INTEGER},
            </if>
            <if test="supplierName != null">
                #{supplierName,jdbcType=VARCHAR},
            </if>
            <if test="desc != null">
                #{desc,jdbcType=VARCHAR},
            </if>
            <if test="onlineTime != null">
                #{onlineTime,jdbcType=TIMESTAMP},
            </if>
            <if test="offlineTime != null">
                #{offlineTime,jdbcType=TIMESTAMP},
            </if>
            <if test="status != null">
                #{status,jdbcType=INTEGER},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateTime != null">
                #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="createUserId != null">
                #{createUserId,jdbcType=VARCHAR},
            </if>
            <if test="updateUserId != null">
                #{updateUserId,jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>
 
    <update id="updateSmallProgramAdvertInfo" parameterType="Map">
        update business_small_program_advertisement
        <set>
            <if test="position != null">
                `position` = #{position,jdbcType=VARCHAR},
            </if>
            <if test="advertsName != null">
                adverts_name = #{advertsName,jdbcType=VARCHAR},
            </if>
            <if test="picUrl != null">
                pic_url = #{picUrl,jdbcType=VARCHAR},
            </if>
            <if test="url != null">
                url = #{url,jdbcType=VARCHAR},
            </if>
            <if test="sort != null">
                sort = #{sort,jdbcType=INTEGER},
            </if>
            <if test="supplierName != null">
                supplier_name = #{supplierName,jdbcType=VARCHAR},
            </if>
            <if test="desc != null">
                `desc` = #{desc,jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                `status` = #{status,jdbcType=INTEGER},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="createUserId != null">
                create_user_id = #{createUserId,jdbcType=VARCHAR},
            </if>
            <if test="updateUserId != null">
                update_user_id = #{updateUserId,jdbcType=VARCHAR},
            </if>
            online_time = #{onlineTime,jdbcType=TIMESTAMP},
            offline_time = #{offlineTime,jdbcType=TIMESTAMP}
        </set>
        where id = #{id}
    </update>
 
    <select id="querySmallProgramAdvertsCount" parameterType="Map" resultType="Map">
        select count(1) count
        from business_small_program_advertisement
        where 1 = 1
        <if test="status != null">
            and `status` = #{status}
        </if>
        <if test="advertsId !=null and advertsId != ''">
            and  id like concat('%', #{advertsId},'%')
        </if>
        <if test="advertsName !=null and advertsName != ''">
            and  adverts_name like concat('%', #{advertsName},'%')
        </if>
        <if test="position !=null and position != ''">
            and  `position` like concat('%', #{position},'%')
        </if>
    </select>
 
    <select id="querySmallProgramAdvertInfoList" parameterType="Map" resultType="Map">
        select
        <include refid="Base_Column_List" />
        from business_small_program_advertisement
        where 1 = 1
        <if test="status != null">
            and `status` = #{status}
        </if>
        <if test="advertsId !=null and advertsId != ''">
            and  id like concat('%', #{advertsId},'%')
        </if>
        <if test="advertsName !=null and advertsName != ''">
            and  adverts_name like concat('%', #{advertsName},'%')
        </if>
        <if test="position !=null and position != ''">
            and  `position` like concat('%', #{position},'%')
        </if>
        order by `status` asc
        <if test="sort == 'asc'">
            ,update_time asc
        </if>
        <if test="sort == 'desc'">
            ,update_time desc
        </if>
        <if test="page != -1 and page != null ">
            limit #{page}, #{row}
        </if>
    </select>
 
</mapper>