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类去返回也挺累的,这个看你个人 ...
随机推荐
- 使用 pv 命令监控 linux 命令的执行进度
如果你是一个 linux 系统管理员,那么毫无疑问你必须花费大量的工作时间在命令行上:安装和卸载软件,监视系统状态,复制.移动.删除文件,查错,等等.很多时候都是你输入一个命令,然后等待很长时间直到执 ...
- WM_CONCAT字符超过4000的处理办法
参考网址: http://stackoverflow.com/questions/11541383/ordering-by-list-of-strings-in-oracle-sql-without- ...
- 文本编辑工具(sublime text 2)
学习地址: http://www.iplaysoft.com/sublimetext.html 下载地址:http://www.sublimetext.com
- OpenGL基本框架与三维对象绘制
上次我们介绍了OpenGL的环境构建和二维对象的绘制,这次我们来讲讲三维对象的绘制: 绘制代码如下: Github代码仓库 // opengltest2.cpp : Defines the entry ...
- Spring JDBC PreparedStatementSetter接口示例
org.springframework.jdbc.core.PreparedStatementSetter接口充当JdbcTemplate类使用的一般回调接口.该接口在JdbcTemplate类提供的 ...
- e815. 监听当前选择的的菜单或菜单项
The currently selected menu or menu item in a JMenu or JPopupMenu is tracked by MenuSelectionManager ...
- JS 在火狐浏览器下关闭弹窗
1.首先,要确定火狐设置是否允许通过JS代码window.close()方法关闭标签. 确定方式如下: 在Firefox地址栏里输入 about:config 在配置列表中找到dom. ...
- 通过NAT转发实现私网对外发布信息
我们可以在防火墙的外部网卡上绑定多个合法IP地址,然后通过ip映射使发给其中某一个IP地址的包转发至内部某一用户的WWW服务器上,然后再将该内部WWW服务器响应包伪装成该合法IP发出的包. 具体的IP ...
- 获取真实ip
public function ip() { if (getenv('HTTP_CLIENT_IP')) { $ip = getenv('HTTP_CLIENT_IP'); } elseif (get ...
- Xcode不太常见又实用的小技巧
备份, 原文: http://rocry.com/2012/12/17/xcode-tips/ 让代码中的TODO和FIXME变成Warning 选中某个Target > Build Phase ...