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>
    
  • 相关阅读:
    spring-boot、spring-data-jpa整合
    Executors中的几种线程调用方式
    通过BeanFactoryPostProcessor来获取bean
    spring、spring-data-redis整合使用
    java.io几种读写文件的方式
    springmvc+quartz简单实现定时调度
    httpclient跳过https请求的验证
    Gson的几种使用方式
    httpclient的几种请求URL的方式
    【转】文件各种上传,离不开的表单
  • 原文地址:https://www.cnblogs.com/hoge/p/5567809.html
Copyright © 2011-2022 走看看