构建了关于品类的类

master
20300 2024-03-07 21:23:17 +08:00
parent 3992579c5d
commit fecbad9105
21 changed files with 407 additions and 0 deletions

View File

@ -0,0 +1,48 @@
package com.muyu.product.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.StringUtils;
import com.muyu.product.domain.AsCategoryAttributeGroup;
import com.muyu.product.domain.CategoryInfo;
import com.muyu.product.service.AsCategoryAttributeGroupService;
import com.muyu.product.service.AsCategoryAttributeService;
import com.muyu.product.service.AsCategoryBrandService;
import com.muyu.product.service.CategoryInfoService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @ClassName CategoryController
* @Description
* @Author ZHIHAO.DAI
* @Date 2024/3/7 16:23
*/
@RestController
@RequestMapping("/category")
public class CategoryController {
@Autowired
private AsCategoryAttributeService asCategoryAttributeService;
@Autowired
private AsCategoryBrandService asCategoryBrandService;
@Autowired
private AsCategoryAttributeGroupService attributeGroupService;
@Autowired
private CategoryInfoService categoryInfoService;
@GetMapping("/getCategoryList")
public Result<List<CategoryInfo>> getCategoryList(String likeName){
LambdaQueryWrapper<CategoryInfo> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotEmpty(likeName)){
queryWrapper.like(CategoryInfo::getName,likeName);
}
List<CategoryInfo> list = categoryInfoService.list(queryWrapper);
return Result.success(list);
}
}

View File

@ -0,0 +1,35 @@
package com.muyu.product.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @ClassName AsCategoryAttribute
* @Description
* @Author ZHIHAO.DAI
* @Date 2024/3/7 16:07
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("as_category_attribute")
public class AsCategoryAttribute extends BaseEntity {
private static final long serialVersionUID = 1L;
@Excel(name = "参数主键", cellType = Excel.ColumnType.NUMERIC)
@TableId( type = IdType.AUTO)
private Integer id;
@Excel(name = "品类编号")
private Integer categoryId;
@Excel(name = "品牌编号")
private Integer attributeId;
}

View File

@ -0,0 +1,35 @@
package com.muyu.product.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @ClassName AsCategoryAttributeGroup
* @Description
* @Author ZHIHAO.DAI
* @Date 2024/3/7 16:06
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("as_category_attribute_group")
public class AsCategoryAttributeGroup extends BaseEntity {
private static final long serialVersionUID = 1L;
@Excel(name = "参数主键", cellType = Excel.ColumnType.NUMERIC)
@TableId( type = IdType.AUTO)
private Integer id;
@Excel(name = "品类编号")
private Integer categoryId;
@Excel(name = "品牌编号")
private Integer attributeGroupId;
}

View File

@ -0,0 +1,35 @@
package com.muyu.product.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @ClassName AsCategoryBrand
* @Description
* @Author ZHIHAO.DAI
* @Date 2024/3/7 16:03
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("as_category_brand")
public class AsCategoryBrand extends BaseEntity {
private static final long serialVersionUID = 1L;
@Excel(name = "参数主键", cellType = Excel.ColumnType.NUMERIC)
@TableId( type = IdType.AUTO)
private Integer id;
@Excel(name = "品类编号")
private Integer categoryId;
@Excel(name = "品牌编号")
private Integer brandId;
}

View File

@ -0,0 +1,39 @@
package com.muyu.product.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.muyu.common.core.annotation.Excel;
import com.muyu.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @ClassName CategoryInfo
* @Description
* @Author ZHIHAO.DAI
* @Date 2024/3/7 16:00
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("category_info")
public class CategoryInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
@Excel(name = "参数主键", cellType = Excel.ColumnType.NUMERIC)
@TableId( type = IdType.AUTO)
private Integer id;
@Excel(name = "品类名称")
private String name;
@Excel(name = "品类图片")
private String image;
@Excel(name = "父级品类")
private Integer parentId;
@Excel(name = "简介")
private String introduction;
}

View File

@ -0,0 +1,14 @@
package com.muyu.product.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.AsCategoryAttribute;
import com.muyu.product.domain.AsCategoryAttributeGroup;
/**
* @ClassName AsCategoryAttribute
* @Description
* @Author ZHIHAO.DAI
* @Date 2024/3/7 16:12
*/
public interface AsCategoryAttributeGroupMapper extends BaseMapper<AsCategoryAttributeGroup> {
}

View File

@ -0,0 +1,13 @@
package com.muyu.product.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.AsCategoryAttribute;
/**
* @ClassName AsCategoryAttribute
* @Description
* @Author ZHIHAO.DAI
* @Date 2024/3/7 16:12
*/
public interface AsCategoryAttributeMapper extends BaseMapper<AsCategoryAttribute> {
}

View File

@ -0,0 +1,13 @@
package com.muyu.product.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.AsCategoryBrand;
/**
* @ClassName AsCategoryAttribute
* @Description
* @Author ZHIHAO.DAI
* @Date 2024/3/7 16:12
*/
public interface AsCategoryBrandMapper extends BaseMapper<AsCategoryBrand> {
}

