问答详情
源自:4-4 基于myBatis实现DAO编程(上)

哪位大神帮我看看 下面代码那有错误

<?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>


提问者:鹏鹏python 2016-11-14 18:25

个回答

  • End13147
    2017-04-21 11:37:48

    and start_time <![CDATA[ <= ]] #{killTime},

    这个应该是and start_time <![CDATA[ <= ]]> #{killTime}

  • 不应有的淡定
    2016-11-14 20:48:45

    and start_time <![CDATA[ <= ]] #{killTime},  后面不要加逗号,有 and连接符的