|
@@ -35,17 +35,15 @@ public class StoreProductController {
|
|
|
private StoreProductService storeProductService;
|
|
|
|
|
|
@PostMapping("/add")
|
|
|
- @ApiOperation(value = "商品新增", httpMethod = "POST")
|
|
|
- public Result add(@RequestBody StoreProduct storeProduct, Long userId) {
|
|
|
+ @ApiOperation(value = "商品新增")
|
|
|
+ public Result add(@RequestBody StoreProduct storeProduct) {
|
|
|
if (storeProduct == null) {
|
|
|
return Result.fail(ResultCode.OBJECT_IS_NULL);
|
|
|
}
|
|
|
- if (userId == null) {
|
|
|
- return Result.fail(ResultCode.USERID_IS_NULL);
|
|
|
- }
|
|
|
+
|
|
|
try {
|
|
|
storeProduct.setCreateTime(new Date());
|
|
|
- storeProduct.setCreateUserId(userId);
|
|
|
+// storeProduct.setCreateUserId(userId);
|
|
|
// 生成货号
|
|
|
String itemNumber = generateItemNumber(storeProduct.getCateId());
|
|
|
storeProduct.setItemNumber(itemNumber);
|
|
@@ -82,14 +80,12 @@ public class StoreProductController {
|
|
|
}
|
|
|
|
|
|
@PostMapping("/delete")
|
|
|
- @ApiOperation(value = "商品删除", httpMethod = "POST")
|
|
|
- public Result delete(@RequestParam Long id, Long userId) {
|
|
|
+ @ApiOperation(value = "商品删除")
|
|
|
+ public Result delete(@RequestParam Long id) {
|
|
|
if (id == null) {
|
|
|
return Result.fail(ResultCode.ID_IS_NULL);
|
|
|
}
|
|
|
- if (userId == null) {
|
|
|
- return Result.fail(ResultCode.USERID_IS_NULL);
|
|
|
- }
|
|
|
+
|
|
|
try {
|
|
|
StoreProduct storeProduct = new StoreProduct();
|
|
|
storeProduct.setId(id);
|
|
@@ -103,20 +99,18 @@ public class StoreProductController {
|
|
|
}
|
|
|
|
|
|
@PostMapping("/update")
|
|
|
- @ApiOperation(value = "商品更新", httpMethod = "POST")
|
|
|
- public Result update(@RequestBody StoreProduct storeProduct, Long userId) {
|
|
|
+ @ApiOperation(value = "商品更新")
|
|
|
+ public Result update(@RequestBody StoreProduct storeProduct) {
|
|
|
if (storeProduct == null) {
|
|
|
return Result.fail(ResultCode.OBJECT_IS_NULL);
|
|
|
}
|
|
|
if (storeProduct.getId() == null) {
|
|
|
return Result.fail(ResultCode.ID_IS_NULL);
|
|
|
}
|
|
|
- if (userId == null) {
|
|
|
- return Result.fail(ResultCode.USERID_IS_NULL);
|
|
|
- }
|
|
|
+
|
|
|
try {
|
|
|
storeProduct.setUpdateTime(new Date());
|
|
|
- storeProduct.setUpdateUserId(userId);
|
|
|
+// storeProduct.setUpdateUserId(userId);
|
|
|
storeProductService.update(storeProduct);
|
|
|
} catch (Exception e) {
|
|
|
log.error("更新对象操作异常e:{}", e);
|
|
@@ -126,21 +120,19 @@ public class StoreProductController {
|
|
|
}
|
|
|
|
|
|
@PostMapping("/updateShowStatus")
|
|
|
- @ApiOperation(value = "商品上下架", httpMethod = "POST")
|
|
|
- public Result updateShowStatus(@RequestParam Long id, @RequestParam Integer ShowStatus, Long userId) {
|
|
|
+ @ApiOperation(value = "商品上下架")
|
|
|
+ public Result updateShowStatus(@RequestParam Long id, @RequestParam Integer ShowStatus) {
|
|
|
if (ShowStatus == null) {
|
|
|
return Result.fail(ResultCode.OBJECT_IS_NULL);
|
|
|
}
|
|
|
if (id == null) {
|
|
|
return Result.fail(ResultCode.ID_IS_NULL);
|
|
|
}
|
|
|
- if (userId == null) {
|
|
|
- return Result.fail(ResultCode.USERID_IS_NULL);
|
|
|
- }
|
|
|
+
|
|
|
try {
|
|
|
StoreProduct storeProduct = new StoreProduct();
|
|
|
storeProduct.setUpdateTime(new Date());
|
|
|
- storeProduct.setUpdateUserId(userId);
|
|
|
+// storeProduct.setUpdateUserId(userId);
|
|
|
storeProduct.setIsShow(ShowStatus);
|
|
|
storeProductService.update(storeProduct);
|
|
|
} catch (Exception e) {
|
|
@@ -151,14 +143,12 @@ public class StoreProductController {
|
|
|
}
|
|
|
|
|
|
@PostMapping("/detail")
|
|
|
- @ApiOperation(value = "商品获取详情", httpMethod = "POST")
|
|
|
- public Result<StoreProduct> detail(@RequestParam Long id, Long userId) {
|
|
|
+ @ApiOperation(value = "商品获取详情")
|
|
|
+ public Result<StoreProduct> detail(@RequestParam Long id) {
|
|
|
if (id == null) {
|
|
|
return Result.fail(ResultCode.ID_IS_NULL);
|
|
|
}
|
|
|
- if (userId == null) {
|
|
|
- return Result.fail(ResultCode.USERID_IS_NULL);
|
|
|
- }
|
|
|
+
|
|
|
StoreProduct storeProduct = null;
|
|
|
try {
|
|
|
storeProduct = storeProductService.findById(id);
|
|
@@ -170,11 +160,9 @@ public class StoreProductController {
|
|
|
}
|
|
|
|
|
|
@PostMapping("/list")
|
|
|
- @ApiOperation(value = "商品获取列表", httpMethod = "POST")
|
|
|
- public Result<List<StoreProduct>> list(@RequestBody StoreProduct storeProduct, @RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size, Long userId) {
|
|
|
- if (userId == null) {
|
|
|
- return Result.fail(ResultCode.USERID_IS_NULL);
|
|
|
- }
|
|
|
+ @ApiOperation(value = "商品获取列表")
|
|
|
+ public Result<List<StoreProduct>> list(@RequestBody StoreProduct storeProduct, @RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size) {
|
|
|
+
|
|
|
PageHelper.startPage(page, size);
|
|
|
|
|
|
Condition condition = new Condition(storeProduct.getClass());
|