123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <?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">
- <!-- namespace必须指向DAO接口 -->
- <mapper namespace="com.jpsoft.picc.modules.sys.dao.DataDictionaryDAO">
- <resultMap id="DataDictionaryMap" type="com.jpsoft.picc.modules.sys.entity.DataDictionary">
- <id property="id" column="id_" />
- <result property="name" column="name_" />
- <result property="value" column="value_" />
- <result property="sortNo" column="sort_no" />
- <result property="parentId" column="parent_id" />
- <result property="parentName" column="parent_name"/>
- <result property="dataType" column="data_type" />
- <result property="createBy" column="create_by" />
- <result property="createDate" column="create_date" />
- <result property="updateBy" column="update_by" />
- <result property="updateDate" column="update_date" />
- <result property="activated" column="activated_" />
- <result property="delFlag" column="del_flag"/>
- </resultMap>
- <insert id="insert" parameterType="com.jpsoft.picc.modules.sys.entity.DataDictionary">
- <!--
- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
- select sys_guid() from dual
- </selectKey>
- -->
- <![CDATA[
- insert into sys_data_dictionary
- (id_,name_,value_,sort_no,parent_id,data_type,create_by,create_date,update_by,update_date,activated_,del_flag)
- values
- (
- #{id,jdbcType=VARCHAR}
- ,#{name,jdbcType=VARCHAR}
- ,#{value,jdbcType=VARCHAR}
- ,#{sortNo,jdbcType= NUMERIC }
- ,#{parentId,jdbcType=VARCHAR}
- ,#{dataType,jdbcType= NUMERIC }
- ,#{createBy,jdbcType=VARCHAR}
- ,#{createDate,jdbcType= TIMESTAMP }
- ,#{updateBy,jdbcType=VARCHAR}
- ,#{updateDate,jdbcType= TIMESTAMP }
- ,#{activated,jdbcType= NUMERIC }
- ,#{delFlag,jdbcType= NUMERIC }
- )
- ]]>
- </insert>
- <delete id="delete" parameterType="string">
- delete from sys_data_dictionary where id_=#{id,jdbcType=VARCHAR}
- </delete>
- <update id="update" parameterType="com.jpsoft.picc.modules.sys.entity.DataDictionary">
- update sys_data_dictionary
- <set>
- <if test="userName!=null">
- name_=#{name,jdbcType=VARCHAR},
- </if>
- <if test="value!=null">
- value_=#{value,jdbcType=VARCHAR},
- </if>
- <if test="sortNo!=null">
- sort_no=#{sortNo,jdbcType= NUMERIC },
- </if>
- <if test="parentId!=null">
- parent_id=#{parentId,jdbcType=VARCHAR},
- </if>
- <if test="dataType!=null">
- data_type=#{dataType,jdbcType= NUMERIC },
- </if>
- <if test="createBy!=null">
- create_by=#{createBy,jdbcType=VARCHAR},
- </if>
- <if test="createDate!=null">
- create_date=#{createDate,jdbcType= TIMESTAMP },
- </if>
- <if test="updateBy!=null">
- update_by=#{updateBy,jdbcType=VARCHAR},
- </if>
- <if test="updateDate!=null">
- update_date=#{updateDate,jdbcType= TIMESTAMP },
- </if>
- <if test="activated!=null">
- activated_=#{activated,jdbcType= NUMERIC },
- </if>
- <if test="delFlag!=null">
- del_flag=#{delFlag,jdbcType= NUMERIC },
- </if>
- </set>
- where id_=#{id}
- </update>
- <select id="get" parameterType="string" resultMap="DataDictionaryMap">
- select a.*,b.name_ as parent_name
- from sys_data_dictionary a left join sys_data_dictionary b on a.parent_id = b.id_
- where a.id_=#{0} and a.del_flag = 0
- </select>
- <select id="exist" parameterType="string" resultType="int">
- select count(*) from sys_data_dictionary where id_=#{0} and del_flag = 0
- </select>
- <select id="list" resultMap="DataDictionaryMap">
- select * from sys_data_dictionary where del_flag = 0
- </select>
- <select id="search" parameterType="hashmap" resultMap="DataDictionaryMap">
- <![CDATA[
- SELECT
- a.*,b.name_ AS parent_name
- FROM
- sys_data_dictionary a
- LEFT JOIN sys_data_dictionary b ON a.parent_id = b.id_
- ]]>
- <where>
- a.del_flag = 0
- <if test="searchParams.id != null">
- and a.ID_ like #{searchParams.id}
- </if>
- <if test="searchParams.userName != null">
- and a.name_ like #{searchParams.userName}
- </if>
- <if test="searchParams.excludeId != null">
- <![CDATA[
- and a.ID_ <> #{searchParams.excludeId}
- ]]>
- </if>
- <if test="searchParams.dataType != null">
- and a.data_type = #{searchParams.dataType}
- </if>
- </where>
- <foreach item="sort" collection="sortList" open="order by" separator=",">
- ${sort.name} ${sort.order}
- </foreach>
- </select>
- <select id="queryChildren" resultType="java.util.HashMap" parameterType="string" >
- SELECT
- a.id_ as id,a.name_ as userName,a.value_ as value
- FROM
- sys_data_dictionary a where a.del_flag = 0
- and data_type = 2
- and a.parent_id = #{0}
- </select>
- <select id="getName" parameterType="string" resultType="string">
- select a.name_ as userName
- from sys_data_dictionary a
- where a.id_=#{0} and a.del_flag = 0
- </select>
- <select id="getValue" parameterType="string" resultType="string">
- select a.value_ as value
- from sys_data_dictionary a
- where a.id_=#{0} and a.del_flag = 0
- </select>
- </mapper>
|