<?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.ruoyi.hywz.mapper.AdsMatHyxtInvoiceUserApplyPermissionDMapper">
	<!-- 可根据自己的需求，是否要使用 -->
    <resultMap id="adsMatHyxtInvoiceUserApplyPermissionDMap" type="com.ruoyi.hywz.entity.AdsMatHyxtInvoiceUserApplyPermissionD">
        <result property="id" column="id"/>
        <result property="userId" column="user_id"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
        <result property="isDeleted" column="is_deleted"/>
    </resultMap>

    <select id="queryPage" parameterType="com.ruoyi.hywz.entity.vo.UserPermissionVo" resultType="com.ruoyi.hywz.entity.vo.UserPermissionVo">
        SELECT
            a.user_id AS userId,
            a.user_name AS userName,
            a.nick_name AS nickName,
            a.phonenumber AS phonenumber,
            ifnull( b.apply_permission, 0 ) AS applyPermission
        FROM
            sys_user a
            LEFT JOIN ads_mat_hyxt_invoice_user_apply_permission_d b ON a.user_id = b.user_id
        ${ew.customSqlSegment}
    </select>

</mapper>
