#
luxiaotao1123
2024-01-29 36f6a0cfc6ebc27723d320a8791ea5062fc27697
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?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.zy.asrs.wcs.sys.mapper.UserMapper">
 
 
    <!-- 根据账号查询 -->
    <select id="selectByUsername" resultType="com.zy.asrs.wcs.sys.entity.User">
        SELECT a.* ,
        b.organization_name,
        c.dict_data_name sex_name
        FROM sys_user a
        LEFT JOIN sys_organization b ON a.organization_id = b.organization_id
        LEFT JOIN (
        <include refid="selectSexDictSql"/>
        ) c ON a.sex = c.dict_data_code
        <where>
            AND a.deleted = 0
            AND a.username = #{username}
            <if test="tenantId != null">
                AND a.tenant_id = #{tenantId}
            </if>
            <if test="tenantId == null">
                AND a.tenant_id = 2
            </if>
        </where>
    </select>
 
</mapper>