ganzi-api/inventory-dao/src/main/resources/mapper/SysdocumentMapper.xml
2022-09-16 15:07:17 +08:00

296 lines
11 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.rzyc.mapper.SysdocumentMapper">
<resultMap id="BaseResultMap" type="com.rzyc.model.Sysdocument">
<result column="SysDocumentId" jdbcType="VARCHAR" property="SysDocumentId" />
<result column="BizFileName" jdbcType="VARCHAR" property="bizFileName" />
<result column="SortId" jdbcType="INTEGER" property="sortId" />
<result column="RealFileName" jdbcType="VARCHAR" property="RealFileName" />
<result column="FilePath" jdbcType="VARCHAR" property="FilePath" />
<result column="FileType" jdbcType="VARCHAR" property="fileType" />
<result column="FileSize" jdbcType="VARCHAR" property="fileSize" />
<result column="OTCId" jdbcType="VARCHAR" property="OTCId" />
<result column="OTCType" jdbcType="VARCHAR" property="OTCType" />
<result column="CreatedOn" jdbcType="TIMESTAMP" property="createdOn" />
<result column="CreatedBy" jdbcType="VARCHAR" property="createdBy" />
<result column="ModifiedOn" jdbcType="TIMESTAMP" property="modifiedOn" />
<result column="ModifiedBy" jdbcType="VARCHAR" property="modifiedBy" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
SysDocumentId, BizFileName, SortId, RealFileName, FilePath, FileType, FileSize, OTCId,
OTCType, CreatedOn, CreatedBy, ModifiedOn, ModifiedBy
</sql>
<select id="selectByExample" parameterType="com.rzyc.model.SysdocumentExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from sysdocument
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<delete id="deleteByExample" parameterType="com.rzyc.model.SysdocumentExample">
delete from sysdocument
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.rzyc.model.Sysdocument">
insert into sysdocument (SysDocumentId, BizFileName, SortId,
RealFileName, FilePath, FileType,
FileSize, OTCId, OTCType,
CreatedOn, CreatedBy, ModifiedOn,
ModifiedBy)
values (#{sysDocumentId,jdbcType=VARCHAR}, #{bizFileName,jdbcType=VARCHAR}, #{sortId,jdbcType=INTEGER},
#{realFileName,jdbcType=VARCHAR}, #{filePath,jdbcType=VARCHAR}, #{fileType,jdbcType=VARCHAR},
#{fileSize,jdbcType=VARCHAR}, #{OTCId,jdbcType=VARCHAR}, #{OTCType,jdbcType=VARCHAR},
#{createdOn,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=VARCHAR}, #{modifiedOn,jdbcType=TIMESTAMP},
#{modifiedBy,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.rzyc.model.Sysdocument">
insert into sysdocument
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sysDocumentId != null">
SysDocumentId,
</if>
<if test="bizFileName != null">
BizFileName,
</if>
<if test="sortId != null">
SortId,
</if>
<if test="realFileName != null">
RealFileName,
</if>
<if test="filePath != null">
FilePath,
</if>
<if test="fileType != null">
FileType,
</if>
<if test="fileSize != null">
FileSize,
</if>
<if test="OTCId != null">
OTCId,
</if>
<if test="OTCType != null">
OTCType,
</if>
<if test="createdOn != null">
CreatedOn,
</if>
<if test="createdBy != null">
CreatedBy,
</if>
<if test="modifiedOn != null">
ModifiedOn,
</if>
<if test="modifiedBy != null">
ModifiedBy,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sysDocumentId != null">
#{sysDocumentId,jdbcType=VARCHAR},
</if>
<if test="bizFileName != null">
#{bizFileName,jdbcType=VARCHAR},
</if>
<if test="sortId != null">
#{sortId,jdbcType=INTEGER},
</if>
<if test="realFileName != null">
#{realFileName,jdbcType=VARCHAR},
</if>
<if test="filePath != null">
#{filePath,jdbcType=VARCHAR},
</if>
<if test="fileType != null">
#{fileType,jdbcType=VARCHAR},
</if>
<if test="fileSize != null">
#{fileSize,jdbcType=VARCHAR},
</if>
<if test="OTCId != null">
#{OTCId,jdbcType=VARCHAR},
</if>
<if test="OTCType != null">
#{OTCType,jdbcType=VARCHAR},
</if>
<if test="createdOn != null">
#{createdOn,jdbcType=TIMESTAMP},
</if>
<if test="createdBy != null">
#{createdBy,jdbcType=VARCHAR},
</if>
<if test="modifiedOn != null">
#{modifiedOn,jdbcType=TIMESTAMP},
</if>
<if test="modifiedBy != null">
#{modifiedBy,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.rzyc.model.SysdocumentExample" resultType="java.lang.Long">
select count(*) from sysdocument
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update sysdocument
<set>
<if test="record.sysDocumentId != null">
SysDocumentId = #{record.sysDocumentId,jdbcType=VARCHAR},
</if>
<if test="record.bizFileName != null">
BizFileName = #{record.bizFileName,jdbcType=VARCHAR},
</if>
<if test="record.sortId != null">
SortId = #{record.sortId,jdbcType=INTEGER},
</if>
<if test="record.realFileName != null">
RealFileName = #{record.realFileName,jdbcType=VARCHAR},
</if>
<if test="record.filePath != null">
FilePath = #{record.filePath,jdbcType=VARCHAR},
</if>
<if test="record.fileType != null">
FileType = #{record.fileType,jdbcType=VARCHAR},
</if>
<if test="record.fileSize != null">
FileSize = #{record.fileSize,jdbcType=VARCHAR},
</if>
<if test="record.OTCId != null">
OTCId = #{record.OTCId,jdbcType=VARCHAR},
</if>
<if test="record.OTCType != null">
OTCType = #{record.OTCType,jdbcType=VARCHAR},
</if>
<if test="record.createdOn != null">
CreatedOn = #{record.createdOn,jdbcType=TIMESTAMP},
</if>
<if test="record.createdBy != null">
CreatedBy = #{record.createdBy,jdbcType=VARCHAR},
</if>
<if test="record.modifiedOn != null">
ModifiedOn = #{record.modifiedOn,jdbcType=TIMESTAMP},
</if>
<if test="record.modifiedBy != null">
ModifiedBy = #{record.modifiedBy,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update sysdocument
set SysDocumentId = #{record.sysDocumentId,jdbcType=VARCHAR},
BizFileName = #{record.bizFileName,jdbcType=VARCHAR},
SortId = #{record.sortId,jdbcType=INTEGER},
RealFileName = #{record.realFileName,jdbcType=VARCHAR},
FilePath = #{record.filePath,jdbcType=VARCHAR},
FileType = #{record.fileType,jdbcType=VARCHAR},
FileSize = #{record.fileSize,jdbcType=VARCHAR},
OTCId = #{record.OTCId,jdbcType=VARCHAR},
OTCType = #{record.OTCType,jdbcType=VARCHAR},
CreatedOn = #{record.createdOn,jdbcType=TIMESTAMP},
CreatedBy = #{record.createdBy,jdbcType=VARCHAR},
ModifiedOn = #{record.modifiedOn,jdbcType=TIMESTAMP},
ModifiedBy = #{record.modifiedBy,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<!--查询文件信息-->
<select id="findByOtcId" resultMap="BaseResultMap">
SELECT * FROM `sysdocument` st
WHERE st.`OTCType` = #{otcType}
AND st.`OTCId` in
<foreach collection="otcIds" item="otcId" open="(" close=")" separator=",">
#{otcId}
</foreach>
ORDER BY st.`CreatedOn` ASC;
</select>
<!--删除文件-->
<delete id="delById">
delete from sysdocument where SysDocumentId = #{documentId}
</delete>
</mapper>