<!-- 添加 -->
    <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"的更多相关文章

  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. static为什么一般与final一起用?

    static和final的意义是不同的,static修饰的时候代表对象是静态的,而final修饰的时候代表对象只能赋值一次,他们连用的时候是因为定义的那个对象既要它是静态的,也要求它的值不能再被修改. ...

  2. SpringBoot系列一:SpringBoot的产生

    声明:本文来源于MLDN培训视频的课堂笔记,写在这里只是为了方便查阅. 长期以来 Java 的开发一直让人所诟病: ·Java 项目开发复杂度极其高: · Java 项目的维护非常困难: · 在云时代 ...

  3. 每天一个linux命令:cat 命令

    cat命令的用途是连接文件或标准输入并打印.这个命令常用来显示文件内容,或者将几个文件连接起来显示,或者从标准输入读取内容并显示,它常与重定向符号配合使用. 1.命令格式: cat [选项] [文件] ...

  4. [mysql] mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in

    From: http://www.ttlsa.com/php/deprecated-mysql-connect/ php 5个版本,5.2.5.3.5.4.5.5,怕跟不上时代,新的服务器直接上5.5 ...

  5. A:LinkedList实现了List接口; B: AbstractSet实现了Set接口; C: HashSet继承自AbstractSet基类; D: WeakMap继承自 AbstractMap

    List,Set,Map在java.util包下都是接口 List有两个实现类:ArrayList和LinkedListSet有两个实现类:HashSet和LinkedHashSetAbstractS ...

  6. 一篇关于apache commons类库的详解[转]

    1.1. 开篇 在Java的世界,有很多(成千上万)开源的框架,有成功的,也有不那么成功的,有声名显赫的,也有默默无闻的.在我看来,成功而默默无闻的那些框架值得我们格外的尊敬和关注,Jakarta C ...

  7. 使用redis镜像

    运行容器 runoob@runoob:~/redis$ docker run -p : -v $PWD/data:/data -d redis:3.2 redis-server --appendonl ...

  8. js pjax 和window.history.pushState,replaceState

    原文:http://blog.linjunhalida.com/blog/pjax/ github:https://github.com/defunkt/jquery-pjax 什么是pjax? 现在 ...

  9. 机器学习结果加ID插入数据库源码

    import org.apache.spark.mllib.evaluation.BinaryClassificationMetrics import org.apache.spark.mllib.l ...

  10. Java SQL注入学习笔记

    1 简介 文章主要内容包括: Java 持久层技术/框架简单介绍 不同场景/框架下易导致 SQL 注入的写法 如何避免和修复 SQL 注入 2 JDBC 介绍 JDBC: 全称 Java Databa ...