#
luxiaotao1123
2024-01-30 3bbc1458f7a8ade7d8f3a43dfadf6225e0c7b748
zy-asrs-wcs/src/main/resources/mapper/sys/UserMapper.xml
@@ -2,27 +2,15 @@
<!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 * from sys_user
        where 1=1
        and deleted = 0
        and username = #{username}
        <if test="hostId != null">
            AND host_id = #{hostId}
        </if>
    </select>
</mapper>