alive-admin/alive-server/target/classes/mapper/system/NoticeMapper.xml

95 lines
4.3 KiB
XML
Raw Permalink Normal View History

2024-05-27 16:26:14 +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.ruoyi.system.mapper.NoticeMapper">
<resultMap type="com.ruoyi.system.domain.Notice" id="NoticeResult">
<result property="id" column="id" />
<result property="title" column="title" />
<result property="content" column="content" />
<result property="isTop" column="is_top" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectNoticeVo">
select id, title, content, is_top, create_time, create_by, update_time, update_by from notice
</sql>
<select id="selectNoticeList" parameterType="com.ruoyi.system.domain.Notice" resultMap="NoticeResult">
<include refid="selectNoticeVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="content != null and content != ''"> and content = #{content}</if>
<if test="isTop != null and isTop != ''"> and is_top = #{isTop}</if>
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> and create_time between #{params.beginTime} and #{params.endTime}</if>
</where>
order by id desc
</select>
<select id="findNotice" parameterType="com.ruoyi.system.domain.Notice" resultMap="NoticeResult">
<include refid="selectNoticeVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="content != null and content != ''"> and content = #{content}</if>
<if test="isTop != null and isTop != ''"> and is_top = #{isTop}</if>
</where>
limit 1
</select>
<select id="selectNoticeById" parameterType="Integer" resultMap="NoticeResult">
<include refid="selectNoticeVo"/>
where id = #{id}
</select>
<insert id="insertNotice" parameterType="com.ruoyi.system.domain.Notice">
insert into notice
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">id,</if>
<if test="title != null">title,</if>
<if test="content != null">content,</if>
<if test="isTop != null">is_top,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">#{id},</if>
<if test="title != null">#{title},</if>
<if test="content != null">#{content},</if>
<if test="isTop != null">#{isTop},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
</trim>
</insert>
<update id="updateNotice" parameterType="com.ruoyi.system.domain.Notice">
update notice
<trim prefix="SET" suffixOverrides=",">
<if test="title != null">title = #{title},</if>
<if test="content != null">content = #{content},</if>
<if test="isTop != null">is_top = #{isTop},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteNoticeByIds" parameterType="String">
delete from notice where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>