lanan-system/dl-module-jx/src/main/resources/mapper/jx/DriveSchoolExamPassMapper.xml
2024-08-28 00:54:30 +08:00

258 lines
14 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.DriveSchoolExamPassMapper">
<resultMap type="cn.iocoder.yudao.module.jx.domain.DriveSchoolExamPass" id="DriveSchoolExamPassResult">
<result property="id" column="id" />
<result property="jxId" column="jxId" />
<result property="name" column="name" />
<result property="phone" column="phone" />
<result property="userId" column="userId" />
<result property="jlId" column="jlId" />
<result property="courseSubject" column="course_subject" />
<result property="jlName" column="jlName" />
<result property="deduct" column="deduct" />
<result property="payTime" column="payTime" />
<result property="payState" column="payState" />
<result property="courseId" column="courseId" />
<result property="coursePrice" column="course_price" />
<result property="orderNumber" column="orderNumber" />
<result property="photo" column="photo" />
<result property="createTime" column="create_time" />
<result property="creator" column="creator" />
<result property="updateTime" column="update_time" />
<result property="updater" column="updater" />
<result property="status" column="status" />
</resultMap>
<sql id="selectDriveSchoolExamPassVo">
select status,id, jxId, name, phone, userId,payState,payTime, jlId, course_subject, jlName, deduct, courseId, course_price, orderNumber, photo, create_time, creator, update_time, updater from drive_school_exam_pass
</sql>
<select id="selectDriveSchoolExamPassList" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolExamPass" resultMap="DriveSchoolExamPassResult">
<include refid="selectDriveSchoolExamPassVo"/>
<where>
deleted = 0
<if test="entity.jxId != null "> and jxId = #{entity.jxId}</if>
<if test="entity.name != null and entity.name != ''"> and name like concat('%', #{entity.name}, '%')</if>
<if test="entity.phone != null and entity.phone != ''"> and phone = #{entity.phone}</if>
<if test="entity.userId != null "> and userId = #{entity.userId}</if>
<if test="entity.jlId != null "> and jlId = #{entity.jlId}</if>
<if test="entity.courseSubject != null and entity.courseSubject != ''"> and course_subject = #{entity.courseSubject}</if>
<if test="entity.jlName != null and entity.jlName != ''"> and jlName like concat('%', #{entity.jlName}, '%')</if>
<if test="entity.deduct != null "> and deduct = #{entity.deduct}</if>
<if test="entity.payState != null "> and payState = #{entity.payState}</if>
<if test="entity.payTime != null "> and payTime = #{entity.payTime}</if>
<if test="entity.status != null "> and status = #{entity.status}</if>
<if test="entity.courseId != null "> and courseId = #{entity.courseId}</if>
<if test="entity.coursePrice != null "> and course_price = #{entity.coursePrice}</if>
<if test="entity.orderNumber != null and entity.orderNumber != ''"> and orderNumber = #{entity.orderNumber}</if>
<if test="entity.photo != null and entity.photo != ''"> and photo = #{entity.photo}</if>
</where>
order by create_time desc
</select>
<select id="selectDriveSchoolExamPassById" parameterType="Long" resultMap="DriveSchoolExamPassResult">
<include refid="selectDriveSchoolExamPassVo"/>
where id = #{id}
</select>
<insert id="insertDriveSchoolExamPass" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolExamPass" useGeneratedKeys="true" keyProperty="id">
insert into drive_school_exam_pass
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="jxId != null">jxId,</if>
<if test="name != null and name != ''">name,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="userId != null">userId,</if>
<if test="jlId != null">jlId,</if>
<if test="courseSubject != null and courseSubject != ''">course_subject,</if>
<if test="jlName != null and jlName != ''">jlName,</if>
<if test="deduct != null">deduct,</if>
<if test="payState != null">payState,</if>
<if test="paydTime != null">payd_time,</if>
<if test="courseId != null">courseId,</if>
<if test="coursePrice != null">course_price,</if>
<if test="orderNumber != null and orderNumber != ''">orderNumber,</if>
<if test="photo != null and photo != ''">photo,</if>
<if test="createTime != null">create_time,</if>
<if test="creator != null">creator,</if>
<if test="updateTime != null">update_time,</if>
<if test="updater != null">updater,</if>
<if test="status != null">status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="jxId != null">#{jxId},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="userId != null">#{userId},</if>
<if test="jlId != null">#{jlId},</if>
<if test="courseSubject != null and courseSubject != ''">#{courseSubject},</if>
<if test="jlName != null and jlName != ''">#{jlName},</if>
<if test="deduct != null">#{deduct},</if>
<if test="payState != null">#{payState},</if>
<if test="payTime != null">#{payTime},</if>
<if test="courseId != null">#{courseId},</if>
<if test="coursePrice != null">#{coursePrice},</if>
<if test="orderNumber != null and orderNumber != ''">#{orderNumber},</if>
<if test="photo != null and photo != ''">#{photo},</if>
<if test="createTime != null">#{createTime},</if>
<if test="creator != null">#{creator},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updater != null">#{updater},</if>
<if test="status != null">#{status},</if>
</trim>
</insert>
<update id="updateDriveSchoolExamPass" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolExamPass">
update drive_school_exam_pass
<trim prefix="SET" suffixOverrides=",">
<if test="jxId != null">jxId = #{jxId},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="userId != null">userId = #{userId},</if>
<if test="jlId != null">jlId = #{jlId},</if>
<if test="courseSubject != null and courseSubject != ''">course_subject = #{courseSubject},</if>
<if test="jlName != null and jlName != ''">jlName = #{jlName},</if>
<if test="deduct != null">deduct = #{deduct},</if>
<if test="payState != null">payState = #{payState},</if>
<if test="paydTime != null">payd_time = #{paydTime},</if>
<if test="courseId != null">courseId = #{courseId},</if>
<if test="coursePrice != null">course_price = #{coursePrice},</if>
<if test="orderNumber != null and orderNumber != ''">orderNumber = #{orderNumber},</if>
<if test="photo != null and photo != ''">photo = #{photo},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="creator != null">creator = #{creator},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updater != null">updater = #{updater},</if>
<if test="status != null">status = #{status},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDriveSchoolExamPassById" parameterType="Long">
delete from drive_school_exam_pass where id = #{id}
</delete>
<delete id="deleteDriveSchoolExamPassByIds" parameterType="String">
delete from drive_school_exam_pass where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectDriveSchoolExamPassByUserId" parameterType="Long" resultMap="DriveSchoolExamPassResult">
<include refid="selectDriveSchoolExamPassVo"/>
where deleted = 0 and userId = #{userId}
</select>
<select id="checkList" parameterType="Long" resultMap="DriveSchoolExamPassResult">
select * from drive_school_exam_pass
where deleted = 0 and jlId = #{userId}
order by create_time desc
</select>
<select id="getBalanceList" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolExamPass" resultMap="DriveSchoolExamPassResult">
SELECT id,jlName,sum(deduct) deduct,payd_time,jlId
from drive_school_exam_pass
<where>
deleted = 0 and
payState = 1
and status = 1
<if test="entity.payStartTimes != null and entity.payEndTimes != null"> and payd_time between #{entity.payStartTimes} and #{entity.payEndTimes}</if>
<if test="entity.jlName != null and entity.jlName != ''"> and jlName like concat('%', #{entity.jlName}, '%')</if>
<if test="entity.jlId != null "> and jlId = #{entity.jlId}</if>
<if test="entity.jxId != null "> and jxId = #{entity.jxId}</if>
</where>
group by jlId
</select>
<select id="getBalanceByCoachId" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolExamPass" resultMap="DriveSchoolExamPassResult">
SELECT id,jlName,sum(deduct) deduct,payd_time,jlId
from drive_school_exam_pass
<where>
deleted = 0 and
payState = 1
<if test="payStartTimes != null and payEndTimes != null"> and payd_time between #{payStartTimes} and #{payEndTimes}</if>
<if test="jlName != null and jlName != ''"> and jlName like concat('%', #{jlName}, '%')</if>
<if test="jlId != null "> and jlId = #{jlId}</if>
<if test="jxId != null "> and jxId = #{jxId}</if>
</where>
</select>
<select id="getBalanceApp" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolExamPass" resultMap="DriveSchoolExamPassResult">
SELECT id,jlName,sum(deduct) deduct,payd_time,jlId
from drive_school_exam_pass
<where>
deleted = 0 and
payState = 1
<if test="payStartTimes != null and payEndTimes != null"> and payd_time between #{payStartTimes} and #{payEndTimes}</if>
<if test="jlName != null and jlName != ''"> and jlName like concat('%', #{jlName}, '%')</if>
<if test="jlId != null "> and jlId = #{jlId}</if>
<if test="jxId != null "> and jxId = #{jxId}</if>
</where>
</select>
<select id="getBalance" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolExamPass" resultMap="DriveSchoolExamPassResult">
SELECT id,jlName,sum(deduct) deduct,payd_time,jlId
from drive_school_exam_pass
<where>
deleted = 0 and
payState = '0'
<if test="payStartTimes != null and payEndTimes != null"> payd_time between #{payStartTimes} and #{payEndTimes}</if>
<if test="jlName != null and jlName != ''"> and jlName like concat('%', #{jlName}, '%')</if>
<if test="jlId != null "> and jlId = #{jlId}</if>
<if test="jxId != null "> and jxId = #{jxId}</if>
</where>
group by jlId
order by payd_time desc
limit 1
</select>
<select id="getBalanceByCaochId" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolExamPass" resultMap="DriveSchoolExamPassResult">
SELECT id,jlName,sum(deduct) deduct,payd_time,jlId
from drive_school_exam_pass
<where>
deleted = 0 and
payState = '0'
<if test="payStartTimes != null and payEndTimes != null"> payd_time between #{payStartTimes} and #{payEndTimes}</if>
<if test="jlName != null and jlName != ''"> and jlName like concat('%', #{jlName}, '%')</if>
<if test="jlId != null "> and jlId = #{jlId}</if>
<if test="jxId != null "> and jxId = #{jxId}</if>
</where>
limit 1
</select>
<update id="pay" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolExamPass">
update drive_school_exam_pass
<trim prefix="SET" suffixOverrides=",">
<if test="jxId != null">jxId = #{jxId},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="userId != null">userId = #{userId},</if>
<if test="jlId != null">jlId = #{jlId},</if>
<if test="courseSubject != null and courseSubject != ''">course_subject = #{courseSubject},</if>
<if test="jlName != null and jlName != ''">jlName = #{jlName},</if>
<if test="deduct != null">deduct = #{deduct},</if>
<if test="status != null">status = #{status},</if>
payState = '1',
<if test="paydTime != null">payd_time = #{paydTime},</if>
<if test="paydTime != null">payd_time = #{paydTime},</if>
<if test="courseId != null">courseId = #{courseId},</if>
<if test="coursePrice != null">course_price = #{coursePrice},</if>
<if test="orderNumber != null and orderNumber != ''">orderNumber = #{orderNumber},</if>
<if test="photo != null and photo != ''">photo = #{photo},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="creator != null">creator = #{creator},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updater != null">updater = #{updater},</if>
<if test="status != null">status = #{status},</if>
</trim>
where jlId = #{jlId}
and jxId = #{jxId}
and payd_time between #{payStartTimes} and #{payEndTimes}
</update>
</mapper>