Commit 1c737cf139e1b65dba78d7b2a61fcf5f472779b7

Authored by miaoguoxin
1 parent 7fb066e0

code review

src/main/java/com/diligrp/xtrade/order/domain/emuns/IdGenerator.java
1 -package com.diligrp.xtrade.order.domain.emuns;  
2 -  
3 -/**  
4 - * @ClassName: IdGenerator  
5 - * @Description id生成key枚举  
6 - * @author zhangxing  
7 - * @date 2020年4月21日  
8 - */  
9 -public enum IdGenerator {  
10 -  
11 - //订单id生成key  
12 - ORDER_SEQUENCE(1,"ORDER_SEQUENCE"),  
13 -  
14 - //订单详情id生成key  
15 - ORDER_ITEM_SEQUENCE(2,"ORDER_ITEM_SEQUENCE");  
16 -  
17 - //编码  
18 - private int code;  
19 -  
20 - //名称  
21 - private String name;  
22 -  
23 - private IdGenerator(int code, String name) {  
24 - this.code = code;  
25 - this.name = name;  
26 - }  
27 -  
28 - public int getCode() {  
29 - return code;  
30 - }  
31 -  
32 - public String getName() {  
33 - return name;  
34 - }  
35 -  
36 - public static IdGenerator getByCode(int code) {  
37 - for (IdGenerator idGenerator : values()) {  
38 - if (idGenerator.getCode() == code) {  
39 - return idGenerator;  
40 - }  
41 - }  
42 - return null;  
43 - }  
44 -  
45 - public static String getNameByCode(int code) {  
46 - for (IdGenerator idGenerator : IdGenerator.values()) {  
47 - if (idGenerator.getCode() == code) {  
48 - return idGenerator.name;  
49 - }  
50 - }  
51 - return null;  
52 - }  
53 -} 1 +package com.diligrp.xtrade.order.domain.emuns;
  2 +
  3 +/**
  4 + * @ClassName: IdGenerator
  5 + * @Description id生成key枚举
  6 + * @author zhangxing
  7 + * @date 2020年4月21日
  8 + */
  9 +public enum IdGenerator {
  10 +
  11 + //订单id生成key
  12 + ORDER_SEQUENCE(1,"ORDER_SEQUENCE"),
  13 +
  14 + //订单详情id生成key
  15 + ORDER_ITEM_SEQUENCE(2,"ORDER_ITEM_SEQUENCE");
  16 +
  17 + //编码
  18 + private int code;
  19 +
  20 + //名称
  21 + private String name;
  22 +
  23 + IdGenerator(int code, String name) {
  24 + this.code = code;
  25 + this.name = name;
  26 + }
  27 +
  28 + public int getCode() {
  29 + return code;
  30 + }
  31 +
  32 + public String getName() {
  33 + return name;
  34 + }
  35 +
  36 + public static IdGenerator getByCode(int code) {
  37 + for (IdGenerator idGenerator : values()) {
  38 + if (idGenerator.getCode() == code) {
  39 + return idGenerator;
  40 + }
  41 + }
  42 + return null;
  43 + }
  44 +
  45 + public static String getNameByCode(int code) {
  46 + for (IdGenerator idGenerator : IdGenerator.values()) {
  47 + if (idGenerator.getCode() == code) {
  48 + return idGenerator.name;
  49 + }
  50 + }
  51 + return null;
  52 + }
  53 +}
src/main/java/com/diligrp/xtrade/order/domain/emuns/OrderCreateSrc.java
1 -package com.diligrp.xtrade.order.domain.emuns;  
2 -  
3 -/**  
4 - * @ClassName: OrderCreateSrc  
5 - * @Description 订单创建来源枚举类  
6 - * @author zhangxing  
7 - * @date 2020年4月21日  
8 - */  
9 -public enum OrderCreateSrc {  
10 -  
11 - // 来源销售易app  
12 - APP(1, "销售易APP");  
13 -  
14 - // 编码  
15 - private int code;  
16 -  
17 - // 名称  
18 - private String name;  
19 -  
20 - private OrderCreateSrc(int code, String name) {  
21 - this.code = code;  
22 - this.name = name;  
23 - }  
24 -  
25 - public int getCode() {  
26 - return code;  
27 - }  
28 -  
29 - public String getName() {  
30 - return name;  
31 - }  
32 -  
33 - public static OrderCreateSrc getByCode(int code) {  
34 - for (OrderCreateSrc orderCreateSrc : values()) {  
35 - if (orderCreateSrc.getCode() == code) {  
36 - return orderCreateSrc;  
37 - }  
38 - }  
39 - return null;  
40 - }  
41 -  
42 - public static String getNameByCode(int code) {  
43 - for (OrderCreateSrc orderCreateSrc : OrderCreateSrc.values()) {  
44 - if (orderCreateSrc.getCode() == code) {  
45 - return orderCreateSrc.name;  
46 - }  
47 - }  
48 - return null;  
49 - }  
50 -} 1 +package com.diligrp.xtrade.order.domain.emuns;
  2 +
  3 +/**
  4 + * @ClassName: OrderCreateSrc
  5 + * @Description 订单创建来源枚举类
  6 + * @author zhangxing
  7 + * @date 2020年4月21日
  8 + */
  9 +public enum OrderCreateSrc {
  10 +
  11 + // 来源销售易app
  12 + APP(1, "销售易APP");
  13 +
  14 + // 编码
  15 + private int code;
  16 +
  17 + // 名称
  18 + private String name;
  19 +
  20 + OrderCreateSrc(int code, String name) {
  21 + this.code = code;
  22 + this.name = name;
  23 + }
  24 +
  25 + public int getCode() {
  26 + return code;
  27 + }
  28 +
  29 + public String getName() {
  30 + return name;
  31 + }
  32 +
  33 + public static OrderCreateSrc getByCode(int code) {
  34 + for (OrderCreateSrc orderCreateSrc : values()) {
  35 + if (orderCreateSrc.getCode() == code) {
  36 + return orderCreateSrc;
  37 + }
  38 + }
  39 + return null;
  40 + }
  41 +
  42 + public static String getNameByCode(int code) {
  43 + for (OrderCreateSrc orderCreateSrc : OrderCreateSrc.values()) {
  44 + if (orderCreateSrc.getCode() == code) {
  45 + return orderCreateSrc.name;
  46 + }
  47 + }
  48 + return null;
  49 + }
  50 +}
