|
@@ -0,0 +1,122 @@
|
|
|
+package com.txz.mall.controller;
|
|
|
+
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
+import com.txz.mall.core.Result;
|
|
|
+import com.txz.mall.core.ResultCode;
|
|
|
+import com.txz.mall.model.StoreOrderStatus;
|
|
|
+import com.txz.mall.service.StoreOrderStatusService;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import tk.mybatis.mapper.entity.Condition;
|
|
|
+import tk.mybatis.mapper.entity.Example.Criteria;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by CodeGenerator on 2025/07/25.
|
|
|
+ */
|
|
|
+@Api(tags = "[后台]storeOrderStatus管理")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/store/order/status")
|
|
|
+public class StoreOrderStatusController {
|
|
|
+
|
|
|
+ private static Logger log = LoggerFactory.getLogger(StoreOrderStatusController.class);
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private StoreOrderStatusService storeOrderStatusService;
|
|
|
+
|
|
|
+ @PostMapping("/add")
|
|
|
+ @ApiOperation(value = "storeOrderStatus新增")
|
|
|
+ public Result add(@RequestBody StoreOrderStatus storeOrderStatus) {
|
|
|
+ if (storeOrderStatus == null) {
|
|
|
+ return Result.fail(ResultCode.OBJECT_IS_NULL);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ storeOrderStatus.setCreateTime(new Date());
|
|
|
+// storeOrderStatus.setCreateUserId(userId);
|
|
|
+ storeOrderStatusService.save(storeOrderStatus);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("新增对象操作异常e:{}", e);
|
|
|
+ return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/delete")
|
|
|
+ @ApiOperation(value = "storeOrderStatus删除")
|
|
|
+ public Result delete(@RequestParam Long id) {
|
|
|
+ if (id == null) {
|
|
|
+ return Result.fail(ResultCode.ID_IS_NULL);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ StoreOrderStatus storeOrderStatus = new StoreOrderStatus();
|
|
|
+ storeOrderStatus.setId(id);
|
|
|
+ storeOrderStatusService.update(storeOrderStatus);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("删除对象操作异常e:{}", e);
|
|
|
+ return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/update")
|
|
|
+ @ApiOperation(value = "storeOrderStatus更新")
|
|
|
+ public Result update(@RequestBody StoreOrderStatus storeOrderStatus) {
|
|
|
+ if (storeOrderStatus == null) {
|
|
|
+ return Result.fail(ResultCode.OBJECT_IS_NULL);
|
|
|
+ }
|
|
|
+ if (storeOrderStatus.getId() == null) {
|
|
|
+ return Result.fail(ResultCode.ID_IS_NULL);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+// storeOrderStatus.setUpdateUserId(userId);
|
|
|
+ storeOrderStatusService.update(storeOrderStatus);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("更新对象操作异常e:{}", e);
|
|
|
+ return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/detail")
|
|
|
+ @ApiOperation(value = "storeOrderStatus获取详情")
|
|
|
+ public Result<StoreOrderStatus> detail(@RequestParam Long id) {
|
|
|
+ if (id == null) {
|
|
|
+ return Result.fail(ResultCode.ID_IS_NULL);
|
|
|
+ }
|
|
|
+ StoreOrderStatus storeOrderStatus = null;
|
|
|
+ try {
|
|
|
+ storeOrderStatus = storeOrderStatusService.findById(id);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("查询对象操作异常e:{}", e);
|
|
|
+ return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+ return Result.success(storeOrderStatus);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/list")
|
|
|
+ @ApiOperation(value = "storeOrderStatus获取列表")
|
|
|
+ public Result<List<StoreOrderStatus>> list(@RequestBody StoreOrderStatus storeOrderStatus, @RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size) {
|
|
|
+ PageHelper.startPage(page, size);
|
|
|
+
|
|
|
+ Condition condition = new Condition(storeOrderStatus.getClass());
|
|
|
+ Criteria criteria = condition.createCriteria();
|
|
|
+ criteria.andEqualTo("isDelete", 0);
|
|
|
+ condition.setOrderByClause("create_time DESC");
|
|
|
+ PageInfo pageInfo = null;
|
|
|
+ try {
|
|
|
+ List<StoreOrderStatus> list = storeOrderStatusService.findByCondition(condition);
|
|
|
+ pageInfo = new PageInfo(list);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("查询对象操作异常e:{}", e);
|
|
|
+ return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
+ return Result.success(pageInfo);
|
|
|
+ }
|
|
|
+}
|