IntelligentRecognition/ah-jjsp-service/.svn/pristine/99/991ed99e3c4d11950415df9a884...

72 lines
2.9 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">
<!--查询全部字典-->
<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>
<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>
<update id="deleteDict" parameterType="String">
update sys_dist SET is_flag='1' WHERE id=#{keyId}
</update>
</mapper>