Browse Source

//..coupon

release_toaliyun_real
xhxu 2 years ago
parent
commit
e2e3cff11f
9 changed files with 944 additions and 57 deletions
  1. +8
    -0
      mallinkAdmin/src/main/resources/db/migration/V2023071200001_marketingMangage_permission.sql
  2. +801
    -0
      mallinkAdmin/src/main/resources/db/migration/V2023071200002_coupon.sql
  3. +0
    -2
      mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java
  4. +6
    -3
      mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java
  5. +43
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumCouponVersion.java
  6. +1
    -4
      mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java
  7. +4
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  8. +80
    -46
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml
  9. +1
    -1
      mallinkService/src/main/resources/mapper/WxCouponPasswordMapper.xml

+ 8
- 0
mallinkAdmin/src/main/resources/db/migration/V2023071200001_marketingMangage_permission.sql View File

@@ -0,0 +1,8 @@
INSERT INTO `mallink`.`mall_permission`(`id`, `name`, `parent_id`, `available`, `permission`, `resource_type`, `module_color`, `module_color_num`, `url`, `icon`, `version_type`, `sort`) VALUES (424, '抖音分账对账统计', 416, 'Y', NULL, 1, NULL, NULL, 'marketingMangage', NULL, 0, 412);


UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 4, 5, 6, 50, 105, 110, 201, 205, 202, 210, 211, 212, 221, 222, 223, 224, 251, 261, 409, 410, 411, 416, 424, 502, 504, 505, 506, 507, 511, 512, 521, 522, 523, 591, 592, 595, 601, 602, 605, 606, 610, 612, 615, 622, 647, 676, 680, 711, 901, 902, 904, 907, 5502, 61202, 61501, 61502]' WHERE `id` = 11;
UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 201, 202, 203, 204, 205, 206, 209, 210, 211, 212, 221, 222, 223, 224, 225, 251, 261, 299, 300, 301, 302, 303, 304, 305, 306, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 423, 424, 431, 432, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 615, 616, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 647, 651, 652, 653, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 676, 680, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 5502, 6610, 6611, 41701, 41702, 60701, 60702, 61201, 61202, 61501, 61502]' WHERE `id` = 12;
UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 4, 5, 6, 50, 105, 110, 201, 205, 202, 210, 211, 212, 221, 222, 223, 224, 226, 251, 261, 409, 410, 411, 416, 424, 502, 504, 505, 506, 507, 511, 512, 521, 522, 523, 591, 592, 595, 601, 602, 605, 606, 610, 612, 615, 622, 676, 680, 711, 716, 901, 902, 904, 907, 5502, 60201, 61202, 61501, 61502]' WHERE `id` = 13;
UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 4, 5, 6, 50, 105, 110, 201, 205, 202, 210, 211, 212, 221, 222, 223, 224, 251, 261, 409, 410, 411, 416, 424, 504, 505, 506, 507, 511, 512, 521, 522, 523, 591, 592, 595, 601, 602, 605, 606, 610, 612, 615, 622, 647, 650, 676, 680, 711, 901, 902, 904, 907, 5502, 41001, 60202, 61202, 61501, 61502, 71101]' WHERE `id` = 102;
UPDATE `mallink`.`mall_sale_type` SET `menus` = '[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 50, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 201, 202, 203, 204, 205, 206, 209, 210, 211, 212, 221, 222, 225, 223, 224, 251, 261, 299, 300, 307, 308, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 423, 424, 431, 432, 502, 503, 504, 505, 506, 507, 508, 509, 511, 512, 513, 514, 521, 522, 523, 531, 532, 533, 591, 592, 595, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 615, 616, 621, 622, 623, 624, 625, 626, 627, 641, 642, 643, 644, 645, 646, 647, 651, 652, 653, 661, 662, 663, 664, 665, 666, 671, 672, 673, 674, 675, 676, 680, 681, 682, 683, 684, 685, 687, 691, 692, 693, 694, 695, 701, 702, 703, 704, 711, 713, 714, 715, 901, 902, 903, 904, 905, 906, 907, 908, 910, 931, 932, 951, 952, 961, 962, 963, 965, 966, 967, 968, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 5502, 6610, 6611, 41701, 41702, 60701, 60702, 61201, 61202, 61501, 61502]' WHERE `id` = 103500103610;

+ 801
- 0
mallinkAdmin/src/main/resources/db/migration/V2023071200002_coupon.sql View File