src/main/java/com/diligrp/xtrade/order/domain/emuns/OrderStatus.java
1 -package com.diligrp.xtrade.order.domain.emuns;  
2 -  
3 -/**  
4 - * @ClassName: OrderStatus  
5 - * @Description 订单状态枚举类  
6 - * @author zhangxing  
7 - * @date 2020年4月21日  
8 - */  
9 -public enum OrderStatus {  
10 -  
11 - /**  
12 - * 未支付  
13 - */  
14 - UNPAIED(1, "未支付");  
15 -  
16 - // 编码  
17 - private int code;  
18 -  
19 - // 名称  
20 - private String name;  
21 -  
22 - private OrderStatus(int code, String name) {  
23 - this.code = code;  
24 - this.name = name;  
25 - }  
26 -  
27 - public int getCode() {  
28 - return code;  
29 - }  
30 -  
31 - public String getName() {  
32 - return name;  
33 - }  
34 -  
35 - public static OrderStatus getByCode(int code) {  
36 - for (OrderStatus orderStatus : values()) {  
37 - if (orderStatus.getCode() == code) {  
38 - return orderStatus;  
39 - }  
40 - }  
41 - return null;  
42 - }  
43 -  
44 - public static String getNameByCode(int code) {  
45 - for (OrderStatus orderStatus : OrderStatus.values()) {  
46 - if (orderStatus.getCode() == code) {  
47 - return orderStatus.name;  
48 - }  
49 - }  
50 - return null;  
51 - }  
52 -} 1 +package com.diligrp.xtrade.order.domain.emuns;
  2 +
  3 +/**
  4 + * @ClassName: OrderStatus
  5 + * @Description 订单状态枚举类
  6 + * @author zhangxing
  7 + * @date 2020年4月21日
  8 + */
  9 +public enum OrderStatus {
  10 +
  11 + /**
  12 + * 未支付
  13 + */
  14 + UNPAIED(1, "未支付");
  15 +
  16 + // 编码
  17 + private int code;
  18 +
  19 + // 名称
  20 + private String name;
  21 +
  22 + OrderStatus(int code, String name) {
  23 + this.code = code;
  24 + this.name = name;
  25 + }
  26 +
  27 + public int getCode() {
  28 + return code;
  29 + }
  30 +
  31 + public String getName() {
  32 + return name;
  33 + }
  34 +
  35 + public static OrderStatus getByCode(int code) {
  36 + for (OrderStatus orderStatus : values()) {
  37 + if (orderStatus.getCode() == code) {
  38 + return orderStatus;
  39 + }
  40 + }
  41 + return null;
  42 + }
  43 +
  44 + public static String getNameByCode(int code) {
  45 + for (OrderStatus orderStatus : OrderStatus.values()) {
  46 + if (orderStatus.getCode() == code) {
  47 + return orderStatus.name;
  48 + }
  49 + }
  50 + return null;
  51 + }
  52 +}
src/main/java/com/diligrp/xtrade/order/domain/emuns/OrderType.java
1 -package com.diligrp.xtrade.order.domain.emuns;  
2 -  
3 -/**  
4 - *  
5 - * @ClassName: OrderType  
6 - * @Description 订单类型枚举类  
7 - * @author zhangxing  
8 - * @date 2020年4月22日  
9 - */  
10 -public enum OrderType {  
11 -  
12 - //普通交易  
13 - NORMAL(1, "普通");  
14 -  
15 - // 编码  
16 - private int code;  
17 -  
18 - // 名称  
19 - private String name;  
20 -  
21 - private OrderType(int code, String name) {  
22 - this.code = code;  
23 - this.name = name;  
24 - }  
25 -  
26 - public int getCode() {  
27 - return code;  
28 - }  
29 -  
30 - public String getName() {  
31 - return name;  
32 - }  
33 -  
34 - public static OrderType getByCode(int code) {  
35 - for (OrderType orderType : values()) {  
36 - if (orderType.getCode() == code) {  
37 - return orderType;  
38 - }  
39 - }  
40 - return null;  
41 - }  
42 -  
43 - public static String getNameByCode(int code) {  
44 - for (OrderType orderType : OrderType.values()) {  
45 - if (orderType.getCode() == code) {  
46 - return orderType.name;  
47 - }  
48 - }  
49 - return null;  
50 - }  
51 -} 1 +package com.diligrp.xtrade.order.domain.emuns;
  2 +
  3 +/**
  4 + *
  5 + * @ClassName: OrderType
  6 + * @Description 订单类型枚举类
  7 + * @author zhangxing
  8 + * @date 2020年4月22日
  9 + */
  10 +public enum OrderType {
  11 +
  12 + //普通交易
  13 + NORMAL(1, "普通");
  14 +
  15 + // 编码
  16 + private int code;
  17 +
  18 + // 名称
  19 + private String name;
  20 +
  21 + OrderType(int code, String name) {
  22 + this.code = code;
  23 + this.name = name;
  24 + }
  25 +
  26 + public int getCode() {
  27 + return code;
  28 + }
  29 +
  30 + public String getName() {
  31 + return name;
  32 + }
  33 +
  34 + public static OrderType getByCode(int code) {
  35 + for (OrderType orderType : values()) {
  36 + if (orderType.getCode() == code) {
  37 + return orderType;
  38 + }
  39 + }
  40 + return null;
  41 + }
  42 +
  43 + public static String getNameByCode(int code) {
  44 + for (OrderType orderType : OrderType.values()) {
  45 + if (orderType.getCode() == code) {
  46 + return orderType.name;
  47 + }
  48 + }
  49 + return null;
  50 + }
  51 +}
src/main/java/com/diligrp/xtrade/order/domain/emuns/PayType.java
1 -package com.diligrp.xtrade.order.domain.emuns;  
2 -  
3 -/**  
4 - * @ClassName: PayType  
5 - * @Description 支付方式枚举类  
6 - * @author zhangxing  
7 - * @date 2020年4月21日  
8 - */  
9 -public enum PayType {  
10 -  
11 - /**  
12 - * 未支付  
13 - */  
14 - ACCOUNT(1, "账户支付");  
15 -  
16 - // 编码  
17 - private int code;  
18 -  
19 - // 名称  
20 - private String name;  
21 -  
22 - private PayType(int code, String name) {  
23 - this.code = code;  
24 - this.name = name;  
25 - }  
26 -  
27 - public int getCode() {  
28 - return code;  
29 - }  
30 -  
31 - public String getName() {  
32 - return name;  
33 - }  
34 -  
35 - public static PayType getByCode(int code) {  
36 - for (PayType payType : values()) {  
37 - if (payType.getCode() == code) {  
38 - return payType;  
39 - }  
40 - }  
41 - return null;  
42 - }  
43 -  
44 - public static String getNameByCode(int code) {  
45 - for (PayType payType : PayType.values()) {  
46 - if (payType.getCode() == code) {  
47 - return payType.name;  
48 - }  
49 - }  
50 - return null;  
51 - }  
52 -} 1 +package com.diligrp.xtrade.order.domain.emuns;
  2 +
  3 +/**
  4 + * @ClassName: PayType
  5 + * @Description 支付方式枚举类
  6 + * @author zhangxing
  7 + * @date 2020年4月21日
  8 + */
  9 +public enum PayType {
  10 +
  11 + /**
  12 + * 未支付
  13 + */
  14 + ACCOUNT(1, "账户支付");
  15 +
  16 + // 编码
  17 + private int code;
  18 +
  19 + // 名称
  20 + private String name;
  21 +
  22 + PayType(int code, String name) {
  23 + this.code = code;
  24 + this.name = name;
  25 + }
  26 +
  27 + public int getCode() {
  28 + return code;
  29 + }
  30 +
  31 + public String getName() {
  32 + return name;
  33 + }
  34 +
  35 + public static PayType getByCode(int code) {
  36 + for (PayType payType : values()) {
  37 + if (payType.getCode() == code) {
  38 + return payType;
  39 + }
  40 + }
  41 + return null;
  42 + }
  43 +
  44 + public static String getNameByCode(int code) {
  45 + for (PayType payType : PayType.values()) {
  46 + if (payType.getCode() == code) {
  47 + return payType.name;
  48 + }
  49 + }
  50 + return null;
  51 + }
  52 +}
