KwcContractLogisticsMapper.xml 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 contactName,
  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. from kwc_contract_logistics a
  61. left join kwc_contract_logistics_unit b on a.id = b.contract_id and b.unit_type = #{entType}
  62. left join kwc_contract_logistics_track c on a.id = c.contract_id and c.del_flag = 0 and c.type = 1
  63. left join kwc_contract_logistics_track d on a.id = d.contract_id and d.del_flag = 0 and d.type = 0
  64. left join kwc_contract_logistics_unit e on a.id = b.contract_id and b.unit_type != #{entType}
  65. where a.del_flag = 0
  66. and b.del_flag = 0
  67. and b.ent_id = #{entId}
  68. <if test="startTime != null">
  69. and a.create_time >= #{startTime}
  70. </if>
  71. <if test="endTime != null">
  72. and a.create_time &lt; date_add(#{endTime}, INTERVAL 1 DAY)
  73. </if>
  74. <if test="status != null">
  75. and a.status = #{status}
  76. </if>
  77. <if test="keywords != null and keywords != ''">
  78. and (b.firm_name like concat('%', #{keywords}, '%') or b.contacts like concat('%', #{keywords}, '%') or b.phone like concat('%', #{keywords}, '%'))
  79. </if>
  80. <if test="idList != null and idList.size() > 0">
  81. and a.id in
  82. <foreach collection="idList" open="(" close=")" separator="," item="item">
  83. #{item}
  84. </foreach>
  85. </if>
  86. </select>
  87. </mapper>