ibatis 使用过程中 经验

sqlmap 中配置sql时候
如果sql出现 < >  ‘ 时候需要替换掉,否则.xml配置文件编译不通过


     lt;          <
    &gt;          > 
    &lt;&gt;   <>
    &amp;      &
    &apos;      '
    &quot;      "

sqlmap配置中

传入单个参数  java.long.String 

传入多个参数  hashmap

#key:int#
#key:varchar#

传入多个参数bean 传入方式


<select id="getDocIds" resultMap="BaseResultMap" parameterClass="java.util.HashMap" >
select
docId,
appId,
authorUsername,
authorRealname,
authorOrgname,
authorOrgId,
authorPositionName,
subject,
createTime,
finishTime,
isParallel,
authorOpid,
nextStatus,
opid,
docBody,
receiverUsername,
receiverRealname,
lastNoteId,
isdel
from  appdoc where docid in
(
select docid from
(
select  count(docid) num , SUM(distinct(docid)) docid  from flowNote  where docId in
(
select docId from appDoc where appid = #appid:int# and isdel = 0 
and  createTime &gt;= cast(#beginTime:varchar# as datetime)
and  createTime &lt;= cast(#endTime:varchar# as datetime) 
) group by docId
) a  where a.num&gt;1
)

</select>

猜你喜欢

转载自jphfly-163-com.iteye.com/blog/1704542
今日推荐