第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

SSM 范圍查找以及分頁(yè)

SSM 范圍查找以及分頁(yè)

Liu__ 2018-07-17 17:37:38
使用ssm編寫的一個(gè)功能輸入機(jī)器編號(hào),開始時(shí)間,結(jié)束時(shí)間,查找實(shí)現(xiàn)過(guò)程中,當(dāng)機(jī)器編號(hào)輸入一個(gè)不存在的值,或者開始時(shí)間空著,都會(huì)報(bào)錯(cuò),錯(cuò)誤顯示是sql語(yǔ)句錯(cuò)誤mybatis的xml文件中,sql語(yǔ)句如下:<select id="findByRowBounds" resultMap="BaseResultMap">?? ??? ?select?? ??? ?<include refid="Base_Column_List" />?? ??? ?from yujing_record?? ??? ?<where>?? ??? ??? ?<if test="macid != null? and macid !=''">?? ??? ??? ??? ?and macid like concat('%',#{macid},'%')?? ??? ??? ?</if>?? ??? ??? ?<if test="start != null and start !=''">?? ??? ??? ??? ?and time <![CDATA[>]]>?? ??? ??? ??? ?#{start}?? ??? ??? ?</if>?? ??? ??? ?<if test="end != null and end !=''">?? ??? ??? ??? ?and time <![CDATA[<]]>?? ??? ??? ??? ?#{end}?? ??? ??? ?</if>?? ??? ?</where>?? ??? ?order by time desc limit #{sindex},#{size}?? ?</select>
查看完整描述

2 回答

?
Liu__

TA貢獻(xiàn)2條經(jīng)驗(yàn) 獲得超1個(gè)贊


按照?<if end != null and end !=“”>
?? ??? ??? ??? ?and time?? #{end}
?</if>

的話運(yùn)行報(bào)錯(cuò)

查看完整回答
反對(duì) 回復(fù) 2018-07-17
?
sunbohan00

TA貢獻(xiàn)44條經(jīng)驗(yàn) 獲得超73個(gè)贊

if判斷語(yǔ)句的問題,可能是我見得少吧,你這么寫的我確實(shí)沒見過(guò),

當(dāng)空值的時(shí)候,if判斷沒有生效,所以空值進(jìn)行搜索會(huì)報(bào)錯(cuò)。

試試這樣

?<if end != null and end !=“”>
?? ??? ??? ??? ?and time?? #{end}
?</if>

查看完整回答
反對(duì) 回復(fù) 2018-07-17
  • Liu__
    Liu__
    我們查的條件有三個(gè),一個(gè)macid,還有兩個(gè)時(shí)間,比如這個(gè) <if test="macid != null and macid !=''"> and macid like concat('%',#{macid},'%') </if> 當(dāng)macid為空的時(shí)候,我們希望就查出所有的macid,所以if里面的條件就不拼接 報(bào)的錯(cuò)誤如下 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-10,10' at line 16
  • 2 回答
  • 0 關(guān)注
  • 3408 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)