mybatis 中的稍微复杂些的sql语句
mybatis 中的稍微复杂些的sql语句:
<?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.creditharmony.core.autoBill.dao.AutoBillTempDao"> <select id="get" resultType="com.creditharmony.core.autoBill.entity.AutoBillTemp">
SELECT * from gl.t_gl_autobill_temp WHERE order_no = #{orderNo}
</select> <insert id="insertBatch">
INSERT INTO gl.t_gl_autobill_temp(user_id, type, order_no, money, status, bill_time, batch_no, bank_info, account_info,account_no,account_name,bill_status,bank_time)
<foreach collection="list" item="item" separator=" union all ">
SELECT #{item.userId}, #{item.type}, #{item.orderNo}, #{item.money}, #{item.status}, to_timestamp(#{item.billTime},'YYYY-MM-DD HH24:MI:SS'), #{item.batchNo}, #{item.bankInfo}, #{item.accountInfo}, #{item.accountNo}, #{item.account_name}, #{item.billStatus}, to_timestamp(#{item.bankTime},'YYYY-MM-DD HH24:MI:SS')
</foreach>
</insert> <insert id="insertHisBatch">
INSERT INTO gl.t_gl_autobill_his(user_id, type, order_no, money, status, bill_time, batch_no, bank_info, account_info,account_no,account_name,bill_status,bank_time)
select user_id, type, order_no, money, status, bill_time, batch_no, bank_info, account_info,account_no,account_name,bill_status,bank_time from gl.t_gl_autobill_temp where order_no in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</insert> <delete id="deleteAll" parameterType="com.creditharmony.core.autoBill.entity.AutoBillTemp">
DELETE FROM gl.t_gl_autobill_temp
</delete> <delete id="deleteAutoBillTemp" parameterType="com.creditharmony.core.autoBill.entity.AutoBillTemp">
DELETE FROM gl.t_gl_autobill_temp WHERE user_id=#{userId} and type=#{type}
</delete> <delete id="delete">
DELETE FROM gl.t_gl_autobill_temp WHERE order_no=#{orderNo}
</delete> <delete id="deleteBatch" parameterType="java.util.List">
DELETE FROM gl.t_gl_autobill_temp
WHERE order_no in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</delete> <update id="updateDeductHisStatus">
UPDATE gl.t_gl_deduct_his_detail SET
bill_status = #{billStatus}
WHERE split_id in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<update id="updateCollectHisStatus">
UPDATE gl.t_gl_deduct_his_detail SET
collect_status = #{billStatus}
WHERE settlement_no in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<update id="updatePayHisStatus">
UPDATE gl.t_gl_pay_his SET
bill_status = #{billStatus}
WHERE item_no in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
</mapper>
mybatis 中的稍微复杂些的sql语句的更多相关文章
- 【mybatis】mybatis执行一个update方法,返回值为1,但是数据库中数据并未更新,粘贴sql语句直接在数据库执行,等待好久报错:Lock wait timeout exceeded; try restarting transaction
今天使用mybatis和jpa的过程中,发现这样一个问题: mybatis执行一个update方法,返回值为1,但是数据库中数据并未更新,粘贴sql语句直接在数据库执行,等待好久报错:Lock wai ...
- 向Oracle中传入数组,批量执行SQL语句
1.首先用PL/SQL创建package create or replace package excuteBatchOperate as type sqlStr_Array ) index by bi ...
- Spring 中jdbcTemplate 实现执行多条sql语句
说一下Spring框架中使用jdbcTemplate实现多条sql语句的执行: 很多情况下我们需要处理一件事情的时候需要对多个表执行多个sql语句,比如淘宝下单时,我们确认付款时要对自己银行账户的表里 ...
- 如何在Oracle中一次执行多条sql语句 (.net C#)
关键是不能换行,要加上begin ...sql... end; 每个SQL用:隔开,end后面必须加: 以下是拷贝于:http://www.cnblogs.com/teamleader/arc ...
- 转载:SQL Server中查询CPU占用高的SQL语句
SQL Server中查询CPU占用高的SQL语句 SQL Server 表变量的用法 究竟什么是敏捷测试--朱少民
- Mybatis中的Mapper.xml映射文件sql查询接收多个参数
我们都知道,在Mybatis中的Mapper.xml映射文件可以定制动态SQL,在dao层定义的接口中定义的参数传到xml文件中之后,在查询之前mybatis会对其进行动态解析,通常使用#{}接收 ...
- MyBatis学习(三)、动态SQL语句
三.动态SQL语句 有些时候,sql语句where条件中,需要一些安全判断,例如按某一条件查询时如果传入的参数是空,此时查询出的结果很可能是空的,也许我们需要参数为空时,是查出全部的信息.使用Orac ...
- 原!!mybatis如何直接 执行传入的任意sql语句 并按照顺序取出查询的结果集
需求: 1.直接执行前端传来的任何sql语句,parameterType="String", 2.对于任何sql语句,其返回值类型无法用resultMap在xml文件里配置或者返回 ...
- MyBatis7:MyBatis插件及示例----打印每条SQL语句及其执行时间
Plugins 摘一段来自MyBatis官方文档的文字. MyBatis允许你在某一点拦截已映射语句执行的调用.默认情况下,MyBatis允许使用插件来拦截方法调用 Executor(update.q ...
随机推荐
- 第一个demo
1.首先这是最初的概念模型. 2.最后设计成这样. 3.运行
- MINIX3 系统任务分析
MINIX3 系统任务分析 7.1 MINIX3 系统任务概要 MINIX3 怎么来给用户提供丰富的服务呢?除了中断,异常处理,除了时钟服务. 程序员总是希望一个操作系统给他提供足够的服务,使得他 ...
- Shell 条件表达式汇总
条件表达式 文件表达式 if [ -f file ] 如果文件存在if [ -d ... ] 如果目录存在if [ -s file ] 如果文件存在且非空 if [ -r f ...
- CUDA 程序中的同步
前言 在并发,多线程环境下,同步是一个很重要的环节.同步即是指进程/线程之间的执行顺序约定. 本文将介绍如何通过共享内存机制实现块内多线程之间的同步. 至于块之间的同步,需要使用到 global me ...
- pcr free library 介绍
一句话:illumina的建库方法,建库时间段,质量还好... the adapters are different in the PCR-free kit compared to the stand ...
- easyui 入门
http://www.cnblogs.com/tangge/p/3214496.html 1.页面引用. jquery,easyui,主题easyui.css,图标ico.css,语言zh_CN.js ...
- iOS学习笔记---oc语言第三天
继承.初始化方法 一.继承 继承的上层:父类 继承的下层:子类 继承是单向的,不能相互继承 继承具有传递性:A继承于B,B继承于C,A具有B和C的特征和行为 子类能继承父类全部的特征和行为(私有变量 ...
- xampp改到phpmyadmin的root密碼無法登錄
open /Applications/XAMPP/xamppfiles/phpmyadmin/config.inc.php $cfg['Servers'][$i]['auth_type'] = 'co ...
- Spring+Websocket实现消息的推送
http://my.oschina.net/ldl123292/blog/304360
- UVA 11997 STL 优先队列
题目链接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem ...