CarinfoMapper.xml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.picc.grab.mapper.CarinfoMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.picc.grab.domain.Carinfo">
  6. <id column="id" property="id"/>
  7. <result column="wtf_id" property="wtfId"/>
  8. <result column="jjbh" property="jjbh"/>
  9. <result column="fgs_id" property="fgsId"/>
  10. <result column="user_id" property="userId"/>
  11. <result column="cjh" property="cjh"/>
  12. <result column="cllx" property="cllx"/>
  13. <result column="csh" property="csh"/>
  14. <result column="pinpai" property="pinpai"/>
  15. <result column="chexi" property="chexi"/>
  16. <result column="chexing" property="chexing"/>
  17. <result column="cph" property="cph"/>
  18. <result column="fdjh" property="fdjh"/>
  19. <result column="djzrq" property="djzrq"/>
  20. <result column="ccrq" property="ccrq"/>
  21. <result column="cpxh" property="cpxh"/>
  22. <result column="bsxlx" property="bsxlx"/>
  23. <result column="rylx" property="rylx"/>
  24. <result column="syxz" property="syxz"/>
  25. <result column="syrxz" property="syrxz"/>
  26. <result column="pailia" property="pailia"/>
  27. <result column="pldw" property="pldw"/>
  28. <result column="bxlc" property="bxlc"/>
  29. <result column="jkfs" property="jkfs"/>
  30. <result column="sgyy" property="sgyy"/>
  31. <result column="cldfd_shen" property="cldfdShen"/>
  32. <result column="cldfd_shi" property="cldfdShi"/>
  33. <result column="cldfd_jtdz" property="cldfdJtdz"/>
  34. <result column="xjfs" property="xjfs"/>
  35. <result column="sfdy" property="sfdy"/>
  36. <result column="sfgz" property="sfgz"/>
  37. <result column="cjhsfbg" property="cjhsfbg"/>
  38. <result column="fdjhsfbg" property="fdjhsfbg"/>
  39. <result column="sfecsg" property="sfecsg"/>
  40. <result column="wtqfy" property="wtqfy"/>
  41. <result column="xjks" property="xjks"/>
  42. <result column="xjjs" property="xjjs"/>
  43. <result column="bjjs" property="bjjs"/>
  44. <result column="xjbz" property="xjbz"/>
  45. <result column="exbz" property="exbz"/>
  46. <result column="exzjbjid" property="exzjbjid"/>
  47. <result column="status" property="status"/>
  48. <result column="by1" property="by1"/>
  49. <result column="by2" property="by2"/>
  50. <result column="by3" property="by3"/>
  51. <result column="bbxrsfcz" property="bbxrsfcz"/>
  52. <result column="create_user_id" property="createUserId"/>
  53. <result column="create_time" property="createTime"/>
  54. <result column="update_time" property="updateTime"/>
  55. <result column="sffqmjbj" property="sffqmjbj"/>
  56. </resultMap>
  57. <!--查询最大的车辆id-->
  58. <select id="getMaxCarId" resultType="java.lang.Integer">
  59. SELECT CONVERT(id,SIGNED) FROM md_carinfo ORDER BY CONVERT(id,SIGNED) DESC LIMIT 0,1
  60. </select>
  61. <!--根据车架号查询车辆id-->
  62. <select id="findCaridByCjh" resultType="java.lang.String">
  63. SELECT id FROM md_carinfo WHERE cjh = #{cjh}
  64. <![CDATA[ AND STATUS <> 0
  65. ]]>
  66. </select>
  67. <!--根据车架号查询出价记录-->
  68. <select id="findCjjlByCjh" resultType="com.picc.grab.entity.grab.dto.CarCjjlDTO">
  69. SELECT cjsj,wtf,wtj,hsj FROM md_carcjjl WHERE cjh = #{cjh}
  70. </select>
  71. <!--查询报价截止时间还有15分未发送报价单的车辆-->
  72. <select id="findVehicleByTenMinute" resultType="java.lang.String">
  73. SELECT DISTINCT car.id FROM md_carInfo car left join md_wtf_Info wtf on wtf.id=car.wtf_id
  74. where car.status=4 and wtf.id=#{id} and car.fgs_id=#{fgsid}
  75. and car.xjjs>now() and IFNULL(car.jjbh,'') !=''
  76. <![CDATA[ and DATE_SUB(car.bjjs, INTERVAL 15 minute)<=now()
  77. ]]>
  78. </select>
  79. <!--查询车辆报价单金额-->
  80. <select id="findBjdjeByCarid" resultType="java.lang.String">
  81. SELECT bjd.bjdje FROM md_carbjd bjd WHERE bjd.carid = #{carid} ORDER BY bjd.create_time DESC LIMIT 1
  82. </select>
  83. <!--维护车辆中标状态-->
  84. <select id="findVehicleByBid" resultType="java.util.Map">
  85. SELECT car.jjbh id,zw.zbgzstatus,car.id carid from md_carinfo car
  86. LEFT JOIN md_zbwt zw on zw.carid=car.id
  87. LEFT JOIN md_wtf_info wtf on wtf.id=car.wtf_id
  88. where car.fgs_id=#{fgsid} and wtf.yjwtf=#{wtfName} and zw.zbgzstatus=#{zbgzstatus} and
  89. TIMESTAMPDIFF(DAY,zw.create_time,NOW()) <![CDATA[ <= ]]>31 and IFNULL(car.jjbh,'') !=''
  90. </select>
  91. <!--同步手续管理车辆信息-->
  92. <insert id="syncSxglcarData">
  93. INSERT INTO nj_pmhtjkdb.md_sxglcar (`id`, `wtj`,
  94. `wtf_id`, `wtf_name`, `fgs_id`, `fgs_name`,
  95. `user_id`, `user_name`, `cjh`, `cllx`, `csh`, `pinpai`, `chexi`, `chexing`, `cph`, `sxglzt`,
  96. `carzname`, `carzdh`, `dsyname`, `dsydh`, `by1`, `by2`, `by3`, `create_time`, `update_time`)
  97. SELECT car.id, (SELECT bjd.bjdje FROM nj_mdb.md_carbjd bjd WHERE carid = car.id ORDER BY bjd.create_time DESC LIMIT 1) wtj,
  98. car.wtf_id, wtf.yjwtf wtf_name, car.fgs_id, fgs.fgs_mc fgs_name,
  99. car.user_id, u.trueName user_name, car.cjh, car.cllx, car.csh, car.pinpai, car.chexi, car.chexing, car.cph, 1 sxglzt,
  100. carzxx.carzname, carzxx.carzdh, carzxx.dsyname, carzxx.dsydh,car.by1, car.by2, car.by3, now() create_time, now() update_time
  101. FROM md_carinfo car
  102. INNER JOIN md_carzxx carzxx ON carzxx.carid = car.id
  103. LEFT JOIN md_zbwt zbwt ON car.id = zbwt.carid
  104. LEFT JOIN md_wtf_info wtf ON car.wtf_id = wtf.id
  105. LEFT JOIN md_fgs_info fgs ON car.fgs_id = fgs.id
  106. LEFT JOIN md_user u ON car.user_id = u.id
  107. LEFT JOIN nj_pmhtjkdb.md_sxglcar wtcar ON car.id = wtcar.id
  108. WHERE car.status = 5 AND zbwt.zbgzstatus = 5 AND car.id = #{carid} AND wtcar.id IS NULL
  109. </insert>
  110. </mapper>