Files
love-nav/src/main/resources/mybatis/BannersDao.xml
2023-12-23 15:34:05 +08:00

107 lines
3.7 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.BannersDao">
<resultMap id="BaseResultMap" type="com.lovenav.entity.Banners">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="img_url" jdbcType="VARCHAR" property="imgUrl" />
<result column="weigh" jdbcType="INTEGER" property="weigh" />
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="banner_status" jdbcType="TINYINT" property="bannerStatus" />
<result column="createtime" jdbcType="TIMESTAMP" property="createtime" />
</resultMap>
<sql id="Base_Column_List">
id, img_url, weigh, url, banner_status, createtime
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ln_banners
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from ln_banners
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.lovenav.entity.Banners" useGeneratedKeys="true">
insert into ln_banners (img_url, weigh, url,
banner_status, createtime)
values (#{imgUrl,jdbcType=VARCHAR}, #{weigh,jdbcType=INTEGER}, #{url,jdbcType=VARCHAR},
#{bannerStatus,jdbcType=TINYINT}, #{createtime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.lovenav.entity.Banners" useGeneratedKeys="true">
insert into ln_banners
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="imgUrl != null">
img_url,
</if>
<if test="weigh != null">
weigh,
</if>
<if test="url != null">
url,
</if>
<if test="bannerStatus != null">
banner_status,
</if>
<if test="createtime != null">
createtime,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="imgUrl != null">
#{imgUrl,jdbcType=VARCHAR},
</if>
<if test="weigh != null">
#{weigh,jdbcType=INTEGER},
</if>
<if test="url != null">
#{url,jdbcType=VARCHAR},
</if>
<if test="bannerStatus != null">
#{bannerStatus,jdbcType=TINYINT},
</if>
<if test="createtime != null">
#{createtime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.lovenav.entity.Banners">
update ln_banners
<set>
<if test="imgUrl != null">
img_url = #{imgUrl,jdbcType=VARCHAR},
</if>
<if test="weigh != null">
weigh = #{weigh,jdbcType=INTEGER},
</if>
<if test="url != null">
url = #{url,jdbcType=VARCHAR},
</if>
<if test="bannerStatus != null">
banner_status = #{bannerStatus,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.Banners">
update ln_banners
set img_url = #{imgUrl,jdbcType=VARCHAR},
weigh = #{weigh,jdbcType=INTEGER},
url = #{url,jdbcType=VARCHAR},
banner_status = #{bannerStatus,jdbcType=TINYINT},
createtime = #{createtime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectAllBanners" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
*
from ln_banners
where banner_status = 0;
</select>
</mapper>