@@ -0,0 +1,801 @@
ALTER TABLE `mallink`.`wx_coupon_0`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_0 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_0`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_1`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_1 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_1`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_2`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_2 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_2`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_3`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_3 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_3`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_4`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_4 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_4`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_5`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_5 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_5`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_6`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_6 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_6`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_7`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_7 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_7`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_8`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_8 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_8`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_9`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_9 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_9`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_10`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_10 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_10`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_11`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_11 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_11`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_12`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_12 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_12`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_13`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_13 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_13`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_14`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_14 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_14`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_15`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_15 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_15`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_16`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_16 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_16`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_17`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_17 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_17`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_18`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_18 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_18`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_19`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_19 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_19`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_20`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_20 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_20`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_21`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_21 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_21`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_22`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_22 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_22`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_23`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_23 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_23`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_24`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_24 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_24`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_25`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_25 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_25`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_26`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_26 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_26`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_27`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_27 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_27`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_28`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_28 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_28`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_29`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_29 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_29`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_30`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_30 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_30`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_31`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_31 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_31`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_32`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_32 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_32`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_33`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_33 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_33`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_34`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_34 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_34`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_35`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_35 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_35`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_36`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_36 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_36`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_37`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_37 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_37`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_38`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_38 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_38`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_39`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_39 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_39`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_40`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_40 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_40`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_41`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_41 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_41`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_42`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_42 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_42`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_43`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_43 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_43`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_44`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_44 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_44`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_45`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_45 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_45`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_46`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_46 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_46`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_47`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_47 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_47`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_48`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_48 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_48`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_49`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_49 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_49`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_50`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_50 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_50`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_51`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_51 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_51`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_52`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_52 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_52`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_53`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_53 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_53`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_54`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_54 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_54`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_55`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_55 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_55`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_56`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_56 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_56`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_57`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_57 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_57`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_58`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_58 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_58`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_59`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_59 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_59`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_60`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_60 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_60`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_61`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_61 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_61`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_62`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_62 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_62`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_63`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_63 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_63`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_64`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_64 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_64`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_65`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_65 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_65`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_66`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_66 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_66`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_67`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_67 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_67`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_68`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_68 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_68`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_69`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_69 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_69`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_70`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_70 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_70`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_71`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_71 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_71`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_72`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_72 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_72`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_73`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_73 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_73`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_74`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_74 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_74`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_75`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_75 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_75`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_76`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_76 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_76`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_77`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_77 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_77`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_78`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_78 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_78`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_79`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_79 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_79`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_80`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_80 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_80`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_81`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_81 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_81`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_82`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_82 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_82`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_83`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_83 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_83`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_84`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_84 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_84`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_85`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_85 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_85`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_86`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_86 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_86`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_87`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_87 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_87`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_88`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_88 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_88`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_89`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_89 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_89`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_90`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_90 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_90`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_91`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_91 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_91`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_92`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_92 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_92`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_93`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_93 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_93`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_94`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_94 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_94`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_95`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_95 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_95`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_96`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_96 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_96`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_97`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_97 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_97`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_98`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_98 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_98`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;

ALTER TABLE `mallink`.`wx_coupon_99`
ADD COLUMN `coupon_id` bigint(20) AFTER `id`;
update wx_coupon_99 set coupon_id = id;
ALTER TABLE `mallink`.`wx_coupon_99`
MODIFY COLUMN `coupon_id` bigint(20) NOT NULL AFTER `id`;


ALTER TABLE `mallink`.`wx_coupon_0`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_1`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_2`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_3`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_4`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_5`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_6`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_7`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_8`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_9`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_10`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_11`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_12`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_13`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_14`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_15`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_16`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_17`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_18`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_19`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_20`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_21`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_22`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_23`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_24`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_25`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_26`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_27`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_28`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_29`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_30`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_31`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_32`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_33`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_34`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_35`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_36`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_37`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_38`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_39`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_40`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_41`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_42`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_43`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_44`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_45`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_46`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_47`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_48`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_49`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_50`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_51`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_52`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_53`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_54`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_55`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_56`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_57`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_58`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_59`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_60`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_61`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_62`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_63`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_64`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_65`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_66`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_67`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_68`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_69`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_70`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_71`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_72`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_73`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_74`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_75`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_76`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_77`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_78`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_79`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_80`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_81`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_82`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_83`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_84`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_85`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_86`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_87`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_88`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_89`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_90`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_91`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_92`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_93`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_94`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_95`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_96`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_97`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_98`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;
ALTER TABLE `mallink`.`wx_coupon_99`
ADD COLUMN `version` smallint(1) NOT NULL DEFAULT 0 AFTER `is_after_set_price`;

+ 0
- 2
mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java View File

@@ -113,7 +113,6 @@ public class WxCouponController extends BaseController {
coupon.setGiftCouponList(couponService.list(couponQ));
}
}
coupon.setCouponId(coupon.getId());
CouponCacheUtils.setOnlyCouponCache(redisTemplate, couponId, coupon);
}
return new ResultData(coupon);
@@ -175,7 +174,6 @@ public class WxCouponController extends BaseController {
coupon.setGiftCouponList(couponService.list(couponQ));
}
}
coupon.setCouponId(coupon.getId());
coupon.setCouponChannelId(couponChannel.getId());
CouponCacheUtils.setCouponCache(redisTemplate, couponChannel.getCouponId(), coupon);
}


+ 6
- 3
mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java View File

@@ -32,6 +32,9 @@ public class WxCoupon extends TenantEntity {

protected Long id;

@io.swagger.annotations.ApiModelProperty(value="商品ID",name="couponId")
private Long couponId;

@TableField(exist = false)
protected List<Integer> types;

@@ -227,9 +230,6 @@ public class WxCoupon extends TenantEntity {
@TableField(exist = false)
@io.swagger.annotations.ApiModelProperty(value="投放频道参数,用来过滤",name="targetAd")
private Integer targetAd;
@TableField(exist = false)
@io.swagger.annotations.ApiModelProperty(value="投放频道参数,用来过滤",name="couponId")
private Long couponId;

@TableField(exist = false)
@io.swagger.annotations.ApiModelProperty(value = "用户积分,用来过滤", name = "userCredit")
@@ -517,5 +517,8 @@ public class WxCoupon extends TenantEntity {
}
return valid_date;
}

@io.swagger.annotations.ApiModelProperty(value = "商品版本 EnumCouponVersion", name = "version")
private Integer version;
}

+ 43
- 0
mallinkService/src/main/java/com/iformall/enums/EnumCouponVersion.java View File

@@ -0,0 +1,43 @@
package com.iformall.enums;

/**
* Created by Stormeye on 2018/08/09.
*/
public enum EnumCouponVersion {

/**
* //初始状态为线上版本。
* //当抖音线上版本需要修改时会新增草稿版本
* //此时修改草稿版本数据
* //草稿版本审核通过后会同步数据到线上版本
* //实现不下架修改
*/
online(0, "线上版本"),
draft(1, "草稿版本"),
;

public static EnumCouponVersion getEnum(Integer code) {
for (EnumCouponVersion value : values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}

private Integer code;
private String message;

EnumCouponVersion(Integer code, String message) {
this.code = code;
this.message = message;
}

public Integer getCode() {
return code;
}

public String getMessage() {
return message;
}
}

+ 1
- 4
mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java View File

@@ -42,8 +42,6 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> {
void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId);
Integer setPrice(WxCoupon wxCoupon);

Integer reduceInventory(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("number")Integer number);

@@ -127,6 +125,5 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> {
List<TtCouponVo> ttCouponList(TtCouponVo ttCouponVo);

Integer findCategoryIdById(@Param("id")Long id,@Param("tenantId")String tenantId);
void setMakeMerchantId(WxCoupon couponQ);

}

+ 4
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java View File

@@ -607,6 +607,9 @@ public class WxCouponServiceImpl implements WxCouponService {
final IdWorker idWorker = IdWorker.get();
if (record.getId() == null) {
record.setId(idWorker.nextId());
if(record.getCouponId() == null){
record.setCouponId(record.getId());
}
if (EnumCouponType.checkCreateWithMerchants(record.getType())) {
for (Iterator<TenantEntity> it = tenantMerchantMap.keySet().iterator();it.hasNext();) {
TenantEntity mallTenant = it.next();
@@ -1266,7 +1269,7 @@ public class WxCouponServiceImpl implements WxCouponService {
@Override
public void exportPressData(WxCoupon record, List<TenantEntity> tenantEntitys, HttpServletRequest request,
HttpServletResponse response) {
Map map = new HashMap();
Map map = new HashMap();
map.put("record", record);
map.put("tenantEntitys", tenantEntitys);
excelService.exportBigExcel(pressDataExporter,map, null, "砍价营销数据信息", WxPressData.class, "砍价营销数据.xlsx", response, false);


+ 80
- 46
mallinkService/src/main/resources/mapper/WxCouponMapper.xml View File

@@ -3,6 +3,8 @@
<mapper namespace="com.iformall.mapper.WxCouponMapper">
<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCoupon">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="coupon_id" jdbcType="BIGINT" property="couponId"/>
<result column="version" jdbcType="INTEGER" property="version"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
<result column="make_merchant_id" jdbcType="BIGINT" property="makeMerchantId"/>
@@ -76,6 +78,8 @@
</resultMap>
<resultMap id="statisMap" type="com.iformall.domain.vo.WxCouponStatisVo">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="coupon_id" jdbcType="BIGINT" property="couponId"/>
<result column="version" jdbcType="INTEGER" property="version"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
<result column="make_merchant_id" jdbcType="BIGINT" property="makeMerchantId"/>
@@ -131,7 +135,7 @@
</resultMap>

<sql id="allColumns">
c.`id`,c.`tenant_id`,c.`parent_tenant_id`,c.`make_merchant_id`,c.`brand`,c.`type`,c.`cover_img`,c.`cover_picture`,c.`detail_picture`,
c.`id`,c.`coupon_id`,c.`version`,c.`tenant_id`,c.`parent_tenant_id`,c.`make_merchant_id`,c.`brand`,c.`type`,c.`cover_img`,c.`cover_picture`,c.`detail_picture`,
c.`title`,c.`sub_title`,c.`item_group`,c.`sale_price`,c.`freight_price`,c.`use_price`,c.`use_limit_rule`,c.`use_limit_quantity`,c.`send_type`,
c.`sold_start_time`,c.`sold_end_time`,c.`valid_type`,c.`valid_start_date`,c.`valid_end_date`,c.`valid_days`,c.`detail`,c.`price`,c.tail_price,c.orig_price,c.`unit`,c.`remain_inventory`,c.`inventory`,
c.`remark`,c.`status`,c.`create_date`,c.`update_date`,c.`business`,c.`sub_business`,c.`support_transfer`,c.`subsidy_num`,c.`subsidy_type`,c.`is_after_set_price`,c.`card_score_rule`,
@@ -139,17 +143,17 @@
c.`conditions`,c.approval_type,c.content_type,c.source_type,c.merchant_type,c.password_support,c.is_recharge,c.used_password,c.gift_list,c.product_type,c.category_id,c.goods_id
</sql>

<sql id="statusColumns">
`id`,`remain_inventory`,`status`
</sql>

<sql id="dynamicWhereConditions">
where 1 = 1
where version = 0

<if test=" null != id ">
and `id` = #{id}
</if>

<if test=" null != couponId ">
and `coupon_id` = #{couponId}
</if>

<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
@@ -381,6 +385,8 @@

<resultMap id="AttrsResultMap" type="com.iformall.domain.po.WxCoupon">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="coupon_id" jdbcType="BIGINT" property="couponId"/>
<result column="version" jdbcType="INTEGER" property="version"/>
<result column="product_type" jdbcType="INTEGER" property="productType"/>
<result column="category_id" jdbcType="INTEGER" property="categoryId"/>
<result column="product_attrs" jdbcType="VARCHAR" property="productAttrs"/>
@@ -388,16 +394,20 @@
</resultMap>

<select id="getAttrsById" parameterType="java.util.HashMap" resultMap="AttrsResultMap">
select id,product_type,category_id,product_attrs,sku_attrs
from wx_coupon where id = #{id} and tenant_id = #{tenantId}
select id,coupon_id,version,product_type,category_id,product_attrs,sku_attrs
from wx_coupon where id = #{id} and tenant_id = #{tenantId}
</select>
<select id="getPriceAndStock" parameterType="java.util.HashMap" resultMap="BaseResultMap">
select c.id,c.sale_price,c.price,c.remain_inventory,c.inventory,c.credit_price from wx_coupon c where id = #{id} and tenant_id = #{tenantId}
select c.id,c.coupon_id,c.version,c.sale_price,c.price,c.remain_inventory,c.inventory,c.credit_price
from wx_coupon c
where c.`version` = 0 and id = #{id} and tenant_id = #{tenantId}
</select>
<select id="batchGetPriceAndStock" parameterType="java.util.HashMap" resultMap="BaseResultMap">
select c.id,c.sale_price,c.price,c.remain_inventory,c.inventory,c.credit_price from wx_coupon c where tenant_id = #{tenantId}
select c.id,c.coupon_id,c.version,c.sale_price,c.price,c.remain_inventory,c.inventory,c.credit_price
from wx_coupon c
where c.`version` = 0 and tenant_id = #{tenantId}
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
@@ -405,9 +415,10 @@
</select>
<select id="findTenantSimpleList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select id,title,sale_price,use_price,price,tail_price,orig_price,auto_refund,business,subsidy_type,source_type,merchant_type,type,unit,cover_img,
select id,coupon_id,c.version,title,sale_price,use_price,price,tail_price,orig_price,auto_refund,business,subsidy_type,source_type,merchant_type,type,unit,cover_img,
sub_title,item_group,sold_start_time,sold_end_time,valid_type,valid_start_date,valid_end_date,is_after_set_price,card_score_rule
from wx_coupon c where c.`tenant_id` = #{tenantId}
from wx_coupon c
where c.`version` = 0 and c.`tenant_id` = #{tenantId}
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -423,24 +434,27 @@
</select>
<select id="findSimpleDetail" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select c.id,c.type,c.cover_img,c.title,c.sub_title,c.item_group,c.sale_price,c.use_price,c.price,c.tail_price,c.orig_price,c.unit,c.detail,c.remark,
select c.id,c.coupon_id,c.version,c.type,c.cover_img,c.title,c.sub_title,c.item_group,c.sale_price,c.use_price,c.price,c.tail_price,c.orig_price,c.unit,c.detail,c.remark,
c.sold_start_time,c.sold_end_time,c.valid_type,c.valid_start_date,c.valid_end_date,
c.auto_refund,c.business,c.subsidy_type,c.source_type,c.merchant_type,c.content_type,c.gift_list,c.support_transfer,c.subsidy_num,
c.is_after_set_price,c.card_score_rule from wx_coupon c where c.id = #{id} and c.`tenant_id` = #{tenantId}
c.is_after_set_price,c.card_score_rule
from wx_coupon c
where c.`version` = 0 and c.id = #{id}
and c.`tenant_id` = #{tenantId}
</select>
<select id="findCouponCVoDetail" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select c.id,c.type,c.cover_img,c.cover_picture,c.detail_picture,c.title,c.sub_title,c.item_group,c.sale_price,c.use_price,
select c.id,c.coupon_id,c.version,c.type,c.cover_img,c.cover_picture,c.detail_picture,c.title,c.sub_title,c.item_group,c.sale_price,c.use_price,
c.use_limit_rule,c.use_limit_quantity,c.send_type,c.sold_start_time,c.sold_end_time,c.valid_type,c.valid_start_date,c.valid_end_date,
c.valid_days,c.detail,c.price,c.tail_price,c.orig_price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,c.is_after_set_price,c.card_score_rule,
c.create_date,c.update_date,c.business,c.sub_business,c.support_transfer,c.press_limit_num, c.auto_refund,c.credit_price,c.conditions,c.content_type
from wx_coupon c where c.id = #{id} and c.`tenant_id` = #{tenantId}
from wx_coupon c where c.`version` = 0 and c.id = #{id} and c.`tenant_id` = #{tenantId}
</select>
<select id="findSimpleDetailList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select c.id,c.type,c.cover_img,c.title,c.sub_title,c.item_group,c.sale_price,c.use_price,c.price,c.tail_price,c.orig_price,c.unit,c.detail,c.remark,
select c.id,c.coupon_id,c.version,c.type,c.cover_img,c.title,c.sub_title,c.item_group,c.sale_price,c.use_price,c.price,c.tail_price,c.orig_price,c.unit,c.detail,c.remark,
c.sold_start_time,c.sold_end_time,c.valid_type,c.valid_start_date,c.valid_end_date,
c.auto_refund,c.business,c.subsidy_type,c.source_type,c.merchant_type,c.content_type,c.is_after_set_price,c.card_score_rule
from wx_coupon c
@@ -450,12 +464,13 @@
<select id="findIdList" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long">
select id
from wx_coupon c
<include refid="dynamicWhereConditions"/>
<include refid="dynamicWhereConditions"/>
</select>
<select id="findSendCouponIds" parameterType="java.util.HashMap" resultType="Long">
select id
from wx_coupon where `tenant_id` = #{tenantId}
from wx_coupon
where c.`version` = 0 and `tenant_id` = #{tenantId}
and ((valid_type=1
<choose>
<when test="expired == 0">
@@ -483,8 +498,9 @@
<select id="findSendCouponList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select
c.id,c.remain_inventory, c.use_limit_rule,c.use_limit_quantity, c.inventory, c.valid_start_date, c.valid_end_date,c.valid_type,c.valid_days
from wx_coupon c where c.`tenant_id` = #{tenantId}
c.id,c.coupon_id,c.version,c.remain_inventory, c.use_limit_rule,c.use_limit_quantity, c.inventory, c.valid_start_date, c.valid_end_date,c.valid_type,c.valid_days
from wx_coupon c
where c.`version` = 0 and c.`tenant_id` = #{tenantId}
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
@@ -509,14 +525,14 @@
SET
`remain_inventory` = #{remainInventory}, `inventory` = #{inventory},
`valid_type` = #{validType}, `valid_end_date` = #{validEndDate}, `valid_days` = #{validDays}
WHERE 1=1
WHERE id = #{id}
<if test=" null != tenantId and '' != tenantId">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>
and id = #{id} and `remain_inventory` = #{orgRemainInventory} and `inventory` = #{orgInventory}
and `remain_inventory` = #{orgRemainInventory} and `inventory` = #{orgInventory}
</update>


@@ -526,6 +542,10 @@
and c.`id` = #{id}
</if>

<if test=" null != couponId ">
and c.`coupon_id` = #{couponId}
</if>

<if test=" null != tenantId and '' != tenantId">
and c.`tenant_id` = #{tenantId}
</if>
@@ -736,7 +756,7 @@
<if test="plat != null and plat == 3">
left join tt_coupon_channel_poi poi on poi.id = c.id
</if>
where c.is_del = 0
where c.is_del = 0 and c.version = 0
<if test="plat != null and plat == 3">
<if test=" null != spuId and '' != spuId">
and poi.`spu_id` = #{spuId}
@@ -765,7 +785,7 @@
<if test="plat != null and plat == 3">
left join tt_coupon_channel_poi poi on poi.id = c.id
</if>
where c.is_del = 0
where c.is_del = 0 and c.version = 0
<if test="plat != null and plat == 3">
<if test=" null != spuId and '' != spuId">
and poi.`spu_id` = #{spuId}
@@ -784,6 +804,8 @@

<resultMap id="WxCouponCVoMap" type="com.iformall.domain.vo.WxCouponCVo">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="coupon_id" jdbcType="INTEGER" property="couponId"/>
<result column="version" jdbcType="BIGINT" property="version"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
<result column="type" jdbcType="INTEGER" property="type"/>
@@ -839,7 +861,10 @@

<resultMap id="WxCouponCVoMapL" type="com.iformall.domain.vo.WxCouponCVo">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="coupon_id" jdbcType="BIGINT" property="couponId"/>
<result column="version" jdbcType="BIGINT" property="version"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
<result column="type" jdbcType="INTEGER" property="type"/>
<result column="cover_img" jdbcType="VARCHAR" property="coverImg"/>
<result column="cover_picture" jdbcType="VARCHAR" property="coverPicture"/>
@@ -893,7 +918,7 @@
</select>

<select id="findVoStatusDetail" parameterType="java.util.HashMap" resultMap="WxCouponCVoMapL">
select id, remain_inventory, status
select id, coupon_id,version,remain_inventory, status
from wx_coupon
where id = #{id} and tenant_id =#{tenantId}
</select>
@@ -934,7 +959,8 @@

<select id="findSaleMoneyByDate"
resultType="com.iformall.domain.vo.WxCouponStatisVo">
select DATE_FORMAT(ci.create_date,'%Y-%m-%d') xtime,sum(round(ci.sale_amount/100,2)) xcount from wx_card_info ci
select DATE_FORMAT(ci.create_date,'%Y-%m-%d') xtime,sum(round(ci.sale_amount/100,2)) xcount
from wx_card_info ci
left join (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon${tenantEntity.shardTableSuffix}
</foreach>) c on c.id = ci.coupon_id
@@ -945,7 +971,8 @@

<select id="findPaymentByDate"
resultType="com.iformall.domain.vo.WxCouponStatisVo">
select DATE_FORMAT(wcs.create_date,'%Y-%m-%d') xtime,sum(round(wcs.real_payment/100,2)) xcount from wx_card_info ci
select DATE_FORMAT(wcs.create_date,'%Y-%m-%d') xtime,sum(round(wcs.real_payment/100,2)) xcount
from wx_card_info ci
left join (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon${tenantEntity.shardTableSuffix}
</foreach>) c on c.id = ci.coupon_id
@@ -1030,7 +1057,7 @@

from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon${tenantEntity.shardTableSuffix}
</foreach>) c where c.type = 100
</foreach>) c where c.version = 0 and c.type = 100
<if test="wxCoupon.title != null and wxCoupon.title !=''">
and c.title like concat('%', #{wxCoupon.title},'%')
</if>
@@ -1086,7 +1113,7 @@
where wc.id = c.id) as sum_subsidy
from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon${tenantEntity.shardTableSuffix}
</foreach>) c where c.type not in(8,9,100)
</foreach>) c where c.version = 0 and c.type not in(8,9,100)
<if test=" 1 == wxCoupon.type ">
and c.sale_price > 0
</if>
@@ -1160,7 +1187,7 @@
and `parent_tenant_id` = #{wxCoupon.parentTenantId}
</if>
group by coupon_id) cop on cop.coupon_id = c.id
where c.type = 8
where c.version = 0 and c.type = 8

<if test=" null != wxCoupon.tenantId and '' != wxCoupon.tenantId">
and c.`tenant_id` = #{wxCoupon.tenantId}
@@ -1266,7 +1293,8 @@
<!--砍价-->
<select id="pressSendHistory"
resultType="com.iformall.domain.vo.WxCouponStatisVo">
select DATE_FORMAT(wop.create_date,'%Y-%m-%d') xtime,count(wop.id) xcount from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
select DATE_FORMAT(wop.create_date,'%Y-%m-%d') xtime,count(wop.id) xcount
from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon${tenantEntity.shardTableSuffix}
</foreach>) wc
left join (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
@@ -1279,6 +1307,7 @@
wop.create_date between #{wxCoupon.startdate} and #{wxCoupon.enddate}
group by xtime
</select>

<select id="pressSuccHistory"
resultType="com.iformall.domain.vo.WxCouponStatisVo">
select DATE_FORMAT(wo.create_date,'%Y-%m-%d') xtime,count(wo.id) xcount
@@ -1292,6 +1321,7 @@
and wo.create_date between #{wxCoupon.startdate} and #{wxCoupon.enddate}
group by xtime
</select>

<select id="pressPaymentHistory"
resultType="com.iformall.domain.vo.WxCouponStatisVo">
select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount
@@ -1305,6 +1335,7 @@
and wco.create_date between #{wxCoupon.startdate} and #{wxCoupon.enddate}
group by xtime
</select>

<select id="pressSuccRate" resultType="java.lang.String">
select
round(
@@ -1333,6 +1364,7 @@
* 100
,2)
</select>

<select id="sumJoin" resultType="Long">
select count(wop.id) from (<foreach collection="tenantEntitys" item="tenantEntity" index="index" separator="union all">
SELECT * from wx_coupon${tenantEntity.shardTableSuffix}
@@ -1377,7 +1409,7 @@
wc.sold_start_time,wc.sold_end_time,wc.`valid_type`,wc.`valid_start_date`,wc.`valid_end_date`,wc.`valid_days`,wc.`detail`,wc.`price`,wc.tail_price,wc.orig_price,wc.`unit`,wc.`remain_inventory`,wc.`inventory`,
wc.`remark`,wc.`status`,wc.`create_date`,wc.`update_date`,wc.`business`,wc.`sub_business`,wc.`support_transfer`,wc.`subsidy_num`,wc.`subsidy_type`,
wc.`press_limit_num`, wc.`press_limit_hours`,wc.`press_pay_reduce_stock`,wc.`press_support_is_new`, wc.`auto_refund`,wc.`credit_price`,wc.`credit_refund`,wc.`conditions`,
wc.title as couponName,wc.`cover_img` as couponPic,wc.`cover_picture` as couponPicture,wc.`detail_picture` as detailPicture,wc.id as couponId
wc.title as couponName,wc.`cover_img` as couponPic,wc.`cover_picture` as couponPicture,wc.`detail_picture` as detailPicture
from wx_coupon_channel ct
left join wx_coupon wc on wc.id = ct.coupon_id
where ct.`sub_target_id` = #{id} and ct.status = 0
@@ -1404,11 +1436,13 @@
</update>

<select id="newfindCList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select id,remain_inventory,inventory,cover_img,title,sub_title,item_group,sale_price,use_price,price,tail_price,
select id,coupon_id,version,remain_inventory,inventory,cover_img,title,sub_title,item_group,sale_price,use_price,price,tail_price,
orig_price,unit,use_limit_rule,use_limit_quantity,send_type,support_transfer,press_limit_num,auto_refund,
conditions,valid_type,sold_start_time,sold_end_time,valid_start_date,valid_end_date,valid_days,credit_price,
remark,content_type,source_type,merchant_type
from wx_coupon where `tenant_id` = #{tenantId}
from wx_coupon
where `version` = 0
and `tenant_id` = #{tenantId}
<if test=" null != id ">
and `id` = #{id}
</if>
@@ -1429,16 +1463,20 @@
<select id="findIdsListHasConditons" parameterType="com.iformall.domain.po.WxCoupon" resultType="Long">
select c.id
from wx_coupon c
where c.`tenant_id` = #{tenantId} and c.conditions is not null
where c.`tenant_id` = #{tenantId}
and c.`version` = 0 and c.conditions is not null
/*and JSON_EXTRACT(c.conditions, '$.type') = 1*/
<if test=" null != parentTenantId and '' != parentTenantId">
and c.`parent_tenant_id` = #{parentTenantId}
</if>

</select>


<resultMap id="TtCouponVoResultMap" type="com.iformall.domain.vo.TtCouponVo">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="coupon_id" jdbcType="BIGINT" property="couponId"/>
<result column="version" jdbcType="INTEGER" property="version"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
<result column="type" jdbcType="INTEGER" property="type"/>
@@ -1482,7 +1520,7 @@


<select id="ttCouponList" parameterType="com.iformall.domain.vo.TtCouponVo" resultMap="TtCouponVoResultMap">
select c.`id`,c.`tenant_id`,c.`parent_tenant_id`,c.`type`,c.`cover_img`,
select c.`id`,c.`coupon_id`,c.`version`,c.`tenant_id`,c.`parent_tenant_id`,c.`type`,c.`cover_img`,
c.`title`,c.`sub_title`,c.`sale_price`,c.`freight_price`,c.`send_type`,
c.sold_start_time,c.sold_end_time,c.`valid_type`,c.`valid_start_date`,c.`valid_end_date`,
c.`valid_days`,c.`price`,c.tail_price,c.orig_price,c.`unit`,c.`remain_inventory`,c.`inventory`,
@@ -1492,12 +1530,16 @@
poi.coupon_channel_id,poi.spu_id,poi.status poi_status,poi.status_desc,poi.last_status,poi.last_status_desc
from wx_coupon c
left join tt_coupon_channel_poi poi on poi.id = c.id
where c.`type` = #{type}
where c.`version` = 0 and c.`type` = #{type}

<if test=" null != id ">
and c.`id` = #{id}
</if>

<if test=" null != couponId ">
and c.`coupon_id` = #{couponId}
</if>

<if test=" null != tenantId and '' != tenantId">
and c.`tenant_id` = #{tenantId}
</if>
@@ -1555,13 +1597,5 @@
where id = #{id}
and tenant_id = #{tenantId}
</select>
<update id="setMakeMerchantId" parameterType="com.iformall.domain.po.WxCoupon" >
update wx_coupon set make_merchant_id = #{makeMerchantId} where id = #{id} and tenant_id = #{tenantId}
</update>
<update id="setPrice" parameterType="com.iformall.domain.po.WxCoupon">
update wx_coupon set price = #{price},subsidy_num=#{subsidyNum} where id = #{id} and tenant_id = #{tenantId} and price = 0
</update>

</mapper>

+ 1
- 1
mallinkService/src/main/resources/mapper/WxCouponPasswordMapper.xml View File

@@ -180,7 +180,7 @@
and `parent_tenant_id` = #{parentTenantId}
</if>
group by coupon_id) cp
inner join wx_coupon c on cp.coupon_id = c.id
left join wx_coupon c on cp.coupon_id = c.id
where c.status=0 and c.put_apply_status in(0,2)
<if test=" null != tenantId and '' != tenantId">
and c.`tenant_id` = #{tenantId}


Loading…
Cancel
Save