KwoWantBuyMapper.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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.sckw.order.dao.KwpWantBuyMapper">
  4. <sql id="Base_Column_List">
  5. kb.id
  6. ,kb.`name`
  7. ,kb.ent_id
  8. , kb.goods_type goodsType
  9. , kb.spec
  10. , kb.price
  11. , kb.amount
  12. , kb.status
  13. , kb.remark
  14. , kb.create_time createTime
  15. , kt.want_buy_id wantBuyId
  16. , kt.trading trading
  17. , kba.name addressName
  18. </sql>
  19. <resultMap id="wangBuyResultMap" type="com.sckw.order.model.vo.res.WantBuySelectRes">
  20. <id column="id" property="id"/>
  21. <result column="name" property="name"/>
  22. <result column="goodsType" property="goodsType"/>
  23. <result column="spec" property="spec"/>
  24. <result column="price" property="price"/>
  25. <result column="amount" property="amount"/>
  26. <result column="status" property="status"/>
  27. <result column="remark" property="remark"/>
  28. <result column="createTime" property="createTime"/>
  29. <result column="updateTime" property="updateTime"/>
  30. <collection property="wantBuyTradings" column="id" ofType="com.sckw.order.model.vo.res.WantBuyTradingRes" javaType="java.util.List" select="tradingSql" >
  31. <id column="wantBuyId" property="wantBuyId"/>
  32. <result column="trading" property="trading"/>
  33. </collection>
  34. </resultMap>
  35. <sql id="where">
  36. kb.del_flag = 0 and kt.del_flag = 0
  37. <if test="wantBuyReq.startCreateTime != null and wantBuyReq.endCreateTime != null">
  38. and kb.create_time between #{wantBuyReq.startCreateTime,jdbcType=TIMESTAMP} and
  39. #{wantBuyReq.endCreateTime,jdbcType=TIMESTAMP}
  40. </if>
  41. <if test="wantBuyReq.tradings != null and wantBuyReq.tradings.size() > 0">
  42. and kt.trading in
  43. <foreach collection="wantBuyReq.tradings" item="item" open="(" close=")" separator=",">
  44. #{item,jdbcType=VARCHAR}
  45. </foreach>
  46. </if>
  47. <if test="wantBuyReq.status != null and wantBuyReq.status != ''">
  48. and kb.status = #{wantBuyReq.status}
  49. </if>
  50. <if test="wantBuyReq.keywords != null and wantBuyReq.keywords != ''">
  51. and (
  52. kb.`name` like concat('%', #{wantBuyReq.keywords,jdbcType=VARCHAR}, '%')
  53. )
  54. </if>
  55. <if test="wantBuyReq.goodsTypeValueSearch != null and wantBuyReq.goodsTypeValueSearch.size() > 0">
  56. and kb.goods_type in
  57. <foreach collection="wantBuyReq.goodsTypeValueSearch" item="item" open="(" close=")" separator=",">
  58. #{item}
  59. </foreach>
  60. </if>
  61. <if test="wantBuyReq.cityCode != null and wantBuyReq.cityCode != ''">
  62. and kba.city_code = #{wantBuyReq.cityCode}
  63. </if>
  64. </sql>
  65. <select id="pageSelect" resultMap="wangBuyResultMap" resultType="com.sckw.order.model.vo.res.WantBuySelectRes">
  66. select
  67. <include refid="Base_Column_List" />
  68. from kwo_want_buy kb left join kwo_want_buy_trading kt on kb.id = kt.want_buy_id
  69. join kwo_want_buy_address kba on kb.id = kba.want_buy_id
  70. <where>
  71. <include refid="where" />
  72. </where>
  73. group by kb.id
  74. order by kb.create_time desc
  75. </select>
  76. <!-- <resultMap id="tradIngMap" type="com.sckw.order.model.KwoWantBuyTrading">-->
  77. <resultMap id="tradIngMap" type="com.sckw.order.model.vo.res.WantBuyTradingRes">
  78. <id column="wantBuyId" property="wantBuyId"/>
  79. <result column="trading" property="trading"/>
  80. </resultMap>
  81. <select id="tradingSql" resultMap="tradIngMap">
  82. select want_buy_id wantBuyId, trading
  83. from kwo_want_buy_trading
  84. where want_buy_id = #{wantBuyId}
  85. </select>
  86. <select id="statisticsCount" resultType="com.sckw.order.model.vo.res.TableTopRes" parameterType="java.util.Map">
  87. select kb.`status` value
  88. from kwo_want_buy kb left join kwo_want_buy_trading kt on kb.id = kt.want_buy_id
  89. <where>
  90. <include refid="where" />
  91. </where>
  92. group by kb.id
  93. order by kb.create_time desc
  94. </select>
  95. <select id="queryBuyHallList" resultMap="wangBuyResultMap" resultType="com.sckw.order.model.vo.res.WantBuySelectRes">
  96. select
  97. <include refid="Base_Column_List" />
  98. from kwo_want_buy kb left join kwo_want_buy_trading kt on kb.id = kt.want_buy_id
  99. join kwo_want_buy_address kba on kb.id = kba.want_buy_id
  100. <where>
  101. <include refid="where" />
  102. </where>
  103. group by kb.id
  104. order by kb.create_time desc
  105. </select>
  106. </mapper>