1. <!-- 添加 -->
  2. <insert id="saveBatchMemberRoleConnRepModel" parameterType="java.util.List">
  3. INSERT INTO member_role_conn
  4. (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)
  5. VALUES
  6. <foreach collection="list" item="item" index="index" separator="," >
  7. (#{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})
  8. </foreach>
  9. </insert>
  1. /**
  2. *
  3. * 批量新增
  4. *
  5. **/
  6. public ServiceMessage<String> saveBatchMemberRoleConnRepModel(
  7. List<MemberRoleConnRepModel> list) {
  8. try {
  9. memberRoleConnRepMapper.saveBatchMemberRoleConnRepModel(list);
  10. return super.returnCorrectResult("批量新增成功!");
  11. } catch (Exception e) {
  12. logger.error(e.getMessage(), e);
  13. return super.returnException("批量新增异常!");
  14. }
  15. }
  1. /**
  2. *
  3. * 批量新增
  4. *
  5. **/
  6. @Test
  7. public void testSaveBatch(){
  8. MemberRoleConnRepModelService hessianServer = J1SOAHessianHelper.getService(url,MemberRoleConnRepModelService.class);
  9. List<MemberRoleConnRepModel> list = new ArrayList<MemberRoleConnRepModel>();
  10. MemberRoleConnRepModel obj = createObj() ;
  11. list.add(obj);
  12. ServiceMessage<String> result = hessianServer.saveBatchMemberRoleConnRepModel(list);
  13. System.out.println(JSONObject.fromObject(result));
  14. }
  1. private MemberRoleConnRepModel createObj() {
  2. MemberRoleConnRepModel obj = new MemberRoleConnRepModel();
  3.  
  4. /**id**/
  5. obj.setId();
  6.  
  7. /**会员ID**/
  8. obj.setMemberId();
  9.  
  10. /**角色ID**/
  11. obj.setRoleId();
  12.  
  13. /**有效时间限制(all/rang)
  14. obj.setTimeRang();
  15.  
  16. /**有效开始时间**/
  17. obj.setBeginTime();
  18.  
  19. /**有效结束时间**/
  20. obj.setEndTime();
  21.  
  22. /**持续时长(天)**/
  23. obj.setLongDate();
  24.  
  25. /**获得时间**/
  26. obj.setGetTime();
  27.  
  28. /**是否删除(Y/N)**/
  29. obj.setIsDelete();
  30.  
  31. /**添加人**/
  32. obj.setAddUser();
  33.  
  34. /**添加时间**/
  35. obj.setAddTime();
  36.  
  37. /**修改人**/
  38. obj.setEditUser();
  39.  
  40. /**修改时间**/
  41. obj.setEditTime();
  42.  
  43. return obj;
  44. }
  1. <select id="getTopGoodsEval" parameterType="java.util.ArrayList"
  2. resultType="GoodsComment">
  3. select t.eid,ge.content,ge.goodsid as goodsId from
  4. (
  5. select max(ge.eid)
  6. as eid from goods_evaluation ge where ge.goodsid
  7. in
  8. <foreach collection="values[]" index="index" item="item" open="("
  9. separator="," close=")">
  10. #{item}
  11. </foreach>
  12. ' group by ge.goodsid
  13. ) t,goods_evaluation ge where
  14. ge.eid=t.eid
  15. </select>
  1. public GoodsComment getTopGoodsEval(List list);

mybatis 之 parameterType="java.util.List"的更多相关文章

  1. mybatis 之 parameterType="java.util.HashMap">

    /** * 根据goods_no 和 goods_id 来查询商品信息 * * @param goodsNos * @return */ public List<Goods> getGoo ...

  2. Mybatis invalid comparison: java.util.Date and java.lang.String

    Mybatis的实体类是java.utils.Date类型,而在Mybatis的XML文件中,使用if判断了,不需要判断是否等于空字符串这种判断,需要人真一些 相关:https://blog.csdn ...

  3. mybatis的parameterType使用map实现真正的sql随意写

    在dao层给map赋值 纠正一下应该把dd作为传入而不是sbiId; sqlMap中的parameterType="java.util.Map", 就 OK package com ...

  4. MyBatis mapper parameterType

    1.   传入简单类型 JAVA代码: public User get(Long id) { return (User) getSqlSession().selectOne("com.liu ...

  5. MyBatis的parameterType传入参数类型

    在mybatis映射接口的配置中,有select,insert,update,delete等元素都提到了parameterType的用法,parameterType为输入参数,在配置的时候,配置相应的 ...

  6. Mabitis 多表查询(一)resultType=“java.util.hashMap”

    1.进行单表查询的时候,xml标签的写法如下 进行多表查询,且无确定返回类型时 xml标签写法如下: <select id="Volume" parameterType=&q ...

  7. mybatis 之 parameterType="String" resultType="java.util.HashMap">

    public ServiceMessage<Map<String, String>> getGoodsStockNo( List<Map<String, Strin ...

  8. mybatis部分版本异常invalid comparison: java.util.Date and java.lang.String

    严重: Servlet.service() for servlet [spring] in context with path [] threw exception [Request processi ...

  9. Mybatis按照SQL查询字段的顺序返回查询结果,使用resultType="java.util.LinkedHashMap"

    在使用Mybatis开发时,Mybatis返回的结果集就是个map,当返回map时只需要做好SQL映射就好了,减少了代码量,简单便捷,缺点是不太方便维护,但是写大量的vo类去返回也挺累的,这个看你个人 ...

随机推荐

  1. 使用 pv 命令监控 linux 命令的执行进度

    如果你是一个 linux 系统管理员,那么毫无疑问你必须花费大量的工作时间在命令行上:安装和卸载软件,监视系统状态,复制.移动.删除文件,查错,等等.很多时候都是你输入一个命令,然后等待很长时间直到执 ...

  2. WM_CONCAT字符超过4000的处理办法

    参考网址: http://stackoverflow.com/questions/11541383/ordering-by-list-of-strings-in-oracle-sql-without- ...

  3. 文本编辑工具(sublime text 2)

    学习地址: http://www.iplaysoft.com/sublimetext.html 下载地址:http://www.sublimetext.com

  4. OpenGL基本框架与三维对象绘制

    上次我们介绍了OpenGL的环境构建和二维对象的绘制,这次我们来讲讲三维对象的绘制: 绘制代码如下: Github代码仓库 // opengltest2.cpp : Defines the entry ...

  5. Spring JDBC PreparedStatementSetter接口示例

    org.springframework.jdbc.core.PreparedStatementSetter接口充当JdbcTemplate类使用的一般回调接口.该接口在JdbcTemplate类提供的 ...

  6. e815. 监听当前选择的的菜单或菜单项

    The currently selected menu or menu item in a JMenu or JPopupMenu is tracked by MenuSelectionManager ...

  7. JS 在火狐浏览器下关闭弹窗

    1.首先,要确定火狐设置是否允许通过JS代码window.close()方法关闭标签. 确定方式如下:      在Firefox地址栏里输入 about:config    在配置列表中找到dom. ...

  8. 通过NAT转发实现私网对外发布信息

    我们可以在防火墙的外部网卡上绑定多个合法IP地址,然后通过ip映射使发给其中某一个IP地址的包转发至内部某一用户的WWW服务器上,然后再将该内部WWW服务器响应包伪装成该合法IP发出的包. 具体的IP ...

  9. 获取真实ip

    public function ip() { if (getenv('HTTP_CLIENT_IP')) { $ip = getenv('HTTP_CLIENT_IP'); } elseif (get ...

  10. Xcode不太常见又实用的小技巧

    备份, 原文: http://rocry.com/2012/12/17/xcode-tips/ 让代码中的TODO和FIXME变成Warning 选中某个Target > Build Phase ...