Files
wuhan-saga/server/target/classes/mapper/AboutMapper.xml

50 lines
2.5 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.AboutMapper">
<select id="selectList" resultType="com.wuhansaga.server.entity.About">
SELECT * FROM f_about WHERE del_flag = 0
<if test="sectionType != null and sectionType != ''">AND section_type = #{sectionType}</if>
ORDER BY sort_order ASC
</select>
<select id="selectPublished" resultType="com.wuhansaga.server.entity.About">
SELECT * FROM f_about WHERE del_flag = 0 AND is_published = 1
<if test="sectionType != null and sectionType != ''">AND section_type = #{sectionType}</if>
ORDER BY sort_order ASC
</select>
<select id="selectById" resultType="com.wuhansaga.server.entity.About">
SELECT * FROM f_about WHERE about_id = #{id} AND del_flag = 0
</select>
<insert id="insert" useGeneratedKeys="true" keyProperty="aboutId">
INSERT INTO f_about (company_info_id, section_type, title_zh, title_en, content_zh, content_en,
image_path, is_published, sort_order, create_by, remark)
VALUES (#{companyInfoId}, #{sectionType}, #{titleZh}, #{titleEn}, #{contentZh}, #{contentEn},
#{imagePath}, #{isPublished}, #{sortOrder}, #{createBy}, #{remark})
</insert>
<update id="update" parameterType="com.wuhansaga.server.entity.About">
UPDATE f_about
<set>
<if test="companyInfoId != null">company_info_id = #{companyInfoId},</if>
<if test="sectionType != null">section_type = #{sectionType},</if>
<if test="titleZh != null">title_zh = #{titleZh},</if>
<if test="titleEn != null">title_en = #{titleEn},</if>
<if test="contentZh != null">content_zh = #{contentZh},</if>
<if test="contentEn != null">content_en = #{contentEn},</if>
<if test="imagePath != null">image_path = #{imagePath},</if>
<if test="isPublished != null">is_published = #{isPublished},</if>
<if test="sortOrder != null">sort_order = #{sortOrder},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
</set>
WHERE about_id = #{aboutId} AND del_flag = 0
</update>
<update id="deleteById">
UPDATE f_about SET del_flag = 1 WHERE about_id = #{id}
</update>
</mapper>