Procházet zdrojové kódy

goods for mini app, simple add goods spec

梁彦春 před 6 roky
rodič
revize
db5326a73e

+ 17
- 7
src/main/java/com.huiju.welcome/controller/TaGoodsController.java Zobrazit soubor

@@ -11,7 +11,6 @@ import com.huiju.welcome.model.TaGoodsSpec;
11 11
 import com.huiju.welcome.service.ITaGoodsService;
12 12
 import com.huiju.welcome.service.ITaGoodsSpecService;
13 13
 import com.huiju.welcome.utils.StatusUtils;
14
-import io.swagger.annotations.ApiImplicitParam;
15 14
 import io.swagger.annotations.ApiImplicitParams;
16 15
 import io.swagger.annotations.ApiOperation;
17 16
 import org.slf4j.Logger;
@@ -51,16 +50,13 @@ public class TaGoodsController extends BaseController {
51 50
     @RequestMapping(value="/taGoods/add",method= RequestMethod.POST)
52 51
     public ResponseBean tpShopImgAdd(@RequestBody String paramStr){
53 52
         JSONObject jsonObject = JSONObject.parseObject(paramStr);
54
-
55 53
         TaGoods taGoods = jsonObject.getObject("goods", TaGoods.class);
56
-        JSONArray spec = jsonObject.getJSONArray("spec");
57
-
58 54
         ResponseBean responseBean = new ResponseBean();
59 55
         try {
60 56
             taGoods.setCreateDate(LocalDateTime.now());
61 57
             taGoods.setStatus(StatusUtils.Normal);
62 58
             Boolean flag = iTaGoodsService.save(taGoods);
63
-            List<TaGoodsSpec> specList = spec.toJavaList(TaGoodsSpec.class);
59
+            List<TaGoodsSpec> specList = taGoods.getSpecList();
64 60
             specList.stream().forEach(e -> {
65 61
                 e.setGoodsId(taGoods.getGoodsId());
66 62
             });
@@ -153,10 +149,9 @@ public class TaGoodsController extends BaseController {
153 149
 
154 150
     @ApiOperation(value = "商品列表", notes = "商品列表")
155 151
     @ApiImplicitParams({
156
-            @ApiImplicitParam(paramType = "body", dataType = "String", name = "typeName", value = "商品名称")
157 152
     })
158 153
     @RequestMapping(value = "/taGoods", method = RequestMethod.GET)
159
-    public ResponseBean typeList(@RequestParam(defaultValue = "1") int pageNum,
154
+    public ResponseBean goodsList(@RequestParam(defaultValue = "1") int pageNum,
160 155
                                  @RequestParam(defaultValue = "10") int pageSize,
161 156
                                  @RequestParam(value = "goodsName",required = false) String goodsName,
162 157
                                  @RequestParam(value = "typeId",required = false) Integer typeId) {
@@ -167,6 +162,21 @@ public class TaGoodsController extends BaseController {
167 162
         return userManagement;
168 163
     }
169 164
 
165
+    @ApiOperation(value = "商品列表", notes = "商品列表")
166
+    @ApiImplicitParams({
167
+    })
168
+    @RequestMapping(value = "/miniapp/taGoods", method = RequestMethod.GET)
169
+    public ResponseBean goodsListForMiniApp(@RequestParam(defaultValue = "1") int pageNum,
170
+                                 @RequestParam(defaultValue = "10") int pageSize,
171
+                                 @RequestParam(value = "goodsName",required = false) String goodsName,
172
+                                 @RequestParam(value = "typeId",required = true) Integer typeId) {
173
+        IPage<TaGoods> pg = new Page<>(pageNum, pageSize);
174
+
175
+        ResponseBean userManagement= iTaGoodsService.goodsList(pg,goodsName,typeId);
176
+
177
+        return userManagement;
178
+    }
179
+
170 180
 
171 181
 
172 182
 

+ 14
- 0
src/main/java/com.huiju.welcome/controller/TdGoodsTypeController.java Zobrazit soubor

@@ -134,4 +134,18 @@ public class TdGoodsTypeController extends BaseController {
134 134
 
135 135
         return userManagement;
136 136
     }
137
+
138
+    @ApiOperation(value = "商品类型列表", notes = "商品类型列表")
139
+    @ApiImplicitParams({
140
+    })
141
+    @RequestMapping(value = "/miniapp/tdGoodsType", method = RequestMethod.GET)
142
+    public ResponseBean typeListForMiniApp(@RequestParam(defaultValue = "1") int pageNum,
143
+                                 @RequestParam(defaultValue = "10") int pageSize,
144
+                                 @RequestParam(value = "typeName",required = false) String typeName) {
145
+        IPage<TdGoodsType> pg = new Page<>(pageNum, pageSize);
146
+
147
+        ResponseBean userManagement= iTdGoodsTypeService.typeList(pg,typeName);
148
+
149
+        return userManagement;
150
+    }
137 151
 }