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

380 lines
21 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.payment.mapper.DriveSchoolPayMapper">
<resultMap type="cn.iocoder.yudao.module.jx.payment.entity.DriveSchoolPay" id="DriveSchoolPayResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="phone" column="phone" />
<result property="identity" column="identity" />
<result property="state" column="state" />
<result property="isSign" column="isSign" />
<result property="userId" column="userId" />
<result property="jlId" column="jlId" />
<result property="jxId" column="jxId" />
<result property="jlName" column="jlName" />
<result property="courseId" column="courseId" />
<result property="courseName" column="courseName" />
<result property="startPay" column="startPay" />
<result property="createTime" column="createTime" />
<result property="orderNumber" column="orderNumber" />
<result property="afternoon" column="afternoon" />
<result property="payType" column="payType" />
<result property="endTime" column="endTime" />
<result property="returnMoney" column="returnMoney" />
<result property="remark" column="remark" />
<result property="proofOne" column="proofOne" />
<result property="proofTwo" column="proofTwo" />
<result property="isReturn" column="isReturn" />
<result property="money" column="money" />
<result property="address" column="address" />
<result property="moneyDetail" column="moneyDetail" />
<result property="blackInto" column="blackInto" />
<result property="manageMoney" column="manageMoney" />
<result property="towMoney" column="towMoney" />
<result property="thirdMoney" column="thirdMoney" />
<result property="twoMoneyTime" column="twoMoneyTime" />
<result property="thirdMoneyTime" column="thirdMoneyTime" />
<result property="coursenName" column="coursenName" />
<result property="typeDec" column="typeDec" />
<result property="prof" column="prof" />
</resultMap>
<sql id="selectDriveSchoolPayVo">
select id, name,prof,money,address,moneyDetail,blackInto,manageMoney,towMoney,thirdMoney,twoTime,twoMoneyTime,thirdMoneyTime,coursenName,typeDec, phone, jlName,courseName, endTime,returnMoney,remark,proofOne,proofTwo,isReturn,payType,identity, state,isSign, userId, jlId, jxId, courseId, startPay, createTime, orderNumber, afternoon from drive_school_pay
</sql>
<select id="selectDriveSchoolPayList" parameterType="cn.iocoder.yudao.module.jx.payment.entity.DriveSchoolPay" resultMap="DriveSchoolPayResult">
<include refid="selectDriveSchoolPayVo"/>
<where>
deleted = 0
<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 like concat('%', #{entity.phone}, '%')</if>
<if test="entity.identity != null and entity.identity != ''"> and identity = #{entity.identity}</if>
<if test="entity.state != null "> and state = #{entity.state}</if>
<if test="entity.isSign != null "> and isSign = #{entity.isSign}</if>
<if test="entity.startPay != null "> and startPay = #{entity.startPay}</if>
<if test="entity.createTime != null "> and createTime = #{entity.createTime}</if>
<if test="entity.orderNumber != null and entity.orderNumber != ''"> and orderNumber like concat('%', #{entity.orderNumber}, '%') </if>
<if test="entity.afternoon != null "> and afternoon = #{entity.afternoon}</if>
<if test="entity.jxId != null "> and jxId = #{entity.jxId}</if>
<if test="entity.userId != null "> and userId = #{entity.userId}</if>
<if test="entity.payType != null "> and payType = #{entity.payType}</if>
<if test="entity.courseName != null "> and courseName like concat('%',#{entity.courseName},'%')</if>
<if test="entity.isReturn != null "> and isReturn = #{entity.isReturn}</if>
</where>
group by identity
order by createTime desc
</select>
<select id="stuList" parameterType="cn.iocoder.yudao.module.jx.payment.entity.DriveSchoolPay" resultMap="DriveSchoolPayResult">
SELECT
*
FROM
drive_school_pay
<where>
deleted = 0 and
identity IS NOT NULL
<if test="entity.type != null and entity.type != ''"> and course_subject = #{entity.type}</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 like concat('%', #{entity.phone}, '%')</if>
<if test="entity.identity != null and entity.identity != ''"> and identity = #{entity.identity}</if>
<if test="entity.state != null "> and state = #{entity.state}</if>
<if test="entity.isSign != null "> and isSign = #{entity.isSign}</if>
<if test="entity.startPay != null "> and startPay = #{entity.startPay}</if>
<if test="entity.createTime != null "> and createTime = #{entity.createTime}</if>
<if test="entity.orderNumber != null and entity.orderNumber != ''"> and orderNumber like concat('%', #{entity.orderNumber}, '%') </if>
<if test="entity.afternoon != null "> and afternoon = #{entity.afternoon}</if>
<if test="entity.jxId != null "> and jxId = #{entity.jxId}</if>
<if test="entity.jlId != null "> and jlId = #{entity.jlId}</if>
<if test="entity.userId != null "> and userId = #{entity.userId}</if>
<if test="entity.payType != null "> and payType = #{entity.payType}</if>
<if test="entity.isReturn != null "> and isReturn = #{entity.isReturn}</if>
</where>
order by createTime desc
</select>
<select id="stuTwoList" parameterType="cn.iocoder.yudao.module.jx.payment.entity.DriveSchoolPay" resultMap="DriveSchoolPayResult">
SELECT
dsep.*
FROM
drive_school_pay dcp
inner join drive_school_exam_pass dsep on dcp.phone = dsep.phone
<where>
deleted = 0 and
identity IS NOT NULL
<if test="entity.type != null and entity.type != ''"> and course_subject = #{entity.type}</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 like concat('%', #{entity.phone}, '%')</if>
<if test="entity.identity != null and entity.identity != ''"> and identity = #{entity.identity}</if>
<if test="entity.state != null "> and state = #{entity.state}</if>
<if test="entity.isSign != null "> and isSign = #{entity.isSign}</if>
<if test="entity.startPay != null "> and startPay = #{entity.startPay}</if>
<if test="entity.createTime != null "> and createTime = #{entity.createTime}</if>
<if test="entity.orderNumber != null and entity.orderNumber != ''"> and orderNumber like concat('%', #{entity.orderNumber}, '%') </if>
<if test="entity.afternoon != null "> and afternoon = #{entity.afternoon}</if>
<if test="entity.jxId != null "> and jxId = #{entity.jxId}</if>
<if test="entity.jlId != null "> and jlId = #{entity.jlId}</if>
<if test="entity.userId != null "> and userId = #{entity.userId}</if>
<if test="entity.payType != null "> and payType = #{entity.payType}</if>
<if test="entity.isReturn != null "> and isReturn = #{entity.isReturn}</if>
</where>
order by dcp.createTime desc
</select>
<select id="stuOneList" parameterType="cn.iocoder.yudao.module.jx.payment.entity.DriveSchoolPay" resultMap="DriveSchoolPayResult">
SELECT
dsep.*
FROM
drive_school_pay dcp
inner join drive_school_exam_pass dsep on dcp.phone = dsep.phone
<where>
deleted = 0 and
identity IS NOT NULL
<if test="entity.type != null and entity.type != ''"> and course_subject = #{entity.type}</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 like concat('%', #{entity.phone}, '%')</if>
<if test="entity.identity != null and entity.identity != ''"> and identity = #{entity.identity}</if>
<if test="entity.state != null "> and state = #{entity.state}</if>
<if test="entity.isSign != null "> and isSign = #{entity.isSign}</if>
<if test="entity.startPay != null "> and startPay = #{entity.startPay}</if>
<if test="entity.createTime != null "> and createTime = #{entity.createTime}</if>
<if test="entity.orderNumber != null and entity.orderNumber != ''"> and orderNumber like concat('%', #{entity.orderNumber}, '%') </if>
<if test="entity.afternoon != null "> and afternoon = #{entity.afternoon}</if>
<if test="entity.jxId != null "> and jxId = #{entity.jxId}</if>
<if test="entity.jlId != null "> and jlId = #{entity.jlId}</if>
<if test="entity.userId != null "> and userId = #{entity.userId}</if>
<if test="entity.payType != null "> and payType = #{entity.payType}</if>
<if test="entity.isReturn != null "> and isReturn = #{entity.isReturn}</if>
</where>
order by dcp.createTime desc
</select>
<select id="selectDriveSchoolPayById" parameterType="Long" resultMap="DriveSchoolPayResult">
<include refid="selectDriveSchoolPayVo"/>
where id = #{id}
</select>
<insert id="insertDriveSchoolPay" parameterType="cn.iocoder.yudao.module.jx.payment.entity.DriveSchoolPay" useGeneratedKeys="true" keyProperty="id">
insert into drive_school_pay
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="identity != null">identity,</if>
<if test="sex != null">sex,</if>
<if test="age != null">age,</if>
<if test="typeDec != null">typeDec,</if>
<if test="orders != null">orders,</if>
<if test="state != null">state,</if>
<if test="userId != null">userId,</if>
<if test="jlId != null">jlId,</if>
<if test="jxId != null">jxId,</if>
<if test="courseId != null">courseId,</if>
<if test="startPay != null">startPay,</if>
<if test="createTime != null">createTime,</if>
<if test="orderNumber != null">orderNumber,</if>
<if test="afternoon != null">afternoon,</if>
<if test="payType != null">payType,</if>
<if test="endTime != null">endTime,</if>
<if test="returnMoney != null">returnMoney,</if>
<if test="remark != null">remark,</if>
<if test="proofOne != null">proofOne,</if>
<if test="proofTwo != null">proofTwo,</if>
<if test="money != null">money,</if>
<if test="address != null">address,</if>
<if test="moneyDetail != null">moneyDetail,</if>
<if test="blackInto != null">blackInto,</if>
<if test="manageMoney != null">manageMoney,</if>
<if test="towMoney != null">towMoney,</if>
<if test="thirdMoney != null">thirdMoney,</if>
<if test="twoTime != null">twoTime,</if>
<if test="twoMoneyTime != null">twoMoneyTime,</if>
<if test="thirdTime != null">thirdTime,</if>
<if test="thirdMoneyTime != null">thirdMoneyTime,</if>
<if test="coursenName != null">coursenName,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="identity != null">#{identity},</if>
<if test="sex != null">#{sex},</if>
<if test="age != null">#{age},</if>
<if test="typeDec != null">#{typeDec},</if>
<if test="orders != null">#{orders},</if>
<if test="state != null">#{state},</if>
<if test="userId != null">#{userId},</if>
<if test="jlId != null">#{jlId},</if>
<if test="jxId != null">#{jxId},</if>
<if test="courseId != null">#{courseId},</if>
<if test="startPay != null">#{startPay},</if>
<if test="createTime != null">#{createTime},</if>
<if test="orderNumber != null">#{orderNumber},</if>
<if test="afternoon != null">#{afternoon},</if>
<if test="payType != null">#{payType},</if>
<if test="endTime != null">#{endTime},</if>
<if test="returnMoney != null">#{returnMoney},</if>
<if test="remark != null">#{remark},</if>
<if test="proofOne != null">#{proofOne},</if>
<if test="proofTwo != null">#{proofTwo},</if>
<if test="money != null">#{money},</if>
<if test="address != null">#{address},</if>
<if test="moneyDetail != null">#{moneyDetail},</if>
<if test="blackInto != null">#{blackInto},</if>
<if test="manageMoney != null">#{manageMoney},</if>
<if test="towMoney != null">#{towMoney},</if>
<if test="thirdMoney != null">#{thirdMoney},</if>
<if test="twoTime != null">#{twoTime},</if>
<if test="twoMoneyTime != null">#{twoMoneyTime},</if>
<if test="thirdTime != null">#{thirdTime},</if>
<if test="thirdMoneyTime != null">#{thirdMoneyTime},</if>
<if test="coursenName != null">#{coursenName},</if>
</trim>
</insert>
<update id="updateDriveSchoolPay" parameterType="cn.iocoder.yudao.module.jx.payment.entity.DriveSchoolPay">
update drive_school_pay
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="identity != null">identity = #{identity},</if>
<if test="state != null">state = #{state},</if>
<if test="isSign != null">isSign = #{isSign},</if>
<if test="userId != null">userId = #{userId},</if>
<if test="jlId != null">jlId = #{jlId},</if>
<if test="jxId != null">jxId = #{jxId},</if>
<if test="courseId != null">courseId = #{courseId},</if>
<if test="startPay != null">startPay = #{startPay},</if>
<if test="createTime != null">createTime = #{createTime},</if>
<if test="orderNumber != null">orderNumber = #{orderNumber},</if>
<if test="afternoon != null">afternoon = #{afternoon},</if>
<if test="endTime != null">endTime = #{endTime},</if>
<if test="returnMoney != null">returnMoney = #{returnMoney},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="proofOne != null">proofOne = #{proofOne},</if>
<if test="proofTwo != null">proofTwo = #{proofTwo},</if>
<if test="isReturn != null">isReturn = #{isReturn},</if>
<if test="prof != null">prof = #{prof},</if>
<if test="money != null">money = #{money},</if>
</trim>
where id = #{id}
</update>
<update id="updatePayById">
update drive_school_pay
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">jlName = #{name},</if>
<if test="jlId != null ">jlId = #{jlId},</if>
state = 3,
isSign = 1
</trim>
where id = #{id}
</update>
<delete id="deleteDriveSchoolPayById" parameterType="Long">
delete from drive_school_pay where id = #{id}
</delete>
<delete id="deleteDriveSchoolPayByIds" parameterType="String">
delete from drive_school_pay where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getUserList" parameterType="cn.iocoder.yudao.module.jx.payment.entity.DriveSchoolPay" resultType="cn.iocoder.yudao.module.jx.vo.DriveSchoolPayVo">
SELECT
dsp.*,
dsc.name coueseName,
dsc.price as price
FROM
drive_school_pay dsp
left join drive_school_course dsc
on dsp.courseId = dsc.id
<where>
dsp.deleted = 0
<if test="entity.name != null and entity.name != ''"> and dsp.`name` like concat('%', #{entity.name}, '%')</if>
<if test="entity.phone != null and entity.phone != ''"> and dsp.phone like concat('%', #{entity.phone}, '%')</if>
<if test="entity.identity != null and entity.identity != ''"> and dsp.identity = #{entity.identity}</if>
<if test="entity.state != null "> and dsp.state = #{entity.state}</if>
<if test="entity.isSign != null "> and dsp.isSign = #{entity.isSign}</if>
<if test="entity.startPay != null "> and dsp.startPay = #{entity.startPay}</if>
<if test="entity.createTime != null "> and dsp.createTime = #{entity.createTime}</if>
<if test="entity.orderNumber != null and orderNumber != ''"> and dsp.orderNumber like concat('%', #{entity.orderNumber}, '%') </if>
<if test="entity.afternoon != null "> and dsp.afternoon = #{entity.afternoon}</if>
<if test="entity.jxId != null "> and dsp.jxId = #{entity.jxId}</if>
<if test="entity.jlId != null "> and dsp.jlId = #{entity.jlId}</if>
<if test="entity.userId != null "> and dsp.userId = #{entity.userId}</if>
<if test="entity.payType != null "> and dsp.payType = #{entity.payType}</if>
<if test="entity.isReturn != null "> and dsp.isReturn = #{entity.isReturn}</if>
</where>
order by createTime desc
</select>
<select id="getReportCourseList" parameterType="cn.iocoder.yudao.module.jx.payment.entity.DriveSchoolPay" resultType="cn.iocoder.yudao.module.jx.vo.DriveSchoolPayVo">
SELECT
dsp.*,
dsc.automatic coueseName
FROM
drive_school_pay dsp
left join drive_school_course dsc on dsp.courseId = dsc.id
<where>
dsp.deleted = 0
<if test="entity.jxId != null "> and jxId = #{entity.jxId}</if>
</where>
order by createTime desc
</select>
<select id="getInfoByUserId" parameterType="Long" resultMap="DriveSchoolPayResult">
<include refid="selectDriveSchoolPayVo"/>
where userId = #{userId}
</select>
<select id="getAllMoney" parameterType="Long" resultType="double">
select count(money) money from drive_school_pay where deleted = 0
</select>
<select id="getInfoByUserIndenty" parameterType="String" resultMap="DriveSchoolPayResult">
<include refid="selectDriveSchoolPayVo"/>
where deleted = 0 and identity = #{userId}
</select>
<select id="getDeductByUserInfo"
resultType="cn.iocoder.yudao.module.jx.payment.entity.DriveSchoolPay">
SELECT
*
FROM
drive_school_pay
<where>
deleted = 0 and
state != '0'
<if test="name != null and name != ''"> and `name` like concat('%', #{name}, '%')</if>
<if test="phone != null and phone != ''"> and phone like concat('%', #{phone}, '%')</if>
<if test="jlName != null "> and jlName = #{jlName}</if>
<if test="userId != null "> and userId = #{userId}</if>
</where>
limit 1
</select>
<select id="selectByCoachId" parameterType="Long" resultType="Integer">
select count(1) count from drive_school_pay
where deleted = 0 and jlId = #{userId}
</select>
<select id="selectByUserId" parameterType="Long" resultMap="DriveSchoolPayResult">
<include refid="selectDriveSchoolPayVo"/>
where deleted = 0 and userId = #{userId}
limit 1
</select>
<select id="selectByPhone" parameterType="String" resultMap="DriveSchoolPayResult">
<include refid="selectDriveSchoolPayVo"/>
where deleted = 0 and phone = #{phone}
limit 1
</select>
</mapper>