123 lines
3.2 KiB
XML
123 lines
3.2 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.bonus.imgTool.system.dao.DictDao">
|
|
<sql id="where">
|
|
<where>
|
|
t.del_flag = 0
|
|
<if test="keyWord != null and keyWord != ''">
|
|
and t.dict_name like concat('%', #{keyWord}, '%')
|
|
OR
|
|
t.id in (
|
|
select t.p_id from sys_distinct t where t.del_flag = 0
|
|
and (
|
|
t.dict_name like concat('%', #{keyWord}, '%')
|
|
)
|
|
)
|
|
</if>
|
|
</where>
|
|
</sql>
|
|
|
|
|
|
<select id="count" resultType="int">
|
|
select count(1) from sys_distinct t
|
|
<include refid="where" />
|
|
</select>
|
|
|
|
<select id="list" resultType="com.bonus.imgTool.system.vo.Dict">
|
|
select
|
|
t.id,
|
|
t.dict_code as dictCode,
|
|
t.dict_name as dictName,
|
|
t.dict_value as dictValue,
|
|
t.p_id as parentId,
|
|
t.dict_sort as sort
|
|
from sys_distinct t
|
|
<include refid="where" />
|
|
order by t.dict_sort
|
|
</select>
|
|
|
|
<select id="listByType" resultType="com.bonus.imgTool.system.vo.Dict">
|
|
select dict2.id,
|
|
dict2.dict_code as dictCode,
|
|
dict2.dict_name as dictName,
|
|
dict2.dict_value as dictValue
|
|
from
|
|
sys_distinct dict
|
|
left join sys_distinct dict2 on dict.id=dict2.p_id
|
|
where dict.dict_code=#{type} and dict2.del_flag = 0
|
|
order by dict2.dict_sort asc
|
|
</select>
|
|
|
|
<select id="listParents" resultType="com.bonus.imgTool.system.vo.Dict">
|
|
select
|
|
t.id,
|
|
t.dict_code as dictCode,
|
|
t.dict_name as dictName,
|
|
t.dict_value as dictValue,
|
|
t.p_id as parentId,
|
|
t.dict_sort as sort
|
|
from sys_distinct t
|
|
where t.p_id = 0 and t.del_flag = 0
|
|
order by t.dict_sort
|
|
</select>
|
|
|
|
<select id="getByDictCode" resultType="com.bonus.imgTool.system.vo.Dict">
|
|
select t.id,
|
|
t.dict_code as dictCode,
|
|
t.dict_name as dictName,
|
|
t.dict_value as dictValue,
|
|
t.p_id as parentId,
|
|
t.dict_sort as sort
|
|
from sys_distinct t
|
|
where t.p_id = #{parentId} and t.dict_code = #{dictCode}
|
|
</select>
|
|
<select id="getByDictName" resultType="com.bonus.imgTool.system.vo.Dict">
|
|
select t.id,
|
|
t.dict_code as dictCode,
|
|
t.dict_name as dictName,
|
|
t.dict_value as dictValue,
|
|
t.p_id as parentId,
|
|
t.dict_sort as sort
|
|
from sys_distinct t
|
|
where t.p_id = #{parentId} and t.dict_name = #{dictName}
|
|
</select>
|
|
<select id="getByDictValue" resultType="com.bonus.imgTool.system.vo.Dict">
|
|
select t.id,
|
|
t.dict_code as dictCode,
|
|
t.dict_name as dictName,
|
|
t.dict_value as dictValue,
|
|
t.p_id as parentId,
|
|
t.dict_sort as sort
|
|
from sys_distinct t
|
|
where t.p_id = #{parentId} and t.dict_value = #{dictValue}
|
|
</select>
|
|
<select id="getById" resultType="com.bonus.imgTool.system.vo.Dict">
|
|
select t.id,
|
|
t.dict_code as dictCode,
|
|
t.dict_name as dictName,
|
|
t.dict_value as dictValue,
|
|
t.p_id as parentId,
|
|
t.dict_sort as sort
|
|
from sys_distinct t
|
|
where t.id = #{id}
|
|
</select>
|
|
|
|
<update id="update">
|
|
update sys_distinct t
|
|
set t.dict_code = #{dictCode},
|
|
t.dict_name = #{dictName},
|
|
t.dict_value = #{dictValue},
|
|
t.dict_sort = #{sort}
|
|
where t.id = #{id}
|
|
</update>
|
|
|
|
<update id="delete">
|
|
update sys_distinct t
|
|
set t.del_flag = 1
|
|
where t.id = #{id}
|
|
</update>
|
|
|
|
|
|
</mapper>
|