| | |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.system.mapper.SysUserMapper"> |
| | | <mapper namespace="org.dromara.system.mapper.SysUserMapper"> |
| | | |
| | | <!-- 多结构嵌套自动映射需带上每个实体的主键id 否则映射会失败 --> |
| | | <resultMap type="com.ruoyi.system.domain.vo.SysUserVo" id="SysUserResult"> |
| | | <resultMap type="org.dromara.system.domain.vo.SysUserVo" id="SysUserResult"> |
| | | <id property="userId" column="user_id"/> |
| | | <result property="deptId" column="dept_id"/> |
| | | <association property="dept" column="dept_id" resultMap="deptResult"/> |
| | | <collection property="roles" javaType="java.util.List" resultMap="RoleResult"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="deptResult" type="com.ruoyi.system.domain.vo.SysDeptVo"> |
| | | <resultMap id="deptResult" type="org.dromara.system.domain.vo.SysDeptVo"> |
| | | <id property="deptId" column="dept_id"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="RoleResult" type="com.ruoyi.system.domain.vo.SysRoleVo"> |
| | | <resultMap id="RoleResult" type="org.dromara.system.domain.vo.SysRoleVo"> |
| | | <id property="roleId" column="role_id"/> |
| | | </resultMap> |
| | | |
| | | <sql id="selectUserVo"> |
| | | select u.user_id, |
| | | u.tenant_id, |
| | | u.dept_id, |
| | | u.user_name, |
| | | u.nick_name, |
| | |
| | | where u.del_flag = '0' and u.phonenumber = #{phonenumber} |
| | | </select> |
| | | |
| | | <select id="selectUserByEmail" parameterType="String" resultMap="SysUserResult"> |
| | | <include refid="selectUserVo"/> |
| | | where u.del_flag = '0' and u.email = #{email} |
| | | </select> |
| | | |
| | | <select id="selectTenantUserByUserName" parameterType="String" resultMap="SysUserResult"> |
| | | <include refid="selectUserVo"/> |
| | | where u.del_flag = '0' and u.user_name = #{userName} and u.tenant_id = #{tenantId} |
| | | </select> |
| | | |
| | | <select id="selectTenantUserByPhonenumber" parameterType="String" resultMap="SysUserResult"> |
| | | <include refid="selectUserVo"/> |
| | | where u.del_flag = '0' and u.phonenumber = #{phonenumber} and u.tenant_id = #{tenantId} |
| | | </select> |
| | | |
| | | <select id="selectTenantUserByEmail" parameterType="String" resultMap="SysUserResult"> |
| | | <include refid="selectUserVo"/> |
| | | where u.del_flag = '0' and u.email = #{email} and u.tenant_id = #{tenantId} |
| | | </select> |
| | | |
| | | <select id="selectUserById" parameterType="Long" resultMap="SysUserResult"> |
| | | <include refid="selectUserVo"/> |
| | | where u.del_flag = '0' and u.user_id = #{userId} |