mybates 参数和处理

来源:互联网 发布:拓扑康102n 导入数据 编辑:程序博客网 时间:2024/06/07 12:03

1.图片前面的服务器地址

CONCAT(#{imageServer},i.imagePosition )

2.参数map

#{imageServer}

3.存储过程参数和调取

<select id="listTree_fy"  statementType="CALLABLE" parameterType="map" resultMap="treeInfoChildren">
{call units_syscode_tree_fy(#{name},#{icon_units},#{icon_user},#{serchValue})}
</select>


4.timestamp转成long型

 CONCAT( UNIX_TIMESTAMP(p.createtime), '000' ) AS praiseTime


5.like

<if test="unitsId!=null"> AND uu.unitsId = #{unitsId}</if>
<if test="content!=null"> AND (m.messageContent LIKE CONCAT('%',#{content},'%') OR
m.userName LIKE CONCAT('%',#{content},'%') )</if>

6.处理关键字

<![CDATA[ ]]> - - - - - - 规避与XML规范冲突的字符

7、In

<if test="exprise!=null">    AND s.exprise  IN    <foreach item="item" index="index" collection="exprise" open="("             separator="," close=")">        #{item}    </foreach></if>


8、xxMapper.java

int countUnreadComms(@Param(value = "activityId") Integer activityId,@Param(value = "replyUid") Long replyUid);

0 0