package com.mes.hollow.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mes.hollow.entity.HollowFormulaDetails; import com.mes.hollow.service.HollowFormulaDetailsService; import com.mes.utils.Result; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; /** * (HollowFormulaDetails)表控制层 * * @author makejava * @since 2024-12-27 13:34:59 */ @Api(tags = "中空配方详情信息") @RestController @RequestMapping("hollowFormulaDetails") public class HollowFormulaDetailsController { /** * 服务对象 */ @Resource private HollowFormulaDetailsService hollowFormulaDetailsService; @ApiOperation("获取配方信息(分页)") @PostMapping("/pageFormulaDetails") public Result> pageFormulaDetails(Integer pageNo, Integer pageSize, String keyword) { Page page = new Page<>(pageNo, pageSize); LambdaQueryWrapper wrapper = new LambdaQueryWrapper().like(StringUtils.isNotBlank(keyword) , HollowFormulaDetails::getFormulaName, keyword); return Result.success(hollowFormulaDetailsService.page(page, wrapper)); } @ApiOperation("获取配方信息(列表)") @PostMapping("/listFormulaDetails") public Result> listFormulaDetails(String keyword) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper().like(StringUtils.isNotBlank(keyword) , HollowFormulaDetails::getFormulaName, keyword); return Result.success(hollowFormulaDetailsService.list(wrapper)); } @ApiOperation("通过主键查询单条数据") @GetMapping("/getFormulaDetailsById") public Result getFormulaDetailsById(Long id) { return Result.success(hollowFormulaDetailsService.getById(id)); } @ApiOperation("新增数据") @PostMapping("/saveFormulaDetails") public Result saveFormulaDetails(@RequestBody HollowFormulaDetails hollowFormulaDetails) { return Result.success(hollowFormulaDetailsService.save(hollowFormulaDetails)); } @ApiOperation("修改数据") @PostMapping("updateFormulaDetails") public Result updateFormulaDetails(@RequestBody HollowFormulaDetails hollowFormulaDetails) { return Result.success(this.hollowFormulaDetailsService.updateById(hollowFormulaDetails)); } @ApiOperation("删除数据") @PostMapping("deleteFormulaDetails") public Result deleteFormulaDetails(@RequestParam("idList") List idList) { return Result.success(this.hollowFormulaDetailsService.removeByIds(idList)); } }