src/main/java/com/diligrp/xtrade/order/domain/emuns/SaleUnit.java
1 -package com.diligrp.xtrade.order.domain.emuns;  
2 -  
3 -/**  
4 - * @ClassName: SaleUnit  
5 - * @Description 销售单位枚举类  
6 - * @author zhangxing  
7 - * @date 2020年4月21日  
8 - */  
9 -public enum SaleUnit {  
10 -  
11 - /**  
12 - * 单位斤  
13 - */  
14 - KILO(1, "斤"),  
15 -  
16 - /**  
17 - * 单位件  
18 - */  
19 - PIECE(2, "斤");  
20 -  
21 - // 编码  
22 - private int code;  
23 -  
24 - // 名称  
25 - private String name;  
26 -  
27 - private SaleUnit(int code, String name) {  
28 - this.code = code;  
29 - this.name = name;  
30 - }  
31 -  
32 - public int getCode() {  
33 - return code;  
34 - }  
35 -  
36 - public String getName() {  
37 - return name;  
38 - }  
39 -  
40 - public static SaleUnit getByCode(int code) {  
41 - for (SaleUnit saleUnit : values()) {  
42 - if (saleUnit.getCode() == code) {  
43 - return saleUnit;  
44 - }  
45 - }  
46 - return null;  
47 - }  
48 -  
49 - public static String getNameByCode(int code) {  
50 - for (SaleUnit saleUnit : SaleUnit.values()) {  
51 - if (saleUnit.getCode() == code) {  
52 - return saleUnit.name;  
53 - }  
54 - }  
55 - return null;  
56 - }  
57 -  
58 -} 1 +package com.diligrp.xtrade.order.domain.emuns;
  2 +
  3 +/**
  4 + * @ClassName: SaleUnit
  5 + * @Description 销售单位枚举类
  6 + * @author zhangxing
  7 + * @date 2020年4月21日
  8 + */
  9 +public enum SaleUnit {
  10 +
  11 + /**
  12 + * 单位斤
  13 + */
  14 + KILO(1, "斤"),
  15 +
  16 + /**
  17 + * 单位件
  18 + */
  19 + PIECE(2, "斤");
  20 +
  21 + // 编码
  22 + private int code;
  23 +
  24 + // 名称
  25 + private String name;
  26 +
  27 + SaleUnit(int code, String name) {
  28 + this.code = code;
  29 + this.name = name;
  30 + }
  31 +
  32 + public int getCode() {
  33 + return code;
  34 + }
  35 +
  36 + public String getName() {
  37 + return name;
  38 + }
  39 +
  40 + public static SaleUnit getByCode(int code) {
  41 + for (SaleUnit saleUnit : values()) {
  42 + if (saleUnit.getCode() == code) {
  43 + return saleUnit;
  44 + }
  45 + }
  46 + return null;
  47 + }
  48 +
  49 + public static String getNameByCode(int code) {
  50 + for (SaleUnit saleUnit : SaleUnit.values()) {
  51 + if (saleUnit.getCode() == code) {
  52 + return saleUnit.name;
  53 + }
  54 + }
  55 + return null;
  56 + }
  57 +
  58 +}
src/main/java/com/diligrp/xtrade/order/domain/emuns/TradeType.java
1 -package com.diligrp.xtrade.order.domain.emuns;  
2 -  
3 -/**  
4 - *  
5 - * @ClassName: TradeType  
6 - * @Description 订单交易类型枚举类  
7 - * @author zhangxing  
8 - * @date 2020年4月22日  
9 - */  
10 -public enum TradeType {  
11 -  
12 - //普通交易  
13 - NORMAL(1, "普通");  
14 -  
15 - // 编码  
16 - private int code;  
17 -  
18 - // 名称  
19 - private String name;  
20 -  
21 - private TradeType(int code, String name) {  
22 - this.code = code;  
23 - this.name = name;  
24 - }  
25 -  
26 - public int getCode() {  
27 - return code;  
28 - }  
29 -  
30 - public String getName() {  
31 - return name;  
32 - }  
33 -  
34 - public static TradeType getByCode(int code) {  
35 - for (TradeType tradeType : values()) {  
36 - if (tradeType.getCode() == code) {  
37 - return tradeType;  
38 - }  
39 - }  
40 - return null;  
41 - }  
42 -  
43 - public static String getNameByCode(int code) {  
44 - for (TradeType tradeType : TradeType.values()) {  
45 - if (tradeType.getCode() == code) {  
46 - return tradeType.name;  
47 - }  
48 - }  
49 - return null;  
50 - }  
51 -} 1 +package com.diligrp.xtrade.order.domain.emuns;
  2 +
  3 +/**
  4 + *
  5 + * @ClassName: TradeType
  6 + * @Description 订单交易类型枚举类
  7 + * @author zhangxing
  8 + * @date 2020年4月22日
  9 + */
  10 +public enum TradeType {
  11 +
  12 + //普通交易
  13 + NORMAL(1, "普通");
  14 +
  15 + // 编码
  16 + private int code;
  17 +
  18 + // 名称
  19 + private String name;
  20 +
  21 + TradeType(int code, String name) {
  22 + this.code = code;
  23 + this.name = name;
  24 + }
  25 +
  26 + public int getCode() {
  27 + return code;
  28 + }
  29 +
  30 + public String getName() {
  31 + return name;
  32 + }
  33 +
  34 + public static TradeType getByCode(int code) {
  35 + for (TradeType tradeType : values()) {
  36 + if (tradeType.getCode() == code) {
  37 + return tradeType;
  38 + }
  39 + }
  40 + return null;
  41 + }
  42 +
  43 + public static String getNameByCode(int code) {
  44 + for (TradeType tradeType : TradeType.values()) {
  45 + if (tradeType.getCode() == code) {
  46 + return tradeType.name;
  47 + }
  48 + }
  49 + return null;
  50 + }
  51 +}
