限时促销管理代码

master
王皓雯 6 years ago
parent 089f3ea1ec
commit 7bdcc6d9a6

@ -0,0 +1,84 @@
package com.macro.mall.controller;
import com.macro.mall.dto.CommonResult;
import com.macro.mall.model.SmsFlashPromotion;
import com.macro.mall.service.SmsFlashPromotionService;
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 = "SmsFlashPromotionController",description = "限时购活动管理")
@RequestMapping("/flash")
public class SmsFlashPromotionController {
@Autowired
private SmsFlashPromotionService flashPromotionService;//限时促销服务
@ApiOperation("添加活动")
@RequestMapping(value = "/create",method = RequestMethod.POST)
@ResponseBody
public Object create(@RequestBody SmsFlashPromotion flashPromotion){
int count = flashPromotionService.create(flashPromotion);
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 SmsFlashPromotion flashPromotion){
int count = flashPromotionService.update(id,flashPromotion);
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 = flashPromotionService.delete(id);
if(count>0){
return new CommonResult().success(count);
}
return new CommonResult().failed();
}
@ApiOperation("修改上下线状态")
@RequestMapping(value = "/update/status/{id}",method = RequestMethod.POST)
@ResponseBody
public Object update(@PathVariable Long id,Integer status){
int count = flashPromotionService.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){//获取信息
SmsFlashPromotion flashPromotion = flashPromotionService.getItem(id);
return new CommonResult().success(flashPromotion);
}
@ApiOperation("根据活动名称分页查询")
@RequestMapping(value = "/list",method = RequestMethod.GET)
@ResponseBody
public Object getItem(@RequestParam(value = "keyword",required = false)String keyword,//活动关键字
@RequestParam(value = "pageSize",defaultValue = "5")Integer pageSize,
@RequestParam(value = "pageNum",defaultValue = "1")Integer pageNum){
List<SmsFlashPromotion> flashPromotionList = flashPromotionService.list(keyword,pageSize,pageNum);
return new CommonResult().pageSuccess(flashPromotionList);
}
}

@ -0,0 +1,75 @@
package com.macro.mall.controller;
import com.macro.mall.dto.CommonResult;
import com.macro.mall.dto.SmsFlashPromotionProduct;
import com.macro.mall.model.SmsFlashPromotionProductRelation;
import com.macro.mall.service.SmsFlashPromotionProductRelationService;
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 = "SmsFlashPromotionProductRelationController", description = "限时购和商品关系管理")
@RequestMapping("/flashProductRelation")
public class SmsFlashPromotionProductRelationController {
@Autowired
private SmsFlashPromotionProductRelationService relationService;//限时促销商品关联服务
@ApiOperation("批量选择商品添加关联")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public Object create(@RequestBody List<SmsFlashPromotionProductRelation> relationList) {
int count = relationService.create(relationList);//关联服务
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 SmsFlashPromotionProductRelation relation) {
int count = relationService.update(id,relation);
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 = relationService.delete(id);
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) {//根据商品id获取信息
SmsFlashPromotionProductRelation relation = relationService.getItem(id);
return new CommonResult().success(relation);
}
@ApiOperation("分页查询不同场次关联及商品信息")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public Object list(@RequestParam(value = "flashPromotionId")Long flashPromotionId,//限时促销id
@RequestParam(value = "flashPromotionSessionId")Long flashPromotionSessionId,//限时促销会场id
@RequestParam(value = "pageSize",defaultValue = "5")Integer pageSize,
@RequestParam(value = "pageNum",defaultValue = "1")Integer pageNum) {
List<SmsFlashPromotionProduct> flashPromotionProductList = relationService.list(flashPromotionId,flashPromotionSessionId,pageSize,pageNum);
return new CommonResult().pageSuccess(flashPromotionProductList);
}
}

@ -0,0 +1,91 @@
package com.macro.mall.controller;
import com.macro.mall.dto.CommonResult;
import com.macro.mall.dto.SmsFlashPromotionSessionDetail;
import com.macro.mall.model.SmsFlashPromotionSession;
import com.macro.mall.service.SmsFlashPromotionSessionService;
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 = "SmsFlashPromotionSessionController", description = "限时购场次管理")
@RequestMapping("/flashSession")
public class SmsFlashPromotionSessionController {
@Autowired
private SmsFlashPromotionSessionService flashPromotionSessionService;
@ApiOperation("添加场次")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public Object create(@RequestBody SmsFlashPromotionSession promotionSession) {
int count = flashPromotionSessionService.create(promotionSession);//限时促销会场服务
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 SmsFlashPromotionSession promotionSession) {
int count = flashPromotionSessionService.update(id,promotionSession);
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 = flashPromotionSessionService.updateStatus(id,status);
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 = flashPromotionSessionService.delete(id);
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) {
SmsFlashPromotionSession promotionSession = flashPromotionSessionService.getItem(id);
return new CommonResult().success(promotionSession);
}
@ApiOperation("获取全部场次")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public Object list() {//获取信息成列表
List<SmsFlashPromotionSession> promotionSessionList = flashPromotionSessionService.list();
return new CommonResult().success(promotionSessionList);
}
@ApiOperation("获取全部可选场次及其数量")
@RequestMapping(value = "/selectList", method = RequestMethod.GET)
@ResponseBody
public Object selectList(Long flashPromotionId) {//可选择列表
List<SmsFlashPromotionSessionDetail> promotionSessionList = flashPromotionSessionService.selectList(flashPromotionId);
return new CommonResult().success(promotionSessionList);
}
}
Loading…
Cancel
Save