DictDao.xml 1.29 KB
Newer Older
Fred's avatar
Fred committed
1 2 3 4 5 6 7 8 9
<?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.govmade.modules.system.dao.DictDao">

	<select id="selectChilds" resultType="DictEntity">
		select value,name from
		system_dicts where pid = (select id from system_dicts where value = #{pValue})
	</select>
刘弈臻's avatar
刘弈臻 committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
	
	<!-- 批量删除 -->
	<update id="deleteBatch">
		UPDATE system_dicts SET state =${@com.govmade.common.utils.Constant@STATE_DELETE} WHERE id IN 
		<foreach collection="ids" item="id" open="("  close=")" separator=",">
            #{id}
        </foreach>
	</update>
		
	<!-- 查询树形数据-->
	<select id="listTree" resultType="DictEntity">
	SELECT * FROM system_dicts AS t
	INNER JOIN (
	SELECT id AS id2 FROM system_dicts
	WHERE
	pid = 0	
	AND state =1
	<if test="params.name2 != null and params.name2 !=''">
	AND NAME LIKE CONCAT('%',#{params.name2},'%')
	</if>
	LIMIT #{params.start},#{params.pageSize2}
    ) AS t2 ON t.root_id = t2.id2 AND t.state=1
    UNION ALL(SELECT *, 0 AS id2 FROM system_dicts
	WHERE
	pid = 0
	AND state =1
	<if test="params.name2 != null and params.name2 !=''">
	AND	NAME LIKE CONCAT('%',#{params.name2},'%')
	</if>	 
    LIMIT #{params.start},#{params.pageSize2}
	)
    ORDER BY id		
	</select>
	
Fred's avatar
Fred committed
44
</mapper>