✨ 商品服务的三级菜单显示
This commit is contained in:
parent
369130ee78
commit
31578685d1
|
@ -46,10 +46,10 @@
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- <dependency> -->
|
<dependency>
|
||||||
<!-- <groupId>com.alibaba.cloud</groupId> -->
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
<!-- <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> -->
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
<!-- </dependency> -->
|
</dependency>
|
||||||
<!-- <dependency> -->
|
<!-- <dependency> -->
|
||||||
<!-- <groupId>com.alibaba.cloud</groupId> -->
|
<!-- <groupId>com.alibaba.cloud</groupId> -->
|
||||||
<!-- <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> -->
|
<!-- <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> -->
|
||||||
|
|
|
@ -19,6 +19,8 @@ spring:
|
||||||
uri: lb://service-product
|
uri: lb://service-product
|
||||||
predicates:
|
predicates:
|
||||||
- Path=/api/product/**
|
- Path=/api/product/**
|
||||||
|
filters:
|
||||||
|
# - RewritePath=/api/(?<segment>.*),/xxx/$\{segment}
|
||||||
- id: route-order
|
- id: route-order
|
||||||
uri: lb://service-order
|
uri: lb://service-order
|
||||||
predicates:
|
predicates:
|
||||||
|
|
|
@ -3,12 +3,13 @@ package com.mall.product;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
|
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@ComponentScan(basePackages = {"com.mall.product", "com.mall.common",})
|
@ComponentScan(basePackages = {"com.mall.product", "com.mall.common",})
|
||||||
@EnableDiscoveryClient
|
@EnableDiscoveryClient
|
||||||
// @RefreshScope
|
@RefreshScope
|
||||||
// @EnableFeignClients
|
// @EnableFeignClients
|
||||||
public class MallProductApplication {
|
public class MallProductApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
package com.mall.product.domain.entity;
|
package com.mall.product.domain.entity;
|
||||||
|
|
||||||
import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
|
import com.alibaba.nacos.shaded.com.google.common.collect.Lists;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
@ -33,6 +30,7 @@ public class Category {
|
||||||
private Integer catLevel;
|
private Integer catLevel;
|
||||||
|
|
||||||
@Schema(name = "showStatus", title = "是否显示[0-不显示,1显示]")
|
@Schema(name = "showStatus", title = "是否显示[0-不显示,1显示]")
|
||||||
|
@TableLogic(value = "1", delval = "0")
|
||||||
private Integer showStatus;
|
private Integer showStatus;
|
||||||
|
|
||||||
@Schema(name = "sort", title = "排序")
|
@Schema(name = "sort", title = "排序")
|
||||||
|
|
|
@ -1,4 +1,15 @@
|
||||||
package com.mall.product.service.ext;
|
package com.mall.product.service.ext;
|
||||||
|
|
||||||
|
import com.mall.product.domain.entity.Category;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class CategoryServiceImplExt {
|
public class CategoryServiceImplExt {
|
||||||
|
|
||||||
|
public static List<Category> getCategoryTreeChildrenList(Category category, List<Category> categoryList) {
|
||||||
|
return categoryList.stream()
|
||||||
|
.filter(item -> item.getParentCid().equals(category.getCatId()))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,10 +13,11 @@ import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.mall.product.service.ext.CategoryServiceImplExt.getCategoryTreeChildrenList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 商品三级分类 服务实现类
|
* 商品三级分类 服务实现类
|
||||||
|
@ -79,6 +80,7 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> i
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void deleteCategory(List<Long> ids) {
|
public void deleteCategory(List<Long> ids) {
|
||||||
|
// baseMapper.removeByIdsByIds(ids);
|
||||||
removeByIds(ids);
|
removeByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,11 +98,4 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> i
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Category> getCategoryTreeChildrenList(Category category, List<Category> categoryList) {
|
|
||||||
List<Category> voList = new ArrayList<>();
|
|
||||||
|
|
||||||
categoryList.stream().filter(item -> item.getCatId().equals(category.getParentCid()))
|
|
||||||
.forEach(voList::add);
|
|
||||||
return voList;
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -6,8 +6,20 @@ datasource:
|
||||||
username: gulimall
|
username: gulimall
|
||||||
password: "0212Gulimall"
|
password: "0212Gulimall"
|
||||||
|
|
||||||
nacos:
|
spring:
|
||||||
server-addr: bunny-web.site:8848
|
cloud:
|
||||||
|
nacos:
|
||||||
|
server-addr: bunny-web.site:8848
|
||||||
|
config:
|
||||||
|
import-check:
|
||||||
|
enabled: true
|
||||||
|
server-addr: bunny-web.site:8848
|
||||||
|
namespace: 510385f8-19a5-4eb4-8cfb-da1e13b9de09
|
||||||
|
group: DEFAULT_GROUP
|
||||||
|
|
||||||
|
config:
|
||||||
|
import:
|
||||||
|
- nacos:mall-product.yml
|
||||||
|
|
||||||
logging:
|
logging:
|
||||||
file:
|
file:
|
||||||
|
|
|
@ -17,13 +17,6 @@ spring:
|
||||||
maximum-pool-size: 20
|
maximum-pool-size: 20
|
||||||
connection-timeout: 30000
|
connection-timeout: 30000
|
||||||
|
|
||||||
cloud:
|
|
||||||
nacos:
|
|
||||||
server-addr: ${nacos.server-addr}
|
|
||||||
|
|
||||||
jackson:
|
|
||||||
date-format: yyyy-MM-dd HH:mm:ss
|
|
||||||
|
|
||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
mapper-locations: classpath:/mapper/*.xml
|
mapper-locations: classpath:/mapper/*.xml
|
||||||
global-config:
|
global-config:
|
||||||
|
@ -31,3 +24,6 @@ mybatis-plus:
|
||||||
id-type: auto
|
id-type: auto
|
||||||
logic-delete-value: 1
|
logic-delete-value: 1
|
||||||
logic-not-delete-value: 0
|
logic-not-delete-value: 0
|
||||||
|
|
||||||
|
jackson:
|
||||||
|
date-format: yyyy-MM-dd HH:mm:ss
|
Loading…
Reference in New Issue