TbBusinessMapper.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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.pj.project.tb_business.TbBusinessMapper">
  4. <!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
  5. <select id="getList" resultType="com.pj.project.tb_business.TbBusiness">
  6. select * from tb_business
  7. <where>
  8. <if test=' this.has("id") '>and id = #{id}</if>
  9. <if test=' this.has("customerId") '>and customer_id = #{customerId}</if>
  10. <if test=' this.has("customerName") '>and customer_name like concat('%', #{customerName} ,'%')</if>
  11. <if test=' this.has("no") '>and no = #{no}</if>
  12. <if test=' this.has("cardNo") '>and card_no like concat('%', #{cardNo} ,'%')</if>
  13. <if test=' this.has("cardSize") '>and card_size = #{cardSize}</if>
  14. <if test=' this.has("netWeight") '>and net_weight = #{netWeight}</if>
  15. <if test=' this.has("goodsName") '>and goods_name = #{goodsName}</if>
  16. <if test=' this.has("goodsCode") '>and goods_code = #{goodsCode}</if>
  17. <if test=' this.has("driverName") '>and driver_name like concat('%', #{driverName} ,'%')</if>
  18. <if test=' this.has("driverId") '>and driver_id = #{driverId}</if>
  19. <if test=' this.has("driverPhone") '>and driver_phone = #{driverPhone}</if>
  20. <if test=' this.has("driverIdCard") '>and driver_id_card like concat('%', #{driverIdCard} ,'%')</if>
  21. <if test=' this.has("expectInDay") '>and expect_in_day = #{expectInDay}</if>
  22. <if test=' this.has("realInDay") '>and real_in_day = #{realInDay}</if>
  23. <if test=' this.has("realInTime") '>and real_in_time = #{realInTime}</if>
  24. <if test=' this.has("payStatus") '>and pay_status = #{payStatus}</if>
  25. <if test=' this.has("payTime") '>and pay_time = #{payTime}</if>
  26. <if test=' this.has("payType") '>and pay_type = #{payType}</if>
  27. <if test=' this.has("outDayTime") '>and out_day_time = #{outDayTime}</if>
  28. <if test=' this.has("partMoney") '>and part_money = #{partMoney}</if>
  29. <if test=' this.has("partTime") '>and part_time = #{partTime}</if>
  30. <if test='isCar==0'>
  31. and declare_no is not null
  32. </if>
  33. <if test='isCar==1'>
  34. and (declare_no is null or declare_no='')
  35. </if>
  36. <if test=' this.has("current") '>
  37. <if test=' current == 3 '>and real_in_time is not null and out_day_time is not null</if>
  38. <if test=' current == 2 '>and real_in_time is not null and out_day_time is null</if>
  39. <if test=' current == 1 '>and real_in_time is null and out_day_time is null</if>
  40. </if>
  41. </where>
  42. order by
  43. <choose>
  44. <when test='sortType == 1'>id desc</when>
  45. <when test='sortType == 2'>customer_id desc</when>
  46. <when test='sortType == 3'>customer_name desc</when>
  47. <when test='sortType == 4'>no desc</when>
  48. <when test='sortType == 5'>card_no desc</when>
  49. <when test='sortType == 6'>card_size desc</when>
  50. <when test='sortType == 7'>net_weight desc</when>
  51. <when test='sortType == 8'>goods_name desc</when>
  52. <when test='sortType == 9'>goods_code desc</when>
  53. <when test='sortType == 10'>driver_name desc</when>
  54. <when test='sortType == 11'>driver_id desc</when>
  55. <when test='sortType == 12'>driver_phone desc</when>
  56. <when test='sortType == 13'>driver_id_card desc</when>
  57. <when test='sortType == 14'>expect_in_day desc</when>
  58. <when test='sortType == 15'>real_in_day desc</when>
  59. <when test='sortType == 16'>real_in_time desc</when>
  60. <when test='sortType == 17'>pay_status desc</when>
  61. <when test='sortType == 18'>pay_time desc</when>
  62. <when test='sortType == 19'>pay_type desc</when>
  63. <when test='sortType == 20'>out_day_time desc</when>
  64. <when test='sortType == 21'>part_money desc</when>
  65. <when test='sortType == 22'>part_time desc</when>
  66. <otherwise>id desc</otherwise>
  67. </choose>
  68. </select>
  69. <select id="getCarDisincleList" resultType="com.pj.project.tb_business.CarDisincle">
  70. SELECT
  71. a.id,
  72. b.id as businessCarId,
  73. a.`no`,a.operate_time,
  74. a.item_price,a.goods_name,a.admin_confirm_input,b.car_no,
  75. b.base_part_money,a.total_money,a.pay_money,a.create_time,
  76. b.real_in_time,b.real_out_time,b.car_no ,a.net_weight,a.card_size,a.pay_status,a.item_type_name
  77. from tb_business a,tb_business_car b
  78. WHERE a.business_car_id=b.id and (a.declare_no='' or a.declare_no is null)
  79. <if test="cardNo !='' and cardNo !=null">
  80. and b.car_no like concat('%',#{cardNo},'%')
  81. </if>
  82. <if test="adminConfirmInput !='-1'">
  83. and a.admin_confirm_input=#{adminConfirmInput}
  84. </if>
  85. <if test="customerId !=null and customerId !=''">
  86. and a.customer_id=#{customerId}
  87. </if>
  88. <if test="carNo !=null and carNo !=''">
  89. and b.car_no like concat ('%',#{carNo},'%')
  90. </if>
  91. ORDER BY a.create_time desc
  92. </select>
  93. <select id="checkCarBusinessType" resultType="java.lang.Integer">
  94. SELECT
  95. count(a.id)
  96. FROM
  97. tb_business_car a,
  98. tb_business b
  99. WHERE
  100. a.id = b.business_car_id
  101. AND a.car_no =#{carNo}
  102. and b.item_type_id=#{typeId}
  103. <if test="before==1">
  104. AND DATE_FORMAT( b.operate_time, '%Y-%m-%d %H:%i:%s' ) &lt; #{operateTime}
  105. </if>
  106. <if test="before==0">
  107. AND DATE_FORMAT( b.operate_time, '%Y-%m-%d %H:%i:%s' ) &gt; #{operateTime}
  108. </if>
  109. </select>
  110. <select id="checkCarBusinessTypeByTime" resultType="java.lang.Integer">
  111. SELECT
  112. count(b.id)
  113. FROM
  114. tb_business_car a,
  115. tb_business b
  116. WHERE
  117. a.id = b.business_car_id
  118. AND a.car_no =#{carNo}
  119. and b.item_type_id=#{typeId}
  120. AND DATE_FORMAT( b.operate_time, '%Y-%m-%d %H:%i:%s' ) &gt; #{timeStart}
  121. and DATE_FORMAT( b.operate_time, '%Y-%m-%d %H:%i:%s' ) &lt; #{timeEnd}
  122. <if test="businessId!=null and businessId !=''">
  123. and b.id !=#{businessId}
  124. </if>
  125. </select>
  126. </mapper>