2018-02-22 12:46:50 +08:00
|
|
|
<?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.nis.web.dao.configuration.ServiceDictInfoDao" >
|
|
|
|
|
|
|
|
|
|
<resultMap id="dictResultMap" type="com.nis.domain.configuration.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" />
|
|
|
|
|
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
|
|
|
|
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
|
|
|
|
<!-- 父id -->
|
|
|
|
|
<association property="parent" javaType="com.nis.domain.configuration.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_valid" property="isValid" jdbcType="INTEGER" />
|
|
|
|
|
</association>
|
|
|
|
|
<!-- 创建人员 -->
|
|
|
|
|
<association property="serviceDictCreator" javaType="com.nis.domain.SysUser">
|
|
|
|
|
<id property="id" column="id"/>
|
|
|
|
|
<result property="loginId" column="login_id"/>
|
|
|
|
|
<result property="name" column="name"/>
|
|
|
|
|
</association>
|
|
|
|
|
<!-- 修改人员 -->
|
|
|
|
|
<association property="serviceDictEditor" javaType="com.nis.domain.SysUser">
|
|
|
|
|
<id property="id" column="id"/>
|
|
|
|
|
<result property="loginId" column="login_id"/>
|
|
|
|
|
<result property="name" column="name"/>
|
|
|
|
|
</association>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="serviceDictInfoColumns">
|
|
|
|
|
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,
|
|
|
|
|
s.creator_id AS "serviceDictCreator.id",
|
|
|
|
|
s.create_time AS createTime,
|
|
|
|
|
s.editor_id AS "serviceDictEditor.id",
|
|
|
|
|
s.edit_time AS editTime
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询分类性质列表 -->
|
|
|
|
|
<select id="findDictList" resultMap="dictResultMap" parameterType="com.nis.domain.configuration.ServiceDictInfo">
|
|
|
|
|
SELECT * FROM service_dict_info WHERE is_valid=1 AND item_type <![CDATA[<>]]> 3
|
|
|
|
|
|
|
|
|
|
<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="beginDate !=null" >
|
|
|
|
|
AND create_time >= #{beginDate,jdbcType=TIMESTAMP}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endDate !=null" >
|
|
|
|
|
AND create_time <= #{endDate,jdbcType=TIMESTAMP}
|
|
|
|
|
</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="findDictMarkList" resultMap="dictResultMap" parameterType="com.nis.domain.configuration.ServiceDictInfo">
|
|
|
|
|
SELECT * FROM service_dict_info WHERE is_valid=1 AND item_type=3
|
|
|
|
|
|
|
|
|
|
<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="beginDate !=null" >
|
|
|
|
|
AND create_time >= #{beginDate,jdbcType=TIMESTAMP}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endDate !=null" >
|
|
|
|
|
AND create_time <= #{endDate,jdbcType=TIMESTAMP}
|
|
|
|
|
</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="getDictById" resultType="com.nis.domain.configuration.ServiceDictInfo">
|
|
|
|
|
select
|
|
|
|
|
<include refid="serviceDictInfoColumns"/>
|
|
|
|
|
from service_dict_info s where s.service_dict_id = #{serviceDictId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 新增字典信息 -->
|
|
|
|
|
|
|
|
|
|
<insert id="insertDict" parameterType="com.nis.domain.configuration.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)
|
|
|
|
|
values ( #{itemType,jdbcType=INTEGER}, #{itemCode,jdbcType=INTEGER},
|
|
|
|
|
#{itemValue,jdbcType=VARCHAR}, #{itemDesc,jdbcType=VARCHAR},
|
|
|
|
|
#{parent.serviceDictId,jdbcType=INTEGER}, #{isLeaf,jdbcType=INTEGER}, #{isValid,jdbcType=INTEGER},
|
|
|
|
|
#{serviceDictCreator.id,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
|
|
|
|
|
#{serviceDictEditor.id,jdbcType=INTEGER}, #{editTime,jdbcType=TIMESTAMP})
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询非叶子节点的所有字典信息 -->
|
|
|
|
|
|
|
|
|
|
<select id="findAllDict">
|
|
|
|
|
select
|
|
|
|
|
<include refid="serviceDictInfoColumns" />
|
|
|
|
|
from service_dict_info s where s.is_leaf = 0;
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 修改 -->
|
|
|
|
|
<update id="update">
|
|
|
|
|
UPDATE service_dict_info s SET
|
|
|
|
|
s.service_dict_id = #{serviceDictId},
|
|
|
|
|
s.item_type = #{itemType},
|
|
|
|
|
s.item_code = #{itemCode},
|
|
|
|
|
s.item_value = #{itemValue},
|
|
|
|
|
s.item_desc = #{itemDesc},
|
|
|
|
|
s.parent_id = #{parent.serviceDictId},
|
|
|
|
|
s.is_leaf = #{isLeaf},
|
|
|
|
|
s.creator_id = #{serviceDictCreator.id},
|
|
|
|
|
s.editor_id = #{serviceDictEditor.id},
|
|
|
|
|
s.edit_time = #{editTime}
|
|
|
|
|
WHERE s.service_dict_id = #{serviceDictId}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<!-- 删除 -->
|
|
|
|
|
|
|
|
|
|
<update id="delete">
|
|
|
|
|
UPDATE service_dict_info s set s.is_valid = #{isValid} where s.service_dict_id = #{serviceDictId}
|
|
|
|
|
</update>
|
|
|
|
|
|
2018-02-25 18:43:20 +08:00
|
|
|
<select id="findItemDict" resultMap="dictResultMap">
|
|
|
|
|
select
|
|
|
|
|
<include refid="serviceDictInfoColumns" />
|
|
|
|
|
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
|
|
|
|
|
<include refid="serviceDictInfoColumns" />
|
|
|
|
|
from service_dict_info s where s.is_leaf = 0 and s.item_type=#{itemType};
|
|
|
|
|
</select>
|
2018-02-22 12:46:50 +08:00
|
|
|
|
|
|
|
|
</mapper>
|