<?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.xunhong.erp.turbo.user.infrastructure.mapper.UserAuthMapper">
	<resultMap id="BaseResultMap"
			   type="com.xunhong.erp.turbo.user.infrastructure.entity.UserAuthDO">
		<result property="userAuthId" column="user_auth_id" jdbcType="INTEGER"/>
		<result property="userId" column="user_id" jdbcType="INTEGER"/>
		<result property="username" column="username" jdbcType="VARCHAR"/>
		<result property="password" column="password" jdbcType="VARCHAR"/>
		<result property="state" column="state" jdbcType="INTEGER"/>
		<result property="socialType" column="social_type" jdbcType="INTEGER"/>
		<result property="createdAt" column="created_at"/>
		<result property="updatedAt" column="updated_at"/>
		<result property="isDelete" column="is_delete"/>
		<result property="version" column="version"/>
		<association property="userDO" column="user_id"
					 javaType="com.xunhong.erp.turbo.user.infrastructure.entity.UserDO"
					 resultMap="com.xunhong.erp.turbo.user.infrastructure.mapper.UserMapper.BaseResultMap"/>
	</resultMap>

	<select id="selectList"
			resultType="com.xunhong.erp.turbo.user.infrastructure.entity.UserAuthDO"
			resultMap="BaseResultMap">
		select a.*, b.*
		from user_auth as a
		left join user as b on a.user_id = b.user_id
		<where>
			and b.is_delete = 0
			<if test="ew!= null">
				<if test="ew.nonEmptyOfWhere">
					AND
				</if>
				${ew.sqlSegment}
			</if>
		</where>
	</select>
</mapper>
