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

k.e.book.ddh.controller.CcIntegralLuckConfigController 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.CcIntegralLuckConfigAddDTO;
import k.e.book.ddh.entity.CcIntegralLuckConfigDO;
import k.e.book.ddh.entity.CcIntegralLuckConfigQueryDTO;
import k.e.book.ddh.entity.CcIntegralLuckConfigVO;
import k.e.book.ddh.service.CcIntegralLuckConfigService;
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 = "CcIntegralLuckConfig相关文档")
@RestController
@RequestMapping("/ccIntegralLuckConfig")
public class CcIntegralLuckConfigController {
    @Resource
    private CcIntegralLuckConfigService ccIntegralLuckConfigService;

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

    @ApiOperation("根据 id 查询CcIntegralLuckConfig信息")
    @GetMapping(value = "/get")
    public Result getCcIntegralLuckConfigById(@RequestParam("id") @ApiParam(value = "ccIntegralLuckConfigD") Long id) {
        return Result.success(CcIntegralLuckConfigDO.toVO(ccIntegralLuckConfigService.getById(id)));
    }

    @ApiOperation("新增CcIntegralLuckConfig")
    @PostMapping("/add")
    public Result addCcIntegralLuckConfig(@RequestBody @Valid CcIntegralLuckConfigAddDTO dto) {
        CcIntegralLuckConfigDO entity = CcIntegralLuckConfigDO.toDO(dto);
        ccIntegralLuckConfigService.save(entity);
        return getCcIntegralLuckConfigById(entity.getId());
    }

    @ApiOperation("删除CcIntegralLuckConfig")
    @DeleteMapping("/delete")
    public Result deleteCcIntegralLuckConfigById(@RequestParam("id") @ApiParam(value = "ccIntegralLuckConfigID") Long id) {
        ccIntegralLuckConfigService.removeById(id);
        return Result.success();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy