407 lines
18 KiB
XML
407 lines
18 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.person.dao.PersonCollectEODao">
|
|
<!-- Result Map-->
|
|
<resultMap id="BaseResultMap" type="com.adc.da.person.entity.TsPersonCollect">
|
|
<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="collect_res_id" property="collectResId"/>
|
|
<result column="collect_info_uri" property="collectInfoUri"/>
|
|
<result column="collect_title" property="collectTitle"/>
|
|
<result column="collect_type" property="collectType"/>
|
|
<result column="user_id" property="userId"/>
|
|
</resultMap>
|
|
|
|
<!-- TS_PERSON_COLLECT table all fields -->
|
|
|
|
<sql id="Base_Column_List">
|
|
modify_time, creation_time, valid_flag, collect_res_id, collect_info_uri, collect_title, collect_type, user_id, 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 >= #{modifyTime1}
|
|
</if>
|
|
<if test="modifyTime2 != null">
|
|
and modify_time <= #{modifyTime2}
|
|
</if>
|
|
<if test="creationTime != null">
|
|
and creation_time ${creationTimeOperator} #{creationTime}
|
|
</if>
|
|
<if test="creationTime1 != null">
|
|
and creation_time >= #{creationTime1}
|
|
</if>
|
|
<if test="creationTime2 != null">
|
|
and creation_time <= #{creationTime2}
|
|
</if>
|
|
<if test="validFlag != null">
|
|
and valid_flag = #{validFlag}
|
|
</if>
|
|
<if test="collectResId != null">
|
|
and collect_res_id ${collectResIdOperator} #{collectResId}
|
|
</if>
|
|
<if test="collectResIds != null and collectResIds.size !=0">
|
|
and collect_res_id IN
|
|
<foreach collection="collectResIds" item="item" index="index" open="(" close=")" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test="collectInfoUri != null">
|
|
and collect_info_uri ${collectInfoUriOperator} #{collectInfoUri}
|
|
</if>
|
|
<if test="collectTitle != null">
|
|
and collect_title like concat(concat('%',#{collectTitle}),'%')
|
|
</if>
|
|
<if test="collectType != null">
|
|
and collect_type ${collectTypeOperator} #{collectType}
|
|
</if>
|
|
<if test="collectTypeList != null and collectTypeList.size !=0">
|
|
and collect_type IN
|
|
<foreach collection="collectTypeList" item="collectTypeItem" index="index" open="(" close=")" separator=",">
|
|
#{collectTypeItem}
|
|
</foreach>
|
|
</if>
|
|
|
|
<if test="userId != null">
|
|
and user_id ${userIdOperator} #{userId}
|
|
</if>
|
|
<if test="id != null">
|
|
and id ${idOperator} #{id}
|
|
</if>
|
|
</trim>
|
|
</sql>
|
|
|
|
<sql id="Base_Where_Clause_stand">
|
|
where 1=1
|
|
<trim suffixOverrides=",">
|
|
<if test="modifyTime != null">
|
|
and TS_PERSON_COLLECT.modify_time ${modifyTimeOperator} #{modifyTime}
|
|
</if>
|
|
<if test="modifyTime1 != null">
|
|
and TS_PERSON_COLLECT.modify_time >= #{modifyTime1}
|
|
</if>
|
|
<if test="modifyTime2 != null">
|
|
and TS_PERSON_COLLECT.modify_time <= #{modifyTime2}
|
|
</if>
|
|
<if test="creationTime != null">
|
|
and TS_PERSON_COLLECT.creation_time ${creationTimeOperator} #{creationTime}
|
|
</if>
|
|
<if test="creationTime1 != null">
|
|
and TS_PERSON_COLLECT.creation_time >= #{creationTime1}
|
|
</if>
|
|
<if test="creationTime2 != null">
|
|
and TS_PERSON_COLLECT.creation_time <= #{creationTime2}
|
|
</if>
|
|
<if test="validFlag != null">
|
|
and TS_PERSON_COLLECT.valid_flag = #{validFlag}
|
|
</if>
|
|
<if test="collectResId != null">
|
|
and TS_PERSON_COLLECT.collect_res_id ${collectResIdOperator} #{collectResId}
|
|
</if>
|
|
<if test="collectInfoUri != null">
|
|
and TS_PERSON_COLLECT.collect_info_uri ${collectInfoUriOperator} #{collectInfoUri}
|
|
</if>
|
|
<if test="collectTitle != null">
|
|
and (
|
|
CASE TS_PERSON_COLLECT.collect_type
|
|
WHEN 'INLAND_STAND' THEN
|
|
DECODE (
|
|
SAR_STANDARDS_INFO.STAND_YEAR,
|
|
NULL,
|
|
SAR_STANDARDS_INFO.stand_name || ' (' || td1.DIC_TYPE_NAME || ' ' || SAR_STANDARDS_INFO.stand_number || ')',
|
|
SAR_STANDARDS_INFO.stand_name || ' (' || td1.DIC_TYPE_NAME || ' ' || SAR_STANDARDS_INFO.stand_number || '-' || SAR_STANDARDS_INFO.stand_year|| ')'
|
|
)
|
|
WHEN 'FOREIGN_STAND' THEN
|
|
DECODE (
|
|
SAR_STANDARDS_INFO.STAND_YEAR,
|
|
NULL,
|
|
SAR_STANDARDS_INFO.stand_name || ' (' || td1.DIC_TYPE_NAME || ' ' || SAR_STANDARDS_INFO.stand_number || ')',
|
|
SAR_STANDARDS_INFO.stand_name || ' (' || td1.DIC_TYPE_NAME || ' ' || SAR_STANDARDS_INFO.stand_number || '-' || SAR_STANDARDS_INFO.stand_year|| ')'
|
|
)
|
|
WHEN 'BUSINESS_STAND' THEN
|
|
DECODE (
|
|
SAR_BUSSIONESS_STAND.STAND_YEAR,
|
|
NULL,
|
|
SAR_BUSSIONESS_STAND.stand_name || ' (' || td2.DIC_TYPE_NAME || ' ' || SAR_BUSSIONESS_STAND.stand_code || ')',
|
|
SAR_BUSSIONESS_STAND.stand_name || ' (' || td2.DIC_TYPE_NAME || ' ' || SAR_BUSSIONESS_STAND.stand_code || '-' || SAR_BUSSIONESS_STAND.stand_year|| ')'
|
|
)
|
|
ELSE
|
|
TS_PERSON_COLLECT.collect_title
|
|
END
|
|
) like concat(concat('%',#{collectTitle}),'%')
|
|
</if>
|
|
<if test="collectType != null">
|
|
and TS_PERSON_COLLECT.collect_type ${collectTypeOperator} #{collectType}
|
|
</if>
|
|
<if test="collectTypeList != null and collectTypeList.size !=0">
|
|
and TS_PERSON_COLLECT.collect_type IN
|
|
<foreach collection="collectTypeList" item="collectTypeItem" index="index" open="(" close=")" separator=",">
|
|
#{collectTypeItem}
|
|
</foreach>
|
|
</if>
|
|
|
|
<if test="userId != null">
|
|
and TS_PERSON_COLLECT.user_id ${userIdOperator} #{userId}
|
|
</if>
|
|
<if test="id != null">
|
|
and TS_PERSON_COLLECT.id ${idOperator} #{id}
|
|
</if>
|
|
</trim>
|
|
</sql>
|
|
|
|
<!-- 插入记录 -->
|
|
<insert id="insert" parameterType="com.adc.da.person.entity.TsPersonCollect">
|
|
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
|
|
SELECT SEQ_TS_PERSON_COLLECT.NEXTVAL FROM DUAL
|
|
</selectKey> -->
|
|
insert into TS_PERSON_COLLECT(<include refid="Base_Column_List"/>)
|
|
values (#{modifyTime, jdbcType=TIMESTAMP}, #{creationTime, jdbcType=TIMESTAMP}, #{validFlag, jdbcType=INTEGER},
|
|
#{collectResId, jdbcType=VARCHAR}, #{collectInfoUri, jdbcType=VARCHAR}, #{collectTitle, jdbcType=VARCHAR},
|
|
#{collectType, jdbcType=VARCHAR}, #{userId, jdbcType=VARCHAR}, #{id, jdbcType=VARCHAR})
|
|
</insert>
|
|
|
|
<!-- 动态插入记录 主键是序列 -->
|
|
<insert id="insertSelective" parameterType="com.adc.da.person.entity.TsPersonCollect">
|
|
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
|
|
SELECT SEQ_TS_PERSON_COLLECT.NEXTVAL FROM DUAL
|
|
</selectKey> -->
|
|
insert into TS_PERSON_COLLECT
|
|
<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="collectResId != null">collect_res_id,</if>
|
|
<if test="collectInfoUri != null">collect_info_uri,</if>
|
|
<if test="collectTitle != null">collect_title,</if>
|
|
<if test="collectType != null">collect_type,</if>
|
|
<if test="userId != null">user_id,</if>
|
|
<if test="id != null">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="collectResId != null">#{collectResId, jdbcType=VARCHAR},</if>
|
|
<if test="collectInfoUri != null">#{collectInfoUri, jdbcType=VARCHAR},</if>
|
|
<if test="collectTitle != null">#{collectTitle, jdbcType=VARCHAR},</if>
|
|
<if test="collectType != null">#{collectType, jdbcType=VARCHAR},</if>
|
|
<if test="userId != null">#{userId, jdbcType=VARCHAR},</if>
|
|
<if test="id != null">#{id, jdbcType=VARCHAR},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<!-- 根据pk,修改记录-->
|
|
<update id="updateByPrimaryKey" parameterType="com.adc.da.person.entity.TsPersonCollect">
|
|
update TS_PERSON_COLLECT
|
|
set modify_time = #{modifyTime},
|
|
creation_time = #{creationTime},
|
|
valid_flag = #{validFlag},
|
|
collect_res_id = #{collectResId},
|
|
collect_info_uri = #{collectInfoUri},
|
|
collect_title = #{collectTitle},
|
|
collect_type = #{collectType},
|
|
user_id = #{userId}
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<!-- 修改记录,只修改只不为空的字段 -->
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.adc.da.person.entity.TsPersonCollect">
|
|
update TS_PERSON_COLLECT
|
|
<set>
|
|
<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="collectResId != null">
|
|
collect_res_id = #{collectResId},
|
|
</if>
|
|
<if test="collectInfoUri != null">
|
|
collect_info_uri = #{collectInfoUri},
|
|
</if>
|
|
<if test="collectTitle != null">
|
|
collect_title = #{collectTitle},
|
|
</if>
|
|
<if test="collectType != null">
|
|
collect_type = #{collectType},
|
|
</if>
|
|
<if test="userId != null">
|
|
user_id = #{userId},
|
|
</if>
|
|
</set>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<!-- 根据id查询 TS_PERSON_COLLECT -->
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from TS_PERSON_COLLECT
|
|
where id = #{value}
|
|
|
|
</select>
|
|
|
|
<!-- 删除记录 -->
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
|
delete from TS_PERSON_COLLECT
|
|
where id = #{value}
|
|
|
|
</delete>
|
|
|
|
<!-- TS_PERSON_COLLECT 列表总数-->
|
|
<select id="queryByCount" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">
|
|
select count(1) from TS_PERSON_COLLECT
|
|
<include refid="Base_Where_Clause"/>
|
|
</select>
|
|
|
|
<!-- 查询TS_PERSON_COLLECT列表 -->
|
|
<select id="queryByPage" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from
|
|
(select tmp_tb.* , rownum rn from
|
|
(select
|
|
<include refid="Base_Column_List"/>
|
|
from TS_PERSON_COLLECT
|
|
<include refid="Base_Where_Clause"/>
|
|
<if test="pager.orderCondition != null and pager.orderCondition != ''">
|
|
${pager.orderCondition}
|
|
</if>
|
|
order by creation_time desc
|
|
) tmp_tb where rownum <= ${pager.endIndex})
|
|
where rn >= ${pager.startIndex} and valid_flag = 0
|
|
</select>
|
|
|
|
|
|
<!-- 分页查询-->
|
|
<select id="queryByPersonCollectPage" resultMap="BaseResultMap" parameterType="com.adc.da.person.page.PersonCollectEOPage">
|
|
select
|
|
*
|
|
from
|
|
(select tmp_tb.* , rownum rn from
|
|
(select
|
|
TS_PERSON_COLLECT.modify_time,
|
|
TS_PERSON_COLLECT.creation_time,
|
|
TS_PERSON_COLLECT.valid_flag,
|
|
TS_PERSON_COLLECT.collect_res_id,
|
|
TS_PERSON_COLLECT.collect_info_uri,
|
|
TS_PERSON_COLLECT.collect_type,
|
|
TS_PERSON_COLLECT.user_id,
|
|
TS_PERSON_COLLECT.id,
|
|
(
|
|
CASE TS_PERSON_COLLECT.collect_type
|
|
WHEN 'INLAND_STAND' THEN
|
|
DECODE (
|
|
SAR_STANDARDS_INFO.STAND_YEAR,
|
|
NULL,
|
|
SAR_STANDARDS_INFO.stand_name || ' (' || td1.DIC_TYPE_NAME || ' ' || SAR_STANDARDS_INFO.stand_number || ')',
|
|
SAR_STANDARDS_INFO.stand_name || ' (' || td1.DIC_TYPE_NAME || ' ' || SAR_STANDARDS_INFO.stand_number || '-' || SAR_STANDARDS_INFO.stand_year|| ')'
|
|
)
|
|
WHEN 'FOREIGN_STAND' THEN
|
|
DECODE (
|
|
SAR_STANDARDS_INFO.STAND_YEAR,
|
|
NULL,
|
|
SAR_STANDARDS_INFO.stand_name || ' (' || td1.DIC_TYPE_NAME || ' ' || SAR_STANDARDS_INFO.stand_number || ')',
|
|
SAR_STANDARDS_INFO.stand_name || ' (' || td1.DIC_TYPE_NAME || ' ' || SAR_STANDARDS_INFO.stand_number || '-' || SAR_STANDARDS_INFO.stand_year|| ')'
|
|
)
|
|
WHEN 'BUSINESS_STAND' THEN
|
|
DECODE (
|
|
SAR_BUSSIONESS_STAND.STAND_YEAR,
|
|
NULL,
|
|
SAR_BUSSIONESS_STAND.stand_name || ' (' || td2.DIC_TYPE_NAME || ' ' || SAR_BUSSIONESS_STAND.stand_code || ')',
|
|
SAR_BUSSIONESS_STAND.stand_name || ' (' || td2.DIC_TYPE_NAME || ' ' || SAR_BUSSIONESS_STAND.stand_code || '-' || SAR_BUSSIONESS_STAND.stand_year|| ')'
|
|
)
|
|
ELSE
|
|
TS_PERSON_COLLECT.collect_title
|
|
END
|
|
) AS collect_title
|
|
from TS_PERSON_COLLECT
|
|
LEFT JOIN SAR_STANDARDS_INFO ON TS_PERSON_COLLECT.COLLECT_RES_ID = SAR_STANDARDS_INFO. ID
|
|
LEFT JOIN TS_DICTYPE td1 ON (SAR_STANDARDS_INFO.STAND_SORT = td1.DIC_TYPE_CODE AND td1.valid_flag = 0 AND td1.PARENT_ID IS NULL)
|
|
LEFT JOIN SAR_BUSSIONESS_STAND ON TS_PERSON_COLLECT.COLLECT_RES_ID = SAR_BUSSIONESS_STAND. ID
|
|
LEFT JOIN TS_DICTYPE td2 ON (SAR_BUSSIONESS_STAND.stand_sort = td2.DIC_TYPE_CODE AND td2.valid_flag = 0 AND td2.PARENT_ID IS NULL)
|
|
<include refid="Base_Where_Clause_stand"/>
|
|
<if test="pager.orderCondition != null and pager.orderCondition != ''">
|
|
${pager.orderCondition}
|
|
</if>
|
|
order by TS_PERSON_COLLECT.creation_time desc
|
|
) as tmp_tb where rownum <= ${pager.endIndex})
|
|
where rn >= ${pager.startIndex}
|
|
</select>
|
|
|
|
<select id="queryByPersonCollectPageCount" resultType="java.lang.Integer" parameterType="com.adc.da.person.page.PersonCollectEOPage">
|
|
select count(1)
|
|
from TS_PERSON_COLLECT
|
|
LEFT JOIN SAR_STANDARDS_INFO ON TS_PERSON_COLLECT.COLLECT_RES_ID = SAR_STANDARDS_INFO. ID
|
|
LEFT JOIN TS_DICTYPE td1 ON (SAR_STANDARDS_INFO.STAND_SORT = td1.DIC_TYPE_CODE AND td1.valid_flag = 0 AND td1.PARENT_ID IS NULL)
|
|
LEFT JOIN SAR_BUSSIONESS_STAND ON TS_PERSON_COLLECT.COLLECT_RES_ID = SAR_BUSSIONESS_STAND. ID
|
|
LEFT JOIN TS_DICTYPE td2 ON (SAR_BUSSIONESS_STAND.stand_sort = td2.DIC_TYPE_CODE AND td2.valid_flag = 0 AND td2.PARENT_ID IS NULL)
|
|
<include refid="Base_Where_Clause_stand"/>
|
|
<if test="pager.orderCondition != null and pager.orderCondition != ''">
|
|
${pager.orderCondition}
|
|
</if>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="queryByList" resultMap="BaseResultMap" parameterType="com.adc.da.person.page.PersonCollectEOPage">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from TS_PERSON_COLLECT
|
|
<include refid="Base_Where_Clause"/>
|
|
<if test="pager.orderCondition != null and pager.orderCondition != ''">
|
|
${pager.orderCondition}
|
|
</if>
|
|
</select>
|
|
|
|
<update id="deleteByIdList" parameterType="java.util.List">
|
|
delete from TS_PERSON_COLLECT
|
|
<where>
|
|
<if test="idList != null">
|
|
"ID" IN
|
|
<foreach close=")" separator="," open="(" item="item" index="index" collection="idList">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
</where>
|
|
</update>
|
|
|
|
<update id="deleteByResId" parameterType="java.lang.String">
|
|
update TS_PERSON_COLLECT
|
|
set valid_flag=1
|
|
where collect_res_id = #{resId}
|
|
</update>
|
|
|
|
<update id="deleteByResIdList" parameterType="java.util.List">
|
|
delete from TS_PERSON_COLLECT
|
|
<where>
|
|
<if test="idList != null">
|
|
collect_res_id IN
|
|
<foreach close=")" separator="," open="(" item="item" index="index" collection="idList">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
</where>
|
|
</update>
|
|
|
|
|
|
<select id="selectPageCollect" resultMap="BaseResultMap" parameterType="java.util.Map">
|
|
select *
|
|
from ts_pserson_collect
|
|
where collect_type=#{c}
|
|
</select>
|
|
</mapper>
|