ExamApplyGoodsMapper.xml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.zhongzheng.modules.exam.mapper.ExamApplyGoodsMapper">
  6. <resultMap type="com.zhongzheng.modules.exam.domain.ExamApplyGoods" id="ExamApplyGoodsResult">
  7. <result property="id" column="id"/>
  8. <result property="applyId" column="apply_id"/>
  9. <result property="createTime" column="create_time"/>
  10. <result property="updateTime" column="update_time"/>
  11. <result property="goodsId" column="goods_id"/>
  12. </resultMap>
  13. <resultMap type="com.zhongzheng.modules.exam.vo.ExamApplyGoodsVo" id="ExamApplyGoodsVoResult">
  14. <result property="goodsName" column="goods_name"/>
  15. <result property="code" column="code"/>
  16. <result property="goodsId" column="goods_id"/>
  17. <result property="applyId" column="apply_id"/>
  18. <result property="applyName" column="apply_name"/>
  19. </resultMap>
  20. <select id="listGoods" parameterType="com.zhongzheng.modules.exam.bo.ExamApplyGoodsQueryBo" resultMap="ExamApplyGoodsVoResult">
  21. SELECT
  22. g.goods_name,
  23. g.`code`
  24. FROM
  25. exam_apply_goods eg
  26. LEFT JOIN goods g ON eg.goods_id = g.goods_id
  27. WHERE
  28. 1=1
  29. AND g.STATUS IN ( 1 )
  30. AND g.goods_type = 1
  31. <if test="applyId != null and applyId != ''">
  32. and eg.apply_id = #{applyId}
  33. </if>
  34. <if test="subjectId != null and subjectId != ''">
  35. 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
  36. AND c.subject_id = #{subjectId}) >0
  37. </if>
  38. <if test="businessId != null and businessId != ''">
  39. AND g.business_id = #{businessId}
  40. </if>
  41. <if test="searchKey != null and searchKey != ''">
  42. and (g.goods_name like concat('%', #{searchKey}, '%'))
  43. </if>
  44. <if test="standPrice != null and standPrice != ''">
  45. AND g.stand_price = #{standPrice}
  46. </if>
  47. </select>
  48. <select id="listByGoodsId" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.exam.vo.ExamApplyGoodsVo">
  49. SELECT
  50. eag.apply_id,
  51. eag.goods_id,
  52. ea.apply_name
  53. FROM exam_apply_goods eag
  54. LEFT JOIN exam_apply ea ON eag.apply_id = ea.apply_id
  55. WHERE
  56. eag.goods_id = #{goodsId}
  57. and unix_timestamp(now()) &lt; ea.apply_end_time
  58. ORDER BY ea.apply_start_time
  59. </select>
  60. </mapper>