首页>代码>微信小程序活动助手,包括nodejs后台管理系统和java后台接口>/mini-app-active-helper/03/mini-app-active-helper/src/main/java/com/core/server/controller/LotteryController.java
package com.core.server.controller;

import com.core.server.entity.AppletLotteryRecord;
import com.core.server.entity.dto.AppletLotteryInfoDto;
import com.core.server.entity.dto.AppletLotteryRecordDto;
import com.core.server.entity.dto.search.AppletLotteryInfoSearchDto;
import com.core.server.entity.dto.search.AppletLotteryRecordSearchDto;
import com.core.server.system.init.AllService;
import com.core.server.system.response.RestResponse;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author :qilong sun
 * @date :Created in 2020/2/24 20:57
 * @description:抽奖控制器
 * @modified By:
 * @version: V1.0$
 */
@RestController
@RequestMapping("/lottery")
public class LotteryController {
    @Autowired
    private AllService allService;

    /**
     * 参加抽奖
     *
     * @param appletLotteryRecordDto
     * @return
     */
    @PostMapping(value = "/participateInTheRaffle")
    public RestResponse participateInTheRaffle(@RequestBody(required = false) AppletLotteryRecordDto appletLotteryRecordDto){
        // 获取当前登录用户
        Integer userId = appletLotteryRecordDto.getUserId();
        Boolean aBoolean = allService.appletLotteryInfoService.participateInTheRaffle(userId, appletLotteryRecordDto);
        return new RestResponse(aBoolean);
    }


    /**
     * 查询抽奖记录 by 抽奖id + 用户ID
     * @param appletLotteryRecordSearchDto
     * @return
     */
    @PostMapping(value = "/queryAppletLotteryRecordByLotteryIdAndUserId")
    public RestResponse queryAppletLotteryRecordByLotteryIdAndUserId(@RequestBody(required = false) AppletLotteryRecordSearchDto appletLotteryRecordSearchDto){
        // 获取当前登录用户
        Integer userId = appletLotteryRecordSearchDto.getUserId();
        AppletLotteryRecord appletLotteryRecord = allService.appletLotteryInfoService.queryAppletLotteryRecordByLotteryIdAndUserId(userId, appletLotteryRecordSearchDto);
        return new RestResponse<>(appletLotteryRecord);
    }

    /**
     * 查询抽奖记录(我参与的 和 我创建的 和 我中奖的)
     * @param appletLotteryInfoSearchDto
     * @return
     */
    @PostMapping(value = "/queryLotteryRecordPageList")
    public RestResponse<PageInfo<AppletLotteryInfoDto>> queryLotteryRecordPageList(@RequestBody(required = false) AppletLotteryInfoSearchDto appletLotteryInfoSearchDto) {
        PageInfo<AppletLotteryInfoDto> appletLotteryInfoDtoPageInfo = allService.appletLotteryInfoService.queryLotteryRecordPageList(appletLotteryInfoSearchDto);
        return new RestResponse<>(appletLotteryInfoDtoPageInfo);
    }

    /**
     * 保存抽奖信息
     *
     * @param appletLotteryInfoDto
     * @return
     */
    @PostMapping(value = "/saveAppletLotteryInfoDto")
    public RestResponse<AppletLotteryInfoDto> saveAppletLotteryInfoDto(@RequestBody(required = false) AppletLotteryInfoDto appletLotteryInfoDto) {
        // 获取当前登录用户
        Integer userId = appletLotteryInfoDto.getUserId();
        appletLotteryInfoDto = allService.appletLotteryInfoService.saveAppletLotteryInfoDto(userId, appletLotteryInfoDto);
        return new RestResponse<>(appletLotteryInfoDto);
    }

    /**
     * 查询抽奖信息分页列表
     *
     * @return
     */
    @PostMapping(value = "/queryAppletLotteryInfoPageList")
    public RestResponse<PageInfo<AppletLotteryInfoDto>> queryAppletLotteryInfoPageList(@RequestBody(required = false) AppletLotteryInfoSearchDto AppletLotteryInfoSearchDto) {
        PageInfo<AppletLotteryInfoDto> pageInfo = allService.appletLotteryInfoService.queryAppletLotteryInfoPageList(AppletLotteryInfoSearchDto);
        return new RestResponse<>(pageInfo);
    }
}
最近下载更多
朤朤朤朤朤朤  LV3 4月14日
1195146710  LV4 1月16日
Lyj 329511  LV4 2023年10月11日
yinyun1985  LV14 2023年8月5日
dzlwindy  LV8 2023年7月13日
fcx2019610048  LV3 2022年12月29日
lironggang  LV38 2022年5月27日
wanglinddad  LV54 2022年2月16日
不停yayaya  LV4 2021年11月17日
peixizhu  LV16 2021年8月24日
最近浏览更多
朤朤朤朤朤朤  LV3 4月14日
可是不知道么  LV23 4月1日
最代码_码鑫源  LV6 3月28日
顾北城  LV12 3月24日
sky丶小十  LV7 3月8日
做你的景天  LV7 2月22日
yanixh  LV1 2月19日
dody02  LV9 1月31日
weiwei_2  LV2 1月30日
BestClever  LV32 1月24日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友