添加优惠券管理接口
This commit is contained in:
@@ -5,7 +5,6 @@ import com.macro.mall.dto.PmsProductParam;
|
||||
import com.macro.mall.dto.PmsProductQueryParam;
|
||||
import com.macro.mall.dto.PmsProductResult;
|
||||
import com.macro.mall.model.PmsProduct;
|
||||
import com.macro.mall.model.PmsProductVertifyRecord;
|
||||
import com.macro.mall.service.PmsProductService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -60,7 +59,7 @@ public class PmsProductController {
|
||||
}
|
||||
|
||||
@ApiOperation("查询商品")
|
||||
@RequestMapping(value = "list", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getList(PmsProductQueryParam productQueryParam,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.dto.SmsCouponParam;
|
||||
import com.macro.mall.model.SmsCoupon;
|
||||
import com.macro.mall.service.SmsCouponService;
|
||||
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/8/28.
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "SmsCouponController", description = "优惠券管理")
|
||||
@RequestMapping("/coupon")
|
||||
public class SmsCouponController {
|
||||
@Autowired
|
||||
private SmsCouponService couponService;
|
||||
@ApiOperation("添加优惠券")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object add(@RequestBody SmsCouponParam couponParam) {
|
||||
int count = couponService.add(couponParam);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@ApiOperation("删除优惠券")
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object delete(@PathVariable Long id) {
|
||||
int count = couponService.delete(id);
|
||||
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 SmsCouponParam couponParam) {
|
||||
int count = couponService.update(id,couponParam);
|
||||
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 = "name",required = false) String name,
|
||||
@RequestParam(value = "type",required = false) Integer type,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<SmsCoupon> couponList = couponService.list(name,type,pageSize,pageNum);
|
||||
return new CommonResult().pageSuccess(couponList);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user