UnionShareOrdersMapper.xml 23.7 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
<?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.yoho.unions.dal.UnionShareOrdersMapper" >
  <resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.UnionShareOrders" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="order_code" property="orderCode" jdbcType="VARCHAR" />
    <result column="settlement_code" property="settlementCode" jdbcType="VARCHAR" />
    <result column="promote_uid" property="promoteUid" jdbcType="INTEGER" />
    <result column="order_uid" property="orderUid" jdbcType="INTEGER" />
    <result column="status" property="status" jdbcType="VARCHAR" />
    <result column="last_order_amount" property="lastOrderAmount" jdbcType="DECIMAL" />
    <result column="order_time" property="orderTime" jdbcType="INTEGER" />
    <result column="is_new" property="isNew" jdbcType="TINYINT" />
    <result column="amount" property="amount" jdbcType="DECIMAL" />
    <result column="create_time" property="createTime" jdbcType="INTEGER" />
    <result column="update_time" property="updateTime" jdbcType="INTEGER" />
    <result column="extra_activity_id" property="extraActivityId" jdbcType="INTEGER" />
    <result column="cps_extra_activity_id" property="cpsExtraActivityId" jdbcType="INTEGER" />
    <result column="activity_id" property="activityId" jdbcType="INTEGER" />
    <result column="activity_name" property="activityName" jdbcType="VARCHAR" />
    <result column="extra_amount" property="extraAmount" jdbcType="DECIMAL" />
    <result column="order_amount" property="orderAmount" jdbcType="DECIMAL" />
    <result column="special_status" property="specialStatus" jdbcType="TINYINT" />
    <result column="payment_type" property="paymentType" jdbcType="TINYINT" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, order_code,settlement_code, promote_uid,order_uid, status, last_order_amount, order_time, is_new, amount, create_time,
    update_time,extra_activity_id,cps_extra_activity_id,activity_id,activity_name,extra_amount,order_amount,special_status,payment_type
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from union_share_orders
    where id = #{id,jdbcType=INTEGER}
  </select>
  <select id="selectByCode" resultMap="BaseResultMap" >
    select
    <include refid="Base_Column_List" />
    from union_share_orders
    where order_code = #{orderCode,jdbcType=VARCHAR}
    limit 1
  </select>
  <select id="selectCountByCondition" resultType="java.lang.Integer" >
    select count(1) from union_share_orders
    where promote_uid = #{promoteUid,jdbcType=INTEGER} and status = #{status,jdbcType=VARCHAR}
  </select>
  <select id="selectAmountByStatus" resultType="java.math.BigDecimal" >
    select IFNULL(sum(amount),0) from union_share_orders
    where promote_uid = #{promoteUid,jdbcType=INTEGER} and status in
    <foreach collection="statusList" item="item" separator="," index="index" open="(" close=")">
      #{item}
    </foreach>
  </select>
  <select id="selectAmountBySettleCode" resultType="java.math.BigDecimal" >
    select IFNULL(sum(amount),0) from union_share_orders
    where promote_uid = #{promoteUid,jdbcType=INTEGER} and settlement_code = #{settlementCode,jdbcType=VARCHAR}
  </select>
  <select id="selectListByCondition" resultMap="BaseResultMap" >
    select
    <include refid="Base_Column_List" />
    from union_share_orders
    where promote_uid = #{promoteUid,jdbcType=INTEGER} and status = #{status,jdbcType=VARCHAR}
    limit #{offset}, #{rows}
  </select>
  <select id="selectListByIds" resultMap="BaseResultMap" >
    select
    <include refid="Base_Column_List" />
    from union_share_orders
    where id in
    <foreach collection="ids" open="(" close=")" item="id" separator=",">
      #{id}
    </foreach>
  </select>
  <select id="selectListByOrderCodesForActivity" resultMap="BaseResultMap" >
    select
    <include refid="Base_Column_List" />
    from union_share_orders
    where status in (10,20,30,40) and order_code in
    <foreach collection="orderCodes" open="(" close=")" item="ordercode" separator=",">
      #{ordercode}
    </foreach>
  </select>
  <select id="selectOrderCodesByCondition" resultType="java.lang.String" >
    select order_code from union_share_orders
    where settlement_code = #{settlementCode,jdbcType=VARCHAR} and order_code is not null
    limit #{offset}, #{rows}
  </select>
  <select id="selectOrderByCondition" resultMap="BaseResultMap">
    select
      <include refid="Base_Column_List" />
    from union_share_orders
    where settlement_code = #{settlementCode,jdbcType=VARCHAR} and order_code is not null
    limit #{offset}, #{rows}
  </select>
  <select id="selectIdForActivity" resultType="java.lang.Integer">
    select id from union_share_orders
    where settlement_code = #{settlementCode,jdbcType=VARCHAR} and order_code is null
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from union_share_orders
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="com.yoho.unions.dal.model.UnionShareOrders" >
    insert into union_share_orders (id, order_code, promote_uid,
    order_uid, settlement_code, status,
    last_order_amount, order_time, is_new,
    amount, create_time, update_time,
    extra_activity_id,cps_extra_activity_id, activity_id,activity_name, extra_amount,
    order_amount,special_status,payment_type)
    values (#{id,jdbcType=INTEGER}, #{orderCode,jdbcType=VARCHAR}, #{promoteUid,jdbcType=INTEGER},
    #{orderUid,jdbcType=INTEGER}, #{settlementCode,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
    #{lastOrderAmount,jdbcType=DECIMAL}, #{orderTime,jdbcType=INTEGER}, #{isNew,jdbcType=TINYINT},
    #{amount,jdbcType=DECIMAL}, #{createTime,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER},
    #{extraActivityId,jdbcType=INTEGER},#{cpsExtraActivityId,jdbcType=INTEGER}, #{activityId,jdbcType=INTEGER},#{activityName,jdbcType=VARCHAR}, #{extraAmount,jdbcType=DECIMAL},
    #{orderAmount,jdbcType=DECIMAL}), #{specialStatus,jdbcType=TINYINT}, #{paymentType,jdbcType=TINYINT}
  </insert>
  <insert id="insertSelective" useGeneratedKeys="true" keyProperty="id"  parameterType="com.yoho.unions.dal.model.UnionShareOrders" >
    insert into union_share_orders
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="orderCode != null" >
        order_code,
      </if>
      <if test="promoteUid != null" >
        promote_uid,
      </if>
      <if test="orderUid != null" >
        order_uid,
      </if>
      <if test="settlementCode != null" >
        settlement_code,
      </if>
      <if test="status != null" >
        status,
      </if>
      <if test="lastOrderAmount != null" >
        last_order_amount,
      </if>
      <if test="orderTime != null" >
        order_time,
      </if>
      <if test="isNew != null" >
        is_new,
      </if>
      <if test="amount != null" >
        amount,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="updateTime != null" >
        update_time,
      </if>
      <if test="extraActivityId != null" >
        extra_activity_id,
      </if>
      <if test="cpsExtraActivityId != null" >
        cps_extra_activity_id,
      </if>
      <if test="activityId != null" >
        activity_id,
      </if>
      <if test="activityName != null" >
        activity_name,
      </if>
      <if test="extraAmount != null" >
        extra_amount,
      </if>
      <if test="orderAmount != null" >
        order_amount,
      </if>
      <if test="specialStatus != null" >
        special_status,
      </if>
      <if test="paymentType != null" >
        payment_type,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="orderCode != null" >
        #{orderCode,jdbcType=VARCHAR},
      </if>
      <if test="promoteUid != null" >
        #{promoteUid,jdbcType=INTEGER},
      </if>
      <if test="orderUid != null" >
        #{orderUid,jdbcType=INTEGER},
      </if>
      <if test="settlementCode != null" >
        #{settlementCode,jdbcType=VARCHAR},
      </if>
      <if test="status != null" >
        #{status,jdbcType=VARCHAR},
      </if>
      <if test="lastOrderAmount != null" >
        #{lastOrderAmount,jdbcType=DECIMAL},
      </if>
      <if test="orderTime != null" >
        #{orderTime,jdbcType=INTEGER},
      </if>
      <if test="isNew != null" >
        #{isNew,jdbcType=TINYINT},
      </if>
      <if test="amount != null" >
        #{amount,jdbcType=DECIMAL},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=INTEGER},
      </if>
      <if test="updateTime != null" >
        #{updateTime,jdbcType=INTEGER},
      </if>
      <if test="extraActivityId != null" >
        #{extraActivityId,jdbcType=INTEGER},
      </if>
      <if test="cpsExtraActivityId != null" >
        #{cpsExtraActivityId,jdbcType=INTEGER},
      </if>
      <if test="activityId != null" >
        #{activityId,jdbcType=INTEGER},
      </if>
      <if test="activityName != null" >
        #{activityName,jdbcType=VARCHAR},
      </if>
      <if test="extraAmount != null" >
        #{extraAmount,jdbcType=DECIMAL},
      </if>
      <if test="orderAmount != null" >
        #{orderAmount,jdbcType=DECIMAL},
      </if>
      <if test="specialStatus != null" >
        #{specialStatus,jdbcType=TINYINT},
      </if>
      <if test="paymentType != null" >
        #{paymentType,jdbcType=TINYINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.yoho.unions.dal.model.UnionShareOrders" >
    update union_share_orders
    <set >
      <if test="orderCode != null" >
        order_code = #{orderCode,jdbcType=VARCHAR},
      </if>
      <if test="promoteUid != null" >
        promote_uid = #{promoteUid,jdbcType=INTEGER},
      </if>
      <if test="orderUid != null" >
        order_uid = #{orderUid,jdbcType=INTEGER},
      </if>
      <if test="settlementCode != null" >
        settlement_code = #{settlementCode,jdbcType=VARCHAR},
      </if>
      <if test="status != null" >
        status = #{status,jdbcType=VARCHAR},
      </if>
      <if test="lastOrderAmount != null" >
        last_order_amount = #{lastOrderAmount,jdbcType=DECIMAL},
      </if>
      <if test="orderTime != null" >
        order_time = #{orderTime,jdbcType=INTEGER},
      </if>
      <if test="isNew != null" >
        is_new = #{isNew,jdbcType=TINYINT},
      </if>
      <if test="amount != null" >
        amount = #{amount,jdbcType=DECIMAL},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=INTEGER},
      </if>
      <if test="updateTime != null" >
        update_time = #{updateTime,jdbcType=INTEGER},
      </if>
      <if test="extraActivityId != null" >
        extra_activity_id = #{extraActivityId,jdbcType=INTEGER},
      </if>
      <if test="cpsExtraActivityId != null" >
        cps_extra_activity_id = #{cpsExtraActivityId,jdbcType=INTEGER},
      </if>
      <if test="activityId != null" >
        activity_id = #{activityId,jdbcType=INTEGER},
      </if>
      <if test="activityName != null" >
        activity_name = #{activityName,jdbcType=VARCHAR},
      </if>
      <if test="extraAmount != null" >
        extra_amount = #{extraAmount,jdbcType=DECIMAL},
      </if>
      <if test="orderAmount != null" >
        order_amount = #{orderAmount,jdbcType=DECIMAL},
      </if>
      <if test="specialStatus != null" >
        special_status = #{specialStatus,jdbcType=TINYINT},
      </if>
      <if test="paymentType != null" >
        payment_type = #{paymentType,jdbcType=TINYINT},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByIdsForExtraActivity" >
    update union_share_orders
    set update_time = #{updateTime,jdbcType=INTEGER},
        extra_activity_id = #{extraActivityId,jdbcType=INTEGER}
    where id in
    <foreach collection="ids" separator="," item="item" index="index" close=")" open="(">
      #{item}
    </foreach>
  </update>
  <update id="updateByIdsForCpsUserActivity" >
    update union_share_orders
    set update_time = #{updateTime,jdbcType=INTEGER},
        cps_extra_activity_id = #{cpsExtraActivityId,jdbcType=INTEGER}
    where id in
    <foreach collection="ids" separator="," item="item" index="index" close=")" open="(">
      #{item}
    </foreach>
  </update>
  <update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.UnionShareOrders" >
    update union_share_orders
    set order_code = #{orderCode,jdbcType=VARCHAR},
      promote_uid = #{promoteUid,jdbcType=INTEGER},
      order_uid = #{orderUid,jdbcType=INTEGER},
      settlement_code = #{settlementCode,jdbcType=VARCHAR},
      status = #{status,jdbcType=VARCHAR},
      last_order_amount = #{lastOrderAmount,jdbcType=DECIMAL},
      order_time = #{orderTime,jdbcType=INTEGER},
      is_new = #{isNew,jdbcType=TINYINT},
      amount = #{amount,jdbcType=DECIMAL},
      create_time = #{createTime,jdbcType=INTEGER},
      update_time = #{updateTime,jdbcType=INTEGER},
      extra_activity_id = #{extraActivityId,jdbcType=INTEGER},
      cps_extra_activity_id = #{cpsExtraActivityId,jdbcType=INTEGER},
      activity_id = #{activityId,jdbcType=INTEGER},
      activity_name = #{activityName,jdbcType=VARCHAR},
      extra_amount = #{extraAmount,jdbcType=DECIMAL},
      order_amount = #{orderAmount,jdbcType=DECIMAL},
      special_status = #{specialStatus,jdbcType=TINYINT},
      payment_type = #{paymentType,jdbcType=TINYINT}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <select id="selectCountBySearchCodition" resultType="java.lang.Integer" parameterType="com.yoho.service.model.union.request.UnionShareOrderSearchReqBO">
    select count(1) from union_share_orders where order_code is not null
    <if test="promoteUid!=null">
      and promote_uid = #{promoteUid}
    </if>
    <if test="orderUid!=null">
      and order_uid = #{orderUid}
    </if>
    <if test="orderCode != null" >
      and order_code = #{orderCode}
    </if>
    <if test="beginTime != null" >
      and order_time &gt; #{beginTime}
    </if>
    <if test="endTime != null" >
      and order_time &lt;#{endTime}
    </if>
  </select>
  <select id="selectAllListByUids" resultMap="BaseResultMap">
    select <include refid="Base_Column_List" /> from union_share_orders where order_code is not null
    <if test="uid!=null">
      and promote_uid = #{uid}
    </if>
    <if test="orderCode != null" >
      and order_code = #{orderCode}
    </if>
    <if test="beginTime != 0" >
      and order_time &gt; #{beginTime}
    </if>
    <if test="endTime != 0" >
      and order_time &lt;#{endTime}
    </if>
    order BY  order_time desc
  </select>
  <select id="selectUidList" resultType="com.yoho.service.model.union.bo.UnionShareOrdersUidBo">
    select promote_uid as promoteUid,order_uid as orderUid,count(id) as num
    from union_share_orders
    where status in(10,20,30,40) and order_code is not null
    <if test="beginTime != null" >
      and order_time &gt;= #{beginTime}
    </if>
    <if test="endTime != null" >
      and order_time &lt;= #{endTime}
    </if>
    group by promote_uid,order_uid
  </select>
  <select id="selectUidAmountList" resultType="com.yoho.service.model.union.bo.UnionShareOrdersUidBo">
    select promote_uid as promoteUid,sum(amount) as amount,count(order_code) as num
    from union_share_orders
    where status in(10,20,30,40)
    <if test="beginTime != null" >
      and order_time &gt;= #{beginTime}
    </if>
    <if test="endTime != null" >
      and order_time &lt;= #{endTime}
    </if>
    group by promote_uid
  </select>
  <select id="selectUidSettlementList" resultType="com.yoho.service.model.union.bo.UnionShareOrdersUidBo">
    select promote_uid as promoteUid,sum(amount) as amount,count(order_code) as num
    from union_share_orders
    where status =20
    <if test="beginTime != null" >
      and update_time &gt;= #{beginTime}
    </if>
    <if test="endTime != null" >
      and update_time &lt;= #{endTime}
    </if>
    group by promote_uid
  </select>
  <select id="selectListByOrderUidForActivity" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from union_share_orders where order_code is not null and status in (10,20,30,40)
      and order_uid = #{orderUid} and promote_uid = #{promoteUid}
    <if test="beginTime != 0" >
      and order_time &gt; #{beginTime}
    </if>
    <if test="endTime != 0" >
      and order_time &lt;#{endTime}
    </if>
  </select>
  <select id="selectMonthData" resultType="com.yoho.unions.dal.model.UnionShareOrdersMonth">
    select sum(amount) as amount,sum(extra_amount) as extraAmount,sum(order_amount) as orderAmount,count(order_code) as orderNum
    from union_share_orders
    where promote_uid = #{promoteUid} and status in (10,20,30,40)
      and order_time &gt;= #{beginTime}
      and order_time &lt; #{endTime}
  </select>
  <select id="selectActivityOrderByUid" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from union_share_orders
    where promote_uid = #{promoteUid} and activity_id = #{activityId} and status in (10,20,30,40)
    <if test="orderUid!=null">
      and order_uid = #{orderUid}
    </if>
    limit 1
  </select>
  <select id="selectListBySearchCodition" resultMap="BaseResultMap" parameterType="com.yoho.service.model.union.request.UnionShareOrderSearchReqBO">
    select <include refid="Base_Column_List" />
    from union_share_orders
    where order_code is not null
    <if test="promoteUid!=null">
      and promote_uid = #{promoteUid}
    </if>
    <if test="orderUid!=null">
      and order_uid = #{orderUid}
    </if>
    <if test="orderCode != null" >
      and order_code = #{orderCode}
    </if>
    <if test="beginTime != null" >
      and order_time &gt; #{beginTime}
    </if>
    <if test="endTime != null" >
      and order_time &lt;#{endTime}
    </if>
    order by order_time desc
    limit #{start},#{size}
  </select>
  <update id="updateStatusById" >
    update union_share_orders
    set status = #{newStatus,jdbcType=VARCHAR},
      update_time = #{updateTime,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER} and status = #{oldStatus,jdbcType=VARCHAR}
  </update>
  <update id="updateStatusByUid" >
    update union_share_orders
    set status = #{newStatus,jdbcType=VARCHAR},
    <if test="settlementCode != null">
      settlement_code = #{settlementCode,jdbcType=VARCHAR},
    </if>
      update_time = #{updateTime,jdbcType=INTEGER}
    where promote_uid = #{promoteUid,jdbcType=INTEGER} and status = #{oldStatus,jdbcType=VARCHAR}
  </update>
  <update id="updateStatusByCode" >
    update union_share_orders
    set status = #{newStatus,jdbcType=VARCHAR},
      update_time = #{updateTime,jdbcType=INTEGER}
    where settlement_code = #{settlementCode,jdbcType=VARCHAR} and status = #{oldStatus,jdbcType=VARCHAR}
  </update>

  <select id="selectRecentlyOrderLimitTen" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from union_share_orders
    where promote_uid = #{uid,jdbcType=INTEGER} and order_code is not null
    AND status != 100
    order by order_time desc
    limit 0,10
  </select>

  <select id="selectOrderList" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from union_share_orders
    where promote_uid = #{params.uid,jdbcType=INTEGER}
    <if test="params.type != null and params.type == 1">
      and order_code is not null
    </if>
    <if test="params.type != null and params.type == 2">
      and activity_id &gt;0
    </if>
    <if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 0">
        AND status != 100
    </if>
    <if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 1">
        AND status = 10
    </if>
    <if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 2">
        AND status IN (20,30)
    </if>
    <if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 3">
        AND status = 40
    </if>
    <if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 0">
        AND status IN (10,20,30,40)
    </if>
    <if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 1">
        AND status = 10
    </if>
    <if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 2">
        AND status IN (20,30)
    </if>
    <if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 3">
        AND status = 40
    </if>
    <if test="params.tab1 != null and params.tab1 == 3">
        AND status IN (91,92,93,200)
    </if>
    order by order_time desc
    limit #{params.start,jdbcType=INTEGER}, #{params.size,jdbcType=INTEGER}
  </select>

  <select id="selectOrderListCount" resultType="java.lang.Integer">
    select
    count(1)
    from union_share_orders
    where promote_uid = #{params.uid,jdbcType=INTEGER}
    <if test="params.type != null and params.type == 1">
      and order_code is not null
    </if>
    <if test="params.type != null and params.type == 2">
      and activity_id &gt;0
    </if>
    <if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 0">
      AND status != 100
    </if>
    <if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 1">
      AND status = 10
    </if>
    <if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 2">
      AND status IN (20,30)
    </if>
    <if test="params.tab1 != null and params.tab1 == 1 and params.tab2 == 3">
      AND status = 40
    </if>
    <if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 0">
      AND status IN (10,20,30,40)
    </if>
    <if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 1">
      AND status = 10
    </if>
    <if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 2">
      AND status IN (20,30)
    </if>
    <if test="params.tab1 != null and params.tab1 == 2 and params.tab2 == 3">
      AND status = 40
    </if>
    <if test="params.tab1 != null and params.tab1 == 3">
      AND status IN (91,92,93)
    </if>
  </select>
  
  <select id="selectListForStatistics" resultMap="BaseResultMap">
    select <include refid="Base_Column_List" /> 
    from union_share_orders 
    where status in (10,20,30,40)
    <if test="uid!=null">
      and promote_uid =#{uid}
    </if>
    <if test="beginTime != null and beginTime != 0" >
      and order_time &gt; #{beginTime}
    </if>
    <if test="endTime != null and endTime != 0" >
      and order_time &lt;#{endTime}
    </if>
  </select>
  <select id="selectStatistics" resultType="com.yoho.service.model.union.response.UnionShareStatisticsRspBO">
    select sum(extra_amount) extraAmountSum,sum(order_amount) orderAmountSum,count(order_code) orderNum
    from union_share_orders
    where status in (10,20,30,40)
    <if test="uid!=null">
      and promote_uid =#{uid}
    </if>
    <if test="beginTime != null and beginTime != 0" >
      and order_time &gt; #{beginTime}
    </if>
    <if test="endTime != null and endTime != 0" >
      and order_time &lt;#{endTime}
    </if>
  </select>
  <select id="selectNewPromoteUidsOrder" resultMap="BaseResultMap">
    select <include refid="Base_Column_List" />
    from union_share_orders
    where order_code is not null and promote_uid in
    <foreach collection="promoteUids" separator="," item="item" index="index" close=")" open="(">
      #{item}
    </foreach>
    and order_time &lt;#{endTime} and status in (10,20,30,40)
  </select>
  <select id="selectNewPromoteUidOrder" resultMap="BaseResultMap">
    select <include refid="Base_Column_List" />
    from union_share_orders
    where promote_uid = #{promoteUid} and order_code is not null and order_time &lt;#{endTime} and status in (10,20,30,40)
  </select>
  
</mapper>