View File

@ -0,0 +1,13 @@
package com.muyu.product.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.product.domain.CategoryInfo;
/**
* @ClassName CategoryInfoMapper
* @Description
* @Author ZHIHAO.DAI
* @Date 2024/3/7 16:10
*/
public interface CategoryInfoMapper extends BaseMapper<CategoryInfo> {
}

View File

@ -0,0 +1,17 @@
package com.muyu.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.product.domain.AsAttributeAttributeGroup;
import com.muyu.product.domain.AsCategoryAttributeGroup;
import com.muyu.product.domain.AttributeInfo;
import java.util.List;
/**
* @ClassName AsAttributeAttributeImpl
* @Description
* @Author ZHIHAO.DAI
* @Date 2024/3/1 13:31
*/
public interface AsCategoryAttributeGroupService extends IService<AsCategoryAttributeGroup> {
}

View File

@ -0,0 +1,14 @@
package com.muyu.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.product.domain.AsCategoryAttribute;
import com.muyu.product.domain.AsCategoryAttributeGroup;
/**
* @ClassName AsAttributeAttributeImpl
* @Description
* @Author ZHIHAO.DAI
* @Date 2024/3/1 13:31
*/
public interface AsCategoryAttributeService extends IService<AsCategoryAttribute> {
}

View File

@ -0,0 +1,14 @@
package com.muyu.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.product.domain.AsCategoryAttribute;
import com.muyu.product.domain.AsCategoryBrand;
/**
* @ClassName AsAttributeAttributeImpl
* @Description
* @Author ZHIHAO.DAI
* @Date 2024/3/1 13:31
*/
public interface AsCategoryBrandService extends IService<AsCategoryBrand> {
}

View File

@ -0,0 +1,14 @@
package com.muyu.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.product.domain.BrandInfo;
import com.muyu.product.domain.CategoryInfo;
/**
* @ClassName BrandInfoService
* @Description
* @Author ZHIHAO.DAI
* @Date 2024/3/6 21:13
*/
public interface CategoryInfoService extends IService<CategoryInfo> {
}

View File

@ -0,0 +1,18 @@
package com.muyu.product.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.product.domain.AsCategoryAttributeGroup;
import com.muyu.product.mapper.AsCategoryAttributeGroupMapper;
import com.muyu.product.service.AsCategoryAttributeGroupService;
import org.springframework.stereotype.Service;
/**
* @ClassName BrandInfoServiceImpl
* @Description
* @Author ZHIHAO.DAI
* @Date 2024/3/6 21:13
*/
@Service
public class AsCategoryAttributeGroupServiceImpl extends ServiceImpl<AsCategoryAttributeGroupMapper, AsCategoryAttributeGroup>
implements AsCategoryAttributeGroupService {
}

View File

@ -0,0 +1,18 @@
package com.muyu.product.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.product.domain.AsCategoryAttribute;
import com.muyu.product.mapper.AsCategoryAttributeMapper;
import com.muyu.product.service.AsCategoryAttributeService;
import org.springframework.stereotype.Service;
/**
* @ClassName BrandInfoServiceImpl
* @Description
* @Author ZHIHAO.DAI
* @Date 2024/3/6 21:13
*/
@Service
public class AsCategoryAttributeServiceImpl extends ServiceImpl<AsCategoryAttributeMapper, AsCategoryAttribute>
implements AsCategoryAttributeService {
}

View File

@ -0,0 +1,21 @@
package com.muyu.product.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.product.domain.AsCategoryAttribute;
import com.muyu.product.domain.AsCategoryBrand;
import com.muyu.product.mapper.AsCategoryAttributeMapper;
import com.muyu.product.mapper.AsCategoryBrandMapper;
import com.muyu.product.service.AsCategoryAttributeService;
import com.muyu.product.service.AsCategoryBrandService;
import org.springframework.stereotype.Service;
/**
* @ClassName BrandInfoServiceImpl
* @Description
* @Author ZHIHAO.DAI
* @Date 2024/3/6 21:13
*/
@Service
public class AsCategoryBrandServiceImpl extends ServiceImpl<AsCategoryBrandMapper, AsCategoryBrand>
implements AsCategoryBrandService {
}

View File

@ -0,0 +1,18 @@
package com.muyu.product.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.product.domain.CategoryInfo;
import com.muyu.product.mapper.CategoryInfoMapper;
import com.muyu.product.service.CategoryInfoService;
import org.springframework.stereotype.Service;
/**
* @ClassName BrandInfoServiceImpl
* @Description
* @Author ZHIHAO.DAI
* @Date 2024/3/6 21:13
*/
@Service
public class CategoryInfoServiceImpl extends ServiceImpl<CategoryInfoMapper, CategoryInfo>
implements CategoryInfoService {
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.muyu.product.mapper.AsCategoryAttributeGroupMapper">
</mapper>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.muyu.product.mapper.AsCategoryAttributeMapper">
</mapper>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.muyu.product.mapper.AsCategoryBrandMapper">
</mapper>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.muyu.product.mapper.CategoryInfoMapper">
</mapper>