2026-03-10 14:30:24 +08:00

88 lines
3.0 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="GoodsPriceDefi">
<insert id="insertGoodsPriceDefi" parameterType="GoodsPriceDefi">
INSERT INTO GoodsPriceDefi ( schoolId, goodsId, years, price, amount, description , startTime , endTime ) Values ( #{schoolId}, #{goodsId}, #{years}, #{price}, #{amount}, #{description} , #{startTime} , #{endTime} )
</insert>
<update id="updateGoodsPriceDefi" parameterType="GoodsPriceDefi">
UPDATE GoodsPriceDefi SET
schoolId = #{schoolId}, goodsId = #{goodsId}, years = #{years}, price = #{price}, amount = #{amount}, description = #{description} ,startTime = #{startTime} , endTime = #{endTime}
where schoolId=#{schoolId} and goodsId=#{goodsId} and years=#{years}
</update>
<select id="getGoodsPriceDefiByKey" parameterType="java.util.Map" resultType="GoodsPriceDefi">
SELECT schoolId , goodsId , years , price , amount , description , startTime , endTime,jcontent
FROM GoodsPriceDefi WHERE schoolId=#{schoolId} and goodsId=#{goodsId} and years=#{years} and current_timestamp &gt; startTime and current_timestamp &lt;endTime
</select>
<select id="getSeqGoodsPriceDefi" resultType="Integer" useCache="false" flushCache="true">
SELECT nextval('seq_goodsPriceDefiId') ;
</select>
<select id="getGoodsPriceDefiBySchoolId" parameterType="java.util.HashMap" resultType="GoodsPriceDefi">
SELECT schoolId , goodsId , years , price , amount , description , startTime , endTime,jcontent
FROM GoodsPriceDefi WHERE schoolId=#{schoolId}
<if test="type != null">
and type = #{type}
</if>
<if test="goodsId!=null">
and goodsId = #{goodsId}
</if>
<if test="nowTime!=null">
<![CDATA[
and #{nowTime} > startTime and #{nowTime} < endTime
]]>
</if>
order by years
</select>
<insert id="insertGoodsPriceDefiBatch" parameterType="java.util.List">
INSERT INTO GoodsPriceDefi ( schoolId, goodsId, years, price, amount, description , startTime , endTime ) Values
<foreach collection="list" index="index" item="item" separator=",">
( #{item.schoolId}, #{item.goodsId}, #{item.years}, #{item.price},
#{item.amount}, #{item.description} , #{item.startTime} , #{item.endTime} )
</foreach>
</insert>
<select id="getGoodsPriceDefiByTime" parameterType="java.util.Map" resultType="GoodsPriceDefi">
SELECT schoolId , goodsId , years , price , amount , description , startTime , endTime
FROM GoodsPriceDefi WHERE schoolId=#{schoolId} and goodsId=#{goodsId} and years=#{years}
and #{created} &gt; startTime and #{created} &lt; endTime
<if test="type != null">
and type = #{type}
</if>
</select>
</mapper>