49 lines
2.3 KiB
XML
49 lines
2.3 KiB
XML
<?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.wuhansaga.server.mapper.BannerMapper">
|
|
|
|
<select id="selectList" resultType="com.wuhansaga.server.entity.Banner">
|
|
SELECT * FROM f_banner WHERE del_flag = 0
|
|
<if test="isPublished != null">AND is_published = #{isPublished}</if>
|
|
ORDER BY sort_order ASC
|
|
</select>
|
|
|
|
<select id="selectPublished" resultType="com.wuhansaga.server.entity.Banner">
|
|
SELECT * FROM f_banner WHERE del_flag = 0 AND is_published = 1
|
|
ORDER BY sort_order ASC
|
|
</select>
|
|
|
|
<select id="selectById" resultType="com.wuhansaga.server.entity.Banner">
|
|
SELECT * FROM f_banner WHERE banner_id = #{id} AND del_flag = 0
|
|
</select>
|
|
|
|
<insert id="insert" useGeneratedKeys="true" keyProperty="bannerId">
|
|
INSERT INTO f_banner (company_info_id, image_path, title_zh, title_en, subtitle_zh, subtitle_en,
|
|
sort_order, is_published, create_by, remark)
|
|
VALUES (#{companyInfoId}, #{imagePath}, #{titleZh}, #{titleEn}, #{subtitleZh}, #{subtitleEn},
|
|
#{sortOrder}, #{isPublished}, #{createBy}, #{remark})
|
|
</insert>
|
|
|
|
<update id="update" parameterType="com.wuhansaga.server.entity.Banner">
|
|
UPDATE f_banner
|
|
<set>
|
|
<if test="companyInfoId != null">company_info_id = #{companyInfoId},</if>
|
|
<if test="imagePath != null">image_path = #{imagePath},</if>
|
|
<if test="titleZh != null">title_zh = #{titleZh},</if>
|
|
<if test="titleEn != null">title_en = #{titleEn},</if>
|
|
<if test="subtitleZh != null">subtitle_zh = #{subtitleZh},</if>
|
|
<if test="subtitleEn != null">subtitle_en = #{subtitleEn},</if>
|
|
<if test="sortOrder != null">sort_order = #{sortOrder},</if>
|
|
<if test="isPublished != null">is_published = #{isPublished},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
update_time = CURRENT_TIMESTAMP
|
|
</set>
|
|
WHERE banner_id = #{bannerId} AND del_flag = 0
|
|
</update>
|
|
|
|
<update id="deleteById">
|
|
UPDATE f_banner SET del_flag = 1 WHERE banner_id = #{id}
|
|
</update>
|
|
</mapper>
|