web123456

【Java graduation project recommendation】Springboot Chinese style makeup website based on SpringBoot

import org.springframework.web.bind.annotation.*; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import your.package.name.pojo.BeautyProduct; // Suppose your makeup product entity class is BeautyProduct import your.package.name.service.BeautyProductService; // Suppose your service is called BeautyProductService @RestController @RequestMapping("/api/beauty-products") public class BeautyProductController { private final BeautyProductService beautyProductService; public BeautyProductController(BeautyProductService beautyProductService) { this.beautyProductService = beautyProductService; } // Get all makeup products @GetMapping public Page<BeautyProduct> getAllBeautyProducts( @RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer size, @RequestParam(required = false) String keyword) { Page<BeautyProduct> beautyProductsPage = new Page<>(page, size); QueryWrapper<BeautyProduct> queryWrapper = new QueryWrapper<>(); if (keyword != null && !keyword.isEmpty()) { queryWrapper.and(wrapper -> wrapper.like("name", keyword) .or() .like("description", keyword) ); } return beautyProductService.page(beautyProductsPage, queryWrapper); } // Obtain a single makeup product based on ID @GetMapping("/{id}") public BeautyProduct getBeautyProductById(@PathVariable Long id) { return beautyProductService.getById(id); } // Create new makeup products @PostMapping public BeautyProduct createBeautyProduct(@RequestBody BeautyProduct beautyProduct) { beautyProductService.save(beautyProduct); return beautyProduct; } // Update makeup product information @PutMapping("/{id}") public BeautyProduct updateBeautyProduct(@PathVariable Long id, @RequestBody BeautyProduct beautyProduct) { beautyProduct.setId(id); beautyProductService.updateById(beautyProduct); return beautyProduct; } // Delete the makeup product @DeleteMapping("/{id}") public void deleteBeautyProduct(@PathVariable Long id) { beautyProductService.removeById(id); } }