<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.dao.IPerformanceResultDao">
<insert id="addOnlineResult" parameterType="java.util.List">
BEGIN
<foreach collection="list" item="item" index="index" separator=";">
insert into pts_online_result values(
SEQ_PTS_ONLINE_RESULT.nextval,
#{item.app_name,jdbcType=VARCHAR},
#{item.app_trade,jdbcType=VARCHAR},
#{item.action_name,jdbcType=VARCHAR},
#{item.con_user,jdbcType=VARCHAR},
#{item.press_time,jdbcType=VARCHAR},
#{item.avg_time,jdbcType=VARCHAR},
#{item.tps,jdbcType=VARCHAR},
#{item.succ_action,jdbcType=VARCHAR},
#{item.fail_action,jdbcType=VARCHAR},
#{item.succ_rate,jdbcType=VARCHAR},
#{item.app_cpu_util,jdbcType=VARCHAR},
#{item.db_cpu_util,jdbcType=VARCHAR},
#{item.scenario_type,jdbcType=VARCHAR},
#{item.app_version,jdbcType=VARCHAR},
#{item.online_tester,jdbcType=VARCHAR},
#{item.online_developer,jdbcType=VARCHAR},
#{item.remark,jdbcType=VARCHAR},
sysdate,
sysdate
)
</foreach>
;end;
</insert> <insert id="addBatchResult" parameterType="java.util.List">
BEGIN
<foreach collection="list" item="item" index="index" separator=";">
insert into pts_batch_result values(
SEQ_PTS_BATCH_RESULT.nextval,
#{item.batch_app_name,jdbcType=VARCHAR},
#{item.batch_app_trade,jdbcType=VARCHAR},
#{item.perpare_data,jdbcType=VARCHAR},
#{item.total_cost,jdbcType=VARCHAR},
#{item.succ_record,jdbcType=VARCHAR},
#{item.fail_record,jdbcType=VARCHAR},
#{item.succ_rate,jdbcType=VARCHAR},
#{item.batch_app_cpu_util,jdbcType=VARCHAR},
#{item.batch_db_cpu_util,jdbcType=VARCHAR},
#{item.scenario_type,jdbcType=VARCHAR},
#{item.batch_app_version,jdbcType=VARCHAR},
#{item.batch_tester,jdbcType=VARCHAR},
#{item.batch_developer,jdbcType=VARCHAR},
#{item.remark,jdbcType=VARCHAR},
sysdate,
sysdate
)
</foreach>
;end;
</insert>
<select id="queryOnlineResultList" resultType="com.pts.model.PerformanceOnlineResultModel" >
select t.RESULT_ID
,t.APP_NAME
,t.APP_TRADE
,t.ACTION_NAME
,t.CON_USER
,t.PRESS_TIME
,t.AVG_TIME
,t.TPS
,t.SUCC_ACTION
,t.FAIL_ACTION
,t.SUCC_RATE
,t.APP_CPU_UTIL
,t.DB_CPU_UTIL
,t.SCENARIO_TYPE
,t.APP_VERSION
,t.ONLINE_TESTER
,t.ONLINE_DEVELOPER
,t.REMARK
,to_char(t.CREATE_TIME, 'yyyy-mm-dd hh24:mi:ss')
,to_char(t.UPDATE_TIME, 'yyyy-mm-dd hh24:mi:ss')
from ( select
rownum rn ,p1.*
from
(select * from pts.pts_online_result p order by p.result_id desc) p1
<where>
<if test="perResultModel.app_name != null and perResultModel.app_name != ''">
and p1.app_name like concat('%',concat(#{perResultModel.app_name,jdbcType=VARCHAR},'%'))
</if>
<if test="perResultModel.scenario_type != null and perResultModel.scenario_type != ''">
and p1.scenario_type like concat('%',concat(#{perResultModel.scenario_type,jdbcType=VARCHAR},'%'))
</if>
<if test="perResultModel.app_trade != null and perResultModel.app_trade != ''">
and p1.app_trade like concat('%',concat(#{perResultModel.app_trade,jdbcType=VARCHAR},'%'))
</if>
<if test="perResultModel.online_tester != null and perResultModel.online_tester != ''">
and p1.online_tester like concat('%',concat(#{perResultModel.online_tester,jdbcType=VARCHAR},'%'))
</if>
<if test="perResultModel.action_name != null and perResultModel.action_name != ''">
and p1.action_name like concat('%',concat(#{perResultModel.action_name,jdbcType=VARCHAR},'%'))
</if>
<if test="perResultModel.app_version != null and perResultModel.app_version != ''">
and p1.app_version like concat('%',concat(#{perResultModel.app_version,jdbcType=VARCHAR},'%'))
</if>
</where>
) t
where t.rn &lt;= #{rows,jdbcType=NUMERIC}
and t.rn &gt; #{start,jdbcType=NUMERIC}
order by result_id desc
</select>
<select id="queryOnlineResultCount" resultType="java.lang.Integer" >
select count(*)
from (select * from pts.pts_online_result p order by p.result_id desc) p1
<where>
<if test="perResultModel.app_name != null and perResultModel.app_name != ''">
and p1.app_name like concat('%',concat(#{perResultModel.app_name,jdbcType=VARCHAR},'%'))
</if>
<if test="perResultModel.scenario_type != null and perResultModel.scenario_type != ''">
and p1.scenario_type like concat('%',concat(#{perResultModel.scenario_type,jdbcType=VARCHAR},'%'))
</if>
<if test="perResultModel.app_trade != null and perResultModel.app_trade != ''">
and p1.app_trade like concat('%',concat(#{perResultModel.app_trade,jdbcType=VARCHAR},'%'))
</if>
<if test="perResultModel.online_tester != null and perResultModel.online_tester != ''">
and p1.online_tester like concat('%',concat(#{perResultModel.online_tester,jdbcType=VARCHAR},'%'))
</if>
<if test="perResultModel.action_name != null and perResultModel.action_name != ''">
and p1.action_name like concat('%',concat(#{perResultModel.action_name,jdbcType=VARCHAR},'%'))
</if>
<if test="perResultModel.app_version != null and perResultModel.app_version != ''">
and p1.app_version like concat('%',concat(#{perResultModel.app_version,jdbcType=VARCHAR},'%'))
</if>
</where>
</select>
<select id="queryOnlineResultDetail" resultType="com.pts.model.PerformanceOnlineResultModel">
select * from pts.pts_online_result p
where p.result_id=#{result_id,jdbcType=NUMERIC}
</select>
<delete id="delOneOnlineResult">
delete from pts.pts_online_result p
where p.result_id=#{result_id,jdbcType=NUMERIC}
</delete>
<update id="editOnlineResultDetail">
update pts.pts_online_result p
set P.APP_NAME=#{porModel.app_name,jdbcType=VARCHAR}
,P.APP_TRADE=#{porModel.app_trade,jdbcType=VARCHAR}
,P.ACTION_NAME=#{porModel.action_name,jdbcType=VARCHAR}
,P.CON_USER=#{porModel.con_user,jdbcType=VARCHAR}
,P.PRESS_TIME=#{porModel.press_time,jdbcType=VARCHAR}
,P.AVG_TIME=#{porModel.avg_time,jdbcType=VARCHAR}
,P.TPS=#{porModel.tps,jdbcType=VARCHAR}
,P.SUCC_ACTION=#{porModel.succ_action,jdbcType=VARCHAR}
,P.FAIL_ACTION=#{porModel.fail_action,jdbcType=VARCHAR}
,P.SUCC_RATE=#{porModel.succ_rate,jdbcType=VARCHAR}
,P.APP_CPU_UTIL=#{porModel.app_cpu_util,jdbcType=VARCHAR}
,P.DB_CPU_UTIL=#{porModel.db_cpu_util,jdbcType=VARCHAR}
,P.SCENARIO_TYPE=#{porModel.scenario_type,jdbcType=VARCHAR}
,P.APP_VERSION=#{porModel.app_version,jdbcType=VARCHAR}
,P.ONLINE_TESTER=#{porModel.online_tester,jdbcType=VARCHAR}
,P.ONLINE_DEVELOPER=#{porModel.online_developer,jdbcType=VARCHAR}
,P.REMARK=#{porModel.remark,jdbcType=VARCHAR}
,P.UPDATE_TIME=sysdate
where p.result_id=#{result_id,jdbcType=NUMERIC}
</update>
<select id="queryBatchResultList" resultType="com.pts.model.PerformanceBatchResultModel">
select
t.BATCH_RESULT_ID
,t.BATCH_APP_NAME
,t.BATCH_APP_TRADE
,t.PERPARE_DATA
,t.TOTAL_COST
,t.SUCC_RECORD
,t.FAIL_RECORD
,t.SUCC_RATE
,t.BATCH_APP_CPU_UTIL
,t.BATCH_DB_CPU_UTIL
,t.SCENARIO_TYPE
,t.BATCH_APP_VERSION
,t.BATCH_TESTER
,t.BATCH_DEVELOPER
,t.REMARK
,to_char(t.CREATE_TIME, 'yyyy-mm-dd hh24:mi:ss')
,to_char(t.UPDATE_TIME, 'yyyy-mm-dd hh24:mi:ss')
from (
select rownum rn , p1.*from
(select * from pts.pts_batch_result p order by p.batch_result_id desc) p1
<where>
<if test="perResultModel.batch_app_name != null and perResultModel.batch_app_name != ''">
and p1.batch_app_name like concat('%',concat(#{perResultModel.batch_app_name,jdbcType=VARCHAR},'%'))
</if>
<if test="perResultModel.batch_app_trade != null and perResultModel.batch_app_trade != ''">
and p1.batch_app_trade like concat('%',concat(#{perResultModel.batch_app_trade,jdbcType=VARCHAR},'%'))
</if>
<if test="perResultModel.batch_tester != null and perResultModel.batch_tester != ''">
and p1.batch_batch_tester like concat('%',concat(#{perResultModel.batch_batch_tester,jdbcType=VARCHAR},'%'))
</if>
<if test="perResultModel.batch_app_version != null and perResultModel.batch_app_version != ''">
and p1.batch_app_version like concat('%',concat(#{perResultModel.batch_app_version,jdbcType=VARCHAR},'%'))
</if>
</where>
) t
where t.rn &lt;=#{rows,jdbcType=NUMERIC}
and t.rn &gt;#{start,jdbcType=NUMERIC}
order by batch_result_id desc
</select>
<select id="queryBatchResultCount" resultType="java.lang.Integer" >
select count(*)
from (select * from pts.pts_batch_result p order by p.batch_result_id desc) p1
<where>
<if test="perResultModel.batch_app_name != null and perResultModel.batch_app_name != ''">
and p1.batch_app_name like concat('%',concat(#{perResultModel.batch_app_name,jdbcType=VARCHAR},'%'))
</if>
<if test="perResultModel.batch_app_trade != null and perResultModel.batch_app_trade != ''">
and p1.batch_app_trade like concat('%',concat(#{perResultModel.batch_app_trade,jdbcType=VARCHAR},'%'))
</if>
<if test="perResultModel.batch_tester != null and perResultModel.batch_tester != ''">
and p1.batch_tester like concat('%',concat(#{perResultModel.batch_tester,jdbcType=VARCHAR},'%'))
</if>
<if test="perResultModel.batch_app_version != null and perResultModel.batch_app_version != ''">
and p1.batch_app_version like concat('%',concat(#{perResultModel.batch_app_version,jdbcType=VARCHAR},'%'))
</if>
</where>
</select>
<select id="queryBatchResultDetail" resultType="com.pts.model.PerformanceBatchResultModel">
select * from pts.pts_batch_result p
where p.batch_result_id=#{batch_result_id,jdbcType=NUMERIC}
</select>
<delete id="delOneBatchResult">
delete from pts.pts_batch_result p
where p.batch_result_id=#{batch_result_id,jdbcType=NUMERIC}
</delete>
<update id="editBatchResultDetail">
update pts.pts_batch_result p
set p.BATCH_APP_NAME=#{pbrModel.batch_app_name,jdbcType=VARCHAR}
,p.BATCH_APP_TRADE=#{pbrModel.batch_app_trade,jdbcType=VARCHAR}
,p.PERPARE_DATA=#{pbrModel.perpare_data,jdbcType=VARCHAR}
,p.TOTAL_COST=#{pbrModel.total_cost,jdbcType=VARCHAR}
,p.SUCC_RECORD=#{pbrModel.succ_record,jdbcType=VARCHAR}
,p.FAIL_RECORD=#{pbrModel.fail_record,jdbcType=VARCHAR}
,p.SUCC_RATE=#{pbrModel.succ_rate,jdbcType=VARCHAR}
,p.BATCH_APP_CPU_UTIL=#{pbrModel.batch_app_cpu_util,jdbcType=VARCHAR}
,p.BATCH_DB_CPU_UTIL=#{pbrModel.batch_db_cpu_util,jdbcType=VARCHAR}
,p.SCENARIO_TYPE=#{pbrModel.scenario_type,jdbcType=VARCHAR}
,p.BATCH_APP_VERSION=#{pbrModel.batch_app_version,jdbcType=VARCHAR}
,p.BATCH_TESTER=#{pbrModel.batch_tester,jdbcType=VARCHAR}
,p.BATCH_DEVELOPER=#{pbrModel.batch_developer,jdbcType=VARCHAR}
,p.REMARK=#{pbrModel.remark,jdbcType=VARCHAR}
,p.UPDATE_TIME=sysdate
where p.batch_result_id=#{batch_result_id,jdbcType=NUMERIC}
</update>
</mapper>

mybatis 批量插入和where条件使用的更多相关文章

  1. 160421、MyBatis批量插入数据

    在程序中封装了一个List集合对象,然后需要把该集合中的实体插入到数据库中,由于项目使用了Spring+MyBatis的配置,所以打算使用MyBatis批量插入,由于之前没用过批量插入,在网上找了一些 ...

  2. MyBatis批量插入数据(MySql)

    由于项目需要生成多条数据,并保存到数据库当中,在程序中封装了一个List集合对象,然后需要把该集合中的实体插入到数据库中,项目使用了Spring+MyBatis,所以打算使用MyBatis批量插入,应 ...

  3. Mybatis 批量插入

    一.首先对于批量数据的插入有两种解决方案(下面内容只讨论和Mysql交互的情况) 1)for循环调用Dao中的单条插入方法 2)传一个List<Object>参数,使用Mybatis的批量 ...

  4. mybatis批量插入数据到oracle

    mybatis 批量插入数据到oracle报 ”java.sql.SQLException: ORA-00933: SQL 命令未正确结束“  错误解决方法 oracle批量插入使用 insert a ...

  5. springMVC 接收数组参数,mybatis 接收数组参数,mybatis批量插入/批量删除案例

    案例是给一个用户赋予多个权限,多个权限用其对应的主键 id 为参数,组成了 一个id数组,传给springMVC,然后springMVC传给mybatis,然后mybatis批量插入.其实类似的场景还 ...

  6. 解决Oracle+Mybatis批量插入报错:SQL 命令未正确结束

    Mybatis批量插入需要foreach元素.foreach元素有以下主要属性: (1)item:集合中每一个元素进行迭代时的别名. (2)index:指定一个名字,用于表示在迭代过程中,每次迭代到的 ...

  7. mybatis批量插入oracle时报错:unique constraint (table name) violated

    mybatis批量插入oracle时报错:unique constraint (table name) violated,是因为插入的集合中有两条相同唯一约束的数据.

  8. Mybatis 批量插入数据

    --mybatis 批量插入数据 --1.Oracle(需要测试下是否支持MySQL) < insert id ="insertBatch" parameterType=&q ...

  9. 【mybatis批量插入】

    mybatis批量插入操作: MySQL:1.INSERT INTO TABLE_NAME(ID,NAME)VALUES(1,'张三'),(2,'李四')                  2.INS ...

随机推荐

  1. JS 跨域问题浅析及解决方法优缺点对比(转)

    1.所谓 JS 跨域问题,是指在一个域下的页面中通过js访问另一个不同域下 的数据对象, 出于安全性考 虑,几乎所有浏览器都不允许这种跨域访问,这就导致在一些ajax应用中, 使用跨域的web ser ...

  2. SYN Cookie的原理和实现

          本文主要内容:SYN Cookie的原理,以及它的内核实现. 内核版本:3.6 SYN Flood 下面这段介绍引用自[1]. SYN Flood是一种非常危险而常见的Dos攻击方式.到目 ...

  3. Osmocom-BB MOTO C118硬刷

    写在最前面,先知我YY下硬刷最好可能实现的功能: 1.把软件刷入flash,修改loader后,可以实现上电就自动运行程序: 2.硬刷后,程序自动起来,可以修改loader就行加密 3.硬刷后,有可能 ...

  4. C#静态类和静态成员

    1. 静态类 1.1 简介  静态类和类成员用于创建无需创建类的实例就能够访问的数据和函数. 静态类成员可用于分离独立于任何对象标识的数据和行为:无论对象发生什么更改,这些数据和函数都不会随之变化. ...

  5. Linux VPS下SSH常用命令

    目录操作:rm -rf mydir /*删除mydir目录,不需要确认,直接删除*/mkdir dirname /*创建名为dirname的目录*/cd mydir /*进入mydir目录*/cd - ...

  6. Ubuntu14.04 64位运行32位程序

    最近公司新增的机器安装Ubuntu14.04 64bit导致之前在32bit下编译的Qt工具软件无法运行. 于是google的了一下找到一些解决办法,但不能保证全部32bit的Qt程序都能正常,测试了 ...

  7. C++学习笔记36:类模板

    类模板的目的 设计通用的类型式,以适应广泛的成员数据型式 类模板的定义格式 template<模板形式参数列表>class 类名称{...}; 原型:template<typenam ...

  8. 解决一台机器同时运行多个Tomcat服务

    http://www.cnblogs.com/itolssy/archive/2008/09/09/1278041.html 如果不加任何修改,在一台服务器上同时运行两个Tomcat服务显然会发生端口 ...

  9. centos 用户组

    centos 用户组和用户的添加及所属问题 指定附加组   eg:dy 为组名 ,lisi 为用户,要把lisi 用户添加到 dy 组里面 useradd -G dy lisi 可以同时添加多个组, ...

  10. SAP 增强说明

    转自http://blog.csdn.net/lyb_yt/article/details/8177974 (一)什么是增强(Enhancement)? 简单地说,增强就是ERP系统中标准程序的出口, ...