|
@@ -6,12 +6,14 @@
|
|
|
<result column="ORG_CODE" jdbcType="VARCHAR" property="orgCode" />
|
|
|
<result column="USER_NAME" jdbcType="VARCHAR" property="userName" />
|
|
|
<result column="COLUMN_ID" jdbcType="DECIMAL" property="columnId" />
|
|
|
+ <result column="PRIMARY_NAME" jdbcType="VARCHAR" property="primaryName" />
|
|
|
+ <result column="ENABLE_STATUS" jdbcType="DECIMAL" property="enableStatus" />
|
|
|
</resultMap>
|
|
|
<sql id="columns">
|
|
|
- PRIMARY_ID, ORG_CODE, USER_NAME, COLUMN_ID
|
|
|
+ PRIMARY_ID, ORG_CODE, USER_NAME, COLUMN_ID, PRIMARY_NAME, ENABLE_STATUS
|
|
|
</sql>
|
|
|
<sql id="columns_alias">
|
|
|
- t.PRIMARY_ID, t.ORG_CODE, t.USER_NAME, t.COLUMN_ID
|
|
|
+ t.PRIMARY_ID, t.ORG_CODE, t.USER_NAME, t.COLUMN_ID, t.PRIMARY_NAME, t.ENABLE_STATUS
|
|
|
</sql>
|
|
|
<sql id="select">
|
|
|
SELECT <include refid="columns"/> FROM DIL_ROLE_ORGCODE_TABLE
|
|
@@ -20,7 +22,7 @@
|
|
|
SELECT <include refid="columns_alias"/> FROM DIL_ROLE_ORGCODE_TABLE t
|
|
|
</sql>
|
|
|
<sql id="where">
|
|
|
- <where>
|
|
|
+ <where>
|
|
|
<if test="primaryId != null">
|
|
|
and PRIMARY_ID = #{primaryId}
|
|
|
</if>
|
|
@@ -33,10 +35,16 @@
|
|
|
<if test="columnId != null">
|
|
|
and COLUMN_ID = #{columnId}
|
|
|
</if>
|
|
|
+ <if test="primaryName != null and primaryName != ''">
|
|
|
+ and PRIMARY_NAME = #{primaryName}
|
|
|
+ </if>
|
|
|
+ <if test="enableStatus != null">
|
|
|
+ and ENABLE_STATUS = #{enableStatus}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</sql>
|
|
|
<sql id="whereLike">
|
|
|
- <where>
|
|
|
+ <where>
|
|
|
<if test="primaryId != null">
|
|
|
and PRIMARY_ID = #{primaryId}
|
|
|
</if>
|
|
@@ -49,6 +57,12 @@
|
|
|
<if test="columnId != null">
|
|
|
and COLUMN_ID = #{columnId}
|
|
|
</if>
|
|
|
+ <if test="primaryName != null and primaryName != ''">
|
|
|
+ and PRIMARY_NAME LIKE '%${primaryName}%'
|
|
|
+ </if>
|
|
|
+ <if test="enableStatus != null">
|
|
|
+ and ENABLE_STATUS = #{enableStatus}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</sql>
|
|
|
<delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
|
|
@@ -57,22 +71,30 @@
|
|
|
</delete>
|
|
|
<delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
|
|
|
delete from DIL_ROLE_ORGCODE_TABLE
|
|
|
- where 1!=1
|
|
|
- <if test="orgCode != null and orgCode != ''">
|
|
|
- or ORG_CODE = #{orgCode}
|
|
|
- </if>
|
|
|
- <if test="userName != null and userName != ''">
|
|
|
- or USER_NAME = #{userName}
|
|
|
- </if>
|
|
|
- <if test="columnId != null">
|
|
|
- or COLUMN_ID = #{columnId}
|
|
|
- </if>
|
|
|
+ where 1!=1
|
|
|
+ <if test="orgCode != null and orgCode != ''">
|
|
|
+ or ORG_CODE = #{orgCode}
|
|
|
+ </if>
|
|
|
+ <if test="userName != null and userName != ''">
|
|
|
+ or USER_NAME = #{userName}
|
|
|
+ </if>
|
|
|
+ <if test="columnId != null">
|
|
|
+ or COLUMN_ID = #{columnId}
|
|
|
+ </if>
|
|
|
+ <if test="primaryName != null and primaryName != ''">
|
|
|
+ or PRIMARY_NAME = #{primaryName}
|
|
|
+ </if>
|
|
|
+ <if test="enableStatus != null">
|
|
|
+ or ENABLE_STATUS = #{enableStatus}
|
|
|
+ </if>
|
|
|
</delete>
|
|
|
<insert id="insert" parameterType="com.steerinfo.dil.model.DilRoleOrgcodeTable">
|
|
|
- insert into DIL_ROLE_ORGCODE_TABLE (PRIMARY_ID, ORG_CODE, USER_NAME,
|
|
|
- COLUMN_ID)
|
|
|
- values (#{primaryId,jdbcType=DECIMAL}, #{orgCode,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR},
|
|
|
- #{columnId,jdbcType=DECIMAL})
|
|
|
+ insert into DIL_ROLE_ORGCODE_TABLE (PRIMARY_ID, ORG_CODE, USER_NAME,
|
|
|
+ COLUMN_ID, PRIMARY_NAME, ENABLE_STATUS
|
|
|
+ )
|
|
|
+ values (#{primaryId,jdbcType=DECIMAL}, #{orgCode,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR},
|
|
|
+ #{columnId,jdbcType=DECIMAL}, #{primaryName,jdbcType=VARCHAR}, #{enableStatus,jdbcType=DECIMAL}
|
|
|
+ )
|
|
|
</insert>
|
|
|
<insert id="insertSelective" parameterType="com.steerinfo.dil.model.DilRoleOrgcodeTable">
|
|
|
insert into DIL_ROLE_ORGCODE_TABLE
|
|
@@ -89,6 +111,12 @@
|
|
|
<if test="columnId != null">
|
|
|
COLUMN_ID,
|
|
|
</if>
|
|
|
+ <if test="primaryName != null">
|
|
|
+ PRIMARY_NAME,
|
|
|
+ </if>
|
|
|
+ <if test="enableStatus != null">
|
|
|
+ ENABLE_STATUS,
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="primaryId != null">
|
|
@@ -103,13 +131,21 @@
|
|
|
<if test="columnId != null">
|
|
|
#{columnId,jdbcType=DECIMAL},
|
|
|
</if>
|
|
|
+ <if test="primaryName != null">
|
|
|
+ #{primaryName,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="enableStatus != null">
|
|
|
+ #{enableStatus,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
<update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.DilRoleOrgcodeTable">
|
|
|
update DIL_ROLE_ORGCODE_TABLE
|
|
|
set ORG_CODE = #{orgCode,jdbcType=VARCHAR},
|
|
|
- USER_NAME = #{userName,jdbcType=VARCHAR},
|
|
|
- COLUMN_ID = #{columnId,jdbcType=DECIMAL}
|
|
|
+ USER_NAME = #{userName,jdbcType=VARCHAR},
|
|
|
+ COLUMN_ID = #{columnId,jdbcType=DECIMAL},
|
|
|
+ PRIMARY_NAME = #{primaryName,jdbcType=VARCHAR},
|
|
|
+ ENABLE_STATUS = #{enableStatus,jdbcType=DECIMAL}
|
|
|
where PRIMARY_ID = #{primaryId,jdbcType=DECIMAL}
|
|
|
</update>
|
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.DilRoleOrgcodeTable">
|
|
@@ -124,6 +160,12 @@
|
|
|
<if test="columnId != null">
|
|
|
COLUMN_ID = #{columnId,jdbcType=DECIMAL},
|
|
|
</if>
|
|
|
+ <if test="primaryName != null">
|
|
|
+ PRIMARY_NAME = #{primaryName,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="enableStatus != null">
|
|
|
+ ENABLE_STATUS = #{enableStatus,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
</set>
|
|
|
where PRIMARY_ID = #{primaryId,jdbcType=DECIMAL}
|
|
|
</update>
|
|
@@ -140,49 +182,76 @@
|
|
|
<include refid="whereLike"/>
|
|
|
</select>
|
|
|
<insert id="batchInsert" parameterType="java.util.List">
|
|
|
- insert into DIL_ROLE_ORGCODE_TABLE
|
|
|
- (PRIMARY_ID,
|
|
|
- ORG_CODE, USER_NAME, COLUMN_ID
|
|
|
- )
|
|
|
- ( <foreach collection="list" item="item" separator="union all">
|
|
|
- select
|
|
|
- #{item.primaryId,jdbcType=DECIMAL},
|
|
|
- #{item.orgCode,jdbcType=VARCHAR}, #{item.userName,jdbcType=VARCHAR}, #{item.columnId,jdbcType=DECIMAL}
|
|
|
- from dual
|
|
|
- </foreach> )
|
|
|
+ insert into DIL_ROLE_ORGCODE_TABLE
|
|
|
+ (PRIMARY_ID,
|
|
|
+ ORG_CODE, USER_NAME, COLUMN_ID,
|
|
|
+ PRIMARY_NAME, ENABLE_STATUS)
|
|
|
+ ( <foreach collection="list" item="item" separator="union all">
|
|
|
+ select
|
|
|
+ #{item.primaryId,jdbcType=DECIMAL},
|
|
|
+ #{item.orgCode,jdbcType=VARCHAR}, #{item.userName,jdbcType=VARCHAR}, #{item.columnId,jdbcType=DECIMAL},
|
|
|
+ #{item.primaryName,jdbcType=VARCHAR}, #{item.enableStatus,jdbcType=DECIMAL} from dual
|
|
|
+ </foreach> )
|
|
|
</insert>
|
|
|
<update id="batchUpdate" parameterType="java.util.List">
|
|
|
- update DIL_ROLE_ORGCODE_TABLE
|
|
|
- set
|
|
|
- PRIMARY_ID=
|
|
|
- <foreach collection="list" item="item" index="index" separator=" " open="case PRIMARY_ID" close="end">
|
|
|
- when #{item.primaryId,jdbcType=DECIMAL} then #{item.primaryId,jdbcType=DECIMAL}
|
|
|
- </foreach>
|
|
|
- ,ORG_CODE=
|
|
|
- <foreach collection="list" item="item" index="index" separator=" " open="case PRIMARY_ID" close="end">
|
|
|
- when #{item.primaryId,jdbcType=DECIMAL} then #{item.orgCode,jdbcType=VARCHAR}
|
|
|
- </foreach>
|
|
|
- ,USER_NAME=
|
|
|
- <foreach collection="list" item="item" index="index" separator=" " open="case PRIMARY_ID" close="end">
|
|
|
- when #{item.primaryId,jdbcType=DECIMAL} then #{item.userName,jdbcType=VARCHAR}
|
|
|
- </foreach>
|
|
|
- ,COLUMN_ID=
|
|
|
- <foreach collection="list" item="item" index="index" separator=" " open="case PRIMARY_ID" close="end">
|
|
|
- when #{item.primaryId,jdbcType=DECIMAL} then #{item.columnId,jdbcType=DECIMAL}
|
|
|
- </foreach>
|
|
|
- where PRIMARY_ID in
|
|
|
- <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
|
|
|
- #{item.primaryId,jdbcType=DECIMAL}
|
|
|
- </foreach>
|
|
|
+ update DIL_ROLE_ORGCODE_TABLE
|
|
|
+ set
|
|
|
+ PRIMARY_ID=
|
|
|
+ <foreach collection="list" item="item" index="index" separator=" " open="case PRIMARY_ID" close="end">
|
|
|
+ when #{item.primaryId,jdbcType=DECIMAL} then #{item.primaryId,jdbcType=DECIMAL}
|
|
|
+ </foreach>
|
|
|
+ ,ORG_CODE=
|
|
|
+ <foreach collection="list" item="item" index="index" separator=" " open="case PRIMARY_ID" close="end">
|
|
|
+ when #{item.primaryId,jdbcType=DECIMAL} then #{item.orgCode,jdbcType=VARCHAR}
|
|
|
+ </foreach>
|
|
|
+ ,USER_NAME=
|
|
|
+ <foreach collection="list" item="item" index="index" separator=" " open="case PRIMARY_ID" close="end">
|
|
|
+ when #{item.primaryId,jdbcType=DECIMAL} then #{item.userName,jdbcType=VARCHAR}
|
|
|
+ </foreach>
|
|
|
+ ,COLUMN_ID=
|
|
|
+ <foreach collection="list" item="item" index="index" separator=" " open="case PRIMARY_ID" close="end">
|
|
|
+ when #{item.primaryId,jdbcType=DECIMAL} then #{item.columnId,jdbcType=DECIMAL}
|
|
|
+ </foreach>
|
|
|
+ ,PRIMARY_NAME=
|
|
|
+ <foreach collection="list" item="item" index="index" separator=" " open="case PRIMARY_ID" close="end">
|
|
|
+ when #{item.primaryId,jdbcType=DECIMAL} then #{item.primaryName,jdbcType=VARCHAR}
|
|
|
+ </foreach>
|
|
|
+ ,ENABLE_STATUS=
|
|
|
+ <foreach collection="list" item="item" index="index" separator=" " open="case PRIMARY_ID" close="end">
|
|
|
+ when #{item.primaryId,jdbcType=DECIMAL} then #{item.enableStatus,jdbcType=DECIMAL}
|
|
|
+ </foreach>
|
|
|
+ where PRIMARY_ID in
|
|
|
+ <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
|
|
|
+ #{item.primaryId,jdbcType=DECIMAL}
|
|
|
+ </foreach>
|
|
|
</update>
|
|
|
+
|
|
|
<delete id="batchDelete" parameterType="java.util.List">
|
|
|
delete from DIL_ROLE_ORGCODE_TABLE
|
|
|
- where PRIMARY_ID in
|
|
|
+ where PRIMARY_ID in
|
|
|
<foreach collection="list" item="id" open="(" close=")" separator=",">
|
|
|
#{id}
|
|
|
</foreach>
|
|
|
</delete>
|
|
|
+
|
|
|
<!-- 友情提示!!!-->
|
|
|
<!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
|
|
|
-
|
|
|
+ <delete id="deleteSchmenLColumnData" parameterType="map">
|
|
|
+ delete from DIL_ROLE_ORGCODE_TABLE DROT
|
|
|
+ where DROT.USER_NAME = #{userName}
|
|
|
+ and DROT.ORG_CODE = #{orgCode}
|
|
|
+ and DROT.PRIMARY_NAME = #{schemeName}
|
|
|
+ AND DROT.COLUMN_ID IN (SELECT DTCR.PRIMARY_ID FROM DIL_TABLE_COLUMN_ROLE DTCR
|
|
|
+ WHERE DTCR.TABLE_NAME = #{tableName})
|
|
|
+ </delete>
|
|
|
+ <update id="updateEnableStatus" parameterType="map">
|
|
|
+ UPDATE DIL_ROLE_ORGCODE_TABLE DROT
|
|
|
+ SET DROT.ENABLE_STATUS = 0
|
|
|
+ where
|
|
|
+ DROT.USER_NAME = #{userName}
|
|
|
+ AND DROT.COLUMN_ID IN
|
|
|
+ (SELECT DTCR.PRIMARY_ID FROM DIL_TABLE_COLUMN_ROLE DTCR
|
|
|
+ WHERE DTCR.TABLE_NAME = #{tableName})
|
|
|
+ AND DROT.ORG_CODE = #{orgCode}
|
|
|
+ </update>
|
|
|
</mapper>
|