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.
75 lines
2.6 KiB
75 lines
2.6 KiB
<?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.UserStatusMapper">
|
|
|
|
<resultMap type="userStatus" id="UserStatusMap">
|
|
<result property="statusId" column="status_id" jdbcType="INTEGER"/>
|
|
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
|
<result property="classId" column="class_id" jdbcType="INTEGER"/>
|
|
<result property="orderId" column="order_id" jdbcType="INTEGER"/>
|
|
<result property="status" column="status" jdbcType="INTEGER"/>
|
|
</resultMap>
|
|
|
|
<sql id="Base_Column_List">
|
|
status_id,
|
|
user_id,
|
|
class_id,
|
|
order_id,
|
|
`status`
|
|
</sql>
|
|
|
|
<select id="queryDtoByUserId" resultType="com.hc.business.dto.UserStatusClassDto">
|
|
SELECT status_id,
|
|
class_config_id,
|
|
class_name,
|
|
need_paper,
|
|
(bx_hours + xx_hours) as total_hours,
|
|
apply_start_time,
|
|
apply_end_time,
|
|
study_start_time,
|
|
study_end_time,
|
|
paper_start_time,
|
|
paper_end_time,
|
|
cert_start_time,
|
|
cert_end_time,
|
|
user_id,
|
|
paper_id,
|
|
status
|
|
FROM user_status as ut
|
|
INNER JOIN class_config cc on ut.class_id = cc.class_config_id
|
|
WHERE user_id = #{userId} and status=1
|
|
</select>
|
|
|
|
<select id="queryByUserId" resultMap="UserStatusMap">
|
|
SELECT
|
|
<include refid="Base_Column_List"/>
|
|
FROM user_status
|
|
WHERE user_id = #{userId}
|
|
</select>
|
|
|
|
<select id="queryByClassIdAndUserId" resultMap="UserStatusMap">
|
|
SELECT
|
|
<include refid="Base_Column_List"/>
|
|
FROM user_status
|
|
WHERE class_id = #{classId} AND user_id = #{userId}
|
|
</select>
|
|
<select id="queryAvailableByClassId" resultMap="UserStatusMap">
|
|
SELECT
|
|
<include refid="Base_Column_List"/>
|
|
FROM user_status
|
|
WHERE class_id = #{classId} and status=1
|
|
</select>
|
|
<select id="queryByClassId" resultType="com.hc.business.dto.UserStatusDto">
|
|
SELECT
|
|
u.*,o.create_time as payTime
|
|
FROM user u
|
|
INNER JOIN user_status us on u.user_id = us.user_id
|
|
join orders o on us.order_id=o.orders_id
|
|
WHERE us.class_id = #{classId}
|
|
</select>
|
|
<update id="updateUserStatus">
|
|
update user_status set
|
|
status = 0
|
|
where user_id = #{userId} and class_id=#{classId} and order_id=#{orderId}
|
|
</update>
|
|
</mapper> |