| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?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"/>
- <result property="applyId" column="apply_id"/>
- <result property="applyName" column="apply_name"/>
- </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 )
- AND g.goods_type = 1
- <if test="applyId != null and applyId != ''">
- and eg.apply_id = #{applyId}
- </if>
- <if test="subjectId != null and subjectId != ''">
- AND (SELECT count(*) from goods_course gc LEFT JOIN course c ON gc.course_id = c.course_id where gc.goods_id = g.goods_id and c.`status` = 1
- AND c.subject_id = #{subjectId}) >0
- </if>
- <if test="businessId != null and businessId != ''">
- AND g.business_id = #{businessId}
- </if>
- <if test="searchKey != null and searchKey != ''">
- and (g.goods_name like concat('%', #{searchKey}, '%'))
- </if>
- <if test="standPrice != null and standPrice != ''">
- AND g.stand_price = #{standPrice}
- </if>
- </select>
- <select id="listByGoodsId" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.exam.vo.ExamApplyGoodsVo">
- SELECT
- eag.apply_id,
- eag.goods_id,
- ea.apply_name
- FROM exam_apply_goods eag
- LEFT JOIN exam_apply ea ON eag.apply_id = ea.apply_id
- WHERE
- eag.goods_id = #{goodsId}
- and unix_timestamp(now()) < ea.apply_end_time
- ORDER BY ea.apply_start_time
- </select>
- </mapper>
|