src/main/java/com/diligrp/xtrade/order/rpc/feign/AccountRPC.java
1 -package com.diligrp.xtrade.order.rpc.feign;  
2 -  
3 -import org.springframework.cloud.openfeign.FeignClient;  
4 -import org.springframework.web.bind.annotation.RequestMapping;  
5 -  
6 -import com.diligrp.xtrade.order.domain.dto.AccountDto;  
7 -import com.diligrp.xtrade.shared.domain.Message;  
8 -  
9 -@FeignClient(value = "user-service")  
10 -public interface AccountRPC {  
11 -  
12 - @RequestMapping("/dltAccount/getDltAccount")  
13 - public Message<AccountDto> getDltAccount(Long account);  
14 -  
15 -} 1 +package com.diligrp.xtrade.order.rpc.feign;
  2 +
  3 +import org.springframework.cloud.openfeign.FeignClient;
  4 +import org.springframework.web.bind.annotation.RequestMapping;
  5 +
  6 +import com.diligrp.xtrade.order.domain.dto.AccountDto;
  7 +import com.diligrp.xtrade.shared.domain.Message;
  8 +
  9 +@FeignClient(value = "user-service")
  10 +public interface AccountRPC {
  11 +
  12 + @RequestMapping("/dltAccount/getDltAccount")
  13 + Message<AccountDto> getDltAccount(Long account);
  14 +
  15 +}
src/main/java/com/diligrp/xtrade/product/domain/dto/ShopDto.java
1 -package com.diligrp.xtrade.product.domain.dto;  
2 -  
3 -import javax.validation.constraints.Max;  
4 -import javax.validation.constraints.NotBlank;  
5 -import javax.validation.constraints.Pattern;  
6 -  
7 -import org.hibernate.validator.constraints.Length;  
8 -  
9 -/**  
10 - * @ClassName: ShopDTO  
11 - * @Description TODO(用一句话描述该文件做什么)  
12 - * @author yangfan  
13 - * @date 2020年4月21日  
14 - */  
15 -public class ShopDto {  
16 -  
17 - /**  
18 - * 商户id  
19 - */  
20 - private Long merId;  
21 -  
22 - /**  
23 - * 店铺id  
24 - */  
25 - private Long shopId;  
26 -  
27 - /**  
28 - * 店铺名称  
29 - */  
30 - @NotBlank(message = "商铺名称不能为空")  
31 - private String shopName;  
32 -  
33 - /**  
34 - * 店铺类型  
35 - */  
36 - @Pattern(regexp = "^(20|10)$",message = "店铺类型错误")  
37 - private Integer type;  
38 -  
39 - /**  
40 - * 店铺状态  
41 - */  
42 - @Pattern(regexp = "^(1|2)$")  
43 - private Integer status;  
44 -  
45 - /**  
46 - * 是否自营  
47 - */  
48 - @Pattern(regexp = "^(1|2)$")  
49 - private Integer selfShop;  
50 -  
51 - /**  
52 - * 主营业务  
53 - */  
54 - @NotBlank(message = "业务描述不能为空")  
55 - @Length(max = 200,message = "业务描述不超过200字")  
56 - private String mainBiz;  
57 -  
58 - /**  
59 - * 地址  
60 - */  
61 - private String address;  
62 -  
63 - /**  
64 - * 描述  
65 - */  
66 - @NotBlank(message = "店铺描述不能为空")  
67 - @Length(max = 200,message = "店铺描述不超过200字")  
68 - private String description;  
69 -  
70 - public Long getMerId() {  
71 - return merId;  
72 - }  
73 -  
74 - public void setMerId(Long merId) {  
75 - this.merId = merId;  
76 - }  
77 -  
78 - public Long getShopId() {  
79 - return shopId;  
80 - }  
81 -  
82 - public void setShopId(Long shopId) {  
83 - this.shopId = shopId;  
84 - }  
85 -  
86 - public String getShopName() {  
87 - return shopName;  
88 - }  
89 -  
90 - public void setShopName(String shopName) {  
91 - this.shopName = shopName;  
92 - }  
93 -  
94 - public Integer getType() {  
95 - return type;  
96 - }  
97 -  
98 - public void setType(Integer type) {  
99 - this.type = type;  
100 - }  
101 -  
102 - public Integer getStatus() {  
103 - return status;  
104 - }  
105 -  
106 - public void setStatus(Integer status) {  
107 - this.status = status;  
108 - }  
109 -  
110 -  
111 - public Integer getSelfShop() {  
112 - return selfShop;  
113 - }  
114 -  
115 - public void setSelfShop(Integer selfShop) {  
116 - this.selfShop = selfShop;  
117 - }  
118 -  
119 -  
120 - public String getMainBiz() {  
121 - return mainBiz;  
122 - }  
123 -  
124 - public void setMainBiz(String mainBiz) {  
125 - this.mainBiz = mainBiz;  
126 - }  
127 -  
128 - public String getAddress() {  
129 - return address;  
130 - }  
131 -  
132 - public void setAddress(String address) {  
133 - this.address = address;  
134 - }  
135 -  
136 - public String getDescription() {  
137 - return description;  
138 - }  
139 -  
140 - public void setDescription(String description) {  
141 - this.description = description;  
142 - }  
143 -  
144 -} 1 +package com.diligrp.xtrade.product.domain.dto;
  2 +
  3 +import javax.validation.constraints.Max;
  4 +import javax.validation.constraints.NotBlank;
  5 +import javax.validation.constraints.Pattern;
  6 +
  7 +import org.hibernate.validator.constraints.Length;
  8 +
  9 +/**
  10 + * @ClassName: ShopDTO
  11 + * @Description TODO(用一句话描述该文件做什么)
  12 + * @author yangfan
  13 + * @date 2020年4月21日
  14 + */
  15 +public class ShopDto {
  16 +
  17 + /**
  18 + * 商户id
  19 + */
  20 + private Long merId;
  21 +
  22 + /**
  23 + * 店铺id
  24 + */
  25 + private Long shopId;
  26 +
  27 + /**
  28 + * 店铺名称
  29 + */
  30 + @NotBlank(message = "商铺名称不能为空")
  31 + private String shopName;
  32 +
  33 + /**
  34 + * 店铺类型
  35 + */
  36 + @Pattern(regexp = "^(20|10)$",message = "店铺类型错误")
  37 + private Integer type;
  38 +
  39 + /**
  40 + * 店铺状态
  41 + */
  42 + @Pattern(regexp = "^([12])$")
  43 + private Integer status;
  44 +
  45 + /**
  46 + * 是否自营
  47 + */
  48 + @Pattern(regexp = "^([12])$")
  49 + private Integer selfShop;
  50 +
  51 + /**
  52 + * 主营业务
  53 + */
  54 + @NotBlank(message = "业务描述不能为空")
  55 + @Length(max = 200,message = "业务描述不超过200字")
  56 + private String mainBiz;
  57 +
  58 + /**
  59 + * 地址
  60 + */
  61 + private String address;
  62 +
  63 + /**
  64 + * 描述
  65 + */
  66 + @NotBlank(message = "店铺描述不能为空")
  67 + @Length(max = 200,message = "店铺描述不超过200字")
  68 + private String description;
  69 +
  70 + public Long getMerId() {
  71 + return merId;
  72 + }
  73 +
  74 + public void setMerId(Long merId) {
  75 + this.merId = merId;
  76 + }
  77 +
  78 + public Long getShopId() {
  79 + return shopId;
  80 + }
  81 +
  82 + public void setShopId(Long shopId) {
  83 + this.shopId = shopId;
  84 + }
  85 +
  86 + public String getShopName() {
  87 + return shopName;
  88 + }
  89 +
  90 + public void setShopName(String shopName) {
  91 + this.shopName = shopName;
  92 + }
  93 +
  94 + public Integer getType() {
  95 + return type;
  96 + }
  97 +
  98 + public void setType(Integer type) {
  99 + this.type = type;
  100 + }
  101 +
  102 + public Integer getStatus() {
  103 + return status;
  104 + }
  105 +
  106 + public void setStatus(Integer status) {
  107 + this.status = status;
  108 + }
  109 +
  110 +
  111 + public Integer getSelfShop() {
  112 + return selfShop;
  113 + }
  114 +
  115 + public void setSelfShop(Integer selfShop) {
  116 + this.selfShop = selfShop;
  117 + }
  118 +
  119 +
  120 + public String getMainBiz() {
  121 + return mainBiz;
  122 + }
  123 +
  124 + public void setMainBiz(String mainBiz) {
  125 + this.mainBiz = mainBiz;
  126 + }
  127 +
  128 + public String getAddress() {
  129 + return address;
  130 + }
  131 +
  132 + public void setAddress(String address) {
  133 + this.address = address;
  134 + }
  135 +
  136 + public String getDescription() {
  137 + return description;
  138 + }
  139 +
  140 + public void setDescription(String description) {
  141 + this.description = description;
  142 + }
  143 +
  144 +}
