mybatis collection column 传常量
来源:互联网 发布:杭州 软件开发 编辑:程序博客网 时间:2024/06/06 04:40
想要在mybatis 的collection关联查询中,添加一个常量:classifyId=1作为参数,原先使用的添加方式为:
<collection property="imageList" column="{aaaId=aaa_id,classifyId='1'}" javaType="ArrayList" select="com.fsti.information.dao.ImageManageMapper.queryGoodsImage"> </collection>
会报找不到行:”1 “的错误。
需要将关联的语句改为:
<resultMap id="GoodsVO" type="com.fsti.aaa.bean.vo.aaaVO" > <collection property="imageList" column="{aaaId=aaa_id,classifyId=classifyId}" javaType="ArrayList" select="com.fsti.information.dao.ImageManageMapper.queryGoodsImage"> </collection> <collection property="goodsTags" column="{goodsId = goods_id}" javaType="ArrayList" select="com.fsti.goods.dao.GoodsTagsReleMapper.queryGoodsTags"> </collection> </resultMap>
基础查询的语句改为:
<select id="queryAaaVO" resultMap="aaaVO" parameterType="java.util.Map" > select <include refid="Base_Column_List" />, 1 as classifyId from aaa where aaa_id=#{aaaId,jdbcType=BIGINT} </select>
也就是在查询时添加一句 1 as classifyId
然后,将其作为变量在column中引用即可:classifyId=classifyId
阅读全文
0 0
- mybatis collection column 传常量
- mybatis中association和collection的column传入多个参数值
- mybatis property column
- mybatis collection的使用
- Mybatis <collection> 标签使用。
- mybatis ,<collection>使用instance
- Mybatis Association Collection
- mybatis collection使用
- mybatis foreach collection 用法
- mybatis collection 用法
- myBatis使用collection
- mybatis collection 对象自身关联
- Mybatis ResultMap Collection 复合主键
- mybatis中的<collection>标签使用说明
- mybatis 中collection 的用法
- Mybatis ResultMap Collection 复合主键
- mybatis collection 多条件查询
- 再谈Mybatis之Association Collection
- PMK数据生成工具airolib-ng
- 转载:Audition中文汉化版链接
- linux-samba案例分析
- mina框架详解
- JavaScript 部分知识点
- mybatis collection column 传常量
- 谈大规模交易系统架构设计方法--Stateless(无状态web服务)
- 解决macos 终端命令不可用
- 171206之在加载数据的时候加载操作
- 前端学习入门
- DevExpress控件GridControl开发常用要点(项目总结版)
- Android内存优化--OOM
- 高精(第一篇)
- 把二叉树打印成多行