SellerOrderGoodsMapper.xml 23.6 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664
<?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.yohoufo.dal.order.SellerOrderGoodsMapper">
  <resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.SellerOrderGoods">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="product_id" jdbcType="INTEGER" property="productId" />
    <result column="uid" jdbcType="INTEGER" property="uid" />
    <result column="product_name" jdbcType="VARCHAR" property="productName" />
    <result column="storage_id" jdbcType="INTEGER" property="storageId" />
    <result column="depot_no" jdbcType="INTEGER" property="depotNo" />
    <result column="size_id" jdbcType="INTEGER" property="sizeId" />
    <result column="size_name" jdbcType="VARCHAR" property="sizeName" />
    <result column="color_id" jdbcType="SMALLINT" property="colorId" />
    <result column="color_name" jdbcType="VARCHAR" property="colorName" />
    <result column="goods_price" jdbcType="DECIMAL" property="goodsPrice" />
    <result column="status" jdbcType="TINYINT" property="status" />
    <result column="image_url" jdbcType="VARCHAR" property="imageUrl" />
    <result column="is_del" jdbcType="TINYINT" property="isDel" />
    <result column="batch_no" jdbcType="BIGINT" property="batchNo" />
    <result column="num" jdbcType="INTEGER" property="num" />
    <result column="skup_list" jdbcType="VARCHAR" property="skupList" />
    <result column="attributes" jdbcType="INTEGER" property="attributes" />
    <result column="region" jdbcType="INTEGER" property="region" />
    <result column="bid_type" jdbcType="INTEGER" property="bidType" />
    <result column="business_client" jdbcType="INTEGER" property="businessClient" />
  </resultMap>


  <sql id="Base_Column_List">
    id, uid, product_id, product_name, storage_id, depot_no, size_id, size_name,
    color_id, color_name, goods_price, status, image_url, is_del, batch_no, attributes, region, bid_type,
    business_client
  </sql>

  <sql id="Associated_Base_Column_List">
    sog.id, sog.uid, sog.product_id, sog.product_name, sog.storage_id, sog.depot_no, sog.size_id, sog.size_name,
    sog.color_id, sog.color_name, sog.goods_price, sog.status, sog.image_url, sog.is_del, sog.batch_no, sog.attributes
  </sql>


  <!--<select id="selectEarnestMoneyByUid"  resultType="com.yohoufo.dal.order.model.SellerEarnestStatistics">-->
    <!--select-->
    <!--sum(case when sog.attributes in (1,5,6) then (<![CDATA[ case when sog.goods_price*0.04>200 then 200 when sog.goods_price*0.04<28 then 28 else sog.goods_price*0.04 end ]]>)-->
    <!--when sog.attributes=4 then (<![CDATA[ case when sog.goods_price*0.08>400 then 400 when sog.goods_price*0.08<40 then 40 else sog.goods_price*0.08 end ]]> )-->
    <!--end) earnestTotal, sog.uid, sw.amount leftMoney-->
    <!--from seller_order_goods sog, seller_wallet sw-->
    <!--where sog.uid=sw.uid and sog.status=1-->
    <!--<if test="list != null">-->
      <!--and sog.uid in-->
      <!--<foreach item="item" index="index" collection="list" open="(" separator="," close=")">-->
        <!--#{item}-->
      <!--</foreach>-->
    <!--</if> GROUP BY sog.uid-->
  <!--</select>-->


  <select id="selectByPrimaryKey"  resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from seller_order_goods
    where id = #{id,jdbcType=INTEGER}
  </select>



  <!--<select id="selectByUidAndStatus"  resultMap="BaseResultMap">-->
    <!--select-->
    <!--<include refid="Base_Column_List" />-->
    <!--from seller_order_goods-->
    <!--where uid = #{uid,jdbcType=INTEGER}-->
    <!--and status= #{status,jdbcType=INTEGER}-->
  <!--</select>-->


  <select id="selectSaleOutProcessiongByUid"  resultType="com.yohoufo.dal.order.model.SellerGoodSkup">
    select
    sog.uid, sog.id skup,so.earnest_money earnestMoney
    from seller_order_goods sog, seller_order so, buyer_order_goods bog, buyer_order bo
    where
    sog.id = so.skup
    and so.skup = bog.skup
    and bog.order_code = bo.order_code
    and so.payment=11
    and sog.uid = #{uid,jdbcType=INTEGER}
    and sog.status = 2
    and bo.status IN (0, 1, 2, 3, 32,31)
    order by sog.id desc
  </select>


  <select id="selectOnsaleByUid"  resultType="com.yohoufo.dal.order.model.SellerGoodSkup">
    select
    sog.uid, sog.id skup ,so.earnest_money earnestMoney
    from seller_order_goods sog, seller_order so
    where
    sog.id = so.skup
    and so.payment=11
    and sog.uid = #{uid,jdbcType=INTEGER}
    and sog.status = #{status,jdbcType=INTEGER}
    and sog.attributes in
    <foreach collection="list" item="item" open="(" close=")" separator=",">
      #{item,jdbcType=INTEGER}
    </foreach>
    order by sog.id desc
  </select>


  <select id="selectBySkups" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from seller_order_goods
    where 1=1
    <if test="list != null">
      and id in
      <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
        #{item}
      </foreach>
    </if>
  </select>

  <!--<select id="selectCntByStatusAndOrderCode" resultType="java.lang.Integer">-->
  <!--select-->
  <!--count(1)-->
  <!--from ufo_order.seller_order a, ufo_order.seller_order_goods b-->
  <!--where a.skup=b.id-->
  <!--<include refid="join_where_status_orderCode"></include>-->
  <!--</select>-->


  <!--<select id="selectByStatusAndOrderCode" resultType="com.yohoufo.dal.order.model.SellerOrderInfo">-->
    <!--select-->
    <!--a.order_code orderCode, b.status status, b.image_url imageUrl,-->
    <!--b.product_name productName, b.product_id productId, a.skup skup,-->
    <!--b.color_id colorId, b.color_name colorName, b.size_id sizeId, b.size_name sizeName,-->
    <!--b.goods_price goodsPrice, b.attributes attributes,-->
    <!--a.uid ,a.create_time createTime-->
    <!--from ufo_order.seller_order a, ufo_order.seller_order_goods b-->
    <!--where a.skup=b.id-->
    <!--<include refid="join_where_status_orderCode"></include>-->
    <!--order by a.create_time desc-->
    <!--limit #{offset, jdbcType=INTEGER}, #{limit, jdbcType=INTEGER}-->

  <!--</select>-->

  <sql id="join_where_status_orderCode">
    <if test="orderCode !=null">
      and a.order_code = #{orderCode,jdbcType=BIGINT}
    </if>
    and a.uid = #{uid,jdbcType=INTEGER} and a.is_del = 1
    <if test="statusList != null">
      and b.status in
      <foreach item="status" index="index" collection="statusList" open="(" separator="," close=")">
        #{status, jdbcType=TINYINT}
      </foreach>
    </if>
  </sql>

  <select id="selectByBatchNo"  resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from seller_order_goods
    where batch_no = #{condition.batchNo,jdbcType=BIGINT} and status in
    <foreach collection="statusList" item="status" open="(" close=")" separator=",">
      #{status,jdbcType=TINYINT}
    </foreach>
  </select>


  <select id="selectBySkup" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from seller_order_goods
    where 1=1
    <if test="list != null">
      and id in
      <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
        #{item}
      </foreach>
    </if>
  </select>

  <select id="selectBySkupsNStatus" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from seller_order_goods
    where 1=1
    <if test="list != null">
      and id in
      <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
        #{item}
      </foreach>
    </if>
    and status in
    <foreach collection="statusList" item="status" open="(" close=")" separator=",">
      #{status, jdbcType=TINYINT}
    </foreach>

  </select>

  <sql id="sql_where_4_select_UidStatusList">
    uid = #{uid,jdbcType=INTEGER} and is_del = 1
    <if test="statusList != null">
      and status in
      <foreach item="status" index="index" collection="statusList" open="(" separator="," close=")">
        #{status, jdbcType=TINYINT}
      </foreach>
    </if>
    <if test="orderTypes != null">
      and attributes in
      <foreach collection="orderTypes" item="attributes" open="(" close=")" separator=",">
        #{attributes}
      </foreach>
    </if>
  </sql>

  <select id="selectCntByUidStatusList" resultType="java.lang.Integer">
    select count(*) from seller_order_goods where
    <include refid="sql_where_4_select_UidStatusList"/>
  </select>

  <select id="selectCntByUid" resultType="java.lang.Integer">
    select count(*) from seller_order_goods where uid = #{uid,jdbcType=INTEGER}
  </select>


  <select id="selectCntByUidAndAttr" resultType="java.lang.Integer">
    select count(*) from seller_order_goods where uid = #{uid,jdbcType=INTEGER} and attributes = #{attributes,jdbcType=INTEGER}
    <if test="storageId != null">
      and storage_id = #{storageId,jdbcType=INTEGER}
    </if>
    <if test="status != null">
      and status = #{status,jdbcType=INTEGER}
    </if>

  </select>


  <select id="selectByUidAndAttr" resultMap="BaseResultMap">
    select <include refid="Base_Column_List" /> from seller_order_goods
    where uid = #{uid,jdbcType=INTEGER} and attributes = #{attributes,jdbcType=INTEGER}
    <if test="storageId != null">
      and storage_id = #{storageId,jdbcType=INTEGER}
    </if>
    <if test="status != null">
      and status = #{status,jdbcType=INTEGER}
    </if>
    order by id desc
    limit #{offset, jdbcType=INTEGER}, #{limit, jdbcType=INTEGER}
  </select>


  <select id="selectMultiInfoBySkup" resultType="com.yohobuy.ufo.model.order.resp.FastDeliveryGetShelfDetailResp">
    select
    sog.uid,
    sog.id skup, so.order_code orderCode, sog.storage_id storageId, sog.product_name productName,
    sog.size_name sizeName,
    sog.product_id productId, sog.status, sog.goods_price price
    from seller_order_goods sog, seller_order so
    where sog.id=so.skup
    and so.uid= #{uid,jdbcType=INTEGER}
    and sog.id=#{skup,jdbcType=INTEGER}
    limit 1
  </select>

  <!--<select id="selectByUidStatusList" resultMap="BaseResultMap">-->
    <!--select <include refid="Base_Column_List" /> from seller_order_goods-->
    <!--where <include refid="sql_where_4_select_UidStatusList"/>-->
    <!--order by id desc-->
    <!--limit #{offset, jdbcType=INTEGER}, #{limit, jdbcType=INTEGER}-->
  <!--</select>-->


  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.SellerOrderGoods" useGeneratedKeys="true">
    insert into seller_order_goods (product_id, product_name, storage_id,
      depot_no, size_id, size_name, 
       color_id, color_name,
      goods_price, status)
    values (#{productId,jdbcType=INTEGER}, #{productName,jdbcType=VARCHAR}, #{storageId,jdbcType=INTEGER}, 
      #{depotNo,jdbcType=INTEGER}, #{sizeId,jdbcType=INTEGER}, #{sizeName,jdbcType=VARCHAR}, 
       #{colorId,jdbcType=SMALLINT}, #{colorName,jdbcType=VARCHAR},
      #{goodsPrice,jdbcType=DECIMAL}, #{status,jdbcType=TINYINT})
  </insert>


  <insert id="insertBatch" keyColumn="id" keyProperty="id"  useGeneratedKeys="true">
    insert into seller_order_goods (product_id, product_name, storage_id,
    depot_no, size_id, size_name,
    color_id, color_name,
    goods_price, status, batch_no)
    values
    <foreach collection="records" item="sog" separator=",">
      (#{sog.productId,jdbcType=INTEGER}, #{sog.productName,jdbcType=VARCHAR}, #{sog.storageId,jdbcType=INTEGER},
      #{sog.depotNo,jdbcType=INTEGER}, #{sog.sizeId,jdbcType=INTEGER}, #{sog.sizeName,jdbcType=VARCHAR},
      #{sog.colorId,jdbcType=SMALLINT}, #{sog.colorName,jdbcType=VARCHAR},
      #{sog.goodsPrice,jdbcType=DECIMAL}, #{sog.status,jdbcType=TINYINT}, #{sog.batchNo,jdbcType=BIGINT})
    </foreach>

  </insert>


  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.SellerOrderGoods" useGeneratedKeys="true">
    insert into seller_order_goods
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="productId != null">
        product_id,
      </if>
      <if test="uid != null">
        uid,
      </if>
      <if test="productName != null">
        product_name,
      </if>
      <if test="storageId != null">
        storage_id,
      </if>
      <if test="depotNo != null">
        depot_no,
      </if>
      <if test="sizeId != null">
        size_id,
      </if>
      <if test="sizeName != null">
        size_name,
      </if>
      <if test="imageUrl != null">
        image_url,
      </if>
      <if test="colorId != null">
        color_id,
      </if>
      <if test="colorName != null">
        color_name,
      </if>
      <if test="goodsPrice != null">
        goods_price,
      </if>
      <if test="status != null">
        status,
      </if>
      <if test="batchNo != null">
        batch_no,
      </if>
      <if test="attributes != null">
        attributes,
      </if>
      <if test="region != null">
        region,
      </if>
      <if test="bidType != null">
        bid_type,
      </if>

      <if test="businessClient != null">
        business_client,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="productId != null">
        #{productId,jdbcType=INTEGER},
      </if>
      <if test="uid != null">
        #{uid,jdbcType=INTEGER},
      </if>
      <if test="productName != null">
        #{productName,jdbcType=VARCHAR},
      </if>
      <if test="storageId != null">
        #{storageId,jdbcType=INTEGER},
      </if>
      <if test="depotNo != null">
        #{depotNo,jdbcType=INTEGER},
      </if>
      <if test="sizeId != null">
        #{sizeId,jdbcType=INTEGER},
      </if>
      <if test="sizeName != null">
        #{sizeName,jdbcType=VARCHAR},
      </if>
      <if test="imageUrl != null">
        #{imageUrl,jdbcType=VARCHAR},
      </if>
      <if test="colorId != null">
        #{colorId,jdbcType=SMALLINT},
      </if>
      <if test="colorName != null">
        #{colorName,jdbcType=VARCHAR},
      </if>
      <if test="goodsPrice != null">
        #{goodsPrice,jdbcType=DECIMAL},
      </if>
      <if test="status != null">
        #{status,jdbcType=TINYINT},
      </if>
      <if test="batchNo != null">
        #{batchNo,jdbcType=BIGINT},
      </if>
      <if test="attributes != null">
        #{attributes,jdbcType=INTEGER},
      </if>
      <if test="region != null">
        #{region,jdbcType=INTEGER},
      </if>
      <if test="bidType != null">
        #{bidType,jdbcType=INTEGER},
      </if>
      <if test="businessClient != null">
        #{businessClient,jdbcType=INTEGER},
      </if>
      
    </trim>
  </insert>

  <update id="updateStatusBySkpu" parameterType="com.yohoufo.dal.order.model.SellerOrderGoods">
    update seller_order_goods
    <set>
      <if test="status != null">
        status = #{status,jdbcType=TINYINT},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
    and status = #{exceptStatus,jdbcType=TINYINT}
  </update>

  <update id="updateStatusAndUidBySkpu" parameterType="com.yohoufo.dal.order.model.SellerOrderGoods">
    update seller_order_goods
    <set>
      <if test="uid != null">
        uid = #{uid,jdbcType=INTEGER},
      </if>
      <if test="status != null">
        status = #{status,jdbcType=TINYINT},
      </if>
      business_client = #{businessClient,jdbcType=INTEGER}
    </set>
    where id = #{id,jdbcType=INTEGER}
    and status = #{exceptStatus,jdbcType=TINYINT}
    and uid = #{exceptUid,jdbcType=INTEGER}
  </update>


  <update id="updateByPrimaryKeySelective" parameterType="com.yohoufo.dal.order.model.SellerOrderGoods">
    update seller_order_goods
    <set>
      <if test="productId != null">
        product_id = #{productId,jdbcType=INTEGER},
      </if>
      <if test="productName != null">
        product_name = #{productName,jdbcType=VARCHAR},
      </if>
      <if test="storageId != null">
        storage_id = #{storageId,jdbcType=INTEGER},
      </if>
      <if test="depotNo != null">
        depot_no = #{depotNo,jdbcType=INTEGER},
      </if>
      <if test="sizeId != null">
        size_id = #{sizeId,jdbcType=INTEGER},
      </if>
      <if test="sizeName != null">
        size_name = #{sizeName,jdbcType=VARCHAR},
      </if>

      <if test="colorId != null">
        color_id = #{colorId,jdbcType=SMALLINT},
      </if>
      <if test="colorName != null">
        color_name = #{colorName,jdbcType=VARCHAR},
      </if>
      <if test="goodsPrice != null">
        goods_price = #{goodsPrice,jdbcType=DECIMAL},
      </if>
      <if test="status != null">
        status = #{status,jdbcType=TINYINT},
      </if>
      <if test="isDel != null">
        is_del = #{isDel,jdbcType=TINYINT}
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>


  <update id="updateByPrimaryKeys">
    update seller_order_goods
    <set>
    <if test="condition.goodsPrice != null">
      goods_price = #{condition.goodsPrice,jdbcType=DECIMAL},
    </if>
    <if test="condition.status != null">
      status = #{condition.status,jdbcType=TINYINT},
    </if>
    </set>
    where id in
    <foreach collection="ids" item="id" open="(" close=")" separator=",">
      #{id,jdbcType=INTEGER}
    </foreach>
  </update>

  <update id="updateByPrimaryKey" parameterType="com.yohoufo.dal.order.model.SellerOrderGoods">
    update seller_order_goods
    set product_id = #{productId,jdbcType=INTEGER},
      product_name = #{productName,jdbcType=VARCHAR},
      storage_id = #{storageId,jdbcType=INTEGER},
      depot_no = #{depotNo,jdbcType=INTEGER},
      size_id = #{sizeId,jdbcType=INTEGER},
      size_name = #{sizeName,jdbcType=VARCHAR},
      color_id = #{colorId,jdbcType=SMALLINT},
      color_name = #{colorName,jdbcType=VARCHAR},
      goods_price = #{goodsPrice,jdbcType=DECIMAL},
      status = #{status,jdbcType=TINYINT}
    where id = #{id,jdbcType=INTEGER}
  </update>

  <sql id="sql_where_4_select_UidStatusGBBNList">
    uid = #{uid,jdbcType=INTEGER} and is_del = 1
    <if test="statusList != null">
      and status in
      <foreach item="status" index="index" collection="statusList" open="(" separator="," close=")">
        #{status, jdbcType=TINYINT}
      </foreach>
    </if>
    group by batch_no , goods_price ,`status`
  </sql>
  <select id="selectCntByUidStatusGBBNList" resultType="java.lang.Integer">
    SELECT COUNT(*) FROM (SELECT batch_no FROM `seller_order_goods`
    WHERE <include refid="sql_where_4_select_UidStatusGBBNList"/> ) t
  </select>



  <select id="selectByUidStatusGBBNList" resultMap="BaseResultMap">
    select <include refid="Base_Column_List" />,count(*) num,GROUP_CONCAT(id) skup_list from seller_order_goods
    where <include refid="sql_where_4_select_UidStatusGBBNList"/>
    order by id desc
    limit #{offset, jdbcType=INTEGER}, #{limit, jdbcType=INTEGER}
  </select>

  <!--<select id="selectByUidStatusGBBN" parameterType="com.yohoufo.dal.order.model.SellerOrderGoods" resultMap="BaseResultMap">-->
    <!--select <include refid="Base_Column_List" />,count(*) num,GROUP_CONCAT(id) skup_list from seller_order_goods-->
    <!--where uid = #{uid,jdbcType=INTEGER} and is_del = 1-->
    <!--and batch_no =  #{batchNo,jdbcType=BIGINT}-->
    <!--and goods_price = #{goodsPrice,jdbcType=DECIMAL}-->
    <!--and status = #{status,jdbcType=TINYINT}-->
    <!--group by batch_no , goods_price ,`status`-->
    <!--limit 1-->
  <!--</select>-->


  <select id="selectGPByBNStatusPrice" parameterType="com.yohoufo.dal.order.model.SellerOrderGoods" resultMap="BaseResultMap">
    select <include refid="Base_Column_List" /> from seller_order_goods
    where uid = #{uid,jdbcType=INTEGER} and is_del = 1
    and batch_no =  #{batchNo,jdbcType=BIGINT}
    and goods_price = #{goodsPrice,jdbcType=DECIMAL}
    and status = #{status,jdbcType=TINYINT}
    order by id desc
  </select>

  <update id="batchDelete">
    update seller_order_goods set is_del = 0
    where id in
    <foreach collection="skups" item="id" open="(" close=")" separator=",">
      #{id,jdbcType=INTEGER}
    </foreach>
  </update>

  <select id="selectByUidBNStatusGBBPSList" resultMap="BaseResultMap">
    select <include refid="Base_Column_List" />,count(*) num,GROUP_CONCAT(id) skup_list from seller_order_goods
    where batch_no = #{batchNo,jdbcType=BIGINT}
    and <include refid="sql_where_4_select_UidStatusGBBNList"/>
    order by id desc
  </select>



  <select id="selectByGroup" resultMap="BaseResultMap">
    select <include refid="Base_Column_List" />,count(*) num,GROUP_CONCAT(id) skup_list from seller_order_goods
    where 1=1
    <if test="id != null">
      and id &lt; #{id,jdbcType=INTEGER}
    </if>
    and <include refid="sql_where_4_select_UidStatusGBBNList"/>
    order by id desc
    limit #{limit, jdbcType=INTEGER}
  </select>

  <select id="selectByUidStorageStatusGBBPSList" resultMap="BaseResultMap">
    select <include refid="Base_Column_List" /> from seller_order_goods
    where storage_id = #{storageId,jdbcType=INTEGER}
    and <include refid="sql_where_4_select_UidStatusGBBNList"/>
  </select>


  <select id="selectByPayment"  resultMap="BaseResultMap">
    select
    <include refid="Associated_Base_Column_List" />
    from seller_order_goods sog,seller_order so
    where sog.id = so.skup
    and sog.uid = #{condition.uid,jdbcType=INTEGER}
    and sog.product_id = #{condition.productId,jdbcType=INTEGER}
    and sog.storage_id = #{condition.storageId,jdbcType=INTEGER}
    <if test="payment != null">
      and so.payment = #{payment,jdbcType=INTEGER}
    </if>
    and sog.goods_price = #{condition.goodsPrice,jdbcType=DECIMAL}
    <if test="condition.attributes != null">
      and sog.attributes = #{condition.attributes,jdbcType=INTEGER}
    </if>
    and sog.status in
    <foreach collection="statusList" item="status" open="(" close=")" separator=",">
      #{status,jdbcType=TINYINT}
    </foreach>
    limit #{num}
  </select>


  <update id="updateByCondition">
    update seller_order_goods
    <set>
      <if test="updateTo.goodsPrice != null">
        goods_price = #{updateTo.goodsPrice,jdbcType=DECIMAL},
      </if>
      <if test="updateTo.status != null">
        status = #{updateTo.status,jdbcType=TINYINT},
      </if>
    </set>
    where id = #{condition.id,jdbcType=INTEGER}
    and uid = #{condition.uid,jdbcType=INTEGER}
    <if test="condition.goodsPrice != null">
      and goods_price = #{condition.goodsPrice,jdbcType=DECIMAL}
    </if>
    <if test="condition.status != null">
      and status = #{condition.status,jdbcType=TINYINT}
    </if>
  </update>

  <update id="updateDeptNoBySkups" >
    update seller_order_goods
    <set>
      <if test="depotNum != null">
        depot_no = #{depotNum,jdbcType=INTEGER},
      </if>
    </set>
    where id in
    <foreach collection="skupList" item="skup" open="(" close=")" separator=",">
      #{skup, jdbcType=INTEGER}
    </foreach>
  </update>


  <update id="updateStatusfBySkups" >
    update seller_order_goods
    <set>
      <if test="status != null">
        status = #{status,jdbcType=INTEGER},
      </if>
    </set>
    where id in
    <foreach collection="skupList" item="skup" open="(" close=")" separator=",">
      #{skup, jdbcType=INTEGER}
    </foreach>
  </update>


</mapper>