101captain
2022-08-15 bfbfe7d5fd6c90d5f7359762223ce4bd1cc7cfa1
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ComBatteryCommodityActivityController.java
New file
@@ -0,0 +1,175 @@
package com.panzhihua.service_community.api;
import com.panzhihua.service_community.service.ComBatteryCommodityActivityService;
import com.panzhihua.common.model.dtos.common.*;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.service_community.service.ComBatteryCommodityOrderBargainService;
import com.panzhihua.service_community.service.ComBatteryCommodityOrderCollageTeamService;
import com.panzhihua.service_community.service.ComBatteryCommodityOrderService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
 * title: 电动车商城-商家活动表(ComBatteryCommodityActivity)  表控制层
 * <p>
 * projectName 成都呐喊信息技术有限公司-智慧社区项目
 * <p>
 * description: 电动车商城-商家活动表
 *
 * @author lyq
 * @date 2022-03-29 13:17:38
 */
@RestController
@RequestMapping("/comBatteryCommodityActivity")
public class ComBatteryCommodityActivityController {
    @Resource
    private ComBatteryCommodityActivityService comBatteryCommodityActivityService;
    @Resource
    private ComBatteryCommodityOrderCollageTeamService orderCollageTeamService;
    @Resource
    private ComBatteryCommodityOrderBargainService orderBargainService;
    @Resource
    private ComBatteryCommodityOrderService commodityOrderService;
    /**
     * description  queryByPage  分页查询
     *
     * @param comBatteryCommodityActivity 请求参数
     * @return 分页查询返回参数
     * @author lyq
     * @date 2022-03-29 13:17:38
     */
    @PostMapping("/page")
    public R queryByPage(@RequestBody PageComBatteryCommodityActivityDto comBatteryCommodityActivity) {
        return this.comBatteryCommodityActivityService.queryByPage(comBatteryCommodityActivity);
    }
    /**
     * description  add  新增数据
     *
     * @param comBatteryCommodityActivity 请求参数
     * @return 新增结果
     * @author lyq
     * @date 2022-03-29 13:17:38
     */
    @PostMapping("/add")
    public R add(@RequestBody AddComBatteryCommodityActivityDto comBatteryCommodityActivity) {
        return this.comBatteryCommodityActivityService.insert(comBatteryCommodityActivity);
    }
    /**
     * description  edit  编辑数据
     *
     * @param comBatteryCommodityActivity 请求参数
     * @return 编辑结果
     * @author lyq
     * @date 2022-03-29 13:17:38
     */
    @PutMapping("/edit")
    public R edit(@RequestBody EditComBatteryCommodityActivityDto comBatteryCommodityActivity) {
        return this.comBatteryCommodityActivityService.update(comBatteryCommodityActivity);
    }
    /**
     * description  deleteById  删除数据
     *
     * @param id 主键id
     * @return 删除结果
     * @author lyq
     * @date 2022-03-29 13:17:38
     */
    @GetMapping("/delete")
    public R deleteById(@RequestParam("id") Long id) {
        return this.comBatteryCommodityActivityService.deleteById(id);
    }
    /**
     * description  detailById  查询详情
     *
     * @param id 主键id
     * @return 详情数据
     * @author lyq
     * @date 2022-03-29 13:17:38
     */
    @GetMapping("/detail")
    public R detailById(@RequestParam("id") Long id,@RequestParam("userId") Long userId) {
        return this.comBatteryCommodityActivityService.detailById(id,userId);
    }
    /**
     * description  queryByPage  查询列表
     *
     * @param comBatteryCommodityActivity 请求参数
     * @return 列表数据
     * @author lyq
     * @date 2022-03-29 13:17:38
     */
    @PostMapping("/list")
    public R queryByList(@RequestBody PageComBatteryCommodityActivityDto comBatteryCommodityActivity) {
        return this.comBatteryCommodityActivityService.queryByList(comBatteryCommodityActivity);
    }
    /**
     * 修改活动状态
     * @param id    活动id
     * @param status    状态
     * @return  修改结果
     */
    @GetMapping("/updateStatus")
    public R updateStatus(@RequestParam("id") Long id,@RequestParam("status") Integer status) {
        return this.comBatteryCommodityActivityService.updateStatus(id,status);
    }
    /**
     * 创建拼团订单
     * @param orderDto  请求参数
     * @return  创建订单结果
     */
    @PostMapping("/start/fight")
    public R startFight(@RequestBody StartFightOrderDto orderDto){
        return this.orderCollageTeamService.startFight(orderDto);
    }
    /**
     * 创建砍价订单
     * @param orderDto  请求参数
     * @return  创建订单结果
     */
    @PostMapping("/start/bargain")
    public R startBargain(@RequestBody StartBargainOrderDto orderDto){
        return this.orderBargainService.startBargain(orderDto);
    }
    /**
     * 帮好友砍价
     * @param orderDto  请求参数
     * @return  创建订单结果
     */
    @PostMapping("/start/user/bargain")
    public R startUserBargain(@RequestBody StartUserBargainOrderDto orderDto){
        return this.orderBargainService.startUserBargain(orderDto);
    }
    /**
     * 查询砍价记录详情
     * @param id  砍价记录id
     * @return  创建订单结果
     */
    @GetMapping("/user/bargain")
    public R getUserBargain(@RequestParam("id") Long id){
        return this.orderBargainService.getUserBargain(id);
    }
    /**
     * 创建秒杀订单
     * @param orderDto  请求参数
     * @return  创建订单结果
     */
    @PostMapping("/start/seckill")
    public R startSeckill(@RequestBody StartSeckillOrderDto orderDto){
        return this.commodityOrderService.startSeckill(orderDto);
    }
}