Files
love-nav/src/main/resources/mybatis/NoticeDao.xml
2023-12-20 16:20:49 +08:00

98 lines
3.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.lovenav.dao.NoticeDao">
<resultMap id="BaseResultMap" type="com.lovenav.entity.Notice">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="content" jdbcType="VARCHAR" property="content" />
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="notice_status" jdbcType="TINYINT" property="noticeStatus" />
<result column="createtime" jdbcType="TIMESTAMP" property="createtime" />
</resultMap>
<sql id="Base_Column_List">
id, title, content, url, notice_status, createtime
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ln_notice
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from ln_notice
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.lovenav.entity.Notice" useGeneratedKeys="true">
insert into ln_notice (title, content, url,
notice_status, createtime)
values (#{title,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR},
#{noticeStatus,jdbcType=TINYINT}, #{createtime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.lovenav.entity.Notice" useGeneratedKeys="true">
insert into ln_notice
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="title != null">
title,
</if>
<if test="content != null">
content,
</if>
<if test="url != null">
url,
</if>
<if test="noticeStatus != null">
notice_status,
</if>
<if test="createtime != null">
createtime,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
<if test="content != null">
#{content,jdbcType=VARCHAR},
</if>
<if test="url != null">
#{url,jdbcType=VARCHAR},
</if>
<if test="noticeStatus != null">
#{noticeStatus,jdbcType=TINYINT},
</if>
<if test="createtime != null">
#{createtime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.lovenav.entity.Notice">
update ln_notice
<set>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="content != null">
content = #{content,jdbcType=VARCHAR},
</if>
<if test="url != null">
url = #{url,jdbcType=VARCHAR},
</if>
<if test="noticeStatus != null">
notice_status = #{noticeStatus,jdbcType=TINYINT},
</if>
<if test="createtime != null">
createtime = #{createtime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.lovenav.entity.Notice">
update ln_notice
set title = #{title,jdbcType=VARCHAR},
content = #{content,jdbcType=VARCHAR},
url = #{url,jdbcType=VARCHAR},
notice_status = #{noticeStatus,jdbcType=TINYINT},
createtime = #{createtime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>