zoukankan      html  css  js  c++  java
  • 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>
    
  • 相关阅读:
    Android Studio 单刷《第一行代码》系列 05 —— Fragment 基础
    Android Studio 单刷《第一行代码》系列 04 —— Activity 相关
    Android Studio 单刷《第一行代码》系列 03 —— Activity 基础
    Android Studio 单刷《第一行代码》系列 02 —— 日志工具 LogCat
    Android Studio 单刷《第一行代码》系列 01 —— 第一战 HelloWorld
    IDEA 内网手动添加oracle,mysql等数据源,以及server returns invalid timezone错误配置
    eclipse maven设置
    IntelliJ IDE 常用配置
    eclipse maven 常见问题解决方案
    Maven 安装和配置
  • 原文地址:https://www.cnblogs.com/hoge/p/5567809.html
Copyright © 2011-2022 走看看