品类信息

master
Jiang Peng 2024-03-03 10:20:49 +08:00
parent 02c5be6c3d
commit 508569cf08
3 changed files with 19 additions and 33 deletions

View File

@ -35,16 +35,17 @@ import com.muyu.product.service.CategoryInfoService;
@RestController @RestController
@RequestMapping("/category") @RequestMapping("/category")
public class CategoryInfoController extends BaseController { public class CategoryInfoController extends BaseController {
@Autowired @Autowired
private CategoryInfoService categoryInfoService; private CategoryInfoService categoryInfoService;
/** /**
* *
*/ */
@ApiOperation("获取品类信息列表") @ApiOperation("获取品类信息")
@RequiresPermissions("product:category:list") @RequiresPermissions("product:category:list")
@GetMapping("/list") @GetMapping("/list")
public Result<List<CategoryInfo>> list(CategoryInfo categoryInfo) { public Result<List<CategoryInfo>> list(CategoryInfo categoryInfo){
List<CategoryInfo> list = categoryInfoService.list(categoryInfo); List<CategoryInfo> list = categoryInfoService.list(categoryInfo);
return Result.success(list); return Result.success(list);
} }
@ -54,7 +55,7 @@ public class CategoryInfoController extends BaseController {
*/ */
@ApiOperation("导出品类信息列表") @ApiOperation("导出品类信息列表")
@RequiresPermissions("product:category:export") @RequiresPermissions("product:category:export")
@Log(title = "品类信息", businessType = BusinessType.EXPORT) @Log(title = "品类信息",businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, CategoryInfo categoryInfo) { public void export(HttpServletResponse response, CategoryInfo categoryInfo) {
List<CategoryInfo> list = categoryInfoService.list(categoryInfo); List<CategoryInfo> list = categoryInfoService.list(categoryInfo);

View File

@ -11,11 +11,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
* @date 2024-02-27 * @date 2024-02-27
*/ */
public interface CategoryInfoService extends IService<CategoryInfo> { public interface CategoryInfoService extends IService<CategoryInfo> {
/** /**
* *
*
* @param categoryInfo
* @return
*/ */
public List<CategoryInfo> list(CategoryInfo categoryInfo); public List<CategoryInfo> list(CategoryInfo categoryInfo);

View File

@ -22,40 +22,27 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, CategoryInfo> implements CategoryInfoService { public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, CategoryInfo> implements CategoryInfoService {
/** /**
* *
*
* @param categoryInfo
* @return
*/ */
@Override @Override
public List<CategoryInfo> list(CategoryInfo categoryInfo) { public List<CategoryInfo> list(CategoryInfo categoryInfo){
LambdaQueryWrapper<CategoryInfo> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<CategoryInfo> queryWrapper = new LambdaQueryWrapper<>();
if(ObjUtils.notNull(categoryInfo.getName())){
if (ObjUtils.notNull(categoryInfo.getName())){ queryWrapper.like(CategoryInfo::getName,categoryInfo.getName());
queryWrapper.like(CategoryInfo::getName, categoryInfo.getName());
} }
if(ObjUtils.notNull(categoryInfo.getImage())){
if (ObjUtils.notNull(categoryInfo.getImage())){ queryWrapper.eq(CategoryInfo::getImage,categoryInfo.getImage());
queryWrapper.eq(CategoryInfo::getImage, categoryInfo.getImage());
} }
if(ObjUtils.notNull(categoryInfo.getParentId())){
if (ObjUtils.notNull(categoryInfo.getParentId())){ queryWrapper.eq(CategoryInfo::getParentId,categoryInfo.getParentId());
queryWrapper.eq(CategoryInfo::getParentId, categoryInfo.getParentId());
} }
if(ObjUtils.notNull(categoryInfo.getStart())){
if (ObjUtils.notNull(categoryInfo.getStart())){ queryWrapper.eq(CategoryInfo::getStart,categoryInfo.getStart());
queryWrapper.eq(CategoryInfo::getStart, categoryInfo.getStart());
} }
if(ObjUtils.notNull(categoryInfo.getIntroduction())){
if (ObjUtils.notNull(categoryInfo.getIntroduction())){ queryWrapper.eq(CategoryInfo::getIntroduction,categoryInfo.getIntroduction());
queryWrapper.eq(CategoryInfo::getIntroduction, categoryInfo.getIntroduction());
} }
return list(queryWrapper); return list(queryWrapper);
} }
} }