parent
7bdcc6d9a6
commit
178f76a3e5
@ -0,0 +1,83 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.model.SmsHomeAdvertise;
|
||||
import com.macro.mall.service.SmsHomeAdvertiseService;
|
||||
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
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "SmsHomeAdvertiseController", description = "首页轮播广告管理")
|
||||
@RequestMapping("/home/advertise")
|
||||
public class SmsHomeAdvertiseController {
|
||||
@Autowired
|
||||
private SmsHomeAdvertiseService advertiseService;
|
||||
|
||||
@ApiOperation("添加广告")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object create(@RequestBody SmsHomeAdvertise advertise) {
|
||||
int count = advertiseService.create(advertise);
|
||||
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 = advertiseService.delete(ids);
|
||||
if (count > 0)
|
||||
return new CommonResult().success(count);
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@ApiOperation("修改上下线状态")
|
||||
@RequestMapping(value = "/update/status/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateStatus(@PathVariable Long id, Integer status) {
|
||||
int count = advertiseService.updateStatus(id, status);
|
||||
if (count > 0)
|
||||
return new CommonResult().success(count);
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@ApiOperation("获取广告详情")
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public Object getItem(@PathVariable Long id) {
|
||||
SmsHomeAdvertise advertise = advertiseService.getItem(id);
|
||||
return new CommonResult().success(advertise);
|
||||
}
|
||||
|
||||
@ApiOperation("修改广告")
|
||||
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object update(@PathVariable Long id, @RequestBody SmsHomeAdvertise advertise) {
|
||||
int count = advertiseService.update(id, advertise);
|
||||
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 = "endTime", required = false) String endTime,//结束时间
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<SmsHomeAdvertise> advertiseList = advertiseService.list(name, type, endTime, pageSize, pageNum);
|
||||
return new CommonResult().pageSuccess(advertiseList);
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package com.macro.mall.controller;
|
||||
|
||||
import com.macro.mall.dto.CommonResult;
|
||||
import com.macro.mall.model.SmsHomeNewProduct;
|
||||
import com.macro.mall.service.SmsHomeNewProductService;
|
||||
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
|
||||
*/
|
||||
@Controller
|
||||
@Api(tags = "SmsHomeNewProductController", description = "首页新品管理")
|
||||
@RequestMapping("/home/newProduct")
|
||||
public class SmsHomeNewProductController {
|
||||
@Autowired
|
||||
private SmsHomeNewProductService homeNewProductService;
|
||||
@ApiOperation("添加首页推荐品牌")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object create(@RequestBody List<SmsHomeNewProduct> homeBrandList) {
|
||||
int count = homeNewProductService.create(homeBrandList);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@ApiOperation("修改推荐排序")
|
||||
@RequestMapping(value = "/update/sort/{id}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateSort(@PathVariable Long id, Integer sort) {
|
||||
int count = homeNewProductService.updateSort(id,sort);
|
||||
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 = homeNewProductService.delete(ids);
|
||||
if(count>0){
|
||||
return new CommonResult().success(count);
|
||||
}
|
||||
return new CommonResult().failed();
|
||||
}
|
||||
|
||||
@ApiOperation("批量修改推荐状态")
|
||||
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateRecommendStatus(@RequestParam("ids") List<Long> ids, @RequestParam Integer recommendStatus) {
|
||||
int count = homeNewProductService.updateRecommendStatus(ids,recommendStatus);
|
||||
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 = "productName", required = false) String productName,//商品名称
|
||||
@RequestParam(value = "recommendStatus", required = false) Integer recommendStatus,
|
||||
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
|
||||
List<SmsHomeNewProduct> homeBrandList = homeNewProductService.list(productName,recommendStatus,pageSize,pageNum);
|
||||
return new CommonResult().pageSuccess(homeBrandList);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue