248 lines
8.8 KiB
XML
248 lines
8.8 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.ho.business.mapper.PictureMapper">
|
||
|
|
|
||
|
|
<resultMap id="BaseResultMap" type="com.ho.business.entity.Picture">
|
||
|
|
<id property="id" column="id" jdbcType="INTEGER"/>
|
||
|
|
<result property="srcId" column="src_id" jdbcType="INTEGER"/>
|
||
|
|
<result property="url" column="url" jdbcType="VARCHAR"/>
|
||
|
|
<result property="type" column="type" jdbcType="INTEGER"/>
|
||
|
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<sql id="Base_Column_List">
|
||
|
|
id
|
||
|
|
,src_id,file_name,file_path,url,
|
||
|
|
type,create_time,version,owner_user,owner_org,update_log,bucket
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||
|
|
select
|
||
|
|
<include refid="Base_Column_List"/>
|
||
|
|
from picture
|
||
|
|
where id = #{id,jdbcType=INTEGER}
|
||
|
|
</select>
|
||
|
|
<select id="selectBySrcIdAndType" resultType="com.ho.business.entity.Picture">
|
||
|
|
select
|
||
|
|
<include refid="Base_Column_List"/>
|
||
|
|
from picture
|
||
|
|
<where>
|
||
|
|
<if test=" srcId != null ">
|
||
|
|
and src_id = #{srcId}
|
||
|
|
</if>
|
||
|
|
<if test=" type != null ">
|
||
|
|
and `type` = #{type}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectByParam" resultType="com.ho.business.entity.Picture">
|
||
|
|
select
|
||
|
|
<include refid="Base_Column_List"/>
|
||
|
|
from picture
|
||
|
|
<where>
|
||
|
|
<if test=" stationId != null ">
|
||
|
|
and src_id = #{stationId}
|
||
|
|
</if>
|
||
|
|
<if test=" beginTime != null ">
|
||
|
|
and create_time >= #{beginTime}
|
||
|
|
</if>
|
||
|
|
<if test=" endTime != null ">
|
||
|
|
and create_time <= #{endTime}
|
||
|
|
</if>
|
||
|
|
<if test=" type != null ">
|
||
|
|
and `type` = #{type}
|
||
|
|
</if>
|
||
|
|
<if test=" fileName != null">
|
||
|
|
and file_name like concat('%',#{fileName},'%')
|
||
|
|
</if>
|
||
|
|
<if test="url != null">
|
||
|
|
and url = #{url}
|
||
|
|
</if>
|
||
|
|
<if test="ownerUser != null">
|
||
|
|
and owner_user = #{ownerUser}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
order by create_time desc
|
||
|
|
</select>
|
||
|
|
<select id="selectByParams" resultType="com.ho.business.entity.Picture">
|
||
|
|
select
|
||
|
|
<include refid="Base_Column_List"/>
|
||
|
|
from picture
|
||
|
|
<where>
|
||
|
|
<if test=" stationId != null ">
|
||
|
|
and src_id = #{stationId}
|
||
|
|
</if>
|
||
|
|
<if test=" beginTime != null ">
|
||
|
|
and create_time >= #{beginTime}
|
||
|
|
</if>
|
||
|
|
<if test=" endTime != null ">
|
||
|
|
and create_time <= #{endTime}
|
||
|
|
</if>
|
||
|
|
<if test=" type != null ">
|
||
|
|
and `type` = #{type}
|
||
|
|
</if>
|
||
|
|
<if test=" fileName != null">
|
||
|
|
and file_name like concat('%',#{fileName},'%')
|
||
|
|
</if>
|
||
|
|
<if test="url != null">
|
||
|
|
and url = #{url}
|
||
|
|
</if>
|
||
|
|
<if test="ownerUser != null">
|
||
|
|
and owner_user = " "
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
order by create_time desc
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectLastOne" resultType="com.ho.business.entity.Picture">
|
||
|
|
select
|
||
|
|
<include refid="Base_Column_List"/>
|
||
|
|
from picture
|
||
|
|
<where>
|
||
|
|
<if test=" type != null ">
|
||
|
|
and `type` = #{type}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
order by create_time DESC limit 1
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectByStationAndType" resultType="com.ho.business.entity.Picture">
|
||
|
|
select
|
||
|
|
<include refid="Base_Column_List"/>
|
||
|
|
from picture
|
||
|
|
<where>
|
||
|
|
src_id = #{id}
|
||
|
|
<if test=" type != null ">
|
||
|
|
and `type` = #{type}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectAll" resultType="com.ho.business.entity.Picture">
|
||
|
|
select
|
||
|
|
<include refid="Base_Column_List"/>
|
||
|
|
from picture
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||
|
|
delete
|
||
|
|
from picture
|
||
|
|
where id = #{id,jdbcType=INTEGER}
|
||
|
|
</delete>
|
||
|
|
<delete id="deletedBySrcIdsAndType">
|
||
|
|
delete from picture
|
||
|
|
<where>
|
||
|
|
<if test="srcIds != null and srcIds.size() != 0">
|
||
|
|
and src_id in
|
||
|
|
<foreach collection="srcIds" open="(" close=")" separator="," item="item">
|
||
|
|
#{item}
|
||
|
|
</foreach>
|
||
|
|
</if>
|
||
|
|
<if test="type != null">
|
||
|
|
and type = #{type}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
</delete>
|
||
|
|
<delete id="deletedByIds">
|
||
|
|
delete from picture
|
||
|
|
<where>
|
||
|
|
<if test="picturesIds != null and picturesIds.size() != 0">
|
||
|
|
and id in
|
||
|
|
<foreach collection="picturesIds" open="(" close=")" separator="," item="item">
|
||
|
|
#{item}
|
||
|
|
</foreach>
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
|
||
|
|
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.ho.business.entity.Picture"
|
||
|
|
useGeneratedKeys="true">
|
||
|
|
insert into picture
|
||
|
|
( id, src_id, file_name, url
|
||
|
|
, type, create_time)
|
||
|
|
values ( #{id,jdbcType=INTEGER}, #{srcId,jdbcType=INTEGER}, #{fileName,jdbcType=VARCHAR}
|
||
|
|
, #{url,jdbcType=VARCHAR}
|
||
|
|
, #{type,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP})
|
||
|
|
</insert>
|
||
|
|
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.ho.business.entity.Picture"
|
||
|
|
useGeneratedKeys="true">
|
||
|
|
insert into picture
|
||
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="id != null">id,</if>
|
||
|
|
<if test="srcId != null">src_id,</if>
|
||
|
|
<if test="fileName != null">file_name,</if>
|
||
|
|
<if test="filePath != null">file_path,</if>
|
||
|
|
<if test="url != null">url,</if>
|
||
|
|
<if test="type != null">type,</if>
|
||
|
|
<if test="createTime != null">create_time,</if>
|
||
|
|
<if test="version != null">version,</if>
|
||
|
|
<if test="ownerUser != null">owner_user,</if>
|
||
|
|
<if test="ownerOrg != null">owner_org,</if>
|
||
|
|
<if test="updateLog != null">update_log,</if>
|
||
|
|
<if test="bucket != null">bucket,</if>
|
||
|
|
</trim>
|
||
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="id != null">#{id,jdbcType=INTEGER},</if>
|
||
|
|
<if test="srcId != null">#{srcId,jdbcType=INTEGER},</if>
|
||
|
|
<if test="fileName != null">#{fileName,jdbcType=VARCHAR},</if>
|
||
|
|
<if test="filePath != null">#{filePath,jdbcType=VARCHAR},</if>
|
||
|
|
<if test="url != null">#{url,jdbcType=VARCHAR},</if>
|
||
|
|
<if test="type != null">#{type,jdbcType=INTEGER},</if>
|
||
|
|
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
||
|
|
<if test="version != null">#{version},</if>
|
||
|
|
<if test="ownerUser != null">#{ownerUser},</if>
|
||
|
|
<if test="ownerOrg != null">#{ownerOrg},</if>
|
||
|
|
<if test="updateLog != null">#{updateLog},</if>
|
||
|
|
<if test="bucket != null">#{bucket},</if>
|
||
|
|
</trim>
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.ho.business.entity.Picture">
|
||
|
|
update picture
|
||
|
|
<set>
|
||
|
|
<if test="srcId != null">
|
||
|
|
src_id = #{srcId,jdbcType=INTEGER},
|
||
|
|
</if>
|
||
|
|
<if test="fileName != null">
|
||
|
|
file_name = #{fileName,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
<if test="url != null">
|
||
|
|
url = #{url,jdbcType=VARCHAR},
|
||
|
|
</if>
|
||
|
|
<if test="type != null">
|
||
|
|
type = #{type,jdbcType=INTEGER},
|
||
|
|
</if>
|
||
|
|
<if test="createTime != null">
|
||
|
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||
|
|
</if>
|
||
|
|
</set>
|
||
|
|
where id = #{id,jdbcType=INTEGER}
|
||
|
|
</update>
|
||
|
|
<update id="updateByPrimaryKey" parameterType="com.ho.business.entity.Picture">
|
||
|
|
update picture
|
||
|
|
set src_id = #{srcId,jdbcType=INTEGER},
|
||
|
|
file_name = #{fileName,jdbcType=VARCHAR},
|
||
|
|
url = #{url,jdbcType=VARCHAR},
|
||
|
|
type = #{type,jdbcType=INTEGER},
|
||
|
|
create_time = #{createTime,jdbcType=TIMESTAMP}
|
||
|
|
where id = #{id,jdbcType=INTEGER}
|
||
|
|
</update>
|
||
|
|
<update id="setUpSrcIdNUll">
|
||
|
|
update picture
|
||
|
|
set src_id = null
|
||
|
|
<where>
|
||
|
|
<if test="pictureIds != null and pictureIds.size() != 0">
|
||
|
|
and id in
|
||
|
|
<foreach collection="pictureIds" open="(" close=")" separator="," item="item">
|
||
|
|
#{item}
|
||
|
|
</foreach>
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
</update>
|
||
|
|
</mapper>
|