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>
    
  • 相关阅读:
    node
    github
    [模块] pdf转图片-pdf2image
    python 15 自定义模块 随机数 时间模块
    python 14 装饰器
    python 13 内置函数II 匿名函数 闭包
    python 12 生成器 列表推导式 内置函数I
    python 11 函数名 迭代器
    python 10 形参角度 名称空间 加载顺序
    python 09 函数参数初识
  • 原文地址:https://www.cnblogs.com/hoge/p/5567809.html
Copyright © 2011-2022 走看看