| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.sckw.order.dao.KwpWantBuyMapper">
- <sql id="Base_Column_List">
- kb.id
- ,kb.`name`
- ,kb.ent_id
- , kb.goods_type goodsType
- , kb.spec
- , kb.price
- , kb.amount
- , kb.status
- , kb.remark
- , kb.create_time createTime
- , kt.want_buy_id wantBuyId
- , kt.trading trading
- , kba.name addressName
- </sql>
- <resultMap id="wangBuyResultMap" type="com.sckw.order.model.vo.res.WantBuySelectRes">
- <id column="id" property="id"/>
- <result column="name" property="name"/>
- <result column="goodsType" property="goodsType"/>
- <result column="spec" property="spec"/>
- <result column="price" property="price"/>
- <result column="amount" property="amount"/>
- <result column="status" property="status"/>
- <result column="remark" property="remark"/>
- <result column="createTime" property="createTime"/>
- <result column="updateTime" property="updateTime"/>
- <collection property="wantBuyTradings" column="id" ofType="com.sckw.order.model.vo.res.WantBuyTradingRes" javaType="java.util.List" select="tradingSql" >
- <id column="wantBuyId" property="wantBuyId"/>
- <result column="trading" property="trading"/>
- </collection>
- </resultMap>
- <sql id="where">
- kb.del_flag = 0 and kt.del_flag = 0
- <if test="wantBuyReq.startCreateTime != null and wantBuyReq.endCreateTime != null">
- and kb.create_time between #{wantBuyReq.startCreateTime,jdbcType=TIMESTAMP} and
- #{wantBuyReq.endCreateTime,jdbcType=TIMESTAMP}
- </if>
- <if test="wantBuyReq.tradings != null and wantBuyReq.tradings.size() > 0">
- and kt.trading in
- <foreach collection="wantBuyReq.tradings" item="item" open="(" close=")" separator=",">
- #{item,jdbcType=VARCHAR}
- </foreach>
- </if>
- <if test="wantBuyReq.status != null and wantBuyReq.status != ''">
- and kb.status = #{wantBuyReq.status}
- </if>
- <if test="wantBuyReq.keywords != null and wantBuyReq.keywords != ''">
- and (
- kb.`name` like concat('%', #{wantBuyReq.keywords,jdbcType=VARCHAR}, '%')
- )
- </if>
- <if test="wantBuyReq.goodsTypeValueSearch != null and wantBuyReq.goodsTypeValueSearch.size() > 0">
- and kb.goods_type in
- <foreach collection="wantBuyReq.goodsTypeValueSearch" item="item" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="wantBuyReq.areaCode != null and wantBuyReq.areaCode != ''">
- and kba.city_code = #{wantBuyReq.areaCode}
- </if>
- </sql>
- <select id="pageSelect" resultMap="wangBuyResultMap" resultType="com.sckw.order.model.vo.res.WantBuySelectRes">
- select
- <include refid="Base_Column_List" />
- from kwo_want_buy kb left join kwo_want_buy_trading kt on kb.id = kt.want_buy_id
- join kwo_want_buy_address kba on kb.id = kba.want_buy_id
- <where>
- <include refid="where" />
- </where>
- group by kb.id
- order by kb.create_time desc
- </select>
- <!-- <resultMap id="tradIngMap" type="com.sckw.order.model.KwoWantBuyTrading">-->
- <resultMap id="tradIngMap" type="com.sckw.order.model.vo.res.WantBuyTradingRes">
- <id column="wantBuyId" property="wantBuyId"/>
- <result column="trading" property="trading"/>
- </resultMap>
- <select id="tradingSql" resultMap="tradIngMap">
- select want_buy_id wantBuyId, trading
- from kwo_want_buy_trading
- where want_buy_id = #{wantBuyId}
- </select>
- <select id="statisticsCount" resultType="com.sckw.order.model.vo.res.TableTopRes" parameterType="java.util.Map">
- select kb.`status` value
- from kwo_want_buy kb left join kwo_want_buy_trading kt on kb.id = kt.want_buy_id
- <where>
- <include refid="where" />
- </where>
- group by kb.id
- order by kb.create_time desc
- </select>
- <select id="queryBuyHallList" resultMap="wangBuyResultMap" resultType="com.sckw.order.model.vo.res.WantBuySelectRes">
- select
- <include refid="Base_Column_List" />
- from kwo_want_buy kb left join kwo_want_buy_trading kt on kb.id = kt.want_buy_id
- join kwo_want_buy_address kba on kb.id = kba.want_buy_id
- <where>
- <include refid="where" />
- </where>
- group by kb.id
- order by kb.create_time desc
- </select>
- </mapper>
|