<?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.exam.mapper.ExamApplyGoodsMapper">

    <resultMap type="com.zhongzheng.modules.exam.domain.ExamApplyGoods" id="ExamApplyGoodsResult">
        <result property="id" column="id"/>
        <result property="applyId" column="apply_id"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
        <result property="goodsId" column="goods_id"/>
    </resultMap>

    <resultMap type="com.zhongzheng.modules.exam.vo.ExamApplyGoodsVo" id="ExamApplyGoodsVoResult">
        <result property="goodsName" column="goods_name"/>
        <result property="code" column="code"/>
        <result property="goodsId" column="goods_id"/>
    </resultMap>

    <select id="listGoods" parameterType="com.zhongzheng.modules.exam.bo.ExamApplyGoodsQueryBo" resultMap="ExamApplyGoodsVoResult">
        SELECT
        g.goods_name,
        g.`code`
        FROM
        exam_apply_goods eg
        LEFT JOIN goods g ON eg.goods_id = g.goods_id
        WHERE
        1=1
        AND g.STATUS IN ( 1 )
        <if test="applyId != null and applyId != ''">
            and  eg.apply_id = #{applyId}
        </if>

    </select>
</mapper>
