<?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,
|
oss_url as 'ossUrl',
|
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="ossUrl != null">
|
oss_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="ossUrl != null">
|
#{ossUrl,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="ossUrl != null">
|
oss_url = #{ossUrl,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>
|