You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

156 lines
6.6 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?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.hc.business.mapper.ClassConfigMapper">
<resultMap type="classConfig" id="ClassConfigMap">
<result property="classConfigId" column="class_config_id" jdbcType="INTEGER"/>
<result property="className" column="class_name" jdbcType="VARCHAR"/>
<result property="classDesc" column="class_desc" jdbcType="VARCHAR"/>
<result property="classType" column="class_type" jdbcType="INTEGER"/>
<result property="classLogo" column="class_logo" jdbcType="VARCHAR"/>
<result property="areaId" column="area_id" jdbcType="INTEGER"/>
<result property="bxHours" column="bx_hours" jdbcType="FLOAT"/>
<result property="xxHours" column="xx_hours" jdbcType="FLOAT"/>
<result property="paperHours" column="paper_hours" jdbcType="FLOAT"/>
<result property="paperId" column="paper_id" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="INTEGER"/>
<result property="years" column="years" jdbcType="VARCHAR"/>
<result property="price" column="price" jdbcType="NUMERIC"/>
<result property="applyStartTime" column="apply_start_time" jdbcType="INTEGER"/>
<result property="applyEndTime" column="apply_end_time" jdbcType="INTEGER"/>
<result property="studyStartTime" column="study_start_time" jdbcType="INTEGER"/>
<result property="studyEndTime" column="study_end_time" jdbcType="INTEGER"/>
<result property="paperStartTime" column="paper_start_time" jdbcType="INTEGER"/>
<result property="paperEndTime" column="paper_end_time" jdbcType="INTEGER"/>
<result property="certStartTime" column="cert_start_time" jdbcType="INTEGER"/>
<result property="certEndTime" column="cert_end_time" jdbcType="INTEGER"/>
<result property="needPaper" column="need_paper" jdbcType="INTEGER"/>
<result property="valid" column="valid" jdbcType="INTEGER"/>
<result property="classContent" column="class_content" jdbcType="VARCHAR"/>
<result property="classMobileContent" column="class_mobile_content" jdbcType="VARCHAR"/>
<result property="signTime" column="sign_time" jdbcType="BIGINT"/>
<result property="prefix" column="prefix" jdbcType="VARCHAR"/>
<result property="testId" column="test_id" jdbcType="INTEGER"/>
<result property="target" column="target" jdbcType="VARCHAR"/>
<result property="limitNum" column="limit_num" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
class_config_id,
class_name,
class_desc,
class_type,
class_logo,
class_content,
class_mobile_content,
area_id,
bx_hours,
xx_hours,
paper_hours,
paper_id,
create_time,
years,
price,
apply_start_time,
apply_end_time,
study_start_time,
study_end_time,
paper_start_time,
paper_end_time,
cert_start_time,
cert_end_time,
need_paper,
valid,
sign_time,
prefix,
test_id,
target,
limit_num
</sql>
<select id="queryByValid" resultMap="ClassConfigMap">
SELECT
<include refid="Base_Column_List"/>
FROM class_config
WHERE valid = #{valid}
ORDER BY create_time DESC
</select>
<select id="queryByAreaId" resultMap="ClassConfigMap">
SELECT
<include refid="Base_Column_List"/>
FROM class_config
WHERE area_id = #{areaId}
ORDER BY class_config_id DESC
</select>
<select id="queryByTime" resultMap="ClassConfigMap">
SELECT
<include refid="Base_Column_List"/>
FROM class_config
WHERE study_start_time = #{studyStartTime}
ORDER BY class_config_id DESC
</select>
<select id="queryByClassName" resultMap="ClassConfigMap">
SELECT
<include refid="Base_Column_List"/>
FROM class_config
WHERE class_name LIKE "%"#{name}"%"
ORDER BY class_config_id DESC
</select>
<select id="queryAll" resultMap="ClassConfigMap">
SELECT
<include refid="Base_Column_List"/>
FROM class_config
ORDER BY class_config_id DESC
</select>
<select id="queryByYear" resultMap="ClassConfigMap">
SELECT
<include refid="Base_Column_List"/>
FROM class_config
WHERE years LIKE "%"#{year}"%"
ORDER BY class_config_id DESC
</select>
<select id="queryByTarget" resultMap="ClassConfigMap">
SELECT
<include refid="Base_Column_List"/>
FROM class_config
WHERE target LIKE "%"#{target}"%"
ORDER BY class_config_id DESC
</select>
<select id="getPrintList" resultType="com.hc.business.dto.ClassPrintDto">
select *
from (select count(1) course_count,
ss.user_id,
ss.class_id,
Max(ss.score) score,
Max(ss.create_time) create_time
from (SELECT DISTINCT a.user_id, b.class_id, c.class_config_id, h.course_name, f.score, f.create_time
FROM `user` a
join user_status b on a.user_id = b.user_id
join class_config c on b.class_id = c.class_config_id
join class_course d on c.class_config_id = d.class_id
join user_course e on e.course_id = d.course_id
join user_test_history f on f.user_id = a.user_id and f.class_id = c.class_config_id
join paper g on g.paper_id = f.paper_id
join course h on h.course_id = e.course_id
where a.card_id = #{cardId} -- 身份证
and b.`status` = 1 -- 课程正确 没有退费
and e.course_percent = 1 -- 课程必须学完
and d.course_type = 1 -- 只要必须课程
and f.score >= g.paper_score_pass -- >= 合格分数
) ss
group by ss.user_id, ss.class_id) sss
-- 判断所有必修课程,是不是都是进度 100并且合格
where sss.course_count = (select count(*) from class_course where course_type = 1 and class_id = sss.class_id)
</select>
</mapper>