All Downloads are FREE. Search and download functionalities are using the official Maven repository.

k.e.book.ddh.controller.CcIntegralLuckLogController Maven / Gradle / Ivy


package k.e.book.ddh.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import k.e.book.common.model.Result;
import k.e.book.ddh.entity.CcIntegralLuckLogAddDTO;
import k.e.book.ddh.entity.CcIntegralLuckLogDO;
import k.e.book.ddh.entity.CcIntegralLuckLogQueryDTO;
import k.e.book.ddh.entity.CcIntegralLuckLogVO;
import k.e.book.ddh.service.CcIntegralLuckLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * @author kk
 * @date 2023-05-21 11:13
 */

@Api(tags = "CcIntegralLuckLog相关文档")
@RestController
@RequestMapping("/ccIntegralLuckLog")
public class CcIntegralLuckLogController {
    @Resource
    private CcIntegralLuckLogService ccIntegralLuckLogService;

    @ApiOperation("分页查询CcIntegralLuckLog信息")
    @PostMapping(value = "/page")
    public Result> queryPage(@RequestBody @Valid  CcIntegralLuckLogQueryDTO dto) {
        IPage page = ccIntegralLuckLogService.selectProductPage(dto);
        List records = page.getRecords();
        return Result.success(records.stream().map(CcIntegralLuckLogDO::toVO).filter(Objects::nonNull).collect(Collectors.toList()), page.getTotal());
    }

    @ApiOperation("根据 id 查询CcIntegralLuckLog信息")
    @GetMapping(value = "/get")
    public Result getCcIntegralLuckLogById(@RequestParam("id") @ApiParam(value = "ccIntegralLuckLogD") Long id) {
        return Result.success(CcIntegralLuckLogDO.toVO(ccIntegralLuckLogService.getById(id)));
    }

    @ApiOperation("新增CcIntegralLuckLog")
    @PostMapping("/add")
    public Result addCcIntegralLuckLog(@RequestBody @Valid CcIntegralLuckLogAddDTO dto) {
        CcIntegralLuckLogDO entity = CcIntegralLuckLogDO.toDO(dto);
        ccIntegralLuckLogService.save(entity);
        return getCcIntegralLuckLogById(entity.getId());
    }

    @ApiOperation("删除CcIntegralLuckLog")
    @DeleteMapping("/delete")
    public Result deleteCcIntegralLuckLogById(@RequestParam("id") @ApiParam(value = "ccIntegralLuckLogID") Long id) {
        ccIntegralLuckLogService.removeById(id);
        return Result.success();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy