398 lines
16 KiB
XML
398 lines
16 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.SarFileSplitMenuEODao" >
|
|
<!-- Result Map-->
|
|
<resultMap id="BaseResultMap" type="com.adc.da.slrs.standardSplit.entity.SarFileSplitMenuEO" >
|
|
<id column="id" property="id" />
|
|
<result column="info_id" property="infoId" />
|
|
<result column="name" property="name" />
|
|
<result column="p_id" property="pId" />
|
|
<result column="display_seq" property="displaySeq" />
|
|
<result column="valid_flag" property="validFlag" />
|
|
<result column="creation_time" property="creationTime" />
|
|
<result column="modify_time" property="modifyTime" />
|
|
<result column="remarks" property="remarks" />
|
|
<result column="creation_user" property="creationUser" />
|
|
<result column="modify_user" property="modifyUser" />
|
|
<result column="item_name" property="itemName" />
|
|
</resultMap>
|
|
|
|
<!-- SAR_FILE_SPLIT_MENU table all fields -->
|
|
<sql id="Base_Column_List" >
|
|
id, info_id, name, p_id, display_seq, valid_flag, creation_time, modify_time, remarks, creation_user, modify_user,item_name
|
|
</sql>
|
|
|
|
<!-- 查询条件 -->
|
|
<sql id="Base_Where_Clause">
|
|
where 1=1
|
|
<trim suffixOverrides="," >
|
|
<if test="id != null" >
|
|
and id ${idOperator} #{id}
|
|
</if>
|
|
<if test="infoId != null" >
|
|
and info_id ${infoIdOperator} #{infoId}
|
|
</if>
|
|
<if test="name != null" >
|
|
and name ${nameOperator} #{name}
|
|
</if>
|
|
<if test="pId != null" >
|
|
and p_id ${pIdOperator} #{pId}
|
|
</if>
|
|
<if test="displaySeq != null" >
|
|
and display_seq ${displaySeqOperator} #{displaySeq}
|
|
</if>
|
|
<if test="validFlag != null" >
|
|
and valid_flag ${validFlagOperator} #{validFlag}
|
|
</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="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="remarks != null" >
|
|
and remarks ${remarksOperator} #{remarks}
|
|
</if>
|
|
<if test="creationUser != null" >
|
|
and creation_user ${creationUserOperator} #{creationUser}
|
|
</if>
|
|
<if test="modifyUser != null" >
|
|
and modify_user ${modifyUserOperator} #{modifyUser}
|
|
</if>
|
|
</trim>
|
|
</sql>
|
|
|
|
<!-- 插入记录 -->
|
|
<insert id="insert" parameterType="com.adc.da.slrs.standardSplit.entity.SarFileSplitMenuEO" >
|
|
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
|
|
SELECT SEQ_SAR_FILE_SPLIT_MENU.NEXTVAL FROM DUAL
|
|
</selectKey> -->
|
|
insert into SAR_FILE_SPLIT_MENU(<include refid="Base_Column_List" />)
|
|
values (#{id, jdbcType=VARCHAR}, #{infoId, jdbcType=VARCHAR}, #{name, jdbcType=VARCHAR}, #{pId, jdbcType=VARCHAR}, #{displaySeq, jdbcType=VARCHAR}, #{validFlag, jdbcType=INTEGER}, #{creationTime, jdbcType=TIMESTAMP}, #{modifyTime, jdbcType=TIMESTAMP}, #{remarks, jdbcType=VARCHAR}, #{creationUser, jdbcType=VARCHAR}, #{modifyUser, jdbcType=VARCHAR})
|
|
</insert>
|
|
|
|
<!-- 动态插入记录 主键是序列 -->
|
|
<insert id="insertSelective" parameterType="com.adc.da.slrs.standardSplit.entity.SarFileSplitMenuEO" >
|
|
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
|
|
SELECT SEQ_SAR_FILE_SPLIT_MENU.NEXTVAL FROM DUAL
|
|
</selectKey> -->
|
|
insert into SAR_FILE_SPLIT_MENU
|
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
|
<if test="id != null" >id,</if>
|
|
<if test="infoId != null" >info_id,</if>
|
|
<if test="name != null" >name,</if>
|
|
<if test="pId != null" >p_id,</if>
|
|
<if test="displaySeq != null" >display_seq,</if>
|
|
<if test="validFlag != null" >valid_flag,</if>
|
|
<if test="creationTime != null" >creation_time,</if>
|
|
<if test="modifyTime != null" >modify_time,</if>
|
|
<if test="remarks != null" >remarks,</if>
|
|
<if test="creationUser != null" >creation_user,</if>
|
|
<if test="modifyUser != null" >modify_user,</if>
|
|
<if test="itemName != null" >item_name,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
|
<if test="id != null" >#{id, jdbcType=VARCHAR},</if>
|
|
<if test="infoId != null" >#{infoId, jdbcType=VARCHAR},</if>
|
|
<if test="name != null" >#{name, jdbcType=VARCHAR},</if>
|
|
<if test="pId != null" >#{pId, jdbcType=VARCHAR},</if>
|
|
<if test="displaySeq != null" >#{displaySeq, jdbcType=VARCHAR},</if>
|
|
<if test="validFlag != null" >#{validFlag, jdbcType=INTEGER},</if>
|
|
<if test="creationTime != null" >#{creationTime, jdbcType=TIMESTAMP},</if>
|
|
<if test="modifyTime != null" >#{modifyTime, jdbcType=TIMESTAMP},</if>
|
|
<if test="remarks != null" >#{remarks, jdbcType=VARCHAR},</if>
|
|
<if test="creationUser != null" >#{creationUser, jdbcType=VARCHAR},</if>
|
|
<if test="modifyUser != null" >#{modifyUser, jdbcType=VARCHAR},</if>
|
|
<if test="itemName != null" >#{itemName, jdbcType=VARCHAR},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<!-- 根据pk,修改记录-->
|
|
<update id="updateByPrimaryKey" parameterType="com.adc.da.slrs.standardSplit.entity.SarFileSplitMenuEO" >
|
|
update SAR_FILE_SPLIT_MENU
|
|
set info_id = #{infoId},
|
|
name = #{name},
|
|
p_id = #{pId},
|
|
display_seq = #{displaySeq},
|
|
valid_flag = #{validFlag},
|
|
creation_time = #{creationTime},
|
|
modify_time = #{modifyTime},
|
|
remarks = #{remarks},
|
|
creation_user = #{creationUser},
|
|
modify_user = #{modifyUser}
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<!-- 修改记录,只修改只不为空的字段 -->
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.adc.da.slrs.standardSplit.entity.SarFileSplitMenuEO" >
|
|
update SAR_FILE_SPLIT_MENU
|
|
<set >
|
|
<if test="infoId != null" >
|
|
info_id = #{infoId},
|
|
</if>
|
|
<if test="name != null" >
|
|
name = #{name},
|
|
</if>
|
|
<if test="pId != null" >
|
|
p_id = #{pId},
|
|
</if>
|
|
<if test="displaySeq != null" >
|
|
display_seq = #{displaySeq},
|
|
</if>
|
|
<if test="validFlag != null" >
|
|
valid_flag = #{validFlag},
|
|
</if>
|
|
<if test="creationTime != null" >
|
|
creation_time = #{creationTime},
|
|
</if>
|
|
<if test="modifyTime != null" >
|
|
modify_time = #{modifyTime},
|
|
</if>
|
|
<if test="remarks != null" >
|
|
remarks = #{remarks},
|
|
</if>
|
|
<if test="creationUser != null" >
|
|
creation_user = #{creationUser},
|
|
</if>
|
|
<if test="modifyUser != null" >
|
|
modify_user = #{modifyUser},
|
|
</if>
|
|
<if test="itemName != null" >
|
|
item_name = #{itemName},
|
|
</if>
|
|
</set>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<!-- 根据id查询 SAR_FILE_SPLIT_MENU -->
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
|
|
select <include refid="Base_Column_List" />
|
|
from SAR_FILE_SPLIT_MENU
|
|
where id = #{value}
|
|
|
|
</select>
|
|
|
|
<!-- 删除记录 -->
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
|
delete from SAR_FILE_SPLIT_MENU
|
|
where id = #{value}
|
|
|
|
</delete>
|
|
|
|
<!-- SAR_FILE_SPLIT_MENU 列表总数-->
|
|
<select id="queryByCount" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">
|
|
select count(1) from SAR_FILE_SPLIT_MENU
|
|
<include refid="Base_Where_Clause"/>
|
|
</select>
|
|
|
|
<!-- 查询SAR_FILE_SPLIT_MENU列表 -->
|
|
<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_FILE_SPLIT_MENU
|
|
<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_FILE_SPLIT_MENU
|
|
<include refid="Base_Where_Clause"/>
|
|
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
|
|
${pager.orderCondition}
|
|
</if>
|
|
</select>
|
|
|
|
|
|
<!-- 批量插入接口 -->
|
|
<insert id="insertForeach" parameterType="java.util.List">
|
|
insert into SAR_FILE_SPLIT_MENU(<include refid="Base_Column_List" />)
|
|
values
|
|
<foreach collection="list" item="item" index="index" separator=",">
|
|
(#{item.id, jdbcType=VARCHAR},
|
|
#{item.infoId, jdbcType=VARCHAR},
|
|
#{item.name, jdbcType=VARCHAR},
|
|
#{item.pId, jdbcType=VARCHAR},
|
|
#{item.displaySeq, jdbcType=VARCHAR},
|
|
#{item.validFlag, jdbcType=INTEGER},
|
|
#{item.creationTime, jdbcType=TIMESTAMP},
|
|
#{item.modifyTime, jdbcType=TIMESTAMP}, #{item.remarks, jdbcType=VARCHAR},
|
|
#{item.creationUser, jdbcType=VARCHAR}, #{item.modifyUser, jdbcType=VARCHAR} , #{item.itemName, jdbcType=VARCHAR})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<delete id="deleteByIds" parameterType="com.adc.da.slrs.standardSplit.entity.SarFileSplitMenuEO">
|
|
delete from SAR_FILE_SPLIT_MENU
|
|
where info_id in
|
|
<foreach collection="infoIdList" index="index" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</delete>
|
|
|
|
|
|
<update id="updateDisplaySeqAdd" parameterType="com.adc.da.slrs.standardSplit.entity.SarFileSplitMenuEO" >
|
|
update SAR_FILE_SPLIT_MENU
|
|
set display_seq = display_seq+#{childrenCount},
|
|
modify_time = #{modifyTime},
|
|
modify_user = #{modifyUser}
|
|
where display_seq >= #{displaySeqStart} and display_seq < #{displaySeqEnd} and valid_flag = 0 and info_id = #{infoId}
|
|
</update>
|
|
|
|
<update id="updateDisplaySeqCut" parameterType="com.adc.da.slrs.standardSplit.entity.SarFileSplitMenuEO" >
|
|
update SAR_FILE_SPLIT_MENU
|
|
set display_seq = display_seq-#{childrenCount},
|
|
modify_time = #{modifyTime},
|
|
modify_user = #{modifyUser}
|
|
where display_seq <= #{displaySeqEnd} and display_seq > #{displaySeqStart} and valid_flag = 0 and info_id = #{infoId}
|
|
</update>
|
|
|
|
<!--oracle-->
|
|
<!--<select id="queryByPidExcpetSelf" resultMap="BaseResultMap" parameterType="com.adc.da.lawss.entity.SarFileSplitMenuEO">-->
|
|
<!--select SAR_FILE_SPLIT_MENU.* from SAR_FILE_SPLIT_MENU-->
|
|
<!--where valid_flag=0 and id != #{id}-->
|
|
<!--start with id=#{id} connect by prior id= p_id-->
|
|
<!--</select>-->
|
|
|
|
<select id="queryByPidExcpetSelf" resultMap="BaseResultMap" parameterType="com.adc.da.slrs.standardSplit.entity.SarFileSplitMenuEO">
|
|
SELECT * FROM (
|
|
SELECT t1.*,
|
|
IF(FIND_IN_SET(id, @pids) > 0, @pids := CONCAT(@pids, ',', id), '0') AS ischild
|
|
FROM (
|
|
SELECT * FROM SAR_FILE_SPLIT_MENU AS t WHERE valid_flag=0 ORDER BY t.id ASC
|
|
) t1,
|
|
(SELECT @pids := #{id}) t2
|
|
) t3 WHERE ischild != '0'
|
|
</select>
|
|
|
|
<delete id="deleteByPId" parameterType="java.lang.String">
|
|
delete
|
|
from SAR_FILE_SPLIT_MENU
|
|
where id in
|
|
<foreach collection="id" open="(" index="index" item="item" close=")" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
|
|
</delete>
|
|
<select id="getChild" resultType="String">
|
|
select n.id
|
|
from SAR_FILE_SPLIT_MENU n,
|
|
(select (@nodes := queryChildrenTempNode1(#{id})) as pids) t
|
|
WHERE FIND_IN_SET(n.id, t.pids)
|
|
</select>
|
|
|
|
<select id="getChildData" resultType="String">
|
|
SELECT distinct id FROM SAR_FILE_SPLIT_MENU
|
|
WHERE FIND_IN_SET(P_ID,#{id})>0
|
|
</select>
|
|
|
|
<!--<select id="getMaxDisplayByid" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">-->
|
|
<!--SELECT max(SAR_FILE_SPLIT_MENU.DISPLAY_SEQ) FROM-->
|
|
<!--SAR_FILE_SPLIT_MENU START WITH id = #{id} CONNECT BY PRIOR id = p_id-->
|
|
<!--</select>-->
|
|
|
|
<select id="getMaxDisplayByid" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">
|
|
SELECT max(t3.DISPLAY_SEQ) FROM (
|
|
SELECT t1.*,
|
|
IF(FIND_IN_SET(id, @pids) > 0, @pids := CONCAT(@pids, ',', id), '0') AS ischild
|
|
FROM (
|
|
SELECT * FROM SAR_FILE_SPLIT_MENU AS t WHERE valid_flag=0 ORDER BY t.id ASC
|
|
) t1,
|
|
(SELECT @pids := #{id}) t2
|
|
) t3 WHERE ischild != '0'
|
|
</select>
|
|
|
|
<!--<select id="getChildrenCountByParentId" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">-->
|
|
<!--SELECT count(*) FROM-->
|
|
<!--SAR_FILE_SPLIT_MENU START WITH id = #{id} CONNECT BY PRIOR id = p_id-->
|
|
<!--</select>-->
|
|
|
|
<select id="getChildrenCountByParentId" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">
|
|
SELECT count(*) FROM
|
|
SAR_FILE_SPLIT_MENU ,(SELECT getSplitChildList(#{id}) childListStr) t WHERE FIND_IN_SET(ID,childListStr)
|
|
</select>
|
|
|
|
<!--<update id="updateChildrenDisplaySeqByIDAdd" parameterType="com.adc.da.slrs.standardSplit.entity.SarFileSplitMenuEO" >-->
|
|
<!--update SAR_FILE_SPLIT_MENU-->
|
|
<!--set display_seq = display_seq + #{childrenCount},-->
|
|
<!--modify_time = #{modifyTime},-->
|
|
<!--modify_user = #{modifyUser}-->
|
|
<!--where id in ( SELECT id FROM-->
|
|
<!--SAR_FILE_SPLIT_MENU START WITH id = #{id} CONNECT BY PRIOR id = p_id)-->
|
|
<!--</update>-->
|
|
|
|
<update id="updateChildrenDisplaySeqByIDAdd" parameterType="com.adc.da.slrs.standardSplit.entity.SarFileSplitMenuEO" >
|
|
update SAR_FILE_SPLIT_MENU
|
|
set display_seq = display_seq + #{childrenCount},
|
|
modify_time = #{modifyTime},
|
|
modify_user = #{modifyUser}
|
|
where id in (SELECT id
|
|
FROM SAR_FILE_SPLIT_MENU,
|
|
(SELECT getSplitChildList(#{id}) childListStr) t
|
|
WHERE FIND_IN_SET(ID, childListStr)
|
|
)
|
|
</update>
|
|
|
|
<!--<update id="updateChildrenDisplaySeqByIDCut" parameterType="com.adc.da.slrs.standardSplit.entity.SarFileSplitMenuEO" >-->
|
|
<!--update SAR_FILE_SPLIT_MENU-->
|
|
<!--set display_seq = display_seq - #{childrenCount},-->
|
|
<!--modify_time = #{modifyTime},-->
|
|
<!--modify_user = #{modifyUser}-->
|
|
<!--where id in ( SELECT id FROM-->
|
|
<!--SAR_FILE_SPLIT_MENU START WITH id = #{id} CONNECT BY PRIOR id = p_id)-->
|
|
<!--</update>-->
|
|
|
|
<update id="updateChildrenDisplaySeqByIDCut" parameterType="com.adc.da.slrs.standardSplit.entity.SarFileSplitMenuEO" >
|
|
update SAR_FILE_SPLIT_MENU
|
|
set display_seq = display_seq - #{childrenCount},
|
|
modify_time = #{modifyTime},
|
|
modify_user = #{modifyUser}
|
|
where id in (SELECT id
|
|
FROM SAR_FILE_SPLIT_MENU,
|
|
(SELECT getSplitChildList(#{id}) childListStr) t
|
|
WHERE FIND_IN_SET(ID, childListStr)
|
|
)
|
|
</update>
|
|
|
|
<!--oracle 写法-->
|
|
<!--<select id="queryAllChildrenByid" resultMap="BaseResultMap" parameterType="com.adc.da.lawss.entity.SarFileSplitMenuEO">-->
|
|
<!--select SAR_FILE_SPLIT_MENU.* from SAR_FILE_SPLIT_MENU-->
|
|
<!--where valid_flag=0-->
|
|
<!--start with id=#{id} connect by prior id= p_id-->
|
|
<!--</select>-->
|
|
|
|
|
|
<select id="queryAllChildrenByid" resultMap="BaseResultMap" parameterType="com.adc.da.slrs.standardSplit.entity.SarFileSplitMenuEO">
|
|
SELECT * FROM (
|
|
SELECT t1.*,
|
|
IF(FIND_IN_SET(id, @pids) > 0, @pids := CONCAT(@pids, ',', id), '0') AS ischild
|
|
FROM (
|
|
SELECT * FROM SAR_FILE_SPLIT_MENU AS t WHERE valid_flag=0 ORDER BY t.id ASC
|
|
) t1,
|
|
(SELECT @pids := #{id}) t2
|
|
) t3 WHERE ischild != '0'
|
|
</select>
|
|
|
|
<delete id="deleteByIdList" parameterType="java.util.List">
|
|
delete from SAR_FILE_SPLIT_MENU
|
|
where id in
|
|
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</delete>
|
|
|
|
</mapper>
|