package com.panzhihua.applets.api; import com.panzhihua.common.controller.BaseController; import com.panzhihua.common.model.dtos.property.CommonPage; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.raffle.ComActRaffleVO; import com.panzhihua.common.service.community.CommunityService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; /** * 抽奖活动表(ComActRaffle)表控制层 * projectName 成都呐喊信息技术有限公司-智慧社区项目 * description: 抽奖活动表相关功能 * * @author zzj * @since 2022-02-18 14:31:20 */ @Slf4j @Api(tags = {"抽奖活动"}) @RestController @RequestMapping("comActRaffle") public class ComActRaffleApi extends BaseController { /** * 服务对象 */ @Resource private CommunityService communityService; /** * 分页查询所有数据 * * @param commonPage 查询实体 * @return 所有数据 */ @ApiOperation(value = "分页查询",response = ComActRaffleVO.class) @PostMapping("queryAll") public R selectAll(@RequestBody CommonPage commonPage) { commonPage.setType(1); return this.communityService.selectAllComActRaffle(commonPage); } /** * 通过主键查询单条数据 * * @param id 主键 * @return 单条数据 */ @ApiOperation(value = "详情",response = ComActRaffleVO.class) @GetMapping("{id}") public R selectOne(@PathVariable("id") Long id) { return this.communityService.selectOneComActRaffle(id,this.getUserId()); } /** * 新增数据 * * @param comActRaffleVO 实体对象 * @return 新增结果 */ @ApiOperation(value = "新增数据") @PostMapping public R insert(@RequestBody ComActRaffleVO comActRaffleVO) { comActRaffleVO.setCommunityId(this.getCommunityId()); comActRaffleVO.setCreateBy(this.getUserId()); return this.communityService.insertComActRaffle(comActRaffleVO); } /** * 修改数据 * * @param comActRaffleVO 实体对象 * @return 修改结果 */ @ApiOperation(value = "修改数据") @PostMapping("/update") public R update(@RequestBody ComActRaffleVO comActRaffleVO) { return this.communityService.updateComActRaffle(comActRaffleVO); } /** * 删除数据 * * @param id 主键结合 * @return 删除结果 */ @ApiOperation(value = "删除数据") @GetMapping("del") public R delete(@RequestParam("id") Long id) { return this.communityService.deleteComActRaffle(id); } }