KwcContractLogisticsMapper.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.sckw.contract.dao.KwcContractLogisticsMapper">
  6. <resultMap id="BaseResultMap" type="com.sckw.contract.model.entity.KwcContractLogistics">
  7. <id property="id" column="id" jdbcType="BIGINT"/>
  8. <result property="ent_id" column="ent_id" jdbcType="BIGINT"/>
  9. <result property="contract_no" column="contract_no" jdbcType="VARCHAR"/>
  10. <result property="name" column="name" jdbcType="VARCHAR"/>
  11. <result property="signing_way" column="signing_way" jdbcType="VARCHAR"/>
  12. <result property="charging" column="charging" jdbcType="BIGINT"/>
  13. <result property="trading" column="trading" jdbcType="BIGINT"/>
  14. <result property="start_time" column="start_time" jdbcType="TIMESTAMP"/>
  15. <result property="end_time" column="end_time" jdbcType="TIMESTAMP"/>
  16. <result property="amount" column="amount" jdbcType="DECIMAL"/>
  17. <result property="performed_amount" column="performed_amount" jdbcType="DECIMAL"/>
  18. <result property="signing_url" column="signing_url" jdbcType="VARCHAR"/>
  19. <result property="signed_url" column="signed_url" jdbcType="VARCHAR"/>
  20. <result property="signing_no" column="signing_no" jdbcType="VARCHAR"/>
  21. <result property="contract_pid" column="contract_pid" jdbcType="BIGINT"/>
  22. <result property="remark" column="remark" jdbcType="VARCHAR"/>
  23. <result property="status" column="status" jdbcType="INTEGER"/>
  24. <result property="create_by" column="create_by" jdbcType="BIGINT"/>
  25. <result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
  26. <result property="update_by" column="update_by" jdbcType="BIGINT"/>
  27. <result property="update_time" column="update_time" jdbcType="TIMESTAMP"/>
  28. <result property="del_flag" column="del_flag" jdbcType="INTEGER"/>
  29. </resultMap>
  30. <sql id="Base_Column_List">
  31. id,ent_id,contract_no,
  32. name,signing_way,charging,
  33. trading,start_time,end_time,
  34. amount,performed_amount,signing_url,
  35. signed_url,signing_no,contract_pid,
  36. remark,status,create_by,
  37. create_time,update_by,update_time,
  38. del_flag
  39. </sql>
  40. <select id="queryList" resultType="com.sckw.contract.model.dto.res.QueryListResDto">
  41. select a.amount,
  42. a.charging,
  43. a.name contractName,
  44. a.contract_no,
  45. c.create_by initiateBy,
  46. c.create_time initiateTime,
  47. a.create_time,
  48. a.start_time,
  49. a.end_time,
  50. a.id,
  51. a.remark,
  52. a.signing_way,
  53. d.create_time signTime,
  54. a.status,
  55. b.unit_type,
  56. b.ent_id,
  57. b.firm_name entName,
  58. e.ent_id targetEntId,
  59. e.firm_name targetEntName,
  60. a.performed_amount performedAmount,
  61. a.contract_pid contractPid
  62. from kwc_contract_logistics a
  63. left join kwc_contract_logistics_unit b
  64. on a.id = b.contract_id
  65. and b.unit_type = #{entType}
  66. and case when a.status != 3 then b.ent_id in
  67. <foreach collection="allEnt" separator="," open="(" close=")" item="item">
  68. #{item}
  69. </foreach>
  70. end
  71. and b.del_flag = 0
  72. left join kwc_contract_logistics_track c on a.id = c.contract_id and c.del_flag = 0 and c.type = 1
  73. left join kwc_contract_logistics_track d on a.id = d.contract_id and d.del_flag = 0 and d.type = 0
  74. left join kwc_contract_logistics_unit e on a.id = e.contract_id and e.unit_type != #{entType} and e.del_flag = 0
  75. where a.del_flag = 0
  76. and case when a.status = 3 then a.ent_id = #{entId} and #{entType} = 1
  77. else (b.ent_id in
  78. <foreach collection="allEnt" separator="," open="(" close=")" item="item">
  79. #{item}
  80. </foreach>
  81. and b.id is not null)
  82. end
  83. <if test="startTime != null">
  84. and a.create_time >= #{startTime}
  85. </if>
  86. <if test="endTime != null">
  87. and a.create_time &lt; date_add(#{endTime}, INTERVAL 1 DAY)
  88. </if>
  89. <if test="status != null">
  90. and a.status = #{status}
  91. </if>
  92. <if test="keywords != null and keywords != ''">
  93. and (b.firm_name like concat('%', #{keywords}, '%') or
  94. e.firm_name like concat('%', #{keywords}, '%') or
  95. b.contacts like concat('%', #{keywords}, '%') or
  96. b.phone like concat('%', #{keywords}, '%') or
  97. b.sign_phone like concat('%', #{keywords}, '%'))
  98. </if>
  99. <if test="idList != null and idList.size() > 0">
  100. and a.id in
  101. <foreach collection="idList" open="(" close=")" separator="," item="item">
  102. #{item}
  103. </foreach>
  104. </if>
  105. <if test="targetEntId != null">
  106. and e.ent_id = #{targetEntId}
  107. </if>
  108. order by a.create_time desc
  109. </select>
  110. </mapper>