mybatis传List
来源:互联网 发布:语文试卷编制软件 编辑:程序博客网 时间:2024/06/06 17:49
1.mybatis传List查询的情况
<select id="selectProLedgerList" resultType="com.ssic.educateion.common.dto.ProLedgerDto"
parameterType="java.util.List">
SELECT a.wares_id AS waresId,b.ware_batch_no AS batchNo, b.start_address AS startAddress ,b.action_date as actionDate
FROM t_pro_ledger a
LEFT JOIN t_pro_ledger_master b ON a.master_id = b.id
WHERE a.stat = 1 AND b.stat = 1
<if test="waresIdList != null">
and a.wares_id in
<foreach collection="waresIdList" item="id" index="index"
open="(" close=")" separator=",">
#{id}
</foreach>
</if>
ORDER BY a.`create_time` DESC
<insert id="addNutritionalBatch" parameterType="java.util.List">
INSERT INTO t_pro_nutritional (id, package_id,name,unit,weight, create_time, stat)
VALUES
<foreach collection="list" item="item" index="index" separator="," >
(#{item.id},#{item.packageId},#{item.name},#{item.unit},#{item.weight},#{item.createTime},#{item.stat})
</foreach>
<select id="selectProLedgerList" resultType="com.ssic.educateion.common.dto.ProLedgerDto"
parameterType="java.util.List">
SELECT a.wares_id AS waresId,b.ware_batch_no AS batchNo, b.start_address AS startAddress ,b.action_date as actionDate
FROM t_pro_ledger a
LEFT JOIN t_pro_ledger_master b ON a.master_id = b.id
WHERE a.stat = 1 AND b.stat = 1
<if test="waresIdList != null">
and a.wares_id in
<foreach collection="waresIdList" item="id" index="index"
open="(" close=")" separator=",">
#{id}
</foreach>
</if>
ORDER BY a.`create_time` DESC
</select>
Mybatis根据 in List 查询
<if test="ledgerDto.waresNameList != null">
and a.name in
<foreach collection="ledgerDto.waresNameList" item="name" index="index"
open="(" close=")" separator=",">
#{name}
</foreach>
</if>
<insert id="addNutritionalBatch" parameterType="java.util.List">
INSERT INTO t_pro_nutritional (id, package_id,name,unit,weight, create_time, stat)
VALUES
<foreach collection="list" item="item" index="index" separator="," >
(#{item.id},#{item.packageId},#{item.name},#{item.unit},#{item.weight},#{item.createTime},#{item.stat})
</foreach>
</insert>
0 0
- mybatis传List
- mybatis返回List<Map>
- mybatis返回List<domain>
- mybatis返回list<Map>
- mybatis 传入list
- mybatis insert list
- MyBatis插入List对象
- mybatis 返回 list<object>
- mybatis返回List<Map>
- mybatis条件循环list
- mybatis 映射 List<String>
- 后台传List参数,mybatis接收遍历处理demo
- Mybatis传list参数调用oracle存储过程
- Mybatis传list参数调用oracle存储过程
- Mybatis 之List<?>传参的注意事项和原理
- 根据List,mybatis批量查询List结果
- 根据List mybatis批量查询List结果
- Mybatis根据List批量查询List结果
- 【Leetcode】Two Sum II - Input array is sorted
- oracle中层次查询start by ... connect by....详解
- 每天一条liunux--touch命令
- 关于Notification通知的一点愚见(自定义通知栏)
- 便捷提醒小插件之gritter
- mybatis传List
- Synchronized常见用法
- Netty使用MessagePack首先自定义编解码器
- Android 系统签名
- ListView去掉分割线
- CSS :hover和:active区别
- iOS SQLCipher SQLite加密 详解
- jQuery选择器总结
- “(null)” is of a model that is not supported by this version of Xcode. Ple