src/main/java/com/diligrp/xtrade/product/domain/emuns/AccountStatus.java
1 /** 1 /**
2 * Copyright (c) 2016 www.diligrp.com All rights reserved. <br /> 2 * Copyright (c) 2016 www.diligrp.com All rights reserved. <br />
3 * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br /> 3 * 本软件源代码版权归地利集团,未经许可不得任意复制与传播.<br />
4 - *  
5 */ 4 */
6 package com.diligrp.xtrade.product.domain.emuns; 5 package com.diligrp.xtrade.product.domain.emuns;
7 6
@@ -14,13 +13,12 @@ import java.util.Arrays; @@ -14,13 +13,12 @@ import java.util.Arrays;
14 */ 13 */
15 public enum AccountStatus implements IEnumType { 14 public enum AccountStatus implements IEnumType {
16 NORMAL(1, "正常"), 15 NORMAL(1, "正常"),
17 - LOCKED(2, "锁定")  
18 - ; 16 + LOCKED(2, "锁定");
19 17
20 private int code; 18 private int code;
21 private String name; 19 private String name;
22 20
23 - AccountStatus(int code, String name) { 21 + AccountStatus(int code, String name) {
24 this.code = code; 22 this.code = code;
25 this.name = name; 23 this.name = name;
26 } 24 }
src/main/java/com/diligrp/xtrade/product/domain/emuns/AccountType.java
@@ -10,34 +10,31 @@ import java.util.Arrays; @@ -10,34 +10,31 @@ import java.util.Arrays;
10 * @Auther: miaoguoxin 10 * @Auther: miaoguoxin
11 * @Date: 2020/4/21 16:13 11 * @Date: 2020/4/21 16:13
12 */ 12 */
13 -public enum AccountType implements IEnumType { 13 +public enum AccountType implements IEnumType {
  14 + /**个人账户*/
14 PERSONAL(10, "个人账户"), 15 PERSONAL(10, "个人账户"),
15 - 16 + /**对公账户*/
16 PUBLIC(20, "对公账户"), 17 PUBLIC(20, "对公账户"),
17 -  
18 /**临时卡用*/ 18 /**临时卡用*/
19 ANONYMOUS(30, "不记名"); 19 ANONYMOUS(30, "不记名");
20 20
21 private int code; 21 private int code;
22 private String name; 22 private String name;
23 23
24 - AccountType(int code,String name)  
25 - { 24 + AccountType(int code, String name) {
26 this.name = name; 25 this.name = name;
27 this.code = code; 26 this.code = code;
28 } 27 }
29 28
30 @JsonCreator 29 @JsonCreator
31 - public static AccountType getAccountType(int code)  
32 - { 30 + public static AccountType getAccountType(int code) {
33 return Arrays.stream(AccountType.values()) 31 return Arrays.stream(AccountType.values())
34 .filter(type -> type.getCode() == code) 32 .filter(type -> type.getCode() == code)
35 .findFirst() 33 .findFirst()
36 .orElse(null); 34 .orElse(null);
37 } 35 }
38 36
39 - public static String getName(int code)  
40 - { 37 + public static String getName(int code) {
41 return Arrays.stream(AccountType.values()) 38 return Arrays.stream(AccountType.values())
42 .filter(type -> type.getCode() == code) 39 .filter(type -> type.getCode() == code)
43 .findFirst() 40 .findFirst()
@@ -46,15 +43,13 @@ public enum AccountType implements IEnumType { @@ -46,15 +43,13 @@ public enum AccountType implements IEnumType {
46 } 43 }
47 44
48 @Override 45 @Override
49 - public String getName()  
50 - { 46 + public String getName() {
51 return this.name; 47 return this.name;
52 } 48 }
53 49
54 @Override 50 @Override
55 @JsonValue 51 @JsonValue
56 - public int getCode()  
57 - { 52 + public int getCode() {
58 return this.code; 53 return this.code;
59 } 54 }
60 55
src/main/java/com/diligrp/xtrade/product/domain/emuns/IKeyGeneratorKeys.java
@@ -2,31 +2,31 @@ package com.diligrp.xtrade.product.domain.emuns; @@ -2,31 +2,31 @@ package com.diligrp.xtrade.product.domain.emuns;
2 2
3 3
4 /** 4 /**
  5 + * @author yangfan
5 * @ClassName: IKeyGeneratorKeys 6 * @ClassName: IKeyGeneratorKeys
6 * @Description id生成key配置 7 * @Description id生成key配置
7 - * @author yangfan  
8 * @date 2020年4月21日 8 * @date 2020年4月21日
9 */ 9 */
10 public enum IKeyGeneratorKeys { 10 public enum IKeyGeneratorKeys {
11 - CATEGORY_SEQUENCE("CATEGORY_SEQUENCE","品类id"),  
12 - SHOP_SEQUENCE("SHOP_SEQUENCE","店铺id"),  
13 - MERCHANT_SEQUENCE("MERCHANT_SEQUENCE","市场id"),  
14 - ACCOUNT_SEQUENCE("ACCOUNT_SEQUENCE","账号id"),  
15 - ; 11 + CATEGORY_SEQUENCE("CATEGORY_SEQUENCE", "品类id"),
  12 + SHOP_SEQUENCE("SHOP_SEQUENCE", "店铺id"),
  13 + MERCHANT_SEQUENCE("MERCHANT_SEQUENCE", "市场id"),
  14 + ACCOUNT_SEQUENCE("ACCOUNT_SEQUENCE", "账号id"),
  15 + ;
16 16
17 - private String code;  
18 - private String name; 17 + private String code;
  18 + private String name;
19 19
20 - IKeyGeneratorKeys(String code, String name) {  
21 - this.code = code;  
22 - this.name = name;  
23 - } 20 + IKeyGeneratorKeys(String code, String name) {
  21 + this.code = code;
  22 + this.name = name;
  23 + }
24 24
25 - public String getCode() {  
26 - return code;  
27 - } 25 + public String getCode() {
  26 + return code;
  27 + }
28 28
29 - public String getName() {  
30 - return name;  
31 - } 29 + public String getName() {
  30 + return name;
  31 + }
32 } 32 }
src/main/java/com/diligrp/xtrade/product/domain/emuns/MerchantStatus.java
@@ -8,7 +8,7 @@ import java.util.Arrays; @@ -8,7 +8,7 @@ import java.util.Arrays;
8 * @Auther: miaoguoxin 8 * @Auther: miaoguoxin
9 * @Date: 2020/4/21 16:31 9 * @Date: 2020/4/21 16:31
10 */ 10 */
11 -public enum MerchantStatus implements IEnumType { 11 +public enum MerchantStatus implements IEnumType {
12 NORMAL(1, "正常"), 12 NORMAL(1, "正常"),
13 LIMITED(2, "受限"); 13 LIMITED(2, "受限");
14 14
@@ -28,6 +28,7 @@ public enum MerchantStatus implements IEnumType { @@ -28,6 +28,7 @@ public enum MerchantStatus implements IEnumType {
28 public int getCode() { 28 public int getCode() {
29 return this.type; 29 return this.type;
30 } 30 }
  31 +
31 @Override 32 @Override
32 public String getName() { 33 public String getName() {
33 return this.name; 34 return this.name;
src/main/java/com/diligrp/xtrade/product/domain/emuns/ShopStatus.java
@@ -2,40 +2,41 @@ package com.diligrp.xtrade.product.domain.emuns; @@ -2,40 +2,41 @@ package com.diligrp.xtrade.product.domain.emuns;
2 2
3 3
4 public enum ShopStatus { 4 public enum ShopStatus {
5 - OPEN(1, "开店"), OFF(2, "关店");  
6 -  
7 - private Integer code;  
8 - private String name;  
9 -  
10 - private ShopStatus(Integer code, String name) {  
11 - this.code = code;  
12 - this.name = name;  
13 - }  
14 -  
15 - public int getCode() {  
16 - return code;  
17 - }  
18 -  
19 - public String getName() {  
20 - return name;  
21 - }  
22 -  
23 - public static ShopStatus getByCode(int code) {  
24 - for (ShopStatus shopStatus : values()) {  
25 - if (shopStatus.getCode() == code) {  
26 - return shopStatus;  
27 - }  
28 - }  
29 - return null;  
30 - }  
31 -  
32 - public static String getNameByCode(int code) {  
33 - for (ShopStatus shopStatus : ShopStatus.values()) {  
34 - if (shopStatus.getCode() == code) {  
35 - return shopStatus.name;  
36 - }  
37 - }  
38 - return null;  
39 - } 5 + OPEN(1, "开店"),
  6 + OFF(2, "关店");
  7 +
  8 + private Integer code;
  9 + private String name;
  10 +
  11 + ShopStatus(Integer code, String name) {
  12 + this.code = code;
  13 + this.name = name;
  14 + }
  15 +
  16 + public int getCode() {
  17 + return code;
  18 + }
  19 +
  20 + public String getName() {
  21 + return name;
  22 + }
  23 +
  24 + public static ShopStatus getByCode(int code) {
  25 + for (ShopStatus shopStatus : values()) {
  26 + if (shopStatus.getCode() == code) {
  27 + return shopStatus;
  28 + }
  29 + }
  30 + return null;
  31 + }
  32 +
  33 + public static String getNameByCode(int code) {
  34 + for (ShopStatus shopStatus : ShopStatus.values()) {
  35 + if (shopStatus.getCode() == code) {
  36 + return shopStatus.name;
  37 + }
  38 + }
  39 + return null;
  40 + }
40 41
41 } 42 }
src/main/resources/mapping/com/diligrp/xtrade/order/OrderItemDao.xml
1 -<?xml version="1.0" encoding="UTF-8"?>  
2 -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">  
3 -<mapper namespace="com.diligrp.xtrade.order.dao.OrderItemDao">  
4 -  
5 - <sql id="QUERY_COLUMN_LIST">  
6 - <![CDATA[  
7 - `item_id` AS itemId, `order_id` AS orderId, `product_name` AS productName, `product_id` AS productId, `cate_id` AS cateId, `cate_name` AS cateName, `price`, `amount`, `sale_unit` AS saleUnit, `unit_weight` AS unitWeight, `scommission`, `bcommission`, `rule_id` ruleId, `rule_rate` ruleRate, `weight`, `total_money` AS totalMoney  
8 - ]]>  
9 - </sql>  
10 -  
11 - <insert id="insertEntity">  
12 - INSERT INTO `xt_order_item`(`item_id`, `order_id`, `product_name`, `product_id`, `price`, `amount`, `sale_unit`, `unit_weight`, `scommission`, `bcommission`, `rule_id`, `rule_rate`, `weight`, `total_money`, `created_time`, `modified_time`)  
13 - VALUES (#{itemId}, #{orderId}, #{productName}, #{productId}, #{price}, #{amount}, #{saleUnit}, #{unitWeight}, #{scommission}, #{bcommission}, #{ruleid}, #{ruleRate}, #{}weight, #{totalMoney}, NOW(), NOW());  
14 - </insert>  
15 -  
16 - <select id="selectItemsByOrderId" parameterType="long" resultType="orderItemDo">  
17 - SELECT  
18 - <include refid="QUERY_COLUMN_LIST"/>  
19 - FROM `xt_order_item`  
20 - WHERE item_id =#{itemId}  
21 - </select>  
22 -  
23 - <select id="selectOrderItemByOrderId" parameterType="long" resultType="orderItemDo">  
24 - SELECT  
25 - <include refid="QUERY_COLUMN_LIST"/>  
26 - FROM `xt_order_item`  
27 - WHERE order_id =#{orderId}  
28 - </select>  
29 -  
30 - <update id="updateCommission">  
31 - UPDATE `xt_order_item` SET `scommission`=#{scommission}, `bcommission`=#{bcommission}, `rule_id`=#{ruleId}, `rule_rate`=#{ruleRate},modified_time = NOW() WHERE item_id = #{itemId}  
32 - </update>  
33 -  
34 -</mapper>  
35 \ No newline at end of file 1 \ No newline at end of file
  2 +<?xml version="1.0" encoding="UTF-8"?>
  3 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4 +<mapper namespace="com.diligrp.xtrade.order.dao.OrderItemDao">
  5 +
  6 + <sql id="QUERY_COLUMN_LIST">
  7 + <![CDATA[
  8 + `item_id` AS itemId, `order_id` AS orderId, `product_name` AS productName, `product_id` AS productId, `cate_id` AS cateId, `cate_name` AS cateName, `price`, `amount`, `sale_unit` AS saleUnit, `unit_weight` AS unitWeight, `scommission`, `bcommission`, `rule_id` ruleId, `rule_rate` ruleRate, `weight`, `total_money` AS totalMoney
  9 + ]]>
  10 + </sql>
  11 +
  12 + <insert id="insertEntity">
  13 + INSERT INTO `xt_order_item`(`item_id`, `order_id`, `product_name`, `product_id`, `price`, `amount`, `sale_unit`,
  14 + `unit_weight`, `scommission`, `bcommission`, `rule_id`, `rule_rate`, `weight`, `total_money`,
  15 + `created_time`, `modified_time`)
  16 + VALUES (#{itemId}, #{orderId}, #{productName}, #{productId}, #{price}, #{amount}, #{saleUnit}, #{unitWeight},
  17 + #{scommission}, #{bcommission}, #{ruleid}, #{ruleRate}, #{}weight, #{totalMoney}, NOW(), NOW());
  18 + </insert>
  19 + <insert id="insertBatch" parameterType="java.util.List">
  20 + INSERT INTO xt_order_item(item_id, order_id, product_name, product_id, cate_id, cate_name, price, amount, sale_unit,
  21 + unit_weight, scommission, bcommission, rule_id, rule_rate, weight, total_money, created_time, modified_time)
  22 + VALUES
  23 + <foreach collection="list" item="item" index="index" separator=",">
  24 + (
  25 + #{item.itemId},
  26 + #{item.orderId},
  27 + #{item.productName},
  28 + #{item.productId},
  29 + null,
  30 + null,
  31 + #{item.price},
  32 + #{item.amount},
  33 + #{item.saleUnit},
  34 + #{item.unitWeight},
  35 + #{item.scommission},
  36 + #{item.bcommission},
  37 + #{item.ruleId},
  38 + #{item.ruleRate},
  39 + #{item.weight},
  40 + #{item.money},
  41 + now(),
  42 + now()
  43 + )
  44 + </foreach>
  45 + </insert>
  46 +
  47 + <select id="selectItemsByOrderId" parameterType="long" resultType="orderItemDo">
  48 + SELECT
  49 + <include refid="QUERY_COLUMN_LIST"/>
  50 + FROM `xt_order_item`
  51 + WHERE item_id =#{itemId}
  52 + </select>
  53 +
  54 + <update id="updateCommission">
  55 + UPDATE `xt_order_item`
  56 + SET `scommission`=#{scommission},
  57 + `bcommission`=#{bcommission},
  58 + `rule_id`=#{ruleId},
  59 + `rule_rate`=#{ruleRate},
  60 + modified_time = NOW()
  61 + WHERE item_id = #{itemId}
  62 + </update>
  63 +
  64 +</mapper>
src/main/resources/mapping/com/diligrp/xtrade/product/CategoryDao.xml
1 -<?xml version="1.0" encoding="UTF-8" ?>  
2 -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"  
3 - "http://mybatis.org/dtd/mybatis-3-mapper.dtd">  
4 -<mapper namespace="com.diligrp.xtrade.product.dao.CategoryDao">  
5 -  
6 - <!-- etrade_product 所有查询列 -->  
7 - <sql id="QUERY_COLUMN_LIST">  
8 - <![CDATA[`id`, `cate_code` AS cateCode, `cname`, `short_name` AS shortName, `status`, `level`, `type`, `icon`, `image`, `valid_day` AS validDay, `created_time` AS createdTime, `modified_time` AS modifiedTime, `market_id` AS marketId]]>  
9 - </sql>  
10 - <sql id="UPDATE_COLUMN_SET">  
11 - <set>  
12 - <if test="cname != null"><![CDATA[cname = #{cname},]]></if>  
13 - <if test="categoryId != null"><![CDATA[cate_code = #{cateCode},]]></if>  
14 - <if test="status != null"><![CDATA[status = #{status},]]></if>  
15 - <if test="hasChild != null"><![CDATA[has_child = #{hasChild},]]></if>  
16 - <if test="shortName != null"><![CDATA[short_name = #{shortName},]]></if>  
17 - <if test="icon != null"><![CDATA[icon = #{icon},]]></if>  
18 - <if test="cateLevel != null"><![CDATA[cate_level = #{cateLevel},]]></if>  
19 - <if test="image != null"><![CDATA[image = #{image},]]></if>  
20 - <if test="validDay != null"><![CDATA[valid_day = #{validDay},]]></if>  
21 - </set>  
22 - </sql>  
23 - <sql id="QUERY_WHERE_CLAUSE">  
24 - <where>  
25 - <if test="cname != null and cname != ''"><![CDATA[AND cname = #{cname}]]></if>  
26 - <if test="status != null and status != ''"><![CDATA[AND status = #{status}]]></if>  
27 - <if test="cateLevel != null "><![CDATA[AND cate_level = #{cateLevel}]]></if>  
28 - <if test="shortName != null and shortName != ''"><![CDATA[AND short_name = #{shortName}]]></if>  
29 - <if test="cateCode != null and cateCode != ''"><![CDATA[AND cate_code = #{cateCode}]]></if>  
30 - </where>  
31 - </sql>  
32 - <insert id="insert" parameterType="com.diligrp.xtrade.product.domain.entity.CategoryDo">  
33 - <![CDATA[  
34 - INSERT INTO `category`(`id`, `cateCode`, `cname`, `short_name`, `status`, `level`, `type`, `icon`, `image`, `valid_day`, `created_time`, `modified_time`, `market_id`) VALUES  
35 - (#{id}, #{cate_code}, #{sname}, #{shortName}, #{status}, #{level}, #{type}, #{icon}, #{image}, #{validDay}, now(), now(), #{marketId});  
36 - ]]>  
37 - </insert>  
38 - <select id="selectEntityById" parameterType="long">  
39 - <![CDATA[  
40 - SELECT  
41 - ]]>  
42 - <include refid="QUERY_COLUMN_LIST"/>  
43 - <![CDATA[  
44 - FROM `category` WHERE id = #{id};  
45 - ]]>  
46 - </select>  
47 - <update id="update" parameterType="com.diligrp.xtrade.product.domain.entity.CategoryDo">  
48 - <![CDATA[  
49 - UPDATE `category` SET  
50 - ]]>  
51 - <include refid="UPDATE_COLUMN_SET"/>  
52 - <![CDATA[  
53 - modify_date = now()  
54 - WHERE id = #{id}  
55 - ]]>  
56 - </update>  
57 - <update id="delect" parameterType="long">  
58 - <![CDATA[  
59 - UPDATE `category` SET status = 2 WHERE id = #{id};  
60 - ]]>  
61 - </update>  
62 - <select id="selectCateChild" parameterType="string">  
63 - <![CDATA[  
64 - SELECT  
65 - ]]>  
66 - <include refid="QUERY_COLUMN_LIST"/>  
67 - <![CDATA[  
68 - FROM `category` WHERE cate_code LIKE CONCAT(#{cateCode},"%");  
69 - ]]>  
70 - </select>  
71 -</mapper>  
72 \ No newline at end of file 1 \ No newline at end of file
  2 +<?xml version="1.0" encoding="UTF-8" ?>
  3 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5 +<mapper namespace="com.diligrp.xtrade.product.dao.CategoryDao">
  6 +
  7 + <!-- etrade_product 所有查询列 -->
  8 + <sql id="QUERY_COLUMN_LIST">
  9 + <![CDATA[`id`, `cate_code` AS cateCode, `cname`, `short_name` AS shortName, `status`, `level`, `type`, `icon`, `image`, `valid_day` AS validDay, `created_time` AS createdTime, `modified_time` AS modifiedTime, `market_id` AS marketId]]>
  10 + </sql>
  11 + <sql id="UPDATE_COLUMN_SET">
  12 + <set>
  13 + <if test="cname != null"><![CDATA[cname = #{cname},]]></if>
  14 + <if test="categoryId != null"><![CDATA[cate_code = #{cateCode},]]></if>
  15 + <if test="status != null"><![CDATA[status = #{status},]]></if>
  16 + <if test="hasChild != null"><![CDATA[has_child = #{hasChild},]]></if>
  17 + <if test="shortName != null"><![CDATA[short_name = #{shortName},]]></if>
  18 + <if test="icon != null"><![CDATA[icon = #{icon},]]></if>
  19 + <if test="cateLevel != null"><![CDATA[cate_level = #{cateLevel},]]></if>
  20 + <if test="image != null"><![CDATA[image = #{image},]]></if>
  21 + <if test="validDay != null"><![CDATA[valid_day = #{validDay},]]></if>
  22 + </set>
  23 + </sql>
  24 + <sql id="QUERY_WHERE_CLAUSE">
  25 + <where>
  26 + <if test="cname != null and cname != ''"><![CDATA[AND cname = #{cname}]]></if>
  27 + <if test="status != null and status != ''"><![CDATA[AND status = #{status}]]></if>
  28 + <if test="cateLevel != null "><![CDATA[AND cate_level = #{cateLevel}]]></if>
  29 + <if test="shortName != null and shortName != ''"><![CDATA[AND short_name = #{shortName}]]></if>
  30 + <if test="cateCode != null and cateCode != ''"><![CDATA[AND cate_code = #{cateCode}]]></if>
  31 + </where>
  32 + </sql>
  33 + <insert id="insert" parameterType="com.diligrp.xtrade.product.domain.entity.CategoryDo">
  34 + <![CDATA[
  35 + INSERT INTO `category`(`id`, `cate_code`, `cname`, `short_name`, `status`, `level`, `type`, `icon`, `image`, `valid_day`, `created_time`, `modified_time`, `market_id`) VALUES
  36 + (#{id}, #{cate_code}, #{sname}, #{shortName}, #{status}, #{level}, #{type}, #{icon}, #{image}, #{validDay}, now(), now(), #{marketId});
  37 + ]]>
  38 + </insert>
  39 + <select id="selectEntityById" parameterType="java.lang.Long" resultType="com.diligrp.xtrade.product.domain.entity.CategoryDo">
  40 + <![CDATA[
  41 + SELECT
  42 + ]]>
  43 + <include refid="QUERY_COLUMN_LIST"/>
  44 + <![CDATA[
  45 + FROM `category` WHERE id = #{id};
  46 + ]]>
  47 + </select>
  48 + <update id="update" parameterType="com.diligrp.xtrade.product.domain.entity.CategoryDo">
  49 + <![CDATA[
  50 + UPDATE `category` SET
  51 + ]]>
  52 + <include refid="UPDATE_COLUMN_SET"/>
  53 + <![CDATA[
  54 + modified_time = now()
  55 + WHERE id = #{id}
  56 + ]]>
  57 + </update>
  58 + <update id="delect" parameterType="long">
  59 + <![CDATA[
  60 + UPDATE `category` SET status = 2 WHERE id = #{id};
  61 + ]]>
  62 + </update>
  63 + <select id="selectCateChild" parameterType="string" resultType="com.diligrp.xtrade.product.domain.entity.CategoryDo">
  64 + <![CDATA[
  65 + SELECT
  66 + ]]>
  67 + <include refid="QUERY_COLUMN_LIST"/>
  68 + <![CDATA[
  69 + FROM `category` WHERE cate_code LIKE CONCAT(#{cateCode},'%');
  70 + ]]>
  71 + </select>
  72 +</mapper>