123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- <?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.jkcredit.invoice.mapper.waybill.SellCarTradeMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.jkcredit.invoice.model.entity.waybill.SelfCarTrade">
- <id column="id" property="id"/>
- <result column="customId" property="customId"/>
- <result column="companyNum" property="companyNum"/>
- <result column="cardId" property="cardId"/>
- <result column="tradeId" property="tradeId"/>
- <result column="exTime" property="exTime"/>
- <result column="aclTime" property="aclTime"/>
- <result column="fee" property="fee"/>
- <result column="status" property="status"/>
- <result column="applId" property="applId"/>
- <result column="days" property="days"/>
- <result column="companyName" property="companyName"/>
- <result column="companyReferencenum" property="companyReferencenum"/>
- </resultMap>
- <sql id="baseSql">
- id,
- customId,
- companyNum,
- cardId,
- tradeId,
- exTime,
- fee,
- status,
- applId,
- aclTime,
- companyName,
- companyReferencenum,
- interType
- </sql>
- <select id="selectAllByPage" resultMap="BaseResultMap">
- select
- <include refid="baseSql" />,timestampdiff(day,aclTime,now()) days
- from t_SellCarTrade
- <where>
- <if test="sellCarTrade.companyName != null and sellCarTrade.companyName != ''">
- and companyName = BINARY #{sellCarTrade.companyName}
- </if>
- <if test="sellCarTrade.cardIds != null">
- and cardId in
- <foreach collection="sellCarTrade.cardIds" item="cardId" index="index" separator="," open="(" close=")">
- #{cardId}
- </foreach>
- </if>
- <if test="sellCarTrade.tradeIds != null">
- and tradeId in
- <foreach collection="sellCarTrade.tradeIds" item="tradeId" index="index" separator="," open="(" close=")">
- #{tradeId}
- </foreach>
- </if>
- <if test="sellCarTrade.cardAndTradeVos != null">
- and (cardId,tradeId) in
- <foreach collection="sellCarTrade.cardAndTradeVos" item="cardAndTradeVo" index="index" separator="," open="(" close=")">
- (#{cardAndTradeVo.cardId},#{cardAndTradeVo.tradeId})
- </foreach>
- </if>
- <if test="sellCarTrade.companyReferencenum != null and sellCarTrade.companyReferencenum != ''">
- and companyReferencenum = BINARY #{sellCarTrade.companyReferencenum}
- </if>
- <if test="sellCarTrade.status != null and sellCarTrade.status != ''">
- and status = #{sellCarTrade.status}
- </if>
- <if test="sellCarTrade.exTimeBegin != null and sellCarTrade.exTimeBegin != ''">
- and exTime BETWEEN #{sellCarTrade.exTimeBegin} and #{sellCarTrade.exTimeEnd}
- </if>
- <if test="sellCarTrade.aclTimeBegin != null and sellCarTrade.aclTimeBegin != ''">
- and aclTime BETWEEN #{sellCarTrade.aclTimeBegin} and #{sellCarTrade.aclTimeEnd}
- </if>
- <if test="sellCarTrade.exceptionFlag != null and sellCarTrade.exceptionFlag != ''">
- and now()>date_add(aclTime,interval 10 day) and (status=2 or status =1)
- </if>
- </where>
- order by id desc
- </select>
- <select id="selectByTradeId" resultMap="BaseResultMap" parameterType="java.lang.String">
- select
- <include refid="baseSql" />
- from t_SellCarTrade where tradeId = BINARY #{tradeId,jdbcType=VARCHAR}
- </select>
- <insert id="insert" parameterType="com.jkcredit.invoice.model.entity.waybill.SelfCarTrade" >
- insert into t_SellCarTrade (
- customId,
- companyNum,
- cardId,
- tradeId,
- exTime,
- fee,
- status,
- applId,
- aclTime,
- companyName,
- companyReferencenum,interType,updateTime
- )
- values ( #{customId,jdbcType=VARCHAR}, #{companyNum,jdbcType=VARCHAR},
- #{cardId,jdbcType=VARCHAR}, #{tradeId,jdbcType=VARCHAR}, #{exTime,jdbcType=VARCHAR},
- #{fee,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{applId,jdbcType=VARCHAR},#{aclTime,jdbcType=VARCHAR},
- #{companyName,jdbcType=VARCHAR},#{companyReferencenum,jdbcType=VARCHAR}, #{interType,jdbcType=INTEGER},now()
- )
- </insert>
- <update id="updateByPrimaryKey" parameterType="com.jkcredit.invoice.model.entity.waybill.SelfCarTrade" >
- update t_SellCarTrade
- set customId = #{customId,jdbcType=VARCHAR},
- companyNum = #{companyNum,jdbcType=VARCHAR},
- cardId = #{cardId,jdbcType=VARCHAR},
- tradeId = #{tradeId,jdbcType=VARCHAR},
- exTime = #{exTime,jdbcType=VARCHAR},
- fee = #{fee,jdbcType=INTEGER},
- status = #{status,jdbcType=INTEGER},
- applId = #{applId,jdbcType=VARCHAR},
- aclTime = #{aclTime,jdbcType=VARCHAR},
- companyName = #{companyName,jdbcType=VARCHAR},
- companyReferencenum = #{companyReferencenum,jdbcType=VARCHAR}
- where id = #{id,jdbcType=INTEGER}
- </update>
- <update id="updateByTradeId" parameterType="com.jkcredit.invoice.model.entity.waybill.SelfCarTrade" >
- update t_SellCarTrade
- set customId = #{customId,jdbcType=VARCHAR},
- companyNum = #{companyNum,jdbcType=VARCHAR},
- cardId = #{cardId,jdbcType=VARCHAR},
- tradeId = #{tradeId,jdbcType=VARCHAR},
- exTime = #{exTime,jdbcType=VARCHAR},
- fee = #{fee,jdbcType=INTEGER},
- status = #{status,jdbcType=INTEGER},
- applId = #{applId,jdbcType=VARCHAR},
- aclTime = #{aclTime,jdbcType=VARCHAR},
- companyName = #{companyName,jdbcType=VARCHAR},
- companyReferencenum = #{companyReferencenum,jdbcType=VARCHAR},
- interType = #{interType,jdbcType=INTEGER},
- updateTime = now()
- where tradeId = BINARY #{tradeId,jdbcType=INTEGER}
- </update>
- <select id="selectByCardId" resultMap="BaseResultMap" parameterType="java.lang.String" >
- select
- <include refid="baseSql" />
- from t_SellCarTrade
- where cardId = BINARY #{cardId,jdbcType=VARCHAR}
- </select>
- <select id="selectByCardIdByStatus" resultMap="BaseResultMap" parameterType="com.jkcredit.invoice.model.entity.waybill.SelfCarTrade" >
- select
- <include refid="baseSql" />
- from t_SellCarTrade
- where cardId = BINARY #{cardId,jdbcType=VARCHAR} and status = #{status,jdbcType=VARCHAR}
- </select>
- <select id="selectByStatus" resultMap="BaseResultMap" parameterType="java.util.Map" >
- select
- <include refid="baseSql" />
- from t_SellCarTrade
- where status = #{status,jdbcType=VARCHAR}
- <if test="company != null and company != ''">
- and companyName = #{company,jdbcType=VARCHAR}
- </if>
- </select>
- <select id="selectNeedGetTrades" resultMap="BaseResultMap">
- select
- <include refid="baseSql" />
- from t_SellCarTrade
- where status = 2 and bindStatus=1 and aclTime >'2023-03-16 00:00:00'
- UNION ALL
- select
- <include refid="baseSql" />
- from t_SellCarTrade
- where status = 3 and
- updateTime >concat(date_sub(curdate(),interval 1 day),' 00:00:00')
- UNION ALL
- select
- <include refid="baseSql" />
- from t_SellCarTrade
- where aclTime is null and
- updateTime >concat(curdate(),' 00:00:00') and status>1
- </select>
- <update id="upDateCompany" parameterType="com.jkcredit.invoice.model.vo.CompanyVo">
- UPDATE t_SellCarTrade set companyName = #{newCompanyName} where companyName = #{oldCompanyName}
- </update>
- <update id="updatebindStatus" parameterType="java.util.Map">
- UPDATE t_SellCarTrade set bindStatus = #{bindStatus} where companyNum = #{companyNum} and cardId = #{etcCard}
- </update>
- <delete id="deletebyEtcAndTime" parameterType="com.jkcredit.invoice.service.lowerservice.vo.TradeRequestVo">
- delete from t_SellCarTrade where companyName = #{companyName,jdbcType=VARCHAR}
- and customId = #{customerName,jdbcType=VARCHAR}
- and cardId = #{etcId,jdbcType=VARCHAR}
- and exTime BETWEEN #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
- and status = #{tradeStatus,jdbcType=INTEGER}
- </delete>
- <select id="sellectAllNullApplid" resultMap="BaseResultMap">
- select
- <include refid="baseSql" />
- from t_SellCarTrade t
- where t.status in(2,3) and t.aclTime is null and t.id> 1870702
- </select>
- </mapper>
|