KwcContractLogisticsMapper.xml 4.6 KB

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