|
@@ -0,0 +1,59 @@
|
|
|
+<?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.hssx.pcbms.mapper.UserMapper">
|
|
|
+
|
|
|
+ <!-- 通用查询映射结果 -->
|
|
|
+ <resultMap id="BaseResultMap" type="com.hssx.pcbms.entity.User">
|
|
|
+ <id column="id" property="id" />
|
|
|
+ <result column="head_url" property="headUrl" />
|
|
|
+ <result column="name" property="name" />
|
|
|
+ <result column="phone" property="phone" />
|
|
|
+ <result column="dept_id" property="deptId" />
|
|
|
+ <result column="role_id" property="roleId" />
|
|
|
+ <result column="is_pass" property="isPass" />
|
|
|
+ <result column="indate" property="indate" />
|
|
|
+ <result column="password" property="password" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap id="BaseResultMapVO" type="com.hssx.pcbms.entity.vo.UserVO">
|
|
|
+ <id column="id" property="id" />
|
|
|
+ <result column="head_url" property="headUrl" />
|
|
|
+ <result column="name" property="name" />
|
|
|
+ <result column="phone" property="phone" />
|
|
|
+ <result column="dept_id" property="deptId" />
|
|
|
+ <result column="role_id" property="roleId" />
|
|
|
+ <result column="is_pass" property="isPass" />
|
|
|
+ <result column="indate" property="indate" />
|
|
|
+ <result column="password" property="password" />
|
|
|
+ <collection property="permissions" ofType="com.hssx.pcbms.entity.Permission">
|
|
|
+ <id column="id" property="id" />
|
|
|
+ <result column="permission_name" property="permissionName" />
|
|
|
+ </collection>
|
|
|
+ <collection property="roles" ofType="com.hssx.pcbms.entity.Role">
|
|
|
+ <id column="id" property="id" />
|
|
|
+ <result column="rolename" property="name" />
|
|
|
+ <result column="indate" property="indate" />
|
|
|
+ </collection>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 通用查询结果列 -->
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ id, head_url, name, phone, dept_id, role_id, is_pass, indate, password
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectUserRolesAndPermisssuons">
|
|
|
+ select
|
|
|
+ u.id, u.head_url, u.name, u.phone, u.dept_id, u.role_id, u.is_pass, u.indate,
|
|
|
+ p.permission_name,r.name rolename
|
|
|
+ from
|
|
|
+ user u
|
|
|
+ left join role r
|
|
|
+ on u.role_id = r.id
|
|
|
+ left join role_permission rp
|
|
|
+ on r.id = rp.role_id
|
|
|
+ left join permission p
|
|
|
+ on p.id = rp.permission_id
|
|
|
+ where u.id = #{user.id,jdbcType=INTEGER}
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|