UserExamGoodsMapper.xml 5.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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.user.mapper.UserExamGoodsMapper">
  6. <resultMap type="com.zhongzheng.modules.user.domain.UserExamGoods" id="UserExamGoodsResult">
  7. <result property="userExamGoodsId" column="user_exam_goods_id"/>
  8. <result property="userId" column="user_id"/>
  9. <result property="goodsId" column="goods_id"/>
  10. <result property="examNumber" column="exam_number"/>
  11. <result property="doNumber" column="do_number"/>
  12. </resultMap>
  13. <resultMap type="com.zhongzheng.modules.user.vo.UserExamGoodsVo" id="UserExamGoodsVo">
  14. <result property="userExamGoodsId" column="user_exam_goods_id"/>
  15. <result property="userId" column="user_id"/>
  16. <result property="goodsId" column="goods_id"/>
  17. <result property="examNumber" column="exam_number"/>
  18. <result property="doNumber" column="do_number"/>
  19. <result property="createTime" column="create_time"/>
  20. <result property="updateTime" column="update_time"/>
  21. <result property="expendNumber" column="expend_number"/>
  22. <result property="expendBefore" column="expend_before"/>
  23. <result property="goodsCode" column="goods_code"/>
  24. <result property="goodsName" column="goods_name"/>
  25. <result property="standPrice" column="stand_price"/>
  26. <result property="projectName" column="project_name"/>
  27. <result property="businessName" column="business_name"/>
  28. <result property="educationName" column="education_name"/>
  29. </resultMap>
  30. <resultMap type="com.zhongzheng.modules.user.vo.UserExamGoodsSupplementVo" id="UserExamGoodsSupplementVo">
  31. <result property="userExamGoodsId" column="user_exam_goods_id"/>
  32. <result property="goodsId" column="goods_id"/>
  33. <result property="examNumber" column="exam_number"/>
  34. <result property="doNumber" column="do_number"/>
  35. <result property="createTime" column="create_time"/>
  36. <result property="updateTime" column="update_time"/>
  37. <result property="code" column="goods_code"/>
  38. <result property="goodsName" column="goods_name"/>
  39. <result property="standPrice" column="stand_price"/>
  40. <result property="status" column="status"/>
  41. <result property="timeStatus" column="time_status"/>
  42. <result property="makeStartTime" column="make_start_time"/>
  43. <result property="makeEndTime" column="make_end_time"/>
  44. <result property="timeStatus" column="time_status"/>
  45. <result property="projectName" column="project_name"/>
  46. <result property="businessName" column="business_name"/>
  47. <result property="educationName" column="education_name"/>
  48. </resultMap>
  49. <select id="listUserExam" parameterType="com.zhongzheng.modules.user.bo.UserExamGoodsQueryBo" resultMap="UserExamGoodsVo">
  50. SELECT
  51. *,
  52. (SELECT g.goods_name FROM goods g where ueg.goods_id = g.goods_id) as goods_name,
  53. (SELECT g.code FROM goods g where ueg.goods_id = g.goods_id) as goods_code,
  54. (SELECT g.stand_price FROM goods g where ueg.goods_id = g.goods_id) as stand_price,
  55. (SELECT cet.education_name FROM goods g LEFT JOIN course_education_type cet on cet.id = g.education_type_id where ueg.goods_id = g.goods_id) as education_name,
  56. (SELECT cpt.project_name FROM goods g LEFT JOIN course_project_type cpt on cpt.id = g.project_id where ueg.goods_id = g.goods_id) as project_name,
  57. (SELECT cb.business_name FROM goods g LEFT JOIN course_business cb on cb.id = g.business_id where ueg.goods_id = g.goods_id) as business_name
  58. FROM
  59. user_exam_goods ueg
  60. WHERE
  61. ueg.user_id = #{userId}
  62. </select>
  63. <select id="getUserExam" parameterType="map" resultMap="UserExamGoodsSupplementVo">
  64. SELECT
  65. *,
  66. (SELECT g.goods_name FROM goods g where uegs.goods_id = g.goods_id) as goods_name,
  67. (SELECT g.code FROM goods g where uegs.goods_id = g.goods_id) as goods_code,
  68. (SELECT g.stand_price FROM goods g where uegs.goods_id = g.goods_id) as stand_price,
  69. (SELECT g.make_start_time FROM goods g where uegs.goods_id = g.goods_id) as make_start_time,
  70. (SELECT g.make_end_time FROM goods g where uegs.goods_id = g.goods_id) as make_end_time,
  71. (case WHEN (SELECT COUNT(g.goods_id) FROM goods g where uegs.goods_id = g.goods_id and unix_timestamp(now()) BETWEEN g.make_start_time and g.make_end_time) >0 then 1 ELSE 0 end) as time_status,
  72. (SELECT cet.education_name FROM goods g LEFT JOIN course_education_type cet on cet.id = g.education_type_id where uegs.goods_id = g.goods_id) as education_name,
  73. (SELECT cpt.project_name FROM goods g LEFT JOIN course_project_type cpt on cpt.id = g.project_id where uegs.goods_id = g.goods_id) as project_name,
  74. (SELECT cb.business_name FROM goods g LEFT JOIN course_business cb on cb.id = g.business_id where uegs.goods_id = g.goods_id) as business_name
  75. FROM
  76. user_exam_goods_supplement uegs
  77. WHERE
  78. uegs.user_exam_goods_id = #{userExamGoodsId}
  79. and uegs.`status`=#{status}
  80. </select>
  81. </mapper>