<?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.zhongzheng.modules.pay.mapper.PaySupplyMapper">

    <resultMap type="com.zhongzheng.modules.pay.domain.PaySupply" id="PaySupplyResult">
        <result property="supplyId" column="supply_id"/>
        <result property="status" column="status"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
        <result property="remark" column="remark"/>
        <result property="supplyName" column="supply_name"/>
        <result property="serverId" column="server_id"/>
    </resultMap>

    <resultMap type="com.zhongzheng.modules.pay.vo.PaySupplyVo" id="PaySupplyVoResult">
        <result property="supplyId" column="supply_id"/>
        <result property="status" column="status"/>
        <result property="remark" column="remark"/>
        <result property="supplyName" column="supply_name"/>
        <result property="serverId" column="server_id"/>
        <result property="serveName" column="serve_name"/>
    </resultMap>

    <select id="queryList" parameterType="com.zhongzheng.modules.pay.bo.PaySupplyQueryBo"  resultMap="PaySupplyVoResult">
        SELECT
        s.*,
        e.serve_name
        FROM
        pay_supply s
        LEFT JOIN pay_serve e ON s.server_id = e.serve_id
        where 1=1
        <if test="status != null and status.size()!=0 ">
            AND s.status in
            <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        <if test="supplyId != null and supplyId != ''">
            AND p.supply_id = #{supplyId}
        </if>
        order by s.update_time desc
    </select>
</mapper>
