lanan-system/dl-module-jx/src/main/resources/mapper/jx/DriveSchoolNewsMapper.xml
2024-08-28 00:54:30 +08:00

102 lines
5.1 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="cn.iocoder.yudao.module.jx.mapper.DriveSchoolNewsMapper">
<resultMap type="cn.iocoder.yudao.module.jx.domain.DriveSchoolNews" id="DriveSchoolNewsResult">
<result property="id" column="id" />
<result property="deptId" column="dept_id" />
<result property="cover" column="cover" />
<result property="title" column="title" />
<result property="content" column="content" />
<result property="creator" column="creator" />
<result property="createTime" column="create_time" />
<result property="updater" column="updater" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDriveSchoolNewsVo">
select id, dept_id, cover, title, content, creator, create_time, updater, update_time from drive_school_news
</sql>
<select id="selectDriveSchoolNewsList" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolNews" resultMap="DriveSchoolNewsResult">
<include refid="selectDriveSchoolNewsVo"/>
<where>
deleted = 0
<if test="entity.deptId != null "> and dept_id = #{entity.deptId}</if>
<if test="entity.cover != null and entity.cover != ''"> and cover = #{entity.cover}</if>
<if test="entity.title != null and entity.title != ''"> and title = #{entity.title}</if>
<if test="entity.content != null and entity.content != ''"> and content = #{entity.content}</if>
</where>
order by create_time desc
</select>
<select id="selectDriveSchoolNewsListAll" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolNews" resultMap="DriveSchoolNewsResult">
<include refid="selectDriveSchoolNewsVo"/>
<where>
deleted = 0
<if test="entity.deptId != null "> and dept_id = #{entity.deptId}</if>
<if test="entity.cover != null and entity.cover != ''"> and cover = #{entity.cover}</if>
<if test="entity.title != null and entity.title != ''"> and title = #{entity.title}</if>
<if test="entity.content != null and entity.content != ''"> and content = #{entity.content}</if>
</where>
order by create_time desc
</select>
<select id="selectDriveSchoolNewsById" parameterType="Long" resultMap="DriveSchoolNewsResult">
<include refid="selectDriveSchoolNewsVo"/>
where id = #{id}
</select>
<insert id="insertDriveSchoolNews" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolNews" useGeneratedKeys="true" keyProperty="id">
insert into drive_school_news
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deptId != null">dept_id,</if>
<if test="cover != null and cover != ''">cover,</if>
<if test="title != null and title != ''">title,</if>
<if test="content != null and content != ''">content,</if>
<if test="creator != null">creator,</if>
<if test="createTime != null">create_time,</if>
<if test="updater != null">updater,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deptId != null">#{deptId},</if>
<if test="cover != null and cover != ''">#{cover},</if>
<if test="title != null and title != ''">#{title},</if>
<if test="content != null and content != ''">#{content},</if>
<if test="creator != null">#{creator},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updater != null">#{updater},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateDriveSchoolNews" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolNews">
update drive_school_news
<trim prefix="SET" suffixOverrides=",">
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="cover != null and cover != ''">cover = #{cover},</if>
<if test="title != null and title != ''">title = #{title},</if>
<if test="content != null and content != ''">content = #{content},</if>
<if test="creator != null">creator = #{creator},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updater != null">updater = #{updater},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDriveSchoolNewsById" parameterType="Long">
delete from drive_school_news where id = #{id}
</delete>
<delete id="deleteDriveSchoolNewsByIds" parameterType="String">
delete from drive_school_news where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>