|
@@ -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
|
|