zoukankan      html  css  js  c++  java
  • 批量删除以及将String数组转换成Integer数组的奇淫技巧

    首先在pom.xml文件添加依赖:

    <!-- bean工具 -->
    <dependency>
        <groupId>commons-beanutils</groupId>
        <artifactId>commons-beanutils</artifactId>
        <version>1.8.3</version>
    </dependency>

    mapper.xml:

    <delete id="deleteFormTemplate" parameterType="com.activiti.entity.TblAssActivitiFormTemplate">
            delete from
            asura.tbl_ass_activiti_form_template
            where
            aft_id in
            <foreach item="aftIdArray" collection="array" open="(" separator=","
                close=")">
                #{aftIdArray}
            </foreach>
        </delete>

    mapper.java:

    Integer deleteFormTemplate(Integer[] aftId);

    serviceImpl:

        @Override
        public Integer deleteFormTemplate(HttpServletRequest request) {
            String[] aftIdStringArray = request.getParameter("aftIdList").split(",");
            //将String数组转成Integer数组
            Integer[] aftIdArray = (Integer[])ConvertUtils.convert(aftIdStringArray, Integer.class);
            Integer status = formTemplateMapper.deleteFormTemplate(aftIdArray);
            return status;
        }

    controller.java:

    Integer status = formTemplateService.deleteFormTemplate(request);
  • 相关阅读:
    node.js----服务器http
    node.js---对文件操作
    node.js
    历史管理
    h5
    git与github
    js中面向对象(创建对象的几种方式)
    jq基础
    POJ 2492 A Bug's Life
    POJ 1742 Coins
  • 原文地址:https://www.cnblogs.com/XJJD/p/9198809.html
Copyright © 2011-2022 走看看