品类信息
parent
02c5be6c3d
commit
508569cf08
|
@ -35,16 +35,17 @@ import com.muyu.product.service.CategoryInfoService;
|
|||
@RestController
|
||||
@RequestMapping("/category")
|
||||
public class CategoryInfoController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CategoryInfoService categoryInfoService;
|
||||
|
||||
/**
|
||||
* 查询品类信息列表
|
||||
*/
|
||||
@ApiOperation("获取品类信息列表")
|
||||
@ApiOperation("获取品类信息")
|
||||
@RequiresPermissions("product:category:list")
|
||||
@GetMapping("/list")
|
||||
public Result<List<CategoryInfo>> list(CategoryInfo categoryInfo) {
|
||||
public Result<List<CategoryInfo>> list(CategoryInfo categoryInfo){
|
||||
List<CategoryInfo> list = categoryInfoService.list(categoryInfo);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
@ -54,7 +55,7 @@ public class CategoryInfoController extends BaseController {
|
|||
*/
|
||||
@ApiOperation("导出品类信息列表")
|
||||
@RequiresPermissions("product:category:export")
|
||||
@Log(title = "品类信息", businessType = BusinessType.EXPORT)
|
||||
@Log(title = "品类信息",businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, CategoryInfo categoryInfo) {
|
||||
List<CategoryInfo> list = categoryInfoService.list(categoryInfo);
|
||||
|
@ -100,7 +101,7 @@ public class CategoryInfoController extends BaseController {
|
|||
*/
|
||||
@RequiresPermissions("product:category:remove")
|
||||
@Log(title = "品类信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除品类信息")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||
public Result<String> remove(@PathVariable List<Long> ids) {
|
||||
|
|
|
@ -11,11 +11,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
* @date 2024-02-27
|
||||
*/
|
||||
public interface CategoryInfoService extends IService<CategoryInfo> {
|
||||
|
||||
/**
|
||||
* 查询品类信息列表
|
||||
*
|
||||
* @param categoryInfo 品类信息
|
||||
* @return 品类信息集合
|
||||
* 查询品类列表
|
||||
*/
|
||||
public List<CategoryInfo> list(CategoryInfo categoryInfo);
|
||||
|
||||
|
|
|
@ -22,40 +22,27 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, CategoryInfo> implements CategoryInfoService {
|
||||
|
||||
/**
|
||||
* 查询品类信息列表
|
||||
*
|
||||
* @param categoryInfo 品类信息
|
||||
* @return 品类信息
|
||||
* 查询品类信息
|
||||
*/
|
||||
@Override
|
||||
public List<CategoryInfo> list(CategoryInfo categoryInfo) {
|
||||
public List<CategoryInfo> list(CategoryInfo categoryInfo){
|
||||
LambdaQueryWrapper<CategoryInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
|
||||
if (ObjUtils.notNull(categoryInfo.getName())){
|
||||
queryWrapper.like(CategoryInfo::getName, categoryInfo.getName());
|
||||
if(ObjUtils.notNull(categoryInfo.getName())){
|
||||
queryWrapper.like(CategoryInfo::getName,categoryInfo.getName());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(categoryInfo.getImage())){
|
||||
queryWrapper.eq(CategoryInfo::getImage, categoryInfo.getImage());
|
||||
if(ObjUtils.notNull(categoryInfo.getImage())){
|
||||
queryWrapper.eq(CategoryInfo::getImage,categoryInfo.getImage());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(categoryInfo.getParentId())){
|
||||
queryWrapper.eq(CategoryInfo::getParentId, categoryInfo.getParentId());
|
||||
if(ObjUtils.notNull(categoryInfo.getParentId())){
|
||||
queryWrapper.eq(CategoryInfo::getParentId,categoryInfo.getParentId());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(categoryInfo.getStart())){
|
||||
queryWrapper.eq(CategoryInfo::getStart, categoryInfo.getStart());
|
||||
if(ObjUtils.notNull(categoryInfo.getStart())){
|
||||
queryWrapper.eq(CategoryInfo::getStart,categoryInfo.getStart());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(categoryInfo.getIntroduction())){
|
||||
queryWrapper.eq(CategoryInfo::getIntroduction, categoryInfo.getIntroduction());
|
||||
if(ObjUtils.notNull(categoryInfo.getIntroduction())){
|
||||
queryWrapper.eq(CategoryInfo::getIntroduction,categoryInfo.getIntroduction());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return list(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue