融合冲突代码

This commit is contained in:
zhangshilin
2018-03-08 19:10:52 +08:00
parent a55662d868
commit be8a93126c

View File

@@ -5,10 +5,11 @@
<resultMap id="dictResultMap" type="com.nis.domain.basics.ServiceDictInfo" >
<id column="service_dict_id" property="serviceDictId" jdbcType="INTEGER" />
<result column="item_type" property="itemType" jdbcType="INTEGER" />
<result column="item_code" property="itemCode" jdbcType="INTEGER" />
<result column="item_code" property="itemCode" jdbcType="VARCHAR" />
<result column="item_value" property="itemValue" jdbcType="VARCHAR" />
<result column="item_desc" property="itemDesc" jdbcType="VARCHAR" />
<result column="is_leaf" property="isLeaf" jdbcType="INTEGER" />
<result column="level_no" property="levelNo" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
@@ -29,7 +30,15 @@
<result property="name" column="name"/>
</association>
</resultMap>
<resultMap id="dictResultSimpleMap" type="com.nis.domain.basics.ServiceDictInfo" >
<id column="service_dict_id" property="serviceDictId" jdbcType="INTEGER" />
<result column="item_type" property="itemType" jdbcType="INTEGER" />
<result column="item_code" property="itemCode" jdbcType="INTEGER" />
<result column="item_value" property="itemValue" jdbcType="VARCHAR" />
<result column="item_desc" property="itemDesc" jdbcType="VARCHAR" />
<result column="is_leaf" property="isLeaf" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
</resultMap>
<sql id="serviceDictInfoColumns">
s.service_dict_id AS serviceDictId,
s.item_type AS itemType,
@@ -38,12 +47,23 @@
s.item_desc AS itemDesc,
s.parent_id AS "parent.serviceDictId",
s.is_leaf AS isLeaf,
s.level_no AS levelNo,
s.is_valid AS isValid,
s.creator_id AS "serviceDictCreator.id",
s.create_time AS createTime,
s.editor_id AS "serviceDictEditor.id",
s.edit_time AS editTime
</sql>
<sql id="serviceDictInfoColumnsSimple">
s.service_dict_id AS serviceDictId,
s.item_type AS itemType,
s.item_code AS itemCode,
s.item_value AS itemValue,
s.item_desc AS itemDesc,
s.parent_id AS "parent.serviceDictId",
s.is_leaf AS isLeaf,
s.is_valid AS isValid
</sql>
@@ -119,7 +139,7 @@
<include refid="serviceDictInfoColumns"/>
FROM service_dict_info s
<include refid="menuJoins"/>
WHERE s.is_valid =1
WHERE s.is_valid =1 AND s.parent_id != 0
</select>
<!-- 查询所有非叶子配置 -->
@@ -128,72 +148,151 @@
<include refid="serviceDictInfoColumns"/>
FROM service_dict_info s
WHERE s.is_valid = 1 AND s.is_leaf = 0 AND item_type = #{itemType}
ORDER BY s.create_time desc
</select>
<!-- 条件查询分页(==) -->
<select id="findDictSearchList" resultMap="dictResultMap" parameterType="com.nis.domain.basics.ServiceDictInfo">
SELECT * FROM service_dict_info WHERE is_valid=1
<if test="itemType != null and itemType != '' " >
AND item_type like '%${itemType}%'
</if>
<if test="itemCode != null and itemCode != '' " >
AND item_code like '%${itemCode}%'
</if>
<if test="itemValue!= null and itemValue != '' " >
AND item_value like '%${itemValue}%'
</if>
<if test="beginDate !=null" >
AND create_time &gt;= #{beginDate,jdbcType=TIMESTAMP}
</if>
<if test="endDate !=null" >
AND create_time &lt;= DATE_ADD(#{endDate,jdbcType=TIMESTAMP},INTERVAL 1 DAY)
</if>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY create_time desc
</otherwise>
</choose>
</select>
<!-- 条件查询分页(!=) -->
<select id="findDictSearchListN" resultMap="dictResultMap" parameterType="com.nis.domain.basics.ServiceDictInfo">
SELECT * FROM service_dict_info WHERE is_valid=1
<!-- 条件查询顶层分页(==) -->
<select id="findDictTopSearchList" resultMap="dictResultMap" parameterType="com.nis.domain.basics.ServiceDictInfo">
SELECT * FROM service_dict_info s WHERE s.is_valid=1
<if test="itemCode != null and itemCode != '' " >
AND item_code like '%${itemCode}%'
AND s.item_code like '%${itemCode}%'
</if>
<if test="itemValue!= null and itemValue != '' " >
AND item_value like '%${itemValue}%'
AND s.item_value like '%${itemValue}%'
</if>
<if test="itemType != null and itemType != '' " >
AND item_type != ${itemType}
AND s.item_type = ${itemType}
</if>
<if test="beginDate !=null" >
AND s.create_time &gt;= #{beginDate,jdbcType=TIMESTAMP}
</if>
<if test="endDate !=null" >
AND s.create_time &lt;= DATE_ADD(#{endDate,jdbcType=TIMESTAMP},INTERVAL 1 DAY)
</if>
AND s.parent_id not in (
SELECT s2.service_dict_id FROM service_dict_info s2 WHERE s2.is_valid=1
<if test="itemCode != null and itemCode != '' " >
AND s2.item_code like '%${itemCode}%'
</if>
<if test="itemValue!= null and itemValue != '' " >
AND s2.item_value like '%${itemValue}%'
</if>
<if test="itemType != null and itemType != '' " >
AND s2.item_type = ${itemType}
</if>
<if test="beginDate !=null" >
AND s2.create_time &gt;= #{beginDate,jdbcType=TIMESTAMP}
</if>
<if test="endDate !=null" >
AND s2.create_time &lt;= DATE_ADD(#{endDate,jdbcType=TIMESTAMP},INTERVAL 1 DAY)
</if>
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY s.${page.orderBy}
</when>
<otherwise>
ORDER BY s.create_time desc
</otherwise>
</choose>
</select>
<!-- 条件查询顶层分页(!=) -->
<select id="findDictTopSearchListN" resultMap="dictResultMap" parameterType="com.nis.domain.basics.ServiceDictInfo">
SELECT * FROM service_dict_info s WHERE s.is_valid=1
<if test="itemCode != null and itemCode != '' " >
AND s.item_code like '%${itemCode}%'
</if>
<if test="itemValue!= null and itemValue != '' " >
AND s.item_value like '%${itemValue}%'
</if>
<if test="itemType != null and itemType != '' " >
AND s.item_type != ${itemType}
</if>
<if test="beginDate !=null" >
AND s.create_time &gt;= #{beginDate,jdbcType=TIMESTAMP}
</if>
<if test="endDate !=null" >
AND s.create_time &lt;= DATE_ADD(#{endDate,jdbcType=TIMESTAMP},INTERVAL 1 DAY)
</if>
AND s.parent_id not in (
SELECT s2.service_dict_id FROM service_dict_info s2 WHERE s2.is_valid=1
<if test="itemCode != null and itemCode != '' " >
AND s2.item_code like '%${itemCode}%'
</if>
<if test="itemValue!= null and itemValue != '' " >
AND s2.item_value like '%${itemValue}%'
</if>
<if test="itemType != null and itemType != '' " >
AND s2.item_type != ${itemType}
</if>
<if test="beginDate !=null" >
AND s2.create_time &gt;= #{beginDate,jdbcType=TIMESTAMP}
</if>
<if test="endDate !=null" >
AND s2.create_time &lt;= DATE_ADD(#{endDate,jdbcType=TIMESTAMP},INTERVAL 1 DAY)
</if>
)
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY s.${page.orderBy}
</when>
<otherwise>
ORDER BY s.create_time desc
</otherwise>
</choose>
</select>
<!-- 条件查询所有列表 (==)-->
<select id="findAllDictSearchList" resultMap="dictResultMap" parameterType="com.nis.domain.basics.ServiceDictInfo">
SELECT * FROM service_dict_info WHERE is_valid=1
<if test="itemValue != null and itemValue != '' " >
AND item_value like '%${itemValue}%'
</if>
<if test="itemCode != null and itemCode != '' " >
AND item_code like '%${itemCode}%'
</if>
<if test="itemType != null and itemType != '' " >
AND item_type = #{itemType}
</if>
<if test="beginDate !=null" >
AND create_time &gt;= #{beginDate,jdbcType=TIMESTAMP}
</if>
<if test="endDate !=null" >
AND create_time &lt;= DATE_ADD(#{endDate,jdbcType=TIMESTAMP},INTERVAL 1 DAY)
</if>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY create_time desc
</otherwise>
</choose>
</select>
<!-- 条件查询所有列表 (!=)-->
<select id="findAllDictSearchListN" resultMap="dictResultMap" parameterType="com.nis.domain.basics.ServiceDictInfo">
SELECT * FROM service_dict_info WHERE is_valid=1
<if test="itemValue != null and itemValue != '' " >
AND item_value like '%${itemValue}%'
</if>
<if test="itemCode != null and itemCode != '' " >
AND item_code like '%${itemCode}%'
</if>
<if test="itemType != null and itemType != '' " >
AND item_type != #{itemType}
</if>
<if test="beginDate !=null" >
AND create_time &gt;= #{beginDate,jdbcType=TIMESTAMP}
</if>
<if test="endDate !=null" >
AND create_time &lt;= DATE_ADD(#{endDate,jdbcType=TIMESTAMP},INTERVAL 1 DAY)
</if>
</select>
<!-- 根据主键查询字典详细信息 -->
@@ -228,10 +327,10 @@
<!-- 新增字典信息 -->
<insert id="insertDict" parameterType="com.nis.domain.basics.ServiceDictInfo" useGeneratedKeys="true" keyProperty="id" >
insert into service_dict_info (item_type, item_code, item_value, item_desc, parent_id, is_leaf, is_valid, creator_id, create_time, editor_id, edit_time)
insert into service_dict_info (item_type, item_code, item_value, item_desc, parent_id, is_leaf, level_no, is_valid, creator_id, create_time, editor_id, edit_time)
values ( #{itemType,jdbcType=INTEGER}, #{itemCode,jdbcType=INTEGER},
#{itemValue,jdbcType=VARCHAR}, #{itemDesc,jdbcType=VARCHAR},
#{parent.serviceDictId,jdbcType=INTEGER}, #{isLeaf,jdbcType=INTEGER}, #{isValid,jdbcType=INTEGER},
#{parent.serviceDictId,jdbcType=INTEGER}, #{isLeaf,jdbcType=INTEGER},#{levelNo,jdbcType=VARCHAR}, #{isValid,jdbcType=INTEGER},
#{serviceDictCreator.id,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{serviceDictEditor.id,jdbcType=INTEGER}, #{editTime,jdbcType=TIMESTAMP})
</insert>
@@ -248,11 +347,19 @@
s.item_desc = #{itemDesc},
s.parent_id = #{parent.serviceDictId},
s.is_leaf = #{isLeaf},
s.level_no = #{levelNo},
s.creator_id = #{serviceDictCreator.id},
s.editor_id = #{serviceDictEditor.id},
s.edit_time = #{editTime}
WHERE s.service_dict_id = #{serviceDictId}
</update>
<!-- 保存层级 -->
<update id="updateLevelNo">
UPDATE service_dict_info s SET
s.level_no = #{levelNo}
WHERE s.service_dict_id = #{serviceDictId}
</update>
<!-- 删除 -->
@@ -260,14 +367,14 @@
UPDATE service_dict_info s set s.is_valid = #{isValid} where s.service_dict_id = #{serviceDictId}
</update>
<select id="findItemDict" resultMap="dictResultMap">
<select id="findItemDict" resultMap="dictResultSimpleMap">
select
<include refid="serviceDictInfoColumns" />
<include refid="serviceDictInfoColumnsSimple" />
from service_dict_info s where s.is_leaf = 0 and s.item_type=#{itemType} and s.is_valid=#{isValid};
</select>
<select id="findAllItemDict" resultMap="dictResultMap">
<select id="findAllItemDict" resultMap="dictResultSimpleMap">
select
<include refid="serviceDictInfoColumns" />
<include refid="serviceDictInfoColumnsSimple" />
from service_dict_info s where s.is_leaf = 0 and s.item_type=#{itemType};
</select>