| | |
| | | <mapper namespace="cn.stylefeng.guns.modular.business.mapper.MentalTestRecordMapper"> |
| | | |
| | | <select id="myTestTopic" resultType="cn.stylefeng.guns.modular.business.dto.MentalTestMyTestTopicDTO"> |
| | | (SELECT omt.id AS id, |
| | | omt.order_no AS orderNo, |
| | | o.id AS mentalTestRecordId, |
| | | o.create_time AS createTime, |
| | | omt.status_flag AS statusFlag, |
| | | omt.is_back AS isBack, |
| | | omt.test_flag AS testFlag, |
| | | tt.id AS topicId, |
| | | tt.status_flag AS topicStatus, |
| | | tt.title, |
| | | tt.class_id, |
| | | tt.intro, |
| | | tt.image, |
| | | tt.test_type, |
| | | tt.test_amount, |
| | | tt.consult_one, |
| | | tt.consult_amount, |
| | | tt.test_people_num, |
| | | tt.test_set_num |
| | | FROM t_mental_test_record o |
| | | LEFT JOIN t_order_mental_test omt ON o.answer_no = omt.order_no |
| | | LEFT JOIN t_mental_test_topic tt ON o.topic_id = tt.id |
| | | <where> |
| | | <if test="userId != null"> |
| | | AND o.user_id = #{userId} |
| | | </if> |
| | | <if test="topicId != null"> |
| | | AND o.topic_id = #{topicId} |
| | | </if> |
| | | </where> |
| | | ) |
| | | UNION ALL |
| | | (SELECT o.id AS id, |
| | | o.order_no AS orderNo, |
| | | NULL AS mentalTestRecordId, |
| | | o.create_time AS createTime, |
| | | o.status_flag AS statusFlag, |
| | | o.is_back AS isBack, |
| | | o.test_flag AS testFlag, |
| | | tt.id AS topicId, |
| | | tt.status_flag AS topicStatus, |
| | | tt.title, |
| | | tt.class_id, |
| | | tt.intro, |
| | | tt.image, |
| | | tt.test_type, |
| | | tt.test_amount, |
| | | tt.consult_one, |
| | | tt.consult_amount, |
| | | tt.test_people_num, |
| | | tt.test_set_num |
| | | FROM t_order_mental_test o |
| | | LEFT JOIN t_mental_test_topic tt ON o.goods_id = tt.id |
| | | <where> order_no NOT IN (SELECT answer_no FROM t_mental_test_record) |
| | | AND o.status_flag = 1 |
| | | <if test="userId != null"> |
| | | AND o.user_id = #{userId} |
| | | </if> |
| | | <if test="topicId != null"> |
| | | AND o.topic_id = #{topicId} |
| | | </if> |
| | | </where> |
| | | ) |
| | | </select> |
| | | <!--<select id="myTestTopic" resultType="cn.stylefeng.guns.modular.business.dto.MentalTestMyTestTopicDTO"> |
| | | SELECT |
| | | o.*, |
| | | tt.status_flag topicStatus, |
| | |
| | | </if> |
| | | </where> |
| | | ORDER BY o.create_time DESC |
| | | </select> |
| | | </select>--> |
| | | |
| | | <select id="myTestRecordTopicByMentalAppointmentId" resultType="cn.stylefeng.guns.modular.business.dto.MentalTestMyTestTopicDTO"> |
| | | <select id="myTestRecordTopicByMentalAppointmentId" resultType="cn.stylefeng.guns.modular.business.dto.MentalTestMyTestRecordTopicDTO"> |
| | | SELECT |
| | | o.*, |
| | | tt.status_flag topicStatus, |