261 lines
13 KiB
XML
261 lines
13 KiB
XML
![]() |
<?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="cn.iocoder.yudao.module.jx.mapper.DriveSchoolReservationCourseMapper">
|
||
|
|
||
|
<resultMap type="cn.iocoder.yudao.module.jx.domain.DriveSchoolReservationCourse" id="DriveSchoolReservationCourseResult">
|
||
|
<result property="id" column="id" />
|
||
|
<result property="deptId" column="dept_id" />
|
||
|
<result property="userId" column="user_id" />
|
||
|
<result property="userName" column="user_name" />
|
||
|
<result property="orderTime" column="order_time" />
|
||
|
<result property="timePeriod" column="time_period" />
|
||
|
<result property="coachId" column="coach_id" />
|
||
|
<result property="coachName" column="coach_name" />
|
||
|
<result property="stuSignState" column="stu_sign_state" />
|
||
|
<result property="coachSignState" column="coach_sign_state" />
|
||
|
<result property="stuSigninTime" column="stu_signin_time" />
|
||
|
<result property="stuSignoutTime" column="stu_signout_time" />
|
||
|
<result property="coachSigninTime" column="coach_signin_time" />
|
||
|
<result property="coachSignoutTime" column="coach_signout_time" />
|
||
|
<result property="driveTime" column="drive_time" />
|
||
|
<result property="allDriveTime" column="allDriveTime" />
|
||
|
<result property="type" column="type" />
|
||
|
<result property="auditStatus" column="audit_status" />
|
||
|
<result property="accountType" column="account_type" />
|
||
|
<result property="createTime" column="create_time" />
|
||
|
<result property="createBy" column="create_by" />
|
||
|
<result property="updateTime" column="update_time" />
|
||
|
<result property="updateBy" column="update_by" />
|
||
|
</resultMap>
|
||
|
|
||
|
<sql id="selectDriveSchoolReservationCourseVo">
|
||
|
select id, dept_id, user_id,type, user_name,drive_time,stu_sign_state,coach_sign_state,stu_signin_time, stu_signout_time,coach_signin_time,coach_signout_time,order_time, time_period, coach_id, coach_name, account_type, create_time, create_by, update_time, update_by from drive_school_reservation_course
|
||
|
</sql>
|
||
|
|
||
|
<select id="selectDriveSchoolReservationCourseList" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolReservationCourse" resultMap="DriveSchoolReservationCourseResult">
|
||
|
<include refid="selectDriveSchoolReservationCourseVo"/>
|
||
|
<where>
|
||
|
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
||
|
<if test="userId != null "> and user_id = #{userId}</if>
|
||
|
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
|
||
|
<if test="orderTime != null "> and order_time = #{orderTime}</if>
|
||
|
<if test="timePeriod != null and timePeriod != ''"> and time_period = #{timePeriod}</if>
|
||
|
<if test="coachId != null "> and coach_id = #{coachId}</if>
|
||
|
<if test="coachName != null and coachName != ''"> and coach_name like concat('%', #{coachName}, '%')</if>
|
||
|
<if test="accountType != null and accountType != ''"> and account_type = #{accountType}</if>
|
||
|
</where>
|
||
|
order by create_time desc
|
||
|
</select>
|
||
|
|
||
|
<select id="selectDriveSchoolReservationCourseById" parameterType="Long" resultMap="DriveSchoolReservationCourseResult">
|
||
|
<include refid="selectDriveSchoolReservationCourseVo"/>
|
||
|
where id = #{id}
|
||
|
</select>
|
||
|
<select id="findCourseByCurrentTimeAndJlName"
|
||
|
resultType="cn.iocoder.yudao.module.jx.domain.DriveSchoolReservationCourse">
|
||
|
select * from drive_school_reservation_course dsrc
|
||
|
join drive_school_coach dsc on dsrc.coach_name = dsc.instructor_name where dsrc.order_time like concat('%', #{currentDate}, '%') and dsc.id = #{jlId}
|
||
|
</select>
|
||
|
<select id="findCourseByUserId"
|
||
|
resultType="cn.iocoder.yudao.module.jx.domain.DriveSchoolReservationCourse">
|
||
|
select * from drive_school_reservation_course where user_id = #{userId}
|
||
|
</select>
|
||
|
|
||
|
<insert id="insertDriveSchoolReservationCourse" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolReservationCourse">
|
||
|
insert into drive_school_reservation_course
|
||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
<if test="id != null">id,</if>
|
||
|
<if test="deptId != null">dept_id,</if>
|
||
|
<if test="userId != null">user_id,</if>
|
||
|
<if test="userName != null">user_name,</if>
|
||
|
<if test="orderTime != null">order_time,</if>
|
||
|
<if test="timePeriod != null">time_period,</if>
|
||
|
<if test="coachId != null">coach_id,</if>
|
||
|
<if test="coachName != null">coach_name,</if>
|
||
|
<if test="accountType != null">account_type,</if>
|
||
|
<if test="type != null">type,</if>
|
||
|
<if test="createTime != null">create_time,</if>
|
||
|
<if test="createBy != null">create_by,</if>
|
||
|
<if test="updateTime != null">update_time,</if>
|
||
|
<if test="updateBy != null">update_by,</if>
|
||
|
</trim>
|
||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
<if test="id != null">#{id},</if>
|
||
|
<if test="deptId != null">#{deptId},</if>
|
||
|
<if test="userId != null">#{userId},</if>
|
||
|
<if test="userName != null">#{userName},</if>
|
||
|
<if test="orderTime != null">#{orderTime},</if>
|
||
|
<if test="timePeriod != null">#{timePeriod},</if>
|
||
|
<if test="coachId != null">#{coachId},</if>
|
||
|
<if test="coachName != null">#{coachName},</if>
|
||
|
<if test="accountType != null">#{accountType},</if>
|
||
|
<if test="type != null">#{type},</if>
|
||
|
<if test="createTime != null">#{createTime},</if>
|
||
|
<if test="createBy != null">#{createBy},</if>
|
||
|
<if test="updateTime != null">#{updateTime},</if>
|
||
|
<if test="updateBy != null">#{updateBy},</if>
|
||
|
</trim>
|
||
|
</insert>
|
||
|
<insert id="insertBookingInfo">
|
||
|
insert into drive_school_reservation_course (user_id, order_time, time_period, coach_name, create_time) values (#{userId}, #{currentDate}, #{period}, #{instructorName}, now())
|
||
|
</insert>
|
||
|
|
||
|
<update id="updateDriveSchoolReservationCourse" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolReservationCourse">
|
||
|
update drive_school_reservation_course
|
||
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
<if test="deptId != null">dept_id = #{deptId},</if>
|
||
|
<if test="userId != null">user_id = #{userId},</if>
|
||
|
<if test="userName != null">user_name = #{userName},</if>
|
||
|
<if test="stuSignState != null">stu_sign_state = #{stuSignState},</if>
|
||
|
<if test="coachSignState != null">coach_sign_state = #{coachSignState},</if>
|
||
|
<if test="stuSigninTime != null">stu_signin_time = #{stuSigninTime},</if>
|
||
|
<if test="stuSignoutTime != null">stu_signout_time = #{stuSignoutTime},</if>
|
||
|
<if test="coachSigninTime != null">coach_signin_time = #{coachSigninTime},</if>
|
||
|
<if test="coachSignoutTime != null">coach_signout_time = #{coachSignoutTime},</if>
|
||
|
<if test="driveTime != null">drive_time = #{driveTime},</if>
|
||
|
<if test="orderTime != null">order_time = #{orderTime},</if>
|
||
|
<if test="timePeriod != null">time_period = #{timePeriod},</if>
|
||
|
<if test="coachId != null">coach_id = #{coachId},</if>
|
||
|
<if test="coachName != null">coach_name = #{coachName},</if>
|
||
|
<if test="accountType != null">account_type = #{accountType},</if>
|
||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||
|
<if test="auditStatus != null">audit_status = #{auditStatus},</if>
|
||
|
<if test="refuseReason != null">refuse_reason = #{refuseReason},</if>
|
||
|
</trim>
|
||
|
where id = #{id}
|
||
|
</update>
|
||
|
<update id="updateCourseById">
|
||
|
update drive_school_reservation_course set coach_name = #{coachName} where id = #{id}
|
||
|
</update>
|
||
|
|
||
|
<delete id="deleteDriveSchoolReservationCourseById" parameterType="Long">
|
||
|
delete from drive_school_reservation_course where id = #{id}
|
||
|
</delete>
|
||
|
|
||
|
<delete id="deleteDriveSchoolReservationCourseByIds" parameterType="String">
|
||
|
delete from drive_school_reservation_course where id in
|
||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||
|
#{id}
|
||
|
</foreach>
|
||
|
</delete>
|
||
|
|
||
|
<select id="getReservationNumber"
|
||
|
resultType="Integer">
|
||
|
select count(1) number from drive_school_reservation_course where dept_id = #{deptId} and account_type = '2'
|
||
|
</select>
|
||
|
|
||
|
<select id="getReservationNumberThree"
|
||
|
resultType="Integer">
|
||
|
select count(1) number from drive_school_reservation_course where dept_id = #{deptId} and account_type = '3'
|
||
|
</select>
|
||
|
|
||
|
<select id="getIsRecdNumber"
|
||
|
resultType="Integer">
|
||
|
select count(1) number from drive_school_pay where jxId = #{deptId} and state = '3' or jxId = #{deptId} and state = '0'
|
||
|
</select>
|
||
|
|
||
|
<select id="getPaydNumber"
|
||
|
resultType="Integer">
|
||
|
select count(1) number from drive_school_pay where jxId = #{deptId} and state = '3'
|
||
|
</select>
|
||
|
|
||
|
<select id="getSignedNumber"
|
||
|
resultType="Integer">
|
||
|
select count(1) number from drive_school_pay where jxId = #{deptId} and isSign = '1' and state = '3'
|
||
|
</select>
|
||
|
|
||
|
<select id="getReservationCourseList"
|
||
|
resultType="cn.iocoder.yudao.module.jx.domain.DriveSchoolReservationCourse">
|
||
|
select * from drive_school_reservation_course
|
||
|
where dept_id = #{deptId}
|
||
|
</select>
|
||
|
|
||
|
|
||
|
<select id="selectDriveSchoolReservationGetListUser" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolReservationCourse" resultMap="DriveSchoolReservationCourseResult">
|
||
|
<include refid="selectDriveSchoolReservationCourseVo"/>
|
||
|
<where>
|
||
|
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
||
|
<if test="userId != null "> and user_id = #{userId}</if>
|
||
|
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
|
||
|
<if test="orderTime != null "> and order_time = #{orderTime}</if>
|
||
|
<if test="timePeriod != null and timePeriod != ''"> and time_period = #{timePeriod}</if>
|
||
|
<if test="coachId != null "> and coach_id = #{coachId}</if>
|
||
|
<if test="coachName != null and coachName != ''"> and coach_name like concat('%', #{coachName}, '%')</if>
|
||
|
<if test="accountType != null and accountType != ''"> and account_type = #{accountType}</if>
|
||
|
</where>
|
||
|
order by create_time desc
|
||
|
</select>
|
||
|
|
||
|
|
||
|
<select id="getDriveTime" parameterType="Long" resultMap="DriveSchoolReservationCourseResult">
|
||
|
SELECT
|
||
|
SUM(drive_time) allDriveTime
|
||
|
FROM
|
||
|
drive_school_reservation_course
|
||
|
<where>
|
||
|
<if test="userId != null "> and dept_id = #{deptId}</if>
|
||
|
</where>
|
||
|
</select>
|
||
|
|
||
|
<select id="getOftenDriveStudents" parameterType="Long" resultMap="DriveSchoolReservationCourseResult">
|
||
|
SELECT *
|
||
|
FROM drive_school_reservation_course
|
||
|
<where>
|
||
|
create_time >= NOW() - INTERVAL 1 MONTH
|
||
|
<if test="userId != null "> and coach_id = #{userId}</if>
|
||
|
</where>
|
||
|
GROUP BY user_id
|
||
|
HAVING COUNT(1) >= 2;
|
||
|
</select>
|
||
|
|
||
|
<select id="getReservationCourseListByUserId" parameterType="Long" resultMap="DriveSchoolReservationCourseResult">
|
||
|
SELECT *
|
||
|
FROM drive_school_reservation_course
|
||
|
<where>
|
||
|
|
||
|
<if test="userId != null "> and user_id = #{userId}</if>
|
||
|
</where>
|
||
|
order by create_time desc
|
||
|
</select>
|
||
|
|
||
|
<select id="getAppReservationCourseListByUserId" resultMap="DriveSchoolReservationCourseResult">
|
||
|
SELECT *
|
||
|
FROM drive_school_reservation_course
|
||
|
<where>
|
||
|
audit_status = 0
|
||
|
<if test="userId != null "> and coach_id = #{userId}</if>
|
||
|
</where>
|
||
|
order by audit_status,create_time desc
|
||
|
</select>
|
||
|
|
||
|
<select id="getAppReservationCourseListByUserIds" resultMap="DriveSchoolReservationCourseResult">
|
||
|
SELECT *
|
||
|
FROM drive_school_reservation_course
|
||
|
<where>
|
||
|
audit_status != 0
|
||
|
<if test="userId != null "> and coach_id = #{userId}</if>
|
||
|
</where>
|
||
|
order by audit_status,create_time desc
|
||
|
</select>
|
||
|
|
||
|
<select id="getReservationNumberByUserId" resultType="Integer">
|
||
|
select distinct count(1) number from drive_school_reservation_course where coach_id = #{userId} and stu_sign_state !='2' or coach_id = #{userId} and coach_sign_state !='2'
|
||
|
</select>
|
||
|
|
||
|
|
||
|
<update id="updateDriveSchoolReservationCourseByCoach" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolReservationCourse">
|
||
|
update drive_school_reservation_course
|
||
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
<if test="refuseReason != null">refuse_reason = #{refuseReason},</if>
|
||
|
<if test="auditStatus != null">audit_status = #{auditStatus},</if>
|
||
|
</trim>
|
||
|
where id = #{id}
|
||
|
</update>
|
||
|
|
||
|
</mapper>
|