mapper.xml里面的if问题

qq_31098647 2018-05-07 04:43:48
<!-- 主键查询 -->
<select id="selectByPrimaryKey" resultClass="userInfo" parameterClass="userInfo">
SELECT
<include refid="userInfo_Column_List"/>
FROM user_info
WHERE login_name = #login_name#
<if test=' isAreaVersion== "1" '>
<isNotEmpty prepend="and" property="outhosid"> <!-- 登录时的医院ID -->
hosid=#outhosid#
</isNotEmpty>
</if>


错误信息:
The content of element type "select" must match "(include|dynamic|iterate|isParameterPresent|
isNotParameterPresent|isEmpty|isNotEmpty|isNotNull|isNull|isNotEqual|isEqual|isGreaterThan|
isGreaterEqual|isLessThan|isLessEqual|isPropertyAvailable|isNotPropertyAvailable)".
...全文
1316 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
木子0204 2018-05-10
  • 打赏
  • 举报
回复
<select id="selectByParams" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from t_active_flow <include refid="Example_Where_Clause" /> </select> 里面是这样的 ,你的if应该放到 Example_Where_Clause条件里面吧 <sql id="Example_Where_Clause"> <if test=' isAreaVersion== "1" '> <isNotEmpty prepend="and" property="outhosid"> <!-- 登录时的医院ID --> hosid=#outhosid# </isNotEmpty> </if> </sql> 类似这样的
  • 打赏
  • 举报
回复
你的select并没有if这个标签,注意一下mybatis或者ibatis的版本

51,397

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