瀏覽代碼

添加退货原因管理接口

zhh 6 年之前
父節點
當前提交
53092ef98e

文件差異過大導致無法顯示
+ 139 - 117
document/pdm/mall.pdb


文件差異過大導致無法顯示
+ 139 - 117
document/pdm/mall.pdm


+ 86 - 0
mall-admin/src/main/java/com/macro/mall/controller/OmsOrderReturnReasonController.java

@@ -0,0 +1,86 @@
+package com.macro.mall.controller;
+
+import com.macro.mall.dto.CommonResult;
+import com.macro.mall.model.OmsOrderReturnReason;
+import com.macro.mall.service.OmsOrderReturnReasonService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 退货原因管理Controller
+ * Created by macro on 2018/10/17.
+ */
+@Controller
+@Api(tags = "OmsOrderReturnReasonController", description = "退货原因管理")
+@RequestMapping("/returnReason")
+public class OmsOrderReturnReasonController {
+    @Autowired
+    private OmsOrderReturnReasonService orderReturnReasonService;
+
+    @ApiOperation("添加退货原因")
+    @RequestMapping(value = "/create", method = RequestMethod.POST)
+    @ResponseBody
+    public Object create(@RequestBody OmsOrderReturnReason returnReason) {
+        int count = orderReturnReasonService.create(returnReason);
+        if(count>0){
+            return new CommonResult().success(count);
+        }
+        return new CommonResult().failed();
+    }
+
+    @ApiOperation("修改退货原因")
+    @RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
+    @ResponseBody
+    public Object update(@PathVariable Long id, @RequestBody OmsOrderReturnReason returnReason) {
+        int count = orderReturnReasonService.update(id,returnReason);
+        if(count>0){
+            return new CommonResult().success(count);
+        }
+        return new CommonResult().failed();
+    }
+
+    @ApiOperation("批量删除退货原因")
+    @RequestMapping(value = "/delete", method = RequestMethod.POST)
+    @ResponseBody
+    public Object delete(@RequestParam("ids") List<Long> ids) {
+        int count = orderReturnReasonService.delete(ids);
+        if(count>0){
+            return new CommonResult().success(count);
+        }
+        return new CommonResult().failed();
+    }
+
+    @ApiOperation("分页查询全部退货原因")
+    @RequestMapping(value = "/list", method = RequestMethod.GET)
+    @ResponseBody
+    public Object list(@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
+                       @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
+        List<OmsOrderReturnReason> reasonList = orderReturnReasonService.list(pageSize,pageNum);
+        return new CommonResult().pageSuccess(reasonList);
+    }
+
+    @ApiOperation("获取单个退货原因详情信息")
+    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
+    @ResponseBody
+    public Object getItem(@PathVariable Long id) {
+        OmsOrderReturnReason reason = orderReturnReasonService.getItem(id);
+        return new CommonResult().success(reason);
+    }
+
+    @ApiOperation("修改退货原因启用状态")
+    @RequestMapping(value = "/update/status", method = RequestMethod.POST)
+    @ResponseBody
+    public Object updateStatus(@RequestParam(value = "status") Integer status,
+                               @RequestParam("ids") List<Long> ids) {
+        int count = orderReturnReasonService.updateStatus(ids,status);
+        if(count>0){
+            return new CommonResult().success(count);
+        }
+        return new CommonResult().failed();
+    }
+}

+ 41 - 0
mall-admin/src/main/java/com/macro/mall/service/OmsOrderReturnReasonService.java

@@ -0,0 +1,41 @@
+package com.macro.mall.service;
+
+import com.macro.mall.model.OmsOrderReturnReason;
+
+import java.util.List;
+
+/**
+ * 订单原因管理Service
+ * Created by macro on 2018/10/17.
+ */
+public interface OmsOrderReturnReasonService {
+    /**
+     * 添加订单原因
+     */
+    int create(OmsOrderReturnReason returnReason);
+
+    /**
+     * 修改退货原因
+     */
+    int update(Long id, OmsOrderReturnReason returnReason);
+
+    /**
+     * 批量删除退货原因
+     */
+    int delete(List<Long> ids);
+
+    /**
+     * 分页获取退货原因
+     */
+    List<OmsOrderReturnReason> list(Integer pageSize, Integer pageNum);
+
+    /**
+     * 批量修改退货原因状态
+     */
+    int updateStatus(List<Long> ids, Integer status);
+
+    /**
+     * 获取单个退货原因详情信息
+     */
+    OmsOrderReturnReason getItem(Long id);
+}

+ 65 - 0
mall-admin/src/main/java/com/macro/mall/service/impl/OmsOrderReturnReasonServiceImpl.java

@@ -0,0 +1,65 @@
+package com.macro.mall.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.macro.mall.mapper.OmsOrderReturnReasonMapper;
+import com.macro.mall.model.OmsOrderReturnReason;
+import com.macro.mall.model.OmsOrderReturnReasonExample;
+import com.macro.mall.service.OmsOrderReturnReasonService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 订单原因管理Service实现类
+ * Created by macro on 2018/10/17.
+ */
+@Service
+public class OmsOrderReturnReasonServiceImpl implements OmsOrderReturnReasonService {
+    @Autowired
+    private OmsOrderReturnReasonMapper returnReasonMapper;
+    @Override
+    public int create(OmsOrderReturnReason returnReason) {
+        returnReason.setCreateTime(new Date());
+        return returnReasonMapper.insert(returnReason);
+    }
+
+    @Override
+    public int update(Long id, OmsOrderReturnReason returnReason) {
+        returnReason.setId(id);
+        return returnReasonMapper.updateByPrimaryKey(returnReason);
+    }
+
+    @Override
+    public int delete(List<Long> ids) {
+        OmsOrderReturnReasonExample example = new OmsOrderReturnReasonExample();
+        example.createCriteria().andIdIn(ids);
+        return returnReasonMapper.deleteByExample(example);
+    }
+
+    @Override
+    public List<OmsOrderReturnReason> list(Integer pageSize, Integer pageNum) {
+        PageHelper.startPage(pageNum,pageSize);
+        OmsOrderReturnReasonExample example = new OmsOrderReturnReasonExample();
+        example.setOrderByClause("sort desc");
+        return returnReasonMapper.selectByExample(example);
+    }
+
+    @Override
+    public int updateStatus(List<Long> ids, Integer status) {
+        if(!status.equals(0)&&!status.equals(1)){
+            return 0;
+        }
+        OmsOrderReturnReason record = new OmsOrderReturnReason();
+        record.setStatus(status);
+        OmsOrderReturnReasonExample example = new OmsOrderReturnReasonExample();
+        example.createCriteria().andIdIn(ids);
+        return returnReasonMapper.updateByExampleSelective(record,example);
+    }
+
+    @Override
+    public OmsOrderReturnReason getItem(Long id) {
+        return returnReasonMapper.selectByPrimaryKey(id);
+    }
+}

部分文件因文件數量過多而無法顯示