小优化

This commit is contained in:
zlt
2019-02-28 23:15:37 +08:00
parent 30f35b7aa5
commit 530df69fe2
7 changed files with 4 additions and 161 deletions
@@ -1,32 +0,0 @@
<?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.central.user.mapper.SysPermissionMapper">
<sql id="where">
<where>
<if test="permission != null and permission != ''">
and t.permission like concat('%', #{permission}, '%')
</if>
<if test="name != null and name != ''">
and t.name like concat('%', #{name}, '%')
</if>
<if test="searchKey != null and searchKey != ''">
and t.name like concat('%', #{searchKey}, '%')
</if>
</where>
</sql>
<select id="count" resultType="int">
select count(*) from sys_permission t
<include refid="where" />
</select>
<select id="findList" resultType="com.central.common.model.SysPermission">
select * from sys_permission t
<include refid="where" />
order by t.id desc
<!--<if test="start != null and start >= 0 and length != null and length > 0">-->
<!--limit #{start}, #{length}-->
<!--</if>-->
</select>
</mapper>
@@ -1,31 +0,0 @@
<?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.central.user.mapper.SysRolePermissionMapper">
<delete id="deleteRolePermission">
delete from sys_role_permission
<where>
<if test="roleId != null">
and roleId = #{roleId}
</if>
<if test="permissionId != null">
and permissionId = #{permissionId}
</if>
</where>
</delete>
<select id="findPermissionsByRoleIds" resultType="com.central.common.model.SysPermission">
select p.* from
sys_permission p
inner join sys_role_permission rp on
p.id = rp.permissionId
<where>
rp.roleId in
<foreach collection="roleIds" item="roleId" open="("
separator="," close=")">
#{roleId}
</foreach>
</where>
</select>
</mapper>