hz/cloud-platform/cctp-attachment/src/main/resources/mybatis/base/Attachment.Mapper.xml

400 lines
12 KiB
XML
Raw Normal View History

2024-07-04 10:58:03 +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">
<!-- Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved. -->
<!-- Mybatis数据库持久层底层映射文件附件 -->
<!-- version: 1.0 -->
<!-- author: maven-cctp-plugin -->
<!-- date: 2022-03-08 10:14:34 -->
<mapper namespace="net.northking.cctp.attachment.db.dao.AttachmentDao">
<resultMap id="BaseResultMap" type="net.northking.cctp.attachment.db.entity.Attachment">
<!-- 主键 -->
<id column="id" jdbcType="VARCHAR" property="id"/>
<!-- 文件名称 -->
<result column="file_name" jdbcType="VARCHAR" property="fileName"/>
<!-- 文件类型 -->
<result column="content_type" jdbcType="VARCHAR" property="contentType"/>
<!-- 文件长度 -->
<result column="length" jdbcType="BIGINT" property="length"/>
<!-- 关联对象-->
<result column="obj_id" jdbcType="VARCHAR" property="objId"/>
<!-- 业务编码-->
<result column="business_code" jdbcType="VARCHAR" property="businessCode"/>
<!-- 过期时间-->
<result column="over_time" jdbcType="TIMESTAMP" property="overTime"/>
<!-- 创建人 -->
<result column="created_by" jdbcType="VARCHAR" property="createdBy"/>
<!-- 创建时间 -->
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
<!-- 是否删除 -->
<result column="is_deleted" jdbcType="BIT" property="deleted"/>
<!-- 状态 -->
<result column="status" jdbcType="INTEGER" property="status"/>
<!-- 租户 -->
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<!-- 更新文件id -->
<result column="new_file" jdbcType="VARCHAR" property="newFile"/>
</resultMap>
<sql id="Base_Column_List">
id
,file_name
,content_type
,length
,obj_id
,business_code
,over_time
,created_by
,created_time
,is_deleted
,status
,tenant_id
,new_file
</sql>
<sql id="Table_Name">
attachment${tableSuffix}
</sql>
<select id="findByPrimaryKey" parameterType="String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
<include refid="Table_Name"/>
where id = #{id,jdbcType=VARCHAR}
</select>
<select id="findByPrimaryKeys" parameterType="java.util.List" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
<include refid="Table_Name"/>
where id in
<foreach collection="list" item="idItem" open="(" separator="," close=")">
#{idItem, jdbcType=VARCHAR}
</foreach>
</select>
<delete id="deleteByPrimaryKey" parameterType="String">
delete from
<include refid="Table_Name"/>
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByPrimaryKeys" parameterType="String">
delete from
<include refid="Table_Name"/>
where id in
<foreach collection="list" item="idItem" open="(" separator="," close=")">
#{idItem, jdbcType=VARCHAR}
</foreach>
</delete>
<delete id="deleteByExample" parameterType="net.northking.cctp.attachment.db.entity.Attachment">
delete from
<include refid="Table_Name"/>
<trim prefix="WHERE" prefixOverrides="AND" >
<choose>
<when test="id != null">
id = #{id,jdbcType=VARCHAR}
</when>
</choose>
<if test="id != null">
AND id=#{id,jdbcType=VARCHAR}
</if>
<if test="fileName != null">
AND file_name=#{fileName,jdbcType=VARCHAR}
</if>
<if test="contentType != null">
AND content_type=#{contentType,jdbcType=VARCHAR}
</if>
<if test="length != null">
AND length=#{length,jdbcType=BIGINT}
</if>
<if test="objId != null">
AND obj_id=#{objId,jdbcType=VARCHAR}
</if>
<if test="businessCode != null">
AND business_code=#{businessCode,jdbcType=VARCHAR}
</if>
<if test="overTime != null">
AND over_time=#{overTime,jdbcType=TIMESTAMP}
</if>
<if test="createdBy != null">
AND created_by=#{createdBy,jdbcType=VARCHAR}
</if>
<if test="createdTime != null">
AND created_time=#{createdTime,jdbcType=TIMESTAMP}
</if>
<if test="deleted != null">
AND is_deleted=#{deleted,jdbcType=BIT}
</if>
<if test="status != null">
AND status=#{status,jdbcType=INTEGER}
</if>
<if test="tenantId != null">
AND tenant_id=#{tenantId,jdbcType=VARCHAR}
</if>
</trim>
</delete>
<insert id="insert" parameterType="net.northking.cctp.attachment.db.entity.Attachment">
insert into
<include refid="Table_Name"/>
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="fileName != null">
file_name,
</if>
<if test="contentType != null">
content_type,
</if>
<if test="length != null">
length,
</if>
<if test="objId != null">
obj_id,
</if>
<if test="businessCode != null">
business_code,
</if>
<if test="overTime != null">
over_time,
</if>
<if test="createdBy != null">
created_by,
</if>
<if test="createdTime != null">
created_time,
</if>
<if test="deleted != null">
is_deleted,
</if>
<if test="status != null">
status,
</if>
<if test="tenantId != null">
tenant_id,
</if>
<if test="newFile != null">
new_file,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id, jdbcType=VARCHAR},
</if>
<if test="fileName != null">
#{fileName, jdbcType=VARCHAR},
</if>
<if test="contentType != null">
#{contentType, jdbcType=VARCHAR},
</if>
<if test="length != null">
#{length, jdbcType=BIGINT},
</if>
<if test="objId != null">
#{objId,jdbcType=VARCHAR},
</if>
<if test="businessCode != null">
#{businessCode,jdbcType=VARCHAR},
</if>
<if test="overTime != null">
#{overTime,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy, jdbcType=VARCHAR},
</if>
<if test="createdTime != null">
#{createdTime, jdbcType=TIMESTAMP},
</if>
<if test="deleted != null">
#{deleted, jdbcType=BIT},
</if>
<if test="status != null">
#{status, jdbcType=INTEGER},
</if>
<if test="tenantId != null">
#{tenantId, jdbcType=VARCHAR},
</if>
<if test="newFile != null">
#{newFile, jdbcType=VARCHAR},
</if>
</trim>
</insert>
<insert id="insertByBatch" parameterType="java.util.List">
insert into
<include refid="Table_Name"/>
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
file_name,
content_type,
length,
obj_id,
business_code,
over_time,
created_by,
created_time,
is_deleted,
status,
tenant_id,
new_file,
</trim>
values
<foreach collection="list" item="item" index="index" separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
#{item.id, jdbcType=VARCHAR},
#{item.fileName, jdbcType=VARCHAR},
#{item.contentType, jdbcType=VARCHAR},
#{item.length, jdbcType=BIGINT},
#{item.objId, jdbcType=VARCHAR},
#{item.businessCode, jdbcType=VARCHAR},
#{item.overTime, jdbcType=TIMESTAMP},
#{item.createdBy, jdbcType=VARCHAR},
#{item.createdTime, jdbcType=TIMESTAMP},
#{item.deleted, jdbcType=BIT},
#{item.status, jdbcType=INTEGER},
#{item.tenantId, jdbcType=VARCHAR},
#{item.newFile, jdbcType=VARCHAR},
</trim>
</foreach>
</insert>
<update id="updateByPrimaryKey" parameterType="net.northking.cctp.attachment.db.entity.Attachment">
update
<include refid="Table_Name"/>
<set>
<if test="fileName != null">
file_name = #{fileName, jdbcType=VARCHAR},
</if>
<if test="contentType != null">
content_type = #{contentType, jdbcType=VARCHAR},
</if>
<if test="length != null">
length = #{length, jdbcType=BIGINT},
</if>
<if test="objId != null">
obj_id = #{objId, jdbcType=VARCHAR},
</if>
<if test="businessCode != null">
business_code = #{businessCode, jdbcType=VARCHAR},
</if>
<if test="overTime != null">
over_time = #{overTime, jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
created_by = #{createdBy, jdbcType=VARCHAR},
</if>
<if test="createdTime != null">
created_time = #{createdTime, jdbcType=TIMESTAMP},
</if>
<if test="deleted != null">
is_deleted = #{deleted, jdbcType=BIT},
</if>
<if test="status != null">
status = #{status, jdbcType=INTEGER},
</if>
<if test="tenantId != null">
tenant_id = #{tenantId, jdbcType=VARCHAR},
</if>
<if test="newFile != null">
new_file = #{newFile, jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<select id="query" resultMap="BaseResultMap" parameterType="net.northking.cctp.attachment.db.entity.Attachment">
select
<include refid="Base_Column_List" />
from
<include refid="Table_Name"/>
<trim prefix="WHERE" prefixOverrides="AND" >
<if test="id != null">
AND id = #{id,jdbcType=VARCHAR}
</if>
<if test="fileName != null">
AND file_name = #{fileName,jdbcType=VARCHAR}
</if>
<if test="contentType != null">
AND content_type = #{contentType,jdbcType=VARCHAR}
</if>
<if test="length != null">
AND length = #{length,jdbcType=BIGINT}
</if>
<if test="objId != null">
AND obj_id = #{objId,jdbcType=VARCHAR}
</if>
<if test="businessCode != null">
AND business_code = #{businessCode,jdbcType=VARCHAR}
</if>
<if test="createdBy != null">
AND created_by = #{createdBy,jdbcType=VARCHAR}
</if>
<if test="createdTime != null">
AND created_time = #{createdTime,jdbcType=TIMESTAMP}
</if>
<if test="deleted != null">
AND is_deleted = #{deleted,jdbcType=BIT}
</if>
<if test="status != null">
AND status = #{status,jdbcType=INTEGER}
</if>
<if test="tenantId != null">
AND tenant_id = #{tenantId,jdbcType=VARCHAR}
</if>
<if test="newFile != null">
AND new_file = #{newFile, jdbcType=VARCHAR}
</if>
</trim>
</select>
<select id="queryCount" resultType="java.lang.Long" parameterType="net.northking.cctp.attachment.db.entity.Attachment">
select count(*) from
<include refid="Table_Name"/>
<trim prefix="WHERE" prefixOverrides="AND" >
<if test="id != null">
AND id=#{id,jdbcType=VARCHAR}
</if>
<if test="fileName != null">
AND file_name=#{fileName,jdbcType=VARCHAR}
</if>
<if test="contentType != null">
AND content_type=#{contentType,jdbcType=VARCHAR}
</if>
<if test="length != null">
AND length=#{length,jdbcType=BIGINT}
</if>
<if test="objId != null">
AND obj_id=#{objId,jdbcType=VARCHAR}
</if>
<if test="businessCode != null">
AND business_code=#{businessCode,jdbcType=VARCHAR}
</if>
<if test="overTime != null">
AND over_time=#{overTime,jdbcType=TIMESTAMP}
</if>
<if test="createdBy != null">
AND created_by=#{createdBy,jdbcType=VARCHAR}
</if>
<if test="createdTime != null">
AND created_time=#{createdTime,jdbcType=TIMESTAMP}
</if>
<if test="deleted != null">
AND is_deleted=#{deleted,jdbcType=BIT}
</if>
<if test="status != null">
AND status=#{status,jdbcType=INTEGER}
</if>
<if test="tenantId != null">
AND tenant_id=#{tenantId,jdbcType=VARCHAR}
</if>
<if test="newFile != null">
AND new_file = #{newFile, jdbcType=VARCHAR}
</if>
</trim>
</select>
</mapper>