Files
love-nav/src/main/resources/mybatis/AttachmentDao.xml

144 lines
5.0 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.AttachmentDao">
<resultMap id="BaseResultMap" type="com.lovenav.entity.Attachment">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="path" jdbcType="VARCHAR" property="path" />
<result column="suffix" jdbcType="VARCHAR" property="suffix" />
<result column="file_name" jdbcType="VARCHAR" property="fileName" />
<result column="size" jdbcType="DOUBLE" property="size" />
<result column="md5" jdbcType="VARCHAR" property="md5" />
<result column="width" jdbcType="DOUBLE" property="width" />
<result column="height" jdbcType="DOUBLE" property="height" />
<result column="storage" jdbcType="OTHER" property="storage" />
<result column="createtime" jdbcType="TIMESTAMP" property="createtime" />
</resultMap>
<sql id="Base_Column_List">
id, `path`, suffix, file_name, `size`, md5, width, height, `storage`, createtime
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ln_attachment
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from ln_attachment
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.lovenav.entity.Attachment" useGeneratedKeys="true">
insert into ln_attachment (`path`, suffix, file_name,
`size`, md5, width, height,
`storage`, createtime)
values (#{path,jdbcType=VARCHAR}, #{suffix,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR},
#{size,jdbcType=DOUBLE}, #{md5,jdbcType=VARCHAR}, #{width,jdbcType=DOUBLE}, #{height,jdbcType=DOUBLE},
#{storage,jdbcType=OTHER}, #{createtime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" keyProperty="id" parameterType="com.lovenav.entity.Attachment" useGeneratedKeys="true">
insert into ln_attachment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="path != null">
`path`,
</if>
<if test="suffix != null">
suffix,
</if>
<if test="fileName != null">
file_name,
</if>
<if test="size != null">
`size`,
</if>
<if test="md5 != null">
md5,
</if>
<if test="width != null">
width,
</if>
<if test="height != null">
height,
</if>
<if test="storage != null">
`storage`,
</if>
<if test="createtime != null">
createtime,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="path != null">
#{path,jdbcType=VARCHAR},
</if>
<if test="suffix != null">
#{suffix,jdbcType=VARCHAR},
</if>
<if test="fileName != null">
#{fileName,jdbcType=VARCHAR},
</if>
<if test="size != null">
#{size,jdbcType=DOUBLE},
</if>
<if test="md5 != null">
#{md5,jdbcType=VARCHAR},
</if>
<if test="width != null">
#{width,jdbcType=DOUBLE},
</if>
<if test="height != null">
#{height,jdbcType=DOUBLE},
</if>
<if test="storage != null">
#{storage,jdbcType=OTHER},
</if>
<if test="createtime != null">
#{createtime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.lovenav.entity.Attachment">
update ln_attachment
<set>
<if test="path != null">
`path` = #{path,jdbcType=VARCHAR},
</if>
<if test="suffix != null">
suffix = #{suffix,jdbcType=VARCHAR},
</if>
<if test="fileName != null">
file_name = #{fileName,jdbcType=VARCHAR},
</if>
<if test="size != null">
`size` = #{size,jdbcType=DOUBLE},
</if>
<if test="md5 != null">
md5 = #{md5,jdbcType=VARCHAR},
</if>
<if test="width != null">
width = #{width,jdbcType=DOUBLE},
</if>
<if test="height != null">
height = #{height,jdbcType=DOUBLE},
</if>
<if test="storage != null">
`storage` = #{storage,jdbcType=OTHER},
</if>
<if test="createtime != null">
createtime = #{createtime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.lovenav.entity.Attachment">
update ln_attachment
set `path` = #{path,jdbcType=VARCHAR},
suffix = #{suffix,jdbcType=VARCHAR},
file_name = #{fileName,jdbcType=VARCHAR},
`size` = #{size,jdbcType=DOUBLE},
md5 = #{md5,jdbcType=VARCHAR},
width = #{width,jdbcType=DOUBLE},
height = #{height,jdbcType=DOUBLE},
`storage` = #{storage,jdbcType=OTHER},
createtime = #{createtime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>