INSERT INTO UserOwnLesson ( uid, goodsId, startTime, endTime, status , areaid ) Values ( #{uid}, #{goodsId}, #{startTime}, #{endTime}, #{status} , #{areaid} ) UPDATE UserOwnLesson SET uid = #{uid}, goodsId = #{goodsId}, startTime = #{startTime}, endTime = #{endTime}, status = #{status} , areaid = #{areaid} where uid=#{uid} and goodsId=#{goodsId} and areaid = #{areaid} INSERT INTO UserOwnLesson ( uid, goodsId, startTime, endTime, status , areaid ) Values ( #{item.uid}, #{item.goodsId}, #{item.startTime}, #{item.endTime}, #{item.status} , #{item.areaid} ) INSERT INTO UserOwnLesson ( uid, goodsId, startTime, endTime, status , areaid ) SELECT studentId , #{goodsId} , #{startTime}, #{endTime} , 1 , #{areaid} FROM StudentOwnClass WHERE classesId = #{classesId} INSERT INTO UserOwnLesson ( uid, goodsId, startTime, endTime, status , areaid ) SELECT #{userId} , #{goodsId} , #{startTime}, #{endTime} , 1 , #{areaid} UPDATE UserOwnLesson set startTime = #{startTime} , endTime = #{endTime} WHERE uid = #{uid} AND goodsId > 0 AND goodsId in ( select goodsId from Goods where ( isrecomm = 0 ) or ( isrecomm = 1 and price =0 ) ) 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 UserOwnLesson set endTime = ( endTime - interval '${refundYears} year') WHERE uid = #{uid} AND goodsid in (SELECT g.goodsid FROM goods g WHERE (g.isrecomm > 0 AND g.price = 0) OR g.isrecomm = 0) delete from userownlesson where uid=#{uid} and goodsId in #{item}