<?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="cn.pluss.platform.mapper.MerchantCashPlaceStaffMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.pluss.platform.entity.MerchantCashPlaceStaff">
        <id column="id" property="id" />
        <result column="userId" property="userId" />
        <result column="cashPlaceId" property="cashPlaceId" />
        <result column="remark" property="remark" />
        <result column="status" property="status" />
        <result column="createTime" property="createTime" />
        <result column="updateTime" property="updateTime" />
    </resultMap>

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseVOResultMap" type="cn.pluss.platform.vo.MerchantCashPlaceStaffVO">
        <id column="id" property="id" />
        <result column="userId" property="userId" />
        <result column="cashPlaceId" property="cashPlaceId" />
        <result column="remark" property="remark" />
        <result column="createTime" property="createTime" />
        <result column="updateTime" property="updateTime" />
        <result column="status" property="status" />

        <association property="staff" javaType="cn.pluss.platform.entity.UserApp">
            <result column="userId" property="userId" />
            <result column="userName" property="userName" />
        </association>
    </resultMap>

    <select id="selectCustom" resultMap="BaseVOResultMap">
        SELECT
               mcps.id, mcps.userId, mcps.status, mcps.cashPlaceId, mcps.remark, mcps.createTime, mcps.updateTime, ua.userName
        FROM tb_pluss_merchant_cash_place_staff mcps
        LEFT JOIN tb_pluss_user_app ua ON mcps.userId = ua.userId
        ${ew.customSqlSegment}
    </select>
</mapper>
