ExamApplyGoodsMapper.xml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. </resultMap>
  18. <select id="listGoods" parameterType="com.zhongzheng.modules.exam.bo.ExamApplyGoodsQueryBo" resultMap="ExamApplyGoodsVoResult">
  19. SELECT
  20. g.goods_name,
  21. g.`code`
  22. FROM
  23. exam_apply_goods eg
  24. LEFT JOIN goods g ON eg.goods_id = g.goods_id
  25. WHERE
  26. 1=1
  27. AND g.STATUS IN ( 1 )
  28. AND g.goods_type = 1
  29. <if test="applyId != null and applyId != ''">
  30. and eg.apply_id = #{applyId}
  31. </if>
  32. <if test="subjectId != null and subjectId >0">
  33. 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
  34. AND c.subject_id = #{subjectId}) >0
  35. </if>
  36. <if test="businessId != null and businessId != ''">
  37. AND g.business_id = #{businessId}
  38. </if>
  39. <if test="searchKey != null and searchKey != ''">
  40. and (g.goods_name like concat('%', #{searchKey}, '%'))
  41. </if>
  42. <if test="standPrice != null and standPrice != ''">
  43. AND g.stand_price = #{standPrice}
  44. </if>
  45. </select>
  46. </mapper>