<?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.picc.grab.mapper.ZbwtMapper">

	<!-- 通用查询映射结果 -->
	<resultMap id="BaseResultMap" type="com.picc.grab.domain.Zbwt">
		<id column="id" property="id" />
		<result column="carid" property="carid" />
		<result column="zbgzstatus" property="zbgzstatus" />
		<result column="fsbjdsj" property="fsbjdsj" />
		<result column="fsr" property="fsr" />
		<result column="create_time" property="createTime" />
		<result column="lastgztime" property="lastgztime" />
		<result column="gzrwbh" property="gzrwbh" />
	</resultMap>
	<select id="GetZbwtByCarid" resultType="com.picc.grab.domain.Zbwt" resultMap="BaseResultMap">
        select  * from  nj_mdb.md_zbwt WHERE carid=#{carid}
	</select>

	<select id="findByTime" resultType="com.picc.grab.entity.ZbwtVo">
		select a.*,b.cph from nj_mdb.md_zbwt a
		LEFT JOIN nj_mdb.md_carinfo b on b.id = a.carid
		where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <![CDATA[<=]]> date(a.create_time)
		and zbgzstatus = 1
		and b.wtf_id = 'ac61b9bdbc6c4b6ca43fbbfc930de901'
	</select>

	<update id="updateZbwt">
		UPDATE md_zbwt SET zbgzstatus=#{zbgzstatus}
		,bidCompanyName=#{bidCompanyName}
		,outbidTime=#{createTime}
		,bidPrice = #{bidPrice}
		 where carid = #{carid}
	</update>

	<update id="updateSF">
		update nj_mdb.md_carbjxx set sfcn = 0 where carid =  #{carid}
	</update>


</mapper>
