Commit 71351af39885350a368c6c95d9251bb412658452
Merge branch 'master' of http://git3.nong12.com/xtrade/order-service.git
Showing
16 changed files
with
292 additions
and
54 deletions
src/main/java/com/diligrp/xtrade/product/controllor/CategoryController.java
1 | package com.diligrp.xtrade.product.controllor; | 1 | package com.diligrp.xtrade.product.controllor; |
2 | 2 | ||
3 | +import java.util.List; | ||
4 | + | ||
3 | import org.springframework.beans.factory.annotation.Autowired; | 5 | import org.springframework.beans.factory.annotation.Autowired; |
6 | +import org.springframework.validation.annotation.Validated; | ||
4 | import org.springframework.web.bind.annotation.PathVariable; | 7 | import org.springframework.web.bind.annotation.PathVariable; |
8 | +import org.springframework.web.bind.annotation.RequestBody; | ||
5 | import org.springframework.web.bind.annotation.RequestMapping; | 9 | import org.springframework.web.bind.annotation.RequestMapping; |
6 | import org.springframework.web.bind.annotation.RestController; | 10 | import org.springframework.web.bind.annotation.RestController; |
7 | 11 | ||
8 | import com.diligrp.xtrade.product.domain.dto.CategoryDto; | 12 | import com.diligrp.xtrade.product.domain.dto.CategoryDto; |
13 | +import com.diligrp.xtrade.product.domain.entity.CategoryDo; | ||
9 | import com.diligrp.xtrade.product.service.CategoryService; | 14 | import com.diligrp.xtrade.product.service.CategoryService; |
10 | import com.diligrp.xtrade.shared.domain.Message; | 15 | import com.diligrp.xtrade.shared.domain.Message; |
11 | 16 | ||
@@ -16,41 +21,42 @@ import com.diligrp.xtrade.shared.domain.Message; | @@ -16,41 +21,42 @@ import com.diligrp.xtrade.shared.domain.Message; | ||
16 | * @date 2020年4月20日 | 21 | * @date 2020年4月20日 |
17 | */ | 22 | */ |
18 | @RestController | 23 | @RestController |
19 | -@RequestMapping("category/") | 24 | +@RequestMapping("sapi/category/") |
20 | public class CategoryController { | 25 | public class CategoryController { |
21 | - | 26 | + |
22 | @Autowired | 27 | @Autowired |
23 | private CategoryService categoryService; | 28 | private CategoryService categoryService; |
24 | - | 29 | + |
25 | /** | 30 | /** |
26 | - * 新增品类 | ||
27 | - * @Title insert | ||
28 | - * @Description 新增品类 | 31 | + * |
32 | + * @Title save | ||
33 | + * @Description 保存 | ||
29 | * @param categoryDTO | 34 | * @param categoryDTO |
30 | * @return | 35 | * @return |
31 | * @throws | 36 | * @throws |
32 | */ | 37 | */ |
33 | - @RequestMapping("insert") | ||
34 | - public Message<?> insert(CategoryDto categoryDTO){ | 38 | + public Message<?> save(CategoryDto categoryDTO) { |
35 | categoryService.insert(categoryDTO); | 39 | categoryService.insert(categoryDTO); |
36 | return Message.success(); | 40 | return Message.success(); |
37 | } | 41 | } |
42 | + | ||
38 | /** | 43 | /** |
39 | - * 修改品类 | 44 | + * |
40 | * @Title update | 45 | * @Title update |
41 | - * @Description 修改品类 | 46 | + * @Description 修改 |
42 | * @param categoryDTO | 47 | * @param categoryDTO |
43 | * @return | 48 | * @return |
44 | * @throws | 49 | * @throws |
45 | */ | 50 | */ |
46 | @RequestMapping("update") | 51 | @RequestMapping("update") |
47 | - public Message<?> update(CategoryDto categoryDTO){ | 52 | + public Message<Object> update(CategoryDto categoryDTO) { |
48 | categoryService.update(categoryDTO); | 53 | categoryService.update(categoryDTO); |
49 | - return Message.success(); | 54 | + return null; |
55 | + | ||
50 | } | 56 | } |
51 | - | 57 | + |
52 | /** | 58 | /** |
53 | - * id获取 | 59 | + * |
54 | * @Title get | 60 | * @Title get |
55 | * @Description id获取 | 61 | * @Description id获取 |
56 | * @param id | 62 | * @param id |
@@ -58,11 +64,12 @@ public class CategoryController { | @@ -58,11 +64,12 @@ public class CategoryController { | ||
58 | * @throws | 64 | * @throws |
59 | */ | 65 | */ |
60 | @RequestMapping("get/{id}") | 66 | @RequestMapping("get/{id}") |
61 | - public Message<?> get(@PathVariable Long id){ | 67 | + public Message<?> get(@PathVariable Long id) { |
62 | return Message.success(categoryService.selectEntityById(id)); | 68 | return Message.success(categoryService.selectEntityById(id)); |
63 | } | 69 | } |
70 | + | ||
64 | /** | 71 | /** |
65 | - * 主键删除 | 72 | + * |
66 | * @Title delect | 73 | * @Title delect |
67 | * @Description 主键删除 | 74 | * @Description 主键删除 |
68 | * @param id | 75 | * @param id |
@@ -70,8 +77,22 @@ public class CategoryController { | @@ -70,8 +77,22 @@ public class CategoryController { | ||
70 | * @throws | 77 | * @throws |
71 | */ | 78 | */ |
72 | @RequestMapping("delect/{id}") | 79 | @RequestMapping("delect/{id}") |
73 | - public Message<?> delect(@PathVariable Long id){ | 80 | + public Message<?> delect(@PathVariable Long id) { |
74 | categoryService.delectById(id); | 81 | categoryService.delectById(id); |
75 | return Message.success(); | 82 | return Message.success(); |
76 | } | 83 | } |
84 | + | ||
85 | + /** | ||
86 | + * | ||
87 | + * @Title selectCategoryChild | ||
88 | + * @Description TODO | ||
89 | + * @param cateCode | ||
90 | + * @return | ||
91 | + * @throws | ||
92 | + */ | ||
93 | + @RequestMapping("selectCategoryChild/{cateCode}") | ||
94 | + public Message<?> selectCategoryChild(@PathVariable String cateCode) { | ||
95 | + List<CategoryDo> categoryDos = categoryService.selectCateChild(cateCode); | ||
96 | + return Message.success(categoryDos); | ||
97 | + } | ||
77 | } | 98 | } |
src/main/java/com/diligrp/xtrade/product/controllor/ShopController.java
@@ -3,10 +3,13 @@ package com.diligrp.xtrade.product.controllor; | @@ -3,10 +3,13 @@ package com.diligrp.xtrade.product.controllor; | ||
3 | import java.util.List; | 3 | import java.util.List; |
4 | 4 | ||
5 | import org.springframework.beans.factory.annotation.Autowired; | 5 | import org.springframework.beans.factory.annotation.Autowired; |
6 | +import org.springframework.validation.annotation.Validated; | ||
6 | import org.springframework.web.bind.annotation.PathVariable; | 7 | import org.springframework.web.bind.annotation.PathVariable; |
8 | +import org.springframework.web.bind.annotation.RequestBody; | ||
7 | import org.springframework.web.bind.annotation.RequestMapping; | 9 | import org.springframework.web.bind.annotation.RequestMapping; |
8 | import org.springframework.web.bind.annotation.RestController; | 10 | import org.springframework.web.bind.annotation.RestController; |
9 | 11 | ||
12 | +import com.diligrp.xtrade.product.domain.dto.ShopQueryDto; | ||
10 | import com.diligrp.xtrade.product.domain.dto.ShopDto; | 13 | import com.diligrp.xtrade.product.domain.dto.ShopDto; |
11 | import com.diligrp.xtrade.product.domain.entity.ShopDo; | 14 | import com.diligrp.xtrade.product.domain.entity.ShopDo; |
12 | import com.diligrp.xtrade.product.service.ShopService; | 15 | import com.diligrp.xtrade.product.service.ShopService; |
@@ -34,7 +37,7 @@ public class ShopController { | @@ -34,7 +37,7 @@ public class ShopController { | ||
34 | * @throws | 37 | * @throws |
35 | */ | 38 | */ |
36 | @RequestMapping("save") | 39 | @RequestMapping("save") |
37 | - public Message<?> save(ShopDto shop){ | 40 | + public Message<?> save(@Validated @RequestBody ShopDto shop){ |
38 | shopService.insert(shop); | 41 | shopService.insert(shop); |
39 | return Message.success(); | 42 | return Message.success(); |
40 | } | 43 | } |
@@ -48,7 +51,8 @@ public class ShopController { | @@ -48,7 +51,8 @@ public class ShopController { | ||
48 | * @throws | 51 | * @throws |
49 | */ | 52 | */ |
50 | @RequestMapping("get/{shopId}") | 53 | @RequestMapping("get/{shopId}") |
51 | - public Message<ShopDo> get(@PathVariable Long shopId){ | 54 | + |
55 | + public Message<?> get(@PathVariable Long shopId){ | ||
52 | return Message.success(shopService.selectByShopId(shopId)); | 56 | return Message.success(shopService.selectByShopId(shopId)); |
53 | } | 57 | } |
54 | 58 | ||
@@ -64,5 +68,19 @@ public class ShopController { | @@ -64,5 +68,19 @@ public class ShopController { | ||
64 | public Message<?> selectShopByMerId(@PathVariable Long merId){ | 68 | public Message<?> selectShopByMerId(@PathVariable Long merId){ |
65 | List<ShopDo> shopDos = shopService.selectShopByMerId(merId); | 69 | List<ShopDo> shopDos = shopService.selectShopByMerId(merId); |
66 | return Message.success(shopDos); | 70 | return Message.success(shopDos); |
71 | + | ||
72 | + } | ||
73 | + | ||
74 | + /** | ||
75 | + * | ||
76 | + * @Title selectShop | ||
77 | + * @Description 店铺搜索 | ||
78 | + * @param shop | ||
79 | + * @return | ||
80 | + * @throws | ||
81 | + */ | ||
82 | + @RequestMapping("selectShop") | ||
83 | + public Message<?> selectShop(@Validated @RequestBody ShopQueryDto shop){ | ||
84 | + return null; | ||
67 | } | 85 | } |
68 | } | 86 | } |
src/main/java/com/diligrp/xtrade/product/dao/CategoryDao.java
1 | package com.diligrp.xtrade.product.dao; | 1 | package com.diligrp.xtrade.product.dao; |
2 | 2 | ||
3 | +import java.util.List; | ||
4 | + | ||
3 | import org.apache.ibatis.annotations.Mapper; | 5 | import org.apache.ibatis.annotations.Mapper; |
4 | 6 | ||
7 | +import com.diligrp.xtrade.product.domain.dto.CategoryQueryDto; | ||
5 | import com.diligrp.xtrade.product.domain.entity.CategoryDo; | 8 | import com.diligrp.xtrade.product.domain.entity.CategoryDo; |
6 | 9 | ||
7 | 10 | ||
@@ -18,7 +21,26 @@ public interface CategoryDao { | @@ -18,7 +21,26 @@ public interface CategoryDao { | ||
18 | 21 | ||
19 | void update(CategoryDo category); | 22 | void update(CategoryDo category); |
20 | 23 | ||
21 | - CategoryDo selectEntityById(Integer id); | 24 | + CategoryDo selectEntityById(Long id); |
22 | 25 | ||
23 | void delect(Long id); | 26 | void delect(Long id); |
27 | + | ||
28 | + /** | ||
29 | + * | ||
30 | + * @Title selectList | ||
31 | + * @Description 品类条件查询 | ||
32 | + * @param categoryQueryDto | ||
33 | + * @return | ||
34 | + * @throws | ||
35 | + */ | ||
36 | + List<CategoryDo> selectList(CategoryQueryDto categoryQueryDto); | ||
37 | + /** | ||
38 | + * | ||
39 | + * @Title selectCateChild | ||
40 | + * @Description 根据品类编码获取全部下级品类 | ||
41 | + * @param cateCode 品类编码 | ||
42 | + * @return | ||
43 | + * @throws | ||
44 | + */ | ||
45 | + List<CategoryDo> selectCateChild(String cateCode); | ||
24 | } | 46 | } |
src/main/java/com/diligrp/xtrade/product/dao/ShopDao.java
@@ -4,6 +4,7 @@ import java.util.List; | @@ -4,6 +4,7 @@ import java.util.List; | ||
4 | 4 | ||
5 | import org.apache.ibatis.annotations.Mapper; | 5 | import org.apache.ibatis.annotations.Mapper; |
6 | 6 | ||
7 | +import com.diligrp.xtrade.product.domain.dto.ShopQueryDto; | ||
7 | import com.diligrp.xtrade.product.domain.entity.ShopDo; | 8 | import com.diligrp.xtrade.product.domain.entity.ShopDo; |
8 | /** | 9 | /** |
9 | * | 10 | * |
@@ -22,4 +23,7 @@ public interface ShopDao { | @@ -22,4 +23,7 @@ public interface ShopDao { | ||
22 | ShopDo selectByShopId(Long shopId); | 23 | ShopDo selectByShopId(Long shopId); |
23 | 24 | ||
24 | List<ShopDo> selectByMerId(Long merId); | 25 | List<ShopDo> selectByMerId(Long merId); |
26 | + | ||
27 | + List<ShopDo> selectShop(ShopQueryDto shopQueryDto); | ||
28 | + | ||
25 | } | 29 | } |
src/main/java/com/diligrp/xtrade/product/domain/dto/CategoryQueryDto.java
0 → 100644
1 | +package com.diligrp.xtrade.product.domain.dto; | ||
2 | + | ||
3 | + | ||
4 | +/** | ||
5 | + * @ClassName: CategoryDto | ||
6 | + * @Description 品类传输 | ||
7 | + * @author yangfan | ||
8 | + * @date 2020年4月16日 | ||
9 | + */ | ||
10 | +public class CategoryQueryDto{ | ||
11 | + | ||
12 | + /** | ||
13 | + * 品类名称 | ||
14 | + */ | ||
15 | + private String cname; | ||
16 | + /** | ||
17 | + * 拼音缩写 | ||
18 | + */ | ||
19 | + private String shortName; | ||
20 | + /** | ||
21 | + * 品类状态 | ||
22 | + */ | ||
23 | + private Integer status; | ||
24 | + | ||
25 | + /** | ||
26 | + * 品类有效期 | ||
27 | + */ | ||
28 | + private Integer validDay; | ||
29 | + /** | ||
30 | + * 类型 | ||
31 | + */ | ||
32 | + private Long type; | ||
33 | + /** | ||
34 | + * 品类等级 | ||
35 | + */ | ||
36 | + private Integer level; | ||
37 | + | ||
38 | + private Integer currentPage; | ||
39 | + | ||
40 | + public String getCname() { | ||
41 | + return cname; | ||
42 | + } | ||
43 | + public void setCname(String cname) { | ||
44 | + this.cname = cname; | ||
45 | + } | ||
46 | + public String getShortName() { | ||
47 | + return shortName; | ||
48 | + } | ||
49 | + public void setShortName(String shortName) { | ||
50 | + this.shortName = shortName; | ||
51 | + } | ||
52 | + public Integer getStatus() { | ||
53 | + return status; | ||
54 | + } | ||
55 | + public void setStatus(Integer status) { | ||
56 | + this.status = status; | ||
57 | + } | ||
58 | + public Integer getValidDay() { | ||
59 | + return validDay; | ||
60 | + } | ||
61 | + public void setValidDay(Integer validDay) { | ||
62 | + this.validDay = validDay; | ||
63 | + } | ||
64 | + public Long getType() { | ||
65 | + return type; | ||
66 | + } | ||
67 | + public void setType(Long type) { | ||
68 | + this.type = type; | ||
69 | + } | ||
70 | + public Integer getLevel() { | ||
71 | + return level; | ||
72 | + } | ||
73 | + public void setLevel(Integer level) { | ||
74 | + this.level = level; | ||
75 | + } | ||
76 | + public Integer getCurrentPage() { | ||
77 | + return currentPage; | ||
78 | + } | ||
79 | + public void setCurrentPage(Integer currentPage) { | ||
80 | + this.currentPage = currentPage; | ||
81 | + } | ||
82 | + | ||
83 | +} |
src/main/java/com/diligrp/xtrade/product/domain/dto/ShopDto.java
@@ -39,12 +39,12 @@ public class ShopDto { | @@ -39,12 +39,12 @@ public class ShopDto { | ||
39 | /** | 39 | /** |
40 | * 是否自营 | 40 | * 是否自营 |
41 | */ | 41 | */ |
42 | - private Integer isSelfShop; | 42 | + private Integer selfShop; |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * 主营业务 | 45 | * 主营业务 |
46 | */ | 46 | */ |
47 | - private String mainBusiness; | 47 | + private String mainBiz; |
48 | 48 | ||
49 | /** | 49 | /** |
50 | * 地址 | 50 | * 地址 |
@@ -96,20 +96,22 @@ public class ShopDto { | @@ -96,20 +96,22 @@ public class ShopDto { | ||
96 | this.status = status; | 96 | this.status = status; |
97 | } | 97 | } |
98 | 98 | ||
99 | - public Integer getIsSelfShop() { | ||
100 | - return isSelfShop; | 99 | + |
100 | + public Integer getSelfShop() { | ||
101 | + return selfShop; | ||
101 | } | 102 | } |
102 | 103 | ||
103 | - public void setIsSelfShop(Integer isSelfShop) { | ||
104 | - this.isSelfShop = isSelfShop; | 104 | + public void setSelfShop(Integer selfShop) { |
105 | + this.selfShop = selfShop; | ||
105 | } | 106 | } |
106 | 107 | ||
107 | - public String getMainBusiness() { | ||
108 | - return mainBusiness; | 108 | + |
109 | + public String getMainBiz() { | ||
110 | + return mainBiz; | ||
109 | } | 111 | } |
110 | 112 | ||
111 | - public void setMainBusiness(String mainBusiness) { | ||
112 | - this.mainBusiness = mainBusiness; | 113 | + public void setMainBiz(String mainBiz) { |
114 | + this.mainBiz = mainBiz; | ||
113 | } | 115 | } |
114 | 116 | ||
115 | public String getAddress() { | 117 | public String getAddress() { |
src/main/java/com/diligrp/xtrade/product/domain/dto/ShopQueryDto.java
0 → 100644
1 | +package com.diligrp.xtrade.product.domain.dto; | ||
2 | + | ||
3 | +import java.time.LocalDateTime; | ||
4 | + | ||
5 | +/** | ||
6 | + * @ClassName: QueryShopDto | ||
7 | + * @Description TODO(用一句话描述该文件做什么) | ||
8 | + * @author yangfan | ||
9 | + * @date 2020年4月22日 | ||
10 | + */ | ||
11 | +public class ShopQueryDto { | ||
12 | + | ||
13 | + private String shopName; | ||
14 | + private Long merId; | ||
15 | + private LocalDateTime createdTime; | ||
16 | + public String getShopName() { | ||
17 | + return shopName; | ||
18 | + } | ||
19 | + public void setShopName(String shopName) { | ||
20 | + this.shopName = shopName; | ||
21 | + } | ||
22 | + public Long getMerId() { | ||
23 | + return merId; | ||
24 | + } | ||
25 | + public void setMerId(Long merId) { | ||
26 | + this.merId = merId; | ||
27 | + } | ||
28 | + public LocalDateTime getCreatedTime() { | ||
29 | + return createdTime; | ||
30 | + } | ||
31 | + public void setCreatedTime(LocalDateTime createdTime) { | ||
32 | + this.createdTime = createdTime; | ||
33 | + } | ||
34 | + | ||
35 | +} |
src/main/java/com/diligrp/xtrade/product/domain/emuns/IKeyGeneratorKeys.java
@@ -10,7 +10,8 @@ package com.diligrp.xtrade.product.domain.emuns; | @@ -10,7 +10,8 @@ package com.diligrp.xtrade.product.domain.emuns; | ||
10 | public enum IKeyGeneratorKeys { | 10 | public enum IKeyGeneratorKeys { |
11 | SHOP_SEQUENCE("SHOP_SEQUENCE","店铺id"), | 11 | SHOP_SEQUENCE("SHOP_SEQUENCE","店铺id"), |
12 | MERCHANT_SEQUENCE("MERCHANT_SEQUENCE","市场id"), | 12 | MERCHANT_SEQUENCE("MERCHANT_SEQUENCE","市场id"), |
13 | - ACCOUNT_SEQUENCE("ACCOUNT_SEQUENCE","账号id") | 13 | + ACCOUNT_SEQUENCE("ACCOUNT_SEQUENCE","账号id"), |
14 | + CATEGORY_SEQUENCE("CATEGORY_SEQUENCE","品类is") | ||
14 | ; | 15 | ; |
15 | 16 | ||
16 | private String code; | 17 | private String code; |
src/main/java/com/diligrp/xtrade/product/domain/entity/ShopDo.java
@@ -31,10 +31,10 @@ public class ShopDo extends BaseDo { | @@ -31,10 +31,10 @@ public class ShopDo extends BaseDo { | ||
31 | private Integer status; | 31 | private Integer status; |
32 | 32 | ||
33 | //是否自营 | 33 | //是否自营 |
34 | - private Integer isSelfShop; | 34 | + private Integer selfShop; |
35 | 35 | ||
36 | //主营业务 | 36 | //主营业务 |
37 | - private String mainBusiness; | 37 | + private String mainBiz; |
38 | 38 | ||
39 | //地址 | 39 | //地址 |
40 | private String address; | 40 | private String address; |
@@ -82,20 +82,22 @@ public class ShopDo extends BaseDo { | @@ -82,20 +82,22 @@ public class ShopDo extends BaseDo { | ||
82 | this.status = status; | 82 | this.status = status; |
83 | } | 83 | } |
84 | 84 | ||
85 | - public Integer getIsSelfShop() { | ||
86 | - return isSelfShop; | 85 | + |
86 | + | ||
87 | + public Integer getSelfShop() { | ||
88 | + return selfShop; | ||
87 | } | 89 | } |
88 | 90 | ||
89 | - public void setIsSelfShop(Integer isSelfShop) { | ||
90 | - this.isSelfShop = isSelfShop; | 91 | + public void setSelfShop(Integer selfShop) { |
92 | + this.selfShop = selfShop; | ||
91 | } | 93 | } |
92 | 94 | ||
93 | - public String getMainBusiness() { | ||
94 | - return mainBusiness; | 95 | + public String getMainBiz() { |
96 | + return mainBiz; | ||
95 | } | 97 | } |
96 | 98 | ||
97 | - public void setMainBusiness(String mainBusiness) { | ||
98 | - this.mainBusiness = mainBusiness; | 99 | + public void setMainBiz(String mainBiz) { |
100 | + this.mainBiz = mainBiz; | ||
99 | } | 101 | } |
100 | 102 | ||
101 | public String getAddress() { | 103 | public String getAddress() { |
src/main/java/com/diligrp/xtrade/product/service/CategoryService.java
@@ -4,6 +4,7 @@ import java.util.List; | @@ -4,6 +4,7 @@ import java.util.List; | ||
4 | 4 | ||
5 | 5 | ||
6 | import com.diligrp.xtrade.product.domain.dto.CategoryDto; | 6 | import com.diligrp.xtrade.product.domain.dto.CategoryDto; |
7 | +import com.diligrp.xtrade.product.domain.dto.CategoryQueryDto; | ||
7 | import com.diligrp.xtrade.product.domain.entity.CategoryDo; | 8 | import com.diligrp.xtrade.product.domain.entity.CategoryDo; |
8 | 9 | ||
9 | 10 | ||
@@ -23,9 +24,19 @@ public interface CategoryService { | @@ -23,9 +24,19 @@ public interface CategoryService { | ||
23 | /** | 24 | /** |
24 | * @Title selectList | 25 | * @Title selectList |
25 | * @Description 条件查询 | 26 | * @Description 条件查询 |
26 | - * @param category | 27 | + * @param CategoryQueryDto |
27 | * @return | 28 | * @return |
28 | * @throws | 29 | * @throws |
29 | */ | 30 | */ |
30 | - List<CategoryDo> selectList(CategoryDto category); | 31 | + List<CategoryDo> selectList(CategoryQueryDto category); |
32 | + | ||
33 | + /** | ||
34 | + * | ||
35 | + * @Title selectCateChild | ||
36 | + * @Description 根据品类catecode获取下级品类 | ||
37 | + * @param cateCode | ||
38 | + * @return | ||
39 | + * @throws | ||
40 | + */ | ||
41 | + List<CategoryDo> selectCateChild(String cateCode); | ||
31 | } | 42 | } |
src/main/java/com/diligrp/xtrade/product/service/ShopService.java
@@ -3,6 +3,7 @@ package com.diligrp.xtrade.product.service; | @@ -3,6 +3,7 @@ package com.diligrp.xtrade.product.service; | ||
3 | import java.util.List; | 3 | import java.util.List; |
4 | 4 | ||
5 | import com.diligrp.xtrade.product.domain.dto.ShopDto; | 5 | import com.diligrp.xtrade.product.domain.dto.ShopDto; |
6 | +import com.diligrp.xtrade.product.domain.dto.ShopQueryDto; | ||
6 | import com.diligrp.xtrade.product.domain.entity.ShopDo; | 7 | import com.diligrp.xtrade.product.domain.entity.ShopDo; |
7 | 8 | ||
8 | public interface ShopService { | 9 | public interface ShopService { |
@@ -43,4 +44,14 @@ public interface ShopService { | @@ -43,4 +44,14 @@ public interface ShopService { | ||
43 | * @throws | 44 | * @throws |
44 | */ | 45 | */ |
45 | List<ShopDo> selectShopByMerId(Long merId); | 46 | List<ShopDo> selectShopByMerId(Long merId); |
47 | + | ||
48 | + /** | ||
49 | + * | ||
50 | + * @Title selectShop | ||
51 | + * @Description 商铺查询 | ||
52 | + * @param shopQuery | ||
53 | + * @return | ||
54 | + * @throws | ||
55 | + */ | ||
56 | + List<ShopDo> selectShop(ShopQueryDto shopQuery); | ||
46 | } | 57 | } |
src/main/java/com/diligrp/xtrade/product/service/impl/CategoryServiceImpl.java
@@ -9,6 +9,7 @@ import org.springframework.stereotype.Service; | @@ -9,6 +9,7 @@ import org.springframework.stereotype.Service; | ||
9 | 9 | ||
10 | import com.diligrp.xtrade.product.dao.CategoryDao; | 10 | import com.diligrp.xtrade.product.dao.CategoryDao; |
11 | import com.diligrp.xtrade.product.domain.dto.CategoryDto; | 11 | import com.diligrp.xtrade.product.domain.dto.CategoryDto; |
12 | +import com.diligrp.xtrade.product.domain.dto.CategoryQueryDto; | ||
12 | import com.diligrp.xtrade.product.domain.emuns.IKeyGeneratorKeys; | 13 | import com.diligrp.xtrade.product.domain.emuns.IKeyGeneratorKeys; |
13 | import com.diligrp.xtrade.product.domain.entity.CategoryDo; | 14 | import com.diligrp.xtrade.product.domain.entity.CategoryDo; |
14 | import com.diligrp.xtrade.product.service.CategoryService; | 15 | import com.diligrp.xtrade.product.service.CategoryService; |
@@ -34,6 +35,7 @@ public class CategoryServiceImpl implements CategoryService { | @@ -34,6 +35,7 @@ public class CategoryServiceImpl implements CategoryService { | ||
34 | BeanUtils.copyProperties(category, categoryDo); | 35 | BeanUtils.copyProperties(category, categoryDo); |
35 | long id = keyGeneratorManager.getKeyGenerator(IKeyGeneratorKeys.CATEGORY_SEQUENCE).nextId(); | 36 | long id = keyGeneratorManager.getKeyGenerator(IKeyGeneratorKeys.CATEGORY_SEQUENCE).nextId(); |
36 | String cateCode = ""+id; | 37 | String cateCode = ""+id; |
38 | + //cateCode 生成 子级品类继承上级品类cateCode 父code_子code | ||
37 | if (StringUtils.isNotBlank(category.getParentId())) { | 39 | if (StringUtils.isNotBlank(category.getParentId())) { |
38 | CategoryDo pCategoryDo = selectEntityById(Long.valueOf(category.getParentId())); | 40 | CategoryDo pCategoryDo = selectEntityById(Long.valueOf(category.getParentId())); |
39 | cateCode = String.format("%s_%d", pCategoryDo.getCateCode(),id); | 41 | cateCode = String.format("%s_%d", pCategoryDo.getCateCode(),id); |
@@ -51,20 +53,22 @@ public class CategoryServiceImpl implements CategoryService { | @@ -51,20 +53,22 @@ public class CategoryServiceImpl implements CategoryService { | ||
51 | 53 | ||
52 | @Override | 54 | @Override |
53 | public void delectById(Long id) { | 55 | public void delectById(Long id) { |
54 | - // TODO Auto-generated method stub | ||
55 | - | 56 | + categoryDao.delect(id); |
56 | } | 57 | } |
57 | 58 | ||
58 | @Override | 59 | @Override |
59 | public CategoryDo selectEntityById(Long id) { | 60 | public CategoryDo selectEntityById(Long id) { |
60 | - // TODO Auto-generated method stub | ||
61 | - return null; | 61 | + return categoryDao.selectEntityById(id); |
62 | + } | ||
63 | + | ||
64 | + @Override | ||
65 | + public List<CategoryDo> selectList(CategoryQueryDto categoryQueryDto) { | ||
66 | + return categoryDao.selectList(categoryQueryDto); | ||
62 | } | 67 | } |
63 | 68 | ||
64 | @Override | 69 | @Override |
65 | - public List<CategoryDo> selectList(CategoryDto category) { | ||
66 | - // TODO Auto-generated method stub | ||
67 | - return null; | 70 | + public List<CategoryDo> selectCateChild(String cateCode) { |
71 | + return categoryDao.selectCateChild(cateCode); | ||
68 | } | 72 | } |
69 | 73 | ||
70 | } | 74 | } |
src/main/java/com/diligrp/xtrade/product/service/impl/ShopServiceImpl.java
@@ -8,6 +8,7 @@ import org.springframework.stereotype.Service; | @@ -8,6 +8,7 @@ import org.springframework.stereotype.Service; | ||
8 | 8 | ||
9 | import com.diligrp.xtrade.product.dao.ShopDao; | 9 | import com.diligrp.xtrade.product.dao.ShopDao; |
10 | import com.diligrp.xtrade.product.domain.dto.ShopDto; | 10 | import com.diligrp.xtrade.product.domain.dto.ShopDto; |
11 | +import com.diligrp.xtrade.product.domain.dto.ShopQueryDto; | ||
11 | import com.diligrp.xtrade.product.domain.emuns.IKeyGeneratorKeys; | 12 | import com.diligrp.xtrade.product.domain.emuns.IKeyGeneratorKeys; |
12 | import com.diligrp.xtrade.product.domain.entity.ShopDo; | 13 | import com.diligrp.xtrade.product.domain.entity.ShopDo; |
13 | import com.diligrp.xtrade.product.service.ShopService; | 14 | import com.diligrp.xtrade.product.service.ShopService; |
@@ -48,4 +49,10 @@ public class ShopServiceImpl implements ShopService { | @@ -48,4 +49,10 @@ public class ShopServiceImpl implements ShopService { | ||
48 | return shops; | 49 | return shops; |
49 | } | 50 | } |
50 | 51 | ||
52 | + @Override | ||
53 | + public List<ShopDo> selectShop(ShopQueryDto shopQuery) { | ||
54 | + List<ShopDo> shops = shopDao.selectShop(shopQuery); | ||
55 | + return shops; | ||
56 | + } | ||
57 | + | ||
51 | } | 58 | } |
src/main/resources/bootstrap.yml
@@ -20,5 +20,5 @@ spring: | @@ -20,5 +20,5 @@ spring: | ||
20 | active: dev | 20 | active: dev |
21 | 21 | ||
22 | mybatis: | 22 | mybatis: |
23 | - mapper-locations: classpath:mapping/com/diligrp/xtrade/product/*Dao.xml | 23 | + mapper-locations: classpath:mapping/com/diligrp/xtrade/*product/*Dao.xml |
24 | type-aliases-package: com.diligrp.xtrade.*.domain.entity | 24 | type-aliases-package: com.diligrp.xtrade.*.domain.entity |
25 | \ No newline at end of file | 25 | \ No newline at end of file |
src/main/resources/mapping/com/diligrp/xtrade/product/CategoryDao.xml
@@ -51,7 +51,15 @@ | @@ -51,7 +51,15 @@ | ||
51 | UPDATE `category` SET status = 2 WHERE id = #{id}; | 51 | UPDATE `category` SET status = 2 WHERE id = #{id}; |
52 | ]]> | 52 | ]]> |
53 | </update> | 53 | </update> |
54 | - | 54 | + <select id="selectCateChild" parameterType="string"> |
55 | + <![CDATA[ | ||
56 | + SELECT | ||
57 | + ]]> | ||
58 | + <include refid="QUERY_COLUMN_LIST"/> | ||
59 | + <![CDATA[ | ||
60 | + FROM `category` WHERE cate_code LIKE CONCAT(#{cateCode},"%"); | ||
61 | + ]]> | ||
62 | + </select> | ||
55 | 63 | ||
56 | 64 | ||
57 | 65 |
src/main/resources/mapping/com/diligrp/xtrade/product/ShopDao.xml
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | <sql id="QUERY_COLUMN_LIST"> | 5 | <sql id="QUERY_COLUMN_LIST"> |
6 | <![CDATA[ | 6 | <![CDATA[ |
7 | `id`, `shop_id` AS shopId, `shop_name` AS shopName, `address`, `mer_id` AS merId, `type`, `status`, | 7 | `id`, `shop_id` AS shopId, `shop_name` AS shopName, `address`, `mer_id` AS merId, `type`, `status`, |
8 | - `main_business` AS mainBusiness, `self_shop` AS selfShop,`description`,`created_time` AS createdTime, `modified_time`AS modifiedTime | 8 | + `main_biz` AS mainBiz, `self_shop` AS selfShop,`description`,`created_time` AS createdTime, `modified_time`AS modifiedTime |
9 | ]]> | 9 | ]]> |
10 | </sql> | 10 | </sql> |
11 | <sql id="UPDATE_COLUMN_SET"> | 11 | <sql id="UPDATE_COLUMN_SET"> |
@@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
15 | <if test="merId != null"><![CDATA[mer_id = #{merId},]]></if> | 15 | <if test="merId != null"><![CDATA[mer_id = #{merId},]]></if> |
16 | <if test="type != null"><![CDATA[type = #{type},]]></if> | 16 | <if test="type != null"><![CDATA[type = #{type},]]></if> |
17 | <if test="status != null"><![CDATA[status = #{status},]]></if> | 17 | <if test="status != null"><![CDATA[status = #{status},]]></if> |
18 | - <if test="mainBusiness != null"><![CDATA[main_business = #{mainBusiness},]]></if> | 18 | + <if test="mainBiz != null"><![CDATA[main_biz = #{mainBiz},]]></if> |
19 | <if test="selfShop != null"><![CDATA[self_shop = #{selfShop},]]></if> | 19 | <if test="selfShop != null"><![CDATA[self_shop = #{selfShop},]]></if> |
20 | <if test="description != null"><![CDATA[description = #{description},]]></if> | 20 | <if test="description != null"><![CDATA[description = #{description},]]></if> |
21 | <![CDATA[modify_date = now()]]> | 21 | <![CDATA[modify_date = now()]]> |
@@ -50,4 +50,13 @@ | @@ -50,4 +50,13 @@ | ||
50 | FROM `xt_shop` WHERE mer_id = #{merId} | 50 | FROM `xt_shop` WHERE mer_id = #{merId} |
51 | ]]> | 51 | ]]> |
52 | </select> | 52 | </select> |
53 | + <select id="selectShop" parameterType="long" resultType="com.diligrp.xtrade.product.domain.dto.ShopQueryDto"> | ||
54 | + <![CDATA[ | ||
55 | + SELECT | ||
56 | + ]]> | ||
57 | + <include refid="QUERY_COLUMN_LIST" /> | ||
58 | + <![CDATA[ | ||
59 | + FROM `xt_shop` WHERE mer_id = #{merId} | ||
60 | + ]]> | ||
61 | + </select> | ||
53 | </mapper> | 62 | </mapper> |
54 | \ No newline at end of file | 63 | \ No newline at end of file |