mybatis 之 parameterType="java.util.List"
<!-- 添加 -->
<insert id="saveBatchMemberRoleConnRepModel" parameterType="java.util.List">
INSERT INTO member_role_conn
(member_id,role_id,rank_id,time_rang,begin_time,end_time,long_date,get_time,is_delete,add_user,add_time,edit_user,edit_time)
VALUES
<foreach collection="list" item="item" index="index" separator="," >
(#{item.memberId},#{item.roleId},#{item.rankId},#{item.timeRang},#{item.beginTime},#{item.endTime},#{item.longDate},#{item.getTime},#{item.isDelete},#{item.addUser},#{item.addTime},#{item.editUser},#{item.editTime})
</foreach>
</insert>
/**
*
* 批量新增
*
**/
public ServiceMessage<String> saveBatchMemberRoleConnRepModel(
List<MemberRoleConnRepModel> list) {
try {
memberRoleConnRepMapper.saveBatchMemberRoleConnRepModel(list);
return super.returnCorrectResult("批量新增成功!");
} catch (Exception e) {
logger.error(e.getMessage(), e);
return super.returnException("批量新增异常!");
}
}
/**
*
* 批量新增
*
**/
@Test
public void testSaveBatch(){
MemberRoleConnRepModelService hessianServer = J1SOAHessianHelper.getService(url,MemberRoleConnRepModelService.class);
List<MemberRoleConnRepModel> list = new ArrayList<MemberRoleConnRepModel>();
MemberRoleConnRepModel obj = createObj() ;
list.add(obj);
ServiceMessage<String> result = hessianServer.saveBatchMemberRoleConnRepModel(list);
System.out.println(JSONObject.fromObject(result));
}
private MemberRoleConnRepModel createObj() {
MemberRoleConnRepModel obj = new MemberRoleConnRepModel();
/**id**/
obj.setId();
/**会员ID**/
obj.setMemberId();
/**角色ID**/
obj.setRoleId();
/**有效时间限制(all/rang)
obj.setTimeRang();
/**有效开始时间**/
obj.setBeginTime();
/**有效结束时间**/
obj.setEndTime();
/**持续时长(天)**/
obj.setLongDate();
/**获得时间**/
obj.setGetTime();
/**是否删除(Y/N)**/
obj.setIsDelete();
/**添加人**/
obj.setAddUser();
/**添加时间**/
obj.setAddTime();
/**修改人**/
obj.setEditUser();
/**修改时间**/
obj.setEditTime();
return obj;
}
<select id="getTopGoodsEval" parameterType="java.util.ArrayList"
resultType="GoodsComment">
select t.eid,ge.content,ge.goodsid as goodsId from
(
select max(ge.eid)
as eid from goods_evaluation ge where ge.goodsid
in
<foreach collection="values[]" index="index" item="item" open="("
separator="," close=")">
#{item}
</foreach>
' group by ge.goodsid
) t,goods_evaluation ge where
ge.eid=t.eid
</select>
public GoodsComment getTopGoodsEval(List list);
mybatis 之 parameterType="java.util.List"的更多相关文章
- mybatis 之 parameterType="java.util.HashMap">
/** * 根据goods_no 和 goods_id 来查询商品信息 * * @param goodsNos * @return */ public List<Goods> getGoo ...
- Mybatis invalid comparison: java.util.Date and java.lang.String
Mybatis的实体类是java.utils.Date类型,而在Mybatis的XML文件中,使用if判断了,不需要判断是否等于空字符串这种判断,需要人真一些 相关:https://blog.csdn ...
- mybatis的parameterType使用map实现真正的sql随意写
在dao层给map赋值 纠正一下应该把dd作为传入而不是sbiId; sqlMap中的parameterType="java.util.Map", 就 OK package com ...
- MyBatis mapper parameterType
1. 传入简单类型 JAVA代码: public User get(Long id) { return (User) getSqlSession().selectOne("com.liu ...
- MyBatis的parameterType传入参数类型
在mybatis映射接口的配置中,有select,insert,update,delete等元素都提到了parameterType的用法,parameterType为输入参数,在配置的时候,配置相应的 ...
- Mabitis 多表查询(一)resultType=“java.util.hashMap”
1.进行单表查询的时候,xml标签的写法如下 进行多表查询,且无确定返回类型时 xml标签写法如下: <select id="Volume" parameterType=&q ...
- mybatis 之 parameterType="String" resultType="java.util.HashMap">
public ServiceMessage<Map<String, String>> getGoodsStockNo( List<Map<String, Strin ...
- mybatis部分版本异常invalid comparison: java.util.Date and java.lang.String
严重: Servlet.service() for servlet [spring] in context with path [] threw exception [Request processi ...
- Mybatis按照SQL查询字段的顺序返回查询结果,使用resultType="java.util.LinkedHashMap"
在使用Mybatis开发时,Mybatis返回的结果集就是个map,当返回map时只需要做好SQL映射就好了,减少了代码量,简单便捷,缺点是不太方便维护,但是写大量的vo类去返回也挺累的,这个看你个人 ...
随机推荐
- 解决DoubanFM第三方客户端UI线程与工作线程交互问题
最新文章:Virson's Blog 首先要感谢yk000123的慷慨开源,开源地址见:http://doubanfm.codeplex.com/ 最近正好在学习WPF,然后在Codeplex上找到了 ...
- tensorflow的升级与版本管理
1 查看cuda与cudnn的版本 cuda一般安装在 /usr/local/cuda/ 路径下,该路径下有一个version.txt文档,里面记录了cuda的版本信息 cat /usr/local ...
- Quick solution to java.lang.NoClassDefFoundError: org/openqa/selenium/HasInputDevices error
In case if you face this problem, one of the possible solutions that will work for you is to make su ...
- tpshop商品属性表关系
TPshop 里面的商品属性, 首先看看TPshop商品详情中的属性介绍, 纯展示给用户看的. 再来tpshop看看商品列表帅选页面的属性,可以根据属性帅选不同的商品 再来看看tpshop后台属性管理 ...
- miRbase 数据库简介
miRbase 是miRNA 的数据库,目前最新版本为 release 21, 共有28645 条 miRNA, 第22 版已经完成,即将发布,22版新增了10000 个miRNA, 大多来源于新的 ...
- C# 获取Image图片格式
private void button1_Click_1(object sender, EventArgs e) { string path = Application.StartupPath; us ...
- Java标准I/O流编程一览笔录
I/O是什么 I/O 是Input/Output(输入.输出)的简称,输入流可以理解为向内存输入,输出流是从内存输出. 流 流是一个连续的数据流,可以从流中读取数据,也可以往流中写数据.流与数据源,或 ...
- git忽略已添加版本控制的文件
今天使用git做maven项目的版本控制,刚开始搭建项目后,把所有文件全部提交了. 已经提交的文件,gitignore中后配置也无效了. 所以使用以下命令来操作,操作后要提交哦. 1.执行 git r ...
- asp.net导出EXCEL的好方法!(好用,导出全部数据)
1.调用方法: ExportExcel("application/ms-excel", "EXCEL名称.xls", GridView1, this.Page) ...
- Unable to resolve target 'android-9'
右键项目文件--->properties--->android 选择对应版本 保存 如还不生效 打开项目文件project.properties ,修改 target=android-1 ...