|
|
@@ -2,6 +2,21 @@
|
|
|
<!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_name entName
|
|
|
+ , 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
|
|
|
+ </sql>
|
|
|
+
|
|
|
<resultMap id="wangBuyResultMap" type="com.sckw.order.model.vo.res.WantBuySelectRes">
|
|
|
<id column="id" property="id"/>
|
|
|
<result column="name" property="name"/>
|
|
|
@@ -21,43 +36,29 @@
|
|
|
</resultMap>
|
|
|
|
|
|
<select id="pageSelect" resultMap="wangBuyResultMap" resultType="com.sckw.order.model.vo.res.WantBuySelectRes">
|
|
|
- select id
|
|
|
- ,`name`
|
|
|
- ,ent_name entName
|
|
|
- ,goods_type goodsType
|
|
|
- , spec
|
|
|
- , price
|
|
|
- , amount
|
|
|
- , status
|
|
|
- , remark
|
|
|
- , create_time createTime
|
|
|
- , update_time updateTime
|
|
|
- from kwo_want_buy
|
|
|
+ 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
|
|
|
<where>
|
|
|
- del_flag = 0
|
|
|
- <if test="wantBuyReq.statuss != null and wantBuyReq.statuss.size() > 0">
|
|
|
- and status in
|
|
|
- <foreach collection="wantBuyReq.statuss" item="item" open="(" close=")" separator=",">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
+ kb.del_flag = 0 and kt.del_flag = 0
|
|
|
<if test="wantBuyReq.startCreateTime != null and wantBuyReq.endCreateTime != null">
|
|
|
- and create_time between #{wantBuyReq.startCreateTime,jdbcType=TIMESTAMP} and
|
|
|
+ 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 id in
|
|
|
+ and kt.trading in
|
|
|
<foreach collection="wantBuyReq.tradings" item="item" open="(" close=")" separator=",">
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="wantBuyReq.keywords != null and wantBuyReq.keywords != ''">
|
|
|
and (
|
|
|
- `name` like concat('%', #{wantBuyReq.keywords,jdbcType=VARCHAR}, '%')
|
|
|
+ kb.`name` like concat('%', #{wantBuyReq.keywords,jdbcType=VARCHAR}, '%')
|
|
|
)
|
|
|
</if>
|
|
|
</where>
|
|
|
- order by create_time desc
|
|
|
+ group by kb.id
|
|
|
+ order by kb.create_time desc
|
|
|
</select>
|
|
|
|
|
|
<!-- <resultMap id="tradIngMap" type="com.sckw.order.model.KwoWantBuyTrading">-->
|
|
|
@@ -70,69 +71,62 @@
|
|
|
<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 `status` value
|
|
|
- from kwo_want_buy
|
|
|
+ select kb.`status` value
|
|
|
+ from kwo_want_buy kb left join kwo_want_buy_trading kt on kb.id = kt.want_buy_id
|
|
|
<where>
|
|
|
- del_flag = 0
|
|
|
+ kb.del_flag = 0 and kt.del_flag = 0
|
|
|
<if test="wantBuyReq.statuss != null">
|
|
|
- and status = #{wantBuyReq.statuss}
|
|
|
+ and kb.status = #{wantBuyReq.statuss}
|
|
|
</if>
|
|
|
<if test="wantBuyReq.startCreateTime != null and wantBuyReq.endCreateTime != null">
|
|
|
- and create_time between #{wantBuyReq.startCreateTime,jdbcType=TIMESTAMP} and
|
|
|
+ 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 id in
|
|
|
+ and kt.trading in
|
|
|
<foreach collection="wantBuyReq.tradings" item="item" open="(" close=")" separator=",">
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="wantBuyReq.keywords != null and wantBuyReq.keywords != ''">
|
|
|
and (
|
|
|
- `name` like concat('%', #{wantBuyReq.keywords,jdbcType=VARCHAR}, '%')
|
|
|
+ kb.`name` like concat('%', #{wantBuyReq.keywords,jdbcType=VARCHAR}, '%')
|
|
|
)
|
|
|
</if>
|
|
|
</where>
|
|
|
- order by create_time desc
|
|
|
+ order by kb.create_time desc
|
|
|
</select>
|
|
|
|
|
|
|
|
|
<select id="queryBuyHallList" resultMap="wangBuyResultMap" resultType="com.sckw.order.model.vo.res.WantBuySelectRes">
|
|
|
- select id
|
|
|
- ,`name`
|
|
|
- , ent_name entName
|
|
|
- , goods_type goodsType
|
|
|
- , spec
|
|
|
- , price
|
|
|
- , amount
|
|
|
- , status
|
|
|
- , remark
|
|
|
- , create_time createTime
|
|
|
- , update_time updateTime
|
|
|
- from kwo_want_buy
|
|
|
+ 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
|
|
|
<where>
|
|
|
- del_flag = 0
|
|
|
+ kb.del_flag = 0 and kt.del_flag = 0
|
|
|
<if test="wantBuyReq.startCreateTime != null and wantBuyReq.endCreateTime != null">
|
|
|
- and create_time between #{wantBuyReq.startCreateTime,jdbcType=TIMESTAMP} and
|
|
|
+ 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 id in
|
|
|
+ and kt.trading in
|
|
|
<foreach collection="wantBuyReq.tradings" item="item" open="(" close=")" separator=",">
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="wantBuyReq.keywords != null and wantBuyReq.keywords != ''">
|
|
|
and (
|
|
|
- `name` like concat('%', #{wantBuyReq.keywords,jdbcType=VARCHAR}, '%')
|
|
|
+ kb.`name` like concat('%', #{wantBuyReq.keywords,jdbcType=VARCHAR}, '%')
|
|
|
)
|
|
|
</if>
|
|
|
</where>
|
|
|
- order by create_time desc
|
|
|
+ group by kb.id
|
|
|
+ order by kb.create_time desc
|
|
|
</select>
|
|
|
</mapper>
|