2026-05-05 02:52:40 +08:00
|
|
|
<?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.NewsCategoryMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap id="newsCategoryResult" type="com.wuhansaga.server.entity.NewsCategory" autoMapping="true">
|
|
|
|
|
<id property="newsCategoryId" column="category_id"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<select id="selectAll" resultMap="newsCategoryResult">
|
2026-05-05 15:09:49 +08:00
|
|
|
SELECT * FROM f_news_category WHERE del_flag = 0
|
|
|
|
|
<if test="siteCode != null and siteCode != ''">AND site_code = #{siteCode}</if>
|
|
|
|
|
ORDER BY sort_order ASC
|
2026-05-05 02:52:40 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectPublished" resultMap="newsCategoryResult">
|
2026-05-05 15:09:49 +08:00
|
|
|
SELECT * FROM f_news_category WHERE del_flag = 0 AND is_published = 1
|
|
|
|
|
<if test="siteCode != null and siteCode != ''">AND site_code = #{siteCode}</if>
|
|
|
|
|
ORDER BY sort_order ASC
|
2026-05-05 02:52:40 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectById" resultMap="newsCategoryResult">
|
|
|
|
|
SELECT * FROM f_news_category WHERE category_id = #{id} AND del_flag = 0
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insert" useGeneratedKeys="true" keyProperty="newsCategoryId" keyColumn="category_id">
|
2026-05-05 15:09:49 +08:00
|
|
|
INSERT INTO f_news_category (site_code, name_zh, name_en, sort_order, is_published, create_by, remark)
|
|
|
|
|
VALUES (#{siteCode}, #{nameZh}, #{nameEn}, #{sortOrder}, #{isPublished}, #{createBy}, #{remark})
|
2026-05-05 02:52:40 +08:00
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="update" parameterType="com.wuhansaga.server.entity.NewsCategory">
|
|
|
|
|
UPDATE f_news_category
|
|
|
|
|
<set>
|
2026-05-05 15:09:49 +08:00
|
|
|
<if test="siteCode != null">site_code = #{siteCode},</if>
|
2026-05-05 02:52:40 +08:00
|
|
|
<if test="nameZh != null">name_zh = #{nameZh},</if>
|
|
|
|
|
<if test="nameEn != null">name_en = #{nameEn},</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>
|
|
|
|
|
</set>
|
|
|
|
|
WHERE category_id = #{newsCategoryId} AND del_flag = 0
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<update id="deleteById">
|
|
|
|
|
UPDATE f_news_category SET del_flag = 1 WHERE category_id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
</mapper>
|