bns_jjsp_service/securityControl-modules/securityControl-system/target/classes/mapper/system/SysDictMapper.xml

125 lines
4.7 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.securityControl.system.mapper.SysDictDao">
<delete id="deleteCode">
delete from jj_data_code where id=#{id}
</delete>
<!--查询全部字典-->
<select id="getDictList" parameterType="com.securityControl.system.domain.vo.SysDictVo" resultType="com.securityControl.system.domain.vo.SysDictVo" >
select id,name,code,p_id pId,remarks
from sys_dist
where is_flag='0'
<if test="keyWord!=null and keyWord!=''">
and ( name like concat('%',concat(#{keyWord},'%')) or
code like concat('%',concat(#{keyWord},'%')) or
remarks like concat('%',concat(#{keyWord},'%')) )
</if>
</select>
<!--查询上级节点数据-->
<select id="getPDict" parameterType="String" resultType="com.securityControl.system.domain.vo.SysDictVo">
select id,name,code,p_id pId,remarks
from sys_dist
where is_flag='0' AND p_id=#{pId}
</select>
<select id="getNumByName" resultType="Integer" parameterType="com.securityControl.system.domain.vo.SysDictVo">
select count(1) from sys_dist
where is_flag='0' AND p_id=#{pId} and name=#{name}
<if test="id!=null and id!=''">
and id!=#{id}
</if>
</select>
<select id="getNumByCode" resultType="Integer" parameterType="com.securityControl.system.domain.vo.SysDictVo">
select count(1) from sys_dist
where is_flag='0' AND p_id=#{pId} and code=#{code}
<if test="id!=null and id!=''">
and id!=#{id}
</if>
</select>
<insert id="addDict" parameterType="com.securityControl.system.domain.vo.SysDictVo">
insert into sys_dist (name,code,p_id,remarks,is_flag)value (
#{name},#{code},#{pId},#{remarks},'0'
)
</insert>
<insert id="addCode">
insert into jj_data_code (major,code, name,code_value,value,remarks
)value ( #{major},#{code},#{name},#{codeValue},#{value},#{remarks})
</insert>
<update id="updateDict" parameterType="com.securityControl.system.domain.vo.SysDictVo">
update sys_dist
<set>
<if test="name!=null and name!=''">
, name=#{name}
</if>
<if test="code!=null and code!=''">
, code=#{code}
</if>
<if test="pId!=null and pId!=''">
, p_id=#{pId}
</if>
<if test="remarks!=null and remarks!=''">
, remarks=#{remarks}
</if>
</set>
where id=#{id}
</update>
<select id="getDictDetail" parameterType="String" resultType="com.securityControl.system.domain.vo.SysDictVo">
select id,name,code,p_id pId,remarks
from sys_dist
where id=#{keyId}
</select>
<select id="getNumByPId" resultType="Integer">
select count(1)
from sys_dist
where p_id=#{keyId} AND is_flag='0'
</select>
<select id="getJjCodeList" resultType="com.securityControl.system.domain.vo.JjCodeVo">
select id, major , code,
name, code_value codeValue, value,
remarks
from jj_data_code
<where>
<if test="keyWord!=null and keyWord!=''">
AND (code like concat('%',#{keyWord},'%') OR
code_value like concat('%',#{keyWord},'%') OR
value like concat('%',#{keyWord},'%')
)
</if>
</where>
</select>
<select id="getCodeDetails" resultType="com.securityControl.system.domain.vo.JjCodeVo">
select id,major,code,
name, code_value codeValue, value,
remarks
from jj_data_code
where id=#{id}
</select>
<update id="deleteDict" parameterType="String">
update sys_dist SET is_flag='1' WHERE id=#{keyId}
</update>
<update id="updateCode">
update jj_data_code
<set>
<if test="major!=null and major!=''">
, major=#{major}
</if>
<if test="code!=null and code!=''">
, code=#{code}
</if>
<if test="name!=null and name!=''">
, name=#{name}
</if>
<if test="codeValue!=null and codeValue!=''">
, code_value=#{codeValue}
</if>
<if test="value!=null and value!=''">
, value=#{value}
</if>
<if test="remarks!=null and remarks!=''">
, remarks=#{remarks}
</if>
</set>
where id=#{id}
</update>
</mapper>