<?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="org.seckill.dao.SeckillDao">
<!-- 目的:为dao接口方法提供sql语句配置 -->
<update id="reduceNumber">
<!-- 具体sql -->
update
seckillId
set
number = number - 1
where seckill_id = #{seckillId}
and start_time <![CDATA[ <= ]] #{killTime},
and end_time >= #{killTime}
and number > 0;
</update>
<select id="queryById" resultType="Seckill" parameterType="long">
select seckill_id,name,number,start_time,end_time,create_time
from seckill
where seckill_id =#{seckillId}
</select>
<select id ="querAll" resultType="Seckill">
select seckill_id,name,number,start_time,end_time,create_time
from seckill
oder by create_time desc
limit #{offset},#{limit}
</select>
</mapper>
and start_time <![CDATA[ <= ]] #{killTime},
这个应该是and start_time <![CDATA[ <= ]]> #{killTime}
and start_time <![CDATA[ <= ]] #{killTime}, 后面不要加逗号,有 and连接符的