mapper.sys.SysRoleMapper.xml Maven / Gradle / Ivy
The newest version!
<?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="io.github.wslxm.springbootplus2.manage.sys.mapper.SysRoleMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="io.github.wslxm.springbootplus2.manage.sys.model.entity.SysRole"> <result column="id" property="id"/> <result column="create_user" property="createUser"/> <result column="update_user" property="updateUser"/> <result column="create_time" property="createTime"/> <result column="update_time" property="updateTime"/> <result column="deleted" property="deleted"/> <result column="version" property="version"/> <result column="name" property="name"/> <result column="desc" property="desc"/> <result column="disable" property="disable"/> </resultMap> <!-- 通用查询结果列: <include refid="Base_Column_List"></include> --> <sql id="Base_Column_List"> id, create_user, update_user, create_time, update_time, deleted, version, code, name, desc, disable </sql> <select id="list" resultType="io.github.wslxm.springbootplus2.manage.sys.model.vo.SysRoleVO"> select r.* from t_sys_role r left join t_sys_role_user ru on ru.role_id = r.id left join t_sys_user u on u.id = ru.user_id where r.deleted = 0 <if test="query.name != null and query.name != ''"> and r.name like concat(#{query.name},'%') </if> <if test="query.code != null and query.code != ''"> and r.code like concat(#{query.code},'%') </if> <if test="query.disable != null "> and r.`disable` = #{query.disable} </if> <if test="query.userId != null and query.userId != ''"> and u.id = #{query.userId} </if> <if test="createUserId != null"> and r.create_user = #{createUserId} </if> group by r.id order by r.sort asc, r.code asc, r.create_time desc </select> </mapper>