mybatis里select写法 20
selectRESOURCE_ID"id",UP_RESOURCE_ID"upId",RESOURCE_CODE"rescCode",URL,TARGET,ICON,it...
select RESOURCE_ID "id", UP_RESOURCE_ID "upId", RESOURCE_CODE "rescCode", URL,TARGET,ICON,itnlz.TITLE_CNTNT as TEXT from t_itnlz_text itnlz left join t_resource res on res.RESOURCE_ID=itnlz.TITLE_CD1 <include refid="resourceWhere" /> and itnlz.LNG_TP= #{lngTp} and itnlz.title_big_clss= #{titleBigClss} order by res.seq_num没有include后面的条件,就可以查出来,有这个条件为啥就查不出来了,后面的条件该怎么加上去啊?求救~
展开
展开全部
SELECT <include refid="columns"/>
FROM table
<include refid="dynamicWhere" />
<if test="@Ognl@isNotEmpty(orderField)">
order by ${orderField} ${orderSeq}
</if>
<if test="@Ognl@isEmpty(orderField)">
order by tableId desc
</if>
FROM table
<include refid="dynamicWhere" />
<if test="@Ognl@isNotEmpty(orderField)">
order by ${orderField} ${orderSeq}
</if>
<if test="@Ognl@isEmpty(orderField)">
order by tableId desc
</if>
追问
我include where语句后需要添加判断,也就是后面写的and itnlz.LNG_TP= #{lngTp} and itnlz.title_big_clss= #{titleBigClss} ,改怎么写呀,你写的那个是选择排序啊
追答
select send.sendid sendid,
send.sender sender,
rece.receiveid rid,
red.ifRead
from
SYS_SENDNOTE send
left join SYS_NOTE_READ red on send.sendid=red.noteId and red.receiversId=#{receiversId} ,
sys_note_receive rece
where
send.sendid=rece.noteId
and (rece.receiversId in (select orgId from sys_user_org where userId = #{receiversId})
or rece.receiversId=#{receiversId}
)
AND send.subject LIKE #{subject,jdbcType=VARCHAR}
AND send.content LIKE #{content,jdbcType=VARCHAR}
AND red.ifRead is null
AND red.ifRead is not null
order by ${orderField} ${orderSeq}
order by send.sendtime desc
我下班了你看看这个
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询