refactor mapper xml
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
<?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.imyeyu.api.modules.user.mapper.RoleMapper">
|
||||
<select id="selectById" resultType="com.imyeyu.api.modules.user.entity.Role">
|
||||
SELECT
|
||||
*
|
||||
FROM `role`
|
||||
WHERE
|
||||
`id` = #{id}
|
||||
AND `deleted_at` IS NULL
|
||||
LIMIT 1
|
||||
</select>
|
||||
<select id="selectByIdList" resultType="com.imyeyu.api.modules.user.entity.Role">
|
||||
SELECT
|
||||
*
|
||||
FROM `role`
|
||||
WHERE
|
||||
TRUE
|
||||
<if test="idList != null and !idList.isEmpty()">
|
||||
AND `id` IN
|
||||
<foreach collection="idList" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="idList == null or idList.isEmpty()">
|
||||
AND FALSE
|
||||
</if>
|
||||
AND `deleted_at` IS NULL
|
||||
</select>
|
||||
<select id="selectByModuleCode" resultType="com.imyeyu.api.modules.user.entity.Role">
|
||||
SELECT
|
||||
*
|
||||
FROM `role`
|
||||
WHERE
|
||||
`module_code` = #{moduleCode}
|
||||
AND `deleted_at` IS NULL
|
||||
ORDER BY `created_at`
|
||||
</select>
|
||||
<select id="selectByParentRoleId" resultType="com.imyeyu.api.modules.user.entity.Role">
|
||||
SELECT
|
||||
*
|
||||
FROM `role`
|
||||
WHERE
|
||||
<if test="parentRoleId != null">
|
||||
`parent_role_id` = #{parentRoleId}
|
||||
</if>
|
||||
<if test="parentRoleId == null">
|
||||
`parent_role_id` IS NULL
|
||||
</if>
|
||||
AND `deleted_at` IS NULL
|
||||
ORDER BY `module_code`, `created_at`
|
||||
</select>
|
||||
<select id="selectAll" resultType="com.imyeyu.api.modules.user.entity.Role">
|
||||
SELECT
|
||||
*
|
||||
FROM `role`
|
||||
WHERE
|
||||
`deleted_at` IS NULL
|
||||
ORDER BY `module_code`, `created_at`
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user