KwcContractTradeMapper.xml 4.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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.KwcContractTradeMapper">
  6. <resultMap id="BaseResultMap" type="com.sckw.contract.model.entity.KwcContractTrade">
  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="BIGINT"/>
  12. <result property="trading" column="trading" jdbcType="BIGINT"/>
  13. <result property="start_time" column="start_time" jdbcType="TIMESTAMP"/>
  14. <result property="end_time" column="end_time" jdbcType="TIMESTAMP"/>
  15. <result property="amount" column="amount" jdbcType="DECIMAL"/>
  16. <result property="performed_amount" column="performed_amount" jdbcType="DECIMAL"/>
  17. <result property="signing_url" column="signing_url" jdbcType="VARCHAR"/>
  18. <result property="signed_url" column="signed_url" jdbcType="VARCHAR"/>
  19. <result property="signing_no" column="signing_no" jdbcType="VARCHAR"/>
  20. <result property="contract_pid" column="contract_pid" jdbcType="BIGINT"/>
  21. <result property="remark" column="remark" jdbcType="VARCHAR"/>
  22. <result property="status" column="status" jdbcType="INTEGER"/>
  23. <result property="create_by" column="create_by" jdbcType="BIGINT"/>
  24. <result property="create_time" column="create_time" jdbcType="TIMESTAMP"/>
  25. <result property="update_by" column="update_by" jdbcType="BIGINT"/>
  26. <result property="update_time" column="update_time" jdbcType="TIMESTAMP"/>
  27. <result property="del_flag" column="del_flag" jdbcType="INTEGER"/>
  28. </resultMap>
  29. <sql id="Base_Column_List">
  30. id,ent_id,contract_no,
  31. name,signing_way,trading,
  32. start_time,end_time,amount,
  33. performed_amount,signing_url,signed_url,
  34. signing_no,contract_pid,remark,
  35. status,create_by,create_time,
  36. update_by,update_time,del_flag
  37. </sql>
  38. <select id="queryList" resultType="com.sckw.contract.model.dto.res.QueryListResDto">
  39. select a.amount,
  40. a.trading,
  41. a.name contractName,
  42. a.contract_no,
  43. c.create_by initiateBy,
  44. c.create_time initiateTime,
  45. a.create_time,
  46. a.start_time,
  47. a.end_time,
  48. a.id,
  49. a.remark,
  50. a.signing_way,
  51. d.create_time signTime,
  52. a.status,
  53. b.unit_type,
  54. b.ent_id,
  55. b.firm_name entName,
  56. e.ent_id targetEntId,
  57. e.firm_name targetEntName
  58. from kwc_contract_trade a
  59. left join kwc_contract_trade_unit b on a.id = b.contract_id and b.unit_type = #{entType} and b.del_flag = 0
  60. left join kwc_contract_trade_track c on a.id = c.contract_id and c.del_flag = 0 and c.type = 1
  61. left join kwc_contract_trade_track d on a.id = d.contract_id and d.del_flag = 0 and d.type = 0
  62. left join kwc_contract_trade_unit e on a.id = b.contract_id and b.unit_type != #{entType} and e.del_flag = 0
  63. where a.del_flag = 0
  64. and b.ent_id = #{entId}
  65. <if test="startTime != null">
  66. and a.create_time >= #{startTime}
  67. </if>
  68. <if test="endTime != null">
  69. and a.create_time &lt;= #{endTime}
  70. </if>
  71. <if test="status != null">
  72. and a.status = #{status}
  73. </if>
  74. <if test="keywords != null and keywords != ''">
  75. and (b.firm_name like concat('%', #{keywords}, '%') or b.contacts like concat('%', #{keywords}, '%') or b.phone like concat('%', #{keywords}, '%'))
  76. </if>
  77. <if test="idList != null and idList.size() > 0">
  78. and a.id in
  79. <foreach collection="idList" open="(" close=")" separator="," item="item">
  80. #{item}
  81. </foreach>
  82. </if>
  83. <if test="trading != null">
  84. and a.trading = #{trading}
  85. </if>
  86. <if test="signingWay != null">
  87. and a.signing_way = #{signingWay}
  88. </if>
  89. <if test="charging != null">
  90. and a.charging = #{charging}
  91. </if>
  92. </select>
  93. </mapper>