74 lines
2.6 KiB
XML
Raw Normal View History

2026-03-10 16:40:19 +08:00
<?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._3e.newdao.UserOwnLessonDao">
<!-- 支付完成后修改UserOwnLesson的到期时间 -->
<!-- 这里使用map:key分别是"years"="\'1 years\'"、"uid"=121313212 -->
<!-- 此id用于未到期用户 -->
<update id="doUpdateBetween" parameterType="map">
UPDATE userownlesson
SET endtime = #{endtime}
WHERE uid = #{uid} AND goodsid in (SELECT g.goodsid FROM goods g
WHERE (g.isrecomm > 0 AND g.price = 0)
OR g.isrecomm = 0)
</update>
<!-- 此id用于到期用户 -->
<update id="doUpdateAfter" parameterType="map">
UPDATE userownlesson
SET starttime = #{starttime} ,endtime = #{endtime},status=1
WHERE uid = #{uid} AND goodsid in (SELECT g.goodsid FROM goods g
WHERE (g.isrecomm > 0 AND g.price = 0)
OR g.isrecomm = 0)
</update>
<update id="doUpdate">
UPDATE userownlesson
SET startTime = #{startTime} ,endTime = #{endTime}
WHERE uid = #{uid}
</update>
<select id = "findMyEndTime" parameterType="long"
resultType="com._3e.entity.UserOwnLesson">
SELECT uid ,max(endtime) as endtime
FROM userownlesson
WHERE uid = #{uid} AND goodsid in (SELECT g.goodsid FROM goods g
WHERE (g.isrecomm > 0 AND g.price = 0)
OR g.isrecomm = 0)
GROUP BY uid
</select>
<select id = "findUserOwnLessonByUid" parameterType="long"
resultType="com._3e.entity.UserOwnLesson">
SELECT * FROM userownlesson WHERE uid = #{studentid} and status = 1
</select>
<select id = "findMaxUserOwnLessonByUid" parameterType="long"
resultType="com._3e.entity.UserOwnLesson">
SELECT * FROM userownlesson WHERE uid = #{studentid} and status = 1 order by endtime desc limit 1;
</select>
<insert id="doSaveUserOwnLessons" parameterType="java.util.List">
INSERT INTO UserOwnLesson ( uid, goodsId, startTime, endTime,
status , areaid )
Values
<foreach collection="list" index="index" item="item" separator=",">
( #{item.uid}, #{item.goodsid},
#{item.starttime}, #{item.endtime},
#{item.status} , #{item.areaid})
</foreach>
</insert>
<!-- <select id = "testFind" parameterType="map" -->
<!-- resultType="com._3e.entity.Achivement"> -->
<!-- SELECT * -->
<!-- FROM achivement -->
<!-- WHERE uid = #{uid} and score > #{score} -->
<!-- </select> -->
<!-- <update id="update" parameterType="map"> -->
<!-- UPDATE achivement -->
<!-- SET score = score + #{score} -->
<!-- WHERE achivementid = #{id} AND uid = #{uid} -->
<!-- </update> -->
</mapper>