Files
foton-slrs-system-rest/adc-da-slrs/src/main/resources/mybatis/mapper/standardSplit/SarStandFileEOMapper.xml
T
2022-05-17 09:06:58 +08:00

411 lines
17 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.adc.da.slrs.standardSplit.dao.SarStandFileEODao" >
<!-- Result Map-->
<resultMap id="BaseResultMap" type="com.adc.da.slrs.standardSplit.entity.SarStandFileEO" >
<id column="id" property="id" />
<result column="modify_time" property="modifyTime" />
<result column="creation_time" property="creationTime" />
<result column="valid_flag" property="validFlag" />
<result column="use_model" property="useModel" />
<result column="att_id" property="attId" />
<result column="ori_att_id" property="oriAttId" />
<result column="stand_id" property="standId" />
<result column="file_suffix" property="fileSuffix" />
<result column="file_name" property="fileName" />
<result column="stand_file_classify" property="standFileClassify" />
<result column="password" property="password" />
<result column="creation_user" property="creationUser" />
<result column="resId" property="resId" />
<result column="standNumber" property="standNumber" />
<result column="standName" property="standName" />
<result column="sarType" property="sarType" />
<result column="attId1" property="attId1" />
</resultMap>
<!-- SAR_STAND_FILE table all fields -->
<sql id="Base_Column_List" >
modify_time, creation_time, valid_flag, use_model, att_id, stand_id, id,file_suffix,file_name,stand_file_classify,
password,creation_user,ori_att_id
</sql>
<!-- 查询条件 -->
<sql id="Base_Where_Clause">
where 1=1
<trim suffixOverrides="," >
<if test="modifyTime != null" >
and modify_time ${modifyTimeOperator} #{modifyTime}
</if>
<if test="modifyTime1 != null" >
and modify_time &gt;= #{modifyTime1}
</if>
<if test="modifyTime2 != null" >
and modify_time &lt;= #{modifyTime2}
</if>
<if test="creationTime != null" >
and creation_time ${creationTimeOperator} #{creationTime}
</if>
<if test="creationTime1 != null" >
and creation_time &gt;= #{creationTime1}
</if>
<if test="creationTime2 != null" >
and creation_time &lt;= #{creationTime2}
</if>
<if test="validFlag != null" >
and valid_flag ${validFlagOperator} #{validFlag}
</if>
<if test="useModel != null" >
and use_model ${useModelOperator} #{useModel}
</if>
<if test="attId != null" >
and att_id ${attIdOperator} #{attId}
</if>
<if test="standId != null" >
and stand_id ${standIdOperator} #{standId}
</if>
<if test="id != null" >
and id ${idOperator} #{id}
</if>
</trim>
</sql>
<!-- 插入记录 -->
<insert id="insert" parameterType="com.adc.da.slrs.standardSplit.entity.SarStandFileEO" >
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
SELECT SEQ_SAR_STAND_FILE.NEXTVAL FROM DUAL
</selectKey> -->
insert into SAR_STAND_FILE(<include refid="Base_Column_List" />)
values (#{modifyTime, jdbcType=TIMESTAMP}, #{creationTime, jdbcType=TIMESTAMP}, #{validFlag, jdbcType=INTEGER},
#{useModel, jdbcType=VARCHAR}, #{attId, jdbcType=VARCHAR}, #{standId, jdbcType=VARCHAR},
#{id, jdbcType=VARCHAR},#{fileSuffix, jdbcType=VARCHAR},#{fileName, jdbcType=VARCHAR},#{standFileClassify, jdbcType=VARCHAR},
#{password, jdbcType=VARCHAR},#{creationUser, jdbcType=VARCHAR})
</insert>
<!-- 动态插入记录 主键是序列 -->
<insert id="insertSelective" parameterType="com.adc.da.slrs.standardSplit.entity.SarStandFileEO" >
insert into SAR_STAND_FILE
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="modifyTime != null" >modify_time,</if>
<if test="creationTime != null" >creation_time,</if>
<if test="validFlag != null" >valid_flag,</if>
<if test="useModel != null" >use_model,</if>
<if test="attId != null" >att_id,</if>
<if test="standId != null" >stand_id,</if>
<if test="id != null" >id,</if>
<if test="fileSuffix != null" >file_suffix,</if>
<if test="fileName != null" >file_name,</if>
<if test="standFileClassify != null" >stand_file_classify,</if>
<if test="password != null" >password,</if>
<if test="creationUser != null" >creation_user,</if>
<if test="oriAttId != null" >ori_att_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="modifyTime != null" >#{modifyTime, jdbcType=TIMESTAMP},</if>
<if test="creationTime != null" >#{creationTime, jdbcType=TIMESTAMP},</if>
<if test="validFlag != null" >#{validFlag, jdbcType=INTEGER},</if>
<if test="useModel != null" >#{useModel, jdbcType=VARCHAR},</if>
<if test="attId != null" >#{attId, jdbcType=VARCHAR},</if>
<if test="standId != null" >#{standId, jdbcType=VARCHAR},</if>
<if test="id != null" >#{id, jdbcType=VARCHAR},</if>
<if test="fileSuffix != null" >#{fileSuffix, jdbcType=VARCHAR},</if>
<if test="fileName != null" >#{fileName, jdbcType=VARCHAR},</if>
<if test="standFileClassify != null" >#{standFileClassify, jdbcType=VARCHAR},</if>
<if test="password != null" >#{password, jdbcType=VARCHAR},</if>
<if test="creationUser != null" >#{creationUser, jdbcType=VARCHAR},</if>
<if test="oriAttId != null" >#{oriAttId, jdbcType=VARCHAR},</if>
</trim>
</insert>
<!-- 修改记录,只修改只不为空的字段 -->
<update id="updateByPrimaryKeySelective" parameterType="com.adc.da.slrs.standardSplit.entity.SarStandFileEO" >
update SAR_STAND_FILE
<set >
<if test="oriAttId != null" >
ori_att_id = #{oriAttId},
</if>
<if test="modifyTime != null" >
modify_time = #{modifyTime},
</if>
<if test="creationTime != null" >
creation_time = #{creationTime},
</if>
<if test="validFlag != null" >
valid_flag = #{validFlag},
</if>
<if test="useModel != null" >
use_model = #{useModel},
</if>
<if test="attId != null" >
att_id = #{attId},
</if>
<if test="standId != null" >
stand_id = #{standId},
</if>
</set>
where id = #{id}
</update>
<!-- 根据id查询 SAR_STAND_FILE -->
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select <include refid="Base_Column_List" />
from SAR_STAND_FILE
where id = #{value} and valid_flag=0
</select>
<!-- 删除记录 -->
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from SAR_STAND_FILE
where id = #{value}
</delete>
<!-- SAR_STAND_FILE 列表总数-->
<select id="queryByCount" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">
select count(1) from SAR_STAND_FILE
<include refid="Base_Where_Clause"/>
</select>
<!-- 查询SAR_STAND_FILE列表 -->
<select id="queryByPage" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
select <include refid="Base_Column_List" /> from
(select tmp_tb.* from
(select <include refid="Base_Column_List" /> from SAR_STAND_FILE
<include refid="Base_Where_Clause"/>
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
${pager.orderCondition}
</if>
) tmp_tb limit ${pager.startIndex-1},${pageSize}}) a
</select>
<select id="queryByList" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
select <include refid="Base_Column_List"/> from SAR_STAND_FILE
<include refid="Base_Where_Clause"/>
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
${pager.orderCondition}
</if>
</select>
<select id="selectFileByStandId" resultMap="BaseResultMap" parameterType="java.lang.String">
select <include refid="Base_Column_List" />
from SAR_STAND_FILE
where stand_id = #{value} and valid_flag = 0
</select>
<select id="selectFileByAttId" resultMap="BaseResultMap" parameterType="java.lang.String">
select <include refid="Base_Column_List" />
from SAR_STAND_FILE
where valid_flag = 0
and stand_id = (
select stand_id
from SAR_STAND_FILE
where att_id = #{value} and valid_flag = 0 and use_model = 'SOURCE_FILE'
limit 0,1
)
and use_model = 'WEB_FILE'
and ori_att_id = #{value}
order by modify_time desc
</select>
<!-- gaoyan 根据resid 查询 -->
<select id="selectFileByResId" resultMap="BaseResultMap" parameterType="com.adc.da.slrs.standardSplit.entity.SarStandFileEO">
select <include refid="Base_Column_List" />
from SAR_STAND_FILE
where use_model = 'SOURCE_FILE'
</select>
<select id="selectFileMsgByAttId" resultMap="BaseResultMap" parameterType="java.lang.String">
select <include refid="Base_Column_List" />
from SAR_STAND_FILE
where valid_flag = 0
and att_id = #{value}
</select>
<select id="selectFileByStandIdAndId" resultMap="BaseResultMap" parameterType="com.adc.da.slrs.standardSplit.entity.SarStandFileEO">
select <include refid="Base_Column_List" />
from SAR_STAND_FILE
where valid_flag = 0
<if test="standId != null" >
and stand_id = #{standId}
</if>
<if test="idlist != null">
and id not in
<foreach collection="idlist" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<delete id="deleteByStandId" parameterType="java.lang.String">
delete from SAR_STAND_FILE
where stand_id = #{value}
</delete>
<insert id="insertForeach" parameterType="java.util.List">
insert into SAR_STAND_FILE
(<include refid="Base_Column_List" />)
values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.modifyTime, jdbcType=TIMESTAMP},
#{item.creationTime, jdbcType=TIMESTAMP},
#{item.validFlag, jdbcType=INTEGER},
#{item.useModel, jdbcType=VARCHAR},
#{item.attId, jdbcType=VARCHAR},
#{item.standId, jdbcType=VARCHAR},
#{item.id, jdbcType=VARCHAR},
#{item.fileSuffix, jdbcType=VARCHAR},
#{item.fileName, jdbcType=VARCHAR},
#{item.standFileClassify, jdbcType=VARCHAR},
#{item.password, jdbcType=VARCHAR},
#{item.creationUser, jdbcType=VARCHAR},
#{item.oriAttId, jdbcType=VARCHAR})
</foreach>
</insert>
<select id="getStandFileListByPage" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
select * from
(select tmp_tb.* from
(
SELECT
SAR_STAND_FILE.id AS resId,
SAR_STAND_FILE.stand_id,
SAR_STAND_FILE.STAND_FILE_CLASSIFY,
SAR_STAND_FILE.file_name,
(
if(
SAR_STANDARDS_INFO.STAND_YEAR IS NULL,
CONCAT(SAR_STANDARDS_INFO.stand_sort,' ',SAR_STANDARDS_INFO.stand_number),
CONCAT(SAR_STANDARDS_INFO.stand_sort,' ',SAR_STANDARDS_INFO.stand_number,'-',SAR_STANDARDS_INFO.stand_year)
) ) AS standNumber,
SAR_STANDARDS_INFO.stand_name as standName,
SAR_STAND_FILE.att_id AS attId1,
SAR_STANDARDS_INFO.STAND_TYPE as sarType
FROM
SAR_STAND_FILE
RIGHT JOIN SAR_STANDARDS_INFO ON ( SAR_STAND_FILE.STAND_ID = SAR_STANDARDS_INFO.ID AND SAR_STANDARDS_INFO.VALID_FLAG = 0 )
where SAR_STANDARDS_INFO.VALID_FLAG =0 and SAR_STAND_FILE.VALID_FLAG =0
<if test="fileSuffixList != null">
and SAR_STAND_FILE.file_suffix in
<foreach collection="fileSuffixList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="standNumber != null">
and
if(
SAR_STANDARDS_INFO.STAND_YEAR IS NULL,
CONCAT(SAR_STANDARDS_INFO.stand_sort,' ',SAR_STANDARDS_INFO.stand_number),
CONCAT(SAR_STANDARDS_INFO.stand_sort,' ',SAR_STANDARDS_INFO.stand_number,'-',SAR_STANDARDS_INFO.stand_year)
) like concat(concat('%',#{standNumber}),'%')
</if>
<if test="standName != null">
and SAR_STANDARDS_INFO.stand_name like concat(concat ('%',#{standName}),'%')
</if>
<if test="standFileClassify != null">
and SAR_STAND_FILE.STAND_FILE_CLASSIFY = #{standFileClassify}
</if>
<if test="fileType != null">
and SAR_STANDARDS_INFO.STAND_TYPE = #{fileType}
</if>
order by SAR_STAND_FILE.modify_time desc,SAR_STAND_FILE.id
) tmp_tb limit ${pager.startIndex-1},${pageSize}) a
</select>
<select id="getStandFileListByPageCount" parameterType="com.adc.da.base.page.BasePage"
resultType="java.lang.Integer">
select count(*) from
(select tmp_tb.* from
(
SELECT
SAR_STAND_FILE.id AS resId,
SAR_STAND_FILE.stand_id,
SAR_STAND_FILE.STAND_FILE_CLASSIFY,
SAR_STAND_FILE.file_name,
(
if(
SAR_STANDARDS_INFO.STAND_YEAR='',
CONCAT(SAR_STANDARDS_INFO.stand_sort,' ',SAR_STANDARDS_INFO.stand_number),
CONCAT(SAR_STANDARDS_INFO.stand_sort,' ',SAR_STANDARDS_INFO.stand_number,'-',SAR_STANDARDS_INFO.stand_year)
) ) AS standNumber,
SAR_STANDARDS_INFO.stand_name as standName,
SAR_STAND_FILE.att_id AS attId1,
SAR_STANDARDS_INFO.STAND_TYPE as sarType
FROM
SAR_STAND_FILE
RIGHT JOIN SAR_STANDARDS_INFO ON ( SAR_STAND_FILE.STAND_ID = SAR_STANDARDS_INFO.ID AND SAR_STANDARDS_INFO.VALID_FLAG = 0 )
where SAR_STANDARDS_INFO.VALID_FLAG =0 and SAR_STAND_FILE.VALID_FLAG =0
<if test="fileSuffixList != null">
and SAR_STAND_FILE.file_suffix in
<foreach collection="fileSuffixList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="standNumber != null">
and
if(
SAR_STANDARDS_INFO.STAND_YEAR='',
CONCAT(SAR_STANDARDS_INFO.stand_sort,' ',SAR_STANDARDS_INFO.stand_number),
CONCAT(SAR_STANDARDS_INFO.stand_sort,' ',SAR_STANDARDS_INFO.stand_number,'-',SAR_STANDARDS_INFO.stand_year)
) like concat(concat('%',#{standNumber}),'%')
</if>
<if test="standName != null">
and SAR_STANDARDS_INFO.stand_name like concat(concat ('%',#{standName}),'%')
</if>
<if test="standFileClassify != null">
and SAR_STAND_FILE.STAND_FILE_CLASSIFY = #{standFileClassify}
</if>
<if test="fileType != null">
and SAR_STANDARDS_INFO.STAND_TYPE = #{fileType}
</if>
order by SAR_STAND_FILE.modify_time desc,SAR_STAND_FILE.id
) tmp_tb ) a
</select>
<select id="queryStandFileListByCount" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">
select count(1) from (
SELECT
SAR_STAND_FILE.id AS resId,
SAR_STAND_FILE.stand_id,
SAR_STAND_FILE.STAND_FILE_CLASSIFY,
SAR_STAND_FILE.file_name,
(
if(
SAR_STANDARDS_INFO.STAND_YEAR='',
CONCAT(SAR_STANDARDS_INFO.stand_sort,' ',SAR_STANDARDS_INFO.stand_number),
CONCAT(SAR_STANDARDS_INFO.stand_sort,' ',SAR_STANDARDS_INFO.stand_number,'-',SAR_STANDARDS_INFO.stand_year)
) ) AS standNumber,
SAR_STANDARDS_INFO.stand_name as standName,
SAR_STAND_FILE.att_id AS attId,
SAR_STANDARDS_INFO.STAND_TYPE as sarType
FROM
SAR_STAND_FILE
LEFT JOIN SAR_STANDARDS_INFO ON ( SAR_STAND_FILE.STAND_ID = SAR_STANDARDS_INFO.ID AND SAR_STANDARDS_INFO.VALID_FLAG = 0 )
where SAR_STANDARDS_INFO.VALID_FLAG =0 and SAR_STAND_FILE.VALID_FLAG =0
<if test="fileSuffixList != null">
and SAR_STAND_FILE.file_suffix in
<foreach collection="fileSuffixList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="standNumber != null">
and if(
SAR_STANDARDS_INFO.STAND_YEAR='',
CONCAT(SAR_STANDARDS_INFO.stand_sort,' ',SAR_STANDARDS_INFO.stand_number),
CONCAT(SAR_STANDARDS_INFO.stand_sort,' ',SAR_STANDARDS_INFO.stand_number,'-',SAR_STANDARDS_INFO.stand_year)
) like concat(concat('%',#{standNumber}),'%')
</if>
<if test="standName != null">
and SAR_STANDARDS_INFO.stand_name like concat(concat ('%',#{standName}),'%')
</if>
<if test="standFileClassify != null">
and SAR_STAND_FILE.STAND_FILE_CLASSIFY = #{standFileClassify}
</if>
<if test="fileType != null">
and SAR_STANDARDS_INFO.STAND_TYPE = #{fileType}
</if>
) r
</select>
</mapper>