写死菜单

This commit is contained in:
zhangchenbiao
2023-06-08 17:01:31 +08:00
parent 665cb2190f
commit 171957bea0
30 changed files with 878 additions and 35 deletions

View File

@@ -74,6 +74,8 @@ public class CommonConstants {
public static final String DELETE_DEPT_ID = "-1"; public static final String DELETE_DEPT_ID = "-1";
public static final String AI_USER_ID = "a100000001"; public static final String AI_USER_ID = "a100000001";
public static final long ZERO_LONG = 0L;
public static final int ZERO = 0; public static final int ZERO = 0;
public static final int ONE = 1; public static final int ONE = 1;
public static final int TWO = 2; public static final int TWO = 2;

View File

@@ -0,0 +1,31 @@
package com.cool.store.enums;
/**
* @author zhangchenbiao
* @FileName: MentTypeEnum
* @Description:
* @date 2021-09-23 17:59
*/
public enum MenuTypeEnum {
MENU(1,"菜单"),
AUTH(2,"权限");
private Integer code;
private String message;
MenuTypeEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
public Integer getCode() {
return code;
}
public String getMessage() {
return message;
}
}

View File

@@ -0,0 +1,43 @@
package com.cool.store.enums;
import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @author zhangchenbiao
* @FileName: PlatFormTypeEnum
* @Description:
* @date 2023-06-08 16:43
*/
public enum PlatFormTypeEnum {
/**
* 菜单类型
*/
PC("PC","pc端菜单"),
;
private String code;
private String msg;
protected static final Map<String, PlatFormTypeEnum> map = Arrays.stream(values()).collect(
Collectors.toMap(PlatFormTypeEnum::getCode, Function.identity()));
PlatFormTypeEnum(String code, String msg){
this.code=code;
this.msg=msg;
}
public String getCode() {
return code;
}
public String getMsg() {
return msg;
}
public static PlatFormTypeEnum getByCode(String code) {
return map.get(code);
}
}

View File

@@ -0,0 +1,26 @@
package com.cool.store.dao;
import com.cool.store.entity.SysMenuDO;
import com.cool.store.mapper.SysMenuMapper;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.List;
/**
* @author zhangchenbiao
* @FileName: SysMenuDAO
* @Description:
* @date 2023-06-08 16:41
*/
@Repository
public class SysMenuDAO {
@Resource
private SysMenuMapper sysMenuMapper;
public List<SysMenuDO> selectMenuAll(List<Long> parentIds, String platformType){
return sysMenuMapper.selectMenuAll(parentIds, platformType);
}
}

View File

@@ -0,0 +1,29 @@
package com.cool.store.mapper;
import com.cool.store.entity.SysMenuDO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author zhangchenbiao
* @date 2023-06-08 04:38
*/
public interface SysMenuMapper {
/**
*
* 默认插入方法,只会给有值的字段赋值
* 会对传进来的字段做判空处理如果字段为空则使用数据库默认字段或者null
* dateTime:2023-06-08 04:38
*/
int insertSelective(SysMenuDO record);
/**
*
* 默认更新方法根据主键更新不会把null值更新到数据库避免覆盖之前有值的
* dateTime:2023-06-08 04:38
*/
int updateByPrimaryKeySelective(SysMenuDO record);
List<SysMenuDO> selectMenuAll(@Param("list") List<Long> parentIds, @Param("platformType") String platformType);
}

View File

@@ -0,0 +1,239 @@
<?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.cool.store.mapper.SysMenuMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.SysMenuDO">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="parent_id" jdbcType="BIGINT" property="parentId"/>
<result column="code" jdbcType="VARCHAR" property="code"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="alias" jdbcType="VARCHAR" property="alias"/>
<result column="path" jdbcType="VARCHAR" property="path"/>
<result column="perms" jdbcType="VARCHAR" property="perms"/>
<result column="source" jdbcType="VARCHAR" property="source"/>
<result column="sort" jdbcType="INTEGER" property="sort"/>
<result column="category" jdbcType="INTEGER" property="category"/>
<result column="action" jdbcType="INTEGER" property="action"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="platform" jdbcType="VARCHAR" property="platform"/>
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
<result column="target" jdbcType="VARCHAR" property="target"/>
<result column="component" jdbcType="VARCHAR" property="component"/>
<result column="icon" jdbcType="VARCHAR" property="icon"/>
<result column="menu_type" jdbcType="TINYINT" property="menuType"/>
<result column="env" jdbcType="VARCHAR" property="env"/>
<result column="common_functions_icon" jdbcType="VARCHAR" property="commonFunctionsIcon"/>
</resultMap>
<sql id="Base_Column_List">
id, parent_id, code, name, alias, path, perms, source, sort, category, action, remark,
platform, is_deleted, type, target, component, icon, menu_type, env, common_functions_icon
</sql>
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
insert into sys_menu
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId != null">
parent_id,
</if>
<if test="code != null">
code,
</if>
<if test="name != null">
name,
</if>
<if test="alias != null">
alias,
</if>
<if test="path != null">
path,
</if>
<if test="perms != null">
perms,
</if>
<if test="source != null">
source,
</if>
<if test="sort != null">
sort,
</if>
<if test="category != null">
category,
</if>
<if test="action != null">
action,
</if>
<if test="remark != null">
remark,
</if>
<if test="platform != null">
platform,
</if>
<if test="isDeleted != null">
is_deleted,
</if>
<if test="type != null">
type,
</if>
<if test="target != null">
target,
</if>
<if test="component != null">
component,
</if>
<if test="icon != null">
icon,
</if>
<if test="menuType != null">
menu_type,
</if>
<if test="env != null">
env,
</if>
<if test="commonFunctionsIcon != null">
common_functions_icon,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">
#{parentId},
</if>
<if test="code != null">
#{code},
</if>
<if test="name != null">
#{name},
</if>
<if test="alias != null">
#{alias},
</if>
<if test="path != null">
#{path},
</if>
<if test="perms != null">
#{perms},
</if>
<if test="source != null">
#{source},
</if>
<if test="sort != null">
#{sort},
</if>
<if test="category != null">
#{category},
</if>
<if test="action != null">
#{action},
</if>
<if test="remark != null">
#{remark},
</if>
<if test="platform != null">
#{platform},
</if>
<if test="isDeleted != null">
#{isDeleted},
</if>
<if test="type != null">
#{type},
</if>
<if test="target != null">
#{target},
</if>
<if test="component != null">
#{component},
</if>
<if test="icon != null">
#{icon},
</if>
<if test="menuType != null">
#{menuType},
</if>
<if test="env != null">
#{env},
</if>
<if test="commonFunctionsIcon != null">
#{commonFunctionsIcon},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective">
update sys_menu
<set>
<if test="parentId != null">
parent_id = #{parentId},
</if>
<if test="code != null">
code = #{code},
</if>
<if test="name != null">
name = #{name},
</if>
<if test="alias != null">
alias = #{alias},
</if>
<if test="path != null">
path = #{path},
</if>
<if test="perms != null">
perms = #{perms},
</if>
<if test="source != null">
source = #{source},
</if>
<if test="sort != null">
sort = #{sort},
</if>
<if test="category != null">
category = #{category},
</if>
<if test="action != null">
action = #{action},
</if>
<if test="remark != null">
remark = #{remark},
</if>
<if test="platform != null">
platform = #{platform},
</if>
<if test="isDeleted != null">
is_deleted = #{isDeleted},
</if>
<if test="type != null">
type = #{type},
</if>
<if test="target != null">
target = #{target},
</if>
<if test="component != null">
component = #{component},
</if>
<if test="icon != null">
icon = #{icon},
</if>
<if test="menuType != null">
menu_type = #{menuType},
</if>
<if test="env != null">
env = #{env},
</if>
<if test="commonFunctionsIcon != null">
common_functions_icon = #{commonFunctionsIcon},
</if>
</set>
where id = #{id}
</update>
<select id="selectMenuAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
sys_menu
where
platform=#{platformType}
<if test="list!=null and list.size>0">
and parent_id in
<foreach collection="list" item="parentId" open="(" close=")" separator=",">
#{parentId}
</foreach>
</if>
</select>
</mapper>

View File

@@ -3,4 +3,4 @@ jdbc.url = jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcoll
jdbc.user= coolstore jdbc.user= coolstore
jdbc.password = CSCErYcXniNYm7bT jdbc.password = CSCErYcXniNYm7bT
table.name = enterprise_user_role table.name = sys_menu

View File

@@ -0,0 +1,82 @@
package com.cool.store.entity;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
*
* @author zhangchenbiao
* @date 2023-06-08 04:38
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SysMenuDO implements Serializable {
@ApiModelProperty("自增id")
private Long id;
@ApiModelProperty("父级菜单")
private Long parentId;
@ApiModelProperty("菜单编号")
private String code;
@ApiModelProperty("菜单名称")
private String name;
@ApiModelProperty("菜单别名")
private String alias;
@ApiModelProperty("请求地址(前端路由)")
private String path;
@ApiModelProperty("后端权限标识")
private String perms;
@ApiModelProperty("菜单资源(图片)")
private String source;
@ApiModelProperty("排序")
private Integer sort;
@ApiModelProperty("菜单类型(菜单,按钮)")
private Integer category;
@ApiModelProperty("操作按钮类型(工具栏,操作栏,工具操作栏)")
private Integer action;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("所属项目PC小程序")
private String platform;
@ApiModelProperty("是否已删除")
private Integer isDeleted;
@ApiModelProperty("操作类型")
private String type;
@ApiModelProperty("是否新开页面")
private String target;
@ApiModelProperty("组件")
private String component;
@ApiModelProperty("图标")
private String icon;
@ApiModelProperty("菜单类型 1菜单 2权限")
private Integer menuType;
@ApiModelProperty("环境")
private String env;
@ApiModelProperty("常用功能_图标")
private String commonFunctionsIcon;
}

View File

@@ -0,0 +1,118 @@
package com.cool.store.vo.menu;
import com.cool.store.entity.SysMenuDO;
import com.cool.store.enums.MenuTypeEnum;
import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* describe:
*
* @author zhouyiping
* @date 2020/09/22
*/
@Data
public class MenuTreeVO {
@ApiModelProperty("请求地址(前端路由)")
private String path;
@ApiModelProperty("菜单编号")
private String code;
@ApiModelProperty("菜单名称")
private String name;
@ApiModelProperty("菜单id")
private Long id;
@ApiModelProperty("父级菜单")
private Long parentId;
@ApiModelProperty("是否新开页面")
private String target;
@ApiModelProperty("组件")
private String component;
@ApiModelProperty("图标'")
private String icon;
@ApiModelProperty("常用功能图标")
private String commonFunctionsIcon;
@ApiModelProperty("菜单类型 1菜单 2权限")
private Integer menuType;
@ApiModelProperty("权限列表")
private List<String> authorityList;
@ApiModelProperty("子菜单")
private List<MenuTreeVO> children;
public static List<MenuTreeVO> dealMenuTree(Long rootId, List<SysMenuDO> menuList) {
if(CollectionUtils.isEmpty(menuList)){
return Lists.newArrayList();
}
Map<Long, List<SysMenuDO>> parentGroup = ListUtils.emptyIfNull(menuList).stream().collect(Collectors.groupingBy(SysMenuDO::getParentId));
List<SysMenuDO> menuDOList = parentGroup.get(rootId);
if (CollectionUtils.isEmpty(menuDOList)) {
return Collections.emptyList();
}
List<MenuTreeVO> voList = convertVO(menuDOList);
List<MenuTreeVO> treeVOList = new LinkedList<>(voList);
for (MenuTreeVO data : treeVOList) {
getChild(data, parentGroup);
}
return treeVOList;
}
public static List<MenuTreeVO> convertVO(List<SysMenuDO> menuList) {
menuList = menuList.stream().sorted(Comparator.comparing(SysMenuDO::getSort)).collect(Collectors.toList());
List<MenuTreeVO> resultList = new ArrayList<>();
for (SysMenuDO menu : menuList) {
MenuTreeVO vo = new MenuTreeVO();
vo.setId(menu.getId());
vo.setParentId(menu.getParentId());
vo.setName(menu.getName());
vo.setCode(menu.getType());
vo.setPath(menu.getPath());
vo.setComponent(menu.getComponent());
vo.setTarget(menu.getTarget());
vo.setIcon(menu.getIcon());
vo.setMenuType(menu.getMenuType());
vo.setCommonFunctionsIcon(menu.getCommonFunctionsIcon());
resultList.add(vo);
}
return resultList;
}
public static void getChild(MenuTreeVO data, Map<Long, List<SysMenuDO>> parentGroup) {
List<SysMenuDO> sysMenuDOList = parentGroup.get(data.getId());
List<SysMenuDO> parentMenuList = ListUtils.emptyIfNull(sysMenuDOList).stream().filter(menu -> MenuTypeEnum.MENU.getCode().equals(menu.getMenuType())).collect(Collectors.toList());
List<SysMenuDO> parentAuthList = ListUtils.emptyIfNull(sysMenuDOList).stream().filter(menu -> MenuTypeEnum.AUTH.getCode().equals(menu.getMenuType())).collect(Collectors.toList());
//属于菜单下时候
if (CollectionUtils.isNotEmpty(parentMenuList)) {
List<MenuTreeVO> voList = convertVO(parentMenuList);
List<String> authList = parentMenuList.stream().map(SysMenuDO::getType).collect(Collectors.toList());
data.setAuthorityList(authList);
List<MenuTreeVO> menuList = voList.stream().filter(vo -> MenuTypeEnum.MENU.getCode().equals(vo.getMenuType())).collect(Collectors.toList());
data.setChildren(menuList);
voList.forEach(child -> {
getChild(child, parentGroup);
});
}
//数据是权限的的时候
if (CollectionUtils.isNotEmpty(parentAuthList)) {
List<String> authList = parentAuthList.stream().map(SysMenuDO::getType).collect(Collectors.toList());
data.setAuthorityList(authList);
}
}
}

View File

@@ -0,0 +1,16 @@
package com.cool.store.service;
import com.cool.store.vo.menu.MenuTreeVO;
import java.util.List;
/**
* @author zhangchenbiao
* @FileName: MenuService
* @Description:
* @date 2023-06-08 16:43
*/
public interface MenuService {
List<MenuTreeVO> getUserMenus(String userId);
}

View File

@@ -0,0 +1,31 @@
package com.cool.store.service.impl;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.SysMenuDAO;
import com.cool.store.entity.SysMenuDO;
import com.cool.store.enums.PlatFormTypeEnum;
import com.cool.store.service.MenuService;
import com.cool.store.vo.menu.MenuTreeVO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @author zhangchenbiao
* @FileName: MenuServiceImpl
* @Description:
* @date 2023-06-08 16:43
*/
@Service
public class MenuServiceImpl implements MenuService {
@Resource
private SysMenuDAO sysMenuDAO;
@Override
public List<MenuTreeVO> getUserMenus(String userId) {
List<SysMenuDO> menuList= sysMenuDAO.selectMenuAll(null, PlatFormTypeEnum.PC.getCode());
return MenuTreeVO.dealMenuTree(CommonConstants.ZERO_LONG, menuList);
}
}

View File

@@ -0,0 +1,69 @@
package com.cool.store.config;
import javafx.application.Application;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import java.util.List;
/**
* @author zhangchenbiao
* @FileName: ServletContextConfig
* @Description:
* @date 2023-06-08 16:28
*/
@Configuration
@ComponentScan(basePackageClasses = Application.class, useDefaultFilters = true)
public class ServletContextConfig extends WebMvcConfigurationSupport {
private final Logger logger = LoggerFactory.getLogger(ServletContextConfig.class);
/**
* 配置servlet处理
*/
@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
configurer.enable();
}
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowCredentials(true)
.allowedMethods("GET", "POST", "OPTIONS", "PUT", "DELETE")
.maxAge(3600);
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
super.addResourceHandlers(registry);
}
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
}
/**
* 统一异常处理
*
* @param exceptionResolvers
*/
@Override
public void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) {
}
}

View File

@@ -0,0 +1,27 @@
package com.cool.store.controller;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.MenuService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @author zhangchenbiao
* @FileName: MenuController
* @Description:
* @date 2023-06-08 16:58
*/
@RestController
public class MenuController {
@Resource
private MenuService menuService;
@GetMapping("/test/menu/getUserMenus")
public ResponseResult getUserMenus(){
return ResponseResult.success(menuService.getUserMenus(null));
}
}

View File

@@ -34,13 +34,15 @@ public class OssClientController {
private String endpoint; private String endpoint;
@Value("${oss.bucket:null}") @Value("${oss.bucket:null}")
private String bucket; private String bucket;
@Value("${corpId:null}")
private String corpId;
@GetMapping("/getUploadFileConfig") @GetMapping("/getUploadFileConfig")
public ResponseResult getUploadFileConfig(@RequestParam("enterpriseId")String enterpriseId){ public ResponseResult getUploadFileConfig(){
// host的格式为 bucketname.endpoint // host的格式为 bucketname.endpoint
String host = "http://" + bucket + "." + endpoint; String host = "http://" + bucket + "." + endpoint;
// 用户上传文件时指定的前缀。 // 用户上传文件时指定的前缀。
String dir = "partner/" + enterpriseId + "/"; String dir = "partner/" + corpId + "/";
OSSClient client = new OSSClient(endpoint, accessKeyId, accessKeySecret); OSSClient client = new OSSClient(endpoint, accessKeyId, accessKeySecret);
try { try {

View File

@@ -42,4 +42,9 @@ rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq-in
rocketmq.topic=simple_message rocketmq.topic=simple_message
rocketmq.orderTopic=order_message rocketmq.orderTopic=order_message
default.database.name=coolcollege_intelligent_hy #oss配置
oss.accessKeyId=LTAI5tKSnAbkEbmT6CeBwNN3
oss.accessKeySecret=PbXOzUFwAvZ2K5zIawwa7NAJE2pFXS
oss.endpoint=oss-cn-shanghai.aliyuncs.com
oss.bucket=vec-coolstore
corp.id = 10e5fa7c74da175d

View File

@@ -42,4 +42,9 @@ rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq-in
rocketmq.topic=simple_message rocketmq.topic=simple_message
rocketmq.orderTopic=order_message rocketmq.orderTopic=order_message
default.database.name=coolcollege_intelligent_hy #oss配置
oss.accessKeyId=LTAI5tKSnAbkEbmT6CeBwNN3
oss.accessKeySecret=PbXOzUFwAvZ2K5zIawwa7NAJE2pFXS
oss.endpoint=oss-cn-shanghai.aliyuncs.com
oss.bucket=vec-coolstore
corp.id = 10e5fa7c74da175d

View File

@@ -41,3 +41,10 @@ rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX5N7rwl.cn-hangzhou.mq-internal.aliyuncs.com:8080 rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX5N7rwl.cn-hangzhou.mq-internal.aliyuncs.com:8080
rocketmq.topic=simple_message rocketmq.topic=simple_message
rocketmq.orderTopic=order_message rocketmq.orderTopic=order_message
#oss配置
oss.accessKeyId=LTAI5tKSnAbkEbmT6CeBwNN3
oss.accessKeySecret=PbXOzUFwAvZ2K5zIawwa7NAJE2pFXS
oss.endpoint=oss-cn-shanghai.aliyuncs.com
oss.bucket=vec-coolstore
corp.id = 10e5fa7c74da175d

View File

@@ -50,5 +50,4 @@ oss.accessKeyId=LTAI5tKSnAbkEbmT6CeBwNN3
oss.accessKeySecret=PbXOzUFwAvZ2K5zIawwa7NAJE2pFXS oss.accessKeySecret=PbXOzUFwAvZ2K5zIawwa7NAJE2pFXS
oss.endpoint=oss-cn-shanghai.aliyuncs.com oss.endpoint=oss-cn-shanghai.aliyuncs.com
oss.bucket=vec-coolstore oss.bucket=vec-coolstore
corp.id = 10e5fa7c74da175d
default.database.name=coolcollege_intelligent_hy

View File

@@ -41,3 +41,10 @@ rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX5N7rwl.cn-hangzhou.mq-internal.aliyuncs.com:8080 rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX5N7rwl.cn-hangzhou.mq-internal.aliyuncs.com:8080
rocketmq.topic=simple_message rocketmq.topic=simple_message
rocketmq.orderTopic=order_message rocketmq.orderTopic=order_message
#oss配置
oss.accessKeyId=LTAI5tKSnAbkEbmT6CeBwNN3
oss.accessKeySecret=PbXOzUFwAvZ2K5zIawwa7NAJE2pFXS
oss.endpoint=oss-cn-shanghai.aliyuncs.com
oss.bucket=vec-coolstore
corp.id = 10e5fa7c74da175d

View File

@@ -41,3 +41,10 @@ rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX5N7rwl.cn-hangzhou.mq-internal.aliyuncs.com:8080 rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX5N7rwl.cn-hangzhou.mq-internal.aliyuncs.com:8080
rocketmq.topic=simple_message rocketmq.topic=simple_message
rocketmq.orderTopic=order_message rocketmq.orderTopic=order_message
#oss配置
oss.accessKeyId=LTAI5tKSnAbkEbmT6CeBwNN3
oss.accessKeySecret=PbXOzUFwAvZ2K5zIawwa7NAJE2pFXS
oss.endpoint=oss-cn-shanghai.aliyuncs.com
oss.bucket=vec-coolstore
corp.id = 10e5fa7c74da175d

View File

@@ -42,4 +42,9 @@ rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq-in
rocketmq.topic=simple_message rocketmq.topic=simple_message
rocketmq.orderTopic=order_message rocketmq.orderTopic=order_message
default.database.name=coolcollege_intelligent_hy #oss配置
oss.accessKeyId=LTAI5tKSnAbkEbmT6CeBwNN3
oss.accessKeySecret=PbXOzUFwAvZ2K5zIawwa7NAJE2pFXS
oss.endpoint=oss-cn-shanghai.aliyuncs.com
oss.bucket=vec-coolstore
corp.id = 10e5fa7c74da175d

View File

@@ -1,17 +0,0 @@
package com.cool.store.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
/**
* @author zhangchenbiao
* @FileName: CommonBeanConfig
* @Description:
* @date 2023-05-19 18:41
*/
@Slf4j
@Component
public class CommonBeanConfig {
}

View File

@@ -0,0 +1,69 @@
package com.cool.store.config;
import javafx.application.Application;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import java.util.List;
/**
* @author zhangchenbiao
* @FileName: ServletContextConfig
* @Description:
* @date 2023-06-08 16:28
*/
@Configuration
@ComponentScan(basePackageClasses = Application.class, useDefaultFilters = true)
public class ServletContextConfig extends WebMvcConfigurationSupport {
private final Logger logger = LoggerFactory.getLogger(ServletContextConfig.class);
/**
* 配置servlet处理
*/
@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
configurer.enable();
}
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowCredentials(true)
.allowedMethods("GET", "POST", "OPTIONS", "PUT", "DELETE")
.maxAge(3600);
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
super.addResourceHandlers(registry);
}
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
}
/**
* 统一异常处理
*
* @param exceptionResolvers
*/
@Override
public void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) {
}
}

View File

@@ -42,4 +42,9 @@ rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq-in
rocketmq.topic=simple_message rocketmq.topic=simple_message
rocketmq.orderTopic=order_message rocketmq.orderTopic=order_message
default.database.name=coolcollege_intelligent_hy #oss配置
oss.accessKeyId=LTAI5tKSnAbkEbmT6CeBwNN3
oss.accessKeySecret=PbXOzUFwAvZ2K5zIawwa7NAJE2pFXS
oss.endpoint=oss-cn-shanghai.aliyuncs.com
oss.bucket=vec-coolstore
corp.id = 10e5fa7c74da175d

View File

@@ -42,4 +42,9 @@ rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq-in
rocketmq.topic=simple_message rocketmq.topic=simple_message
rocketmq.orderTopic=order_message rocketmq.orderTopic=order_message
default.database.name=coolcollege_intelligent_hy #oss配置
oss.accessKeyId=LTAI5tKSnAbkEbmT6CeBwNN3
oss.accessKeySecret=PbXOzUFwAvZ2K5zIawwa7NAJE2pFXS
oss.endpoint=oss-cn-shanghai.aliyuncs.com
oss.bucket=vec-coolstore
corp.id = 10e5fa7c74da175d

View File

@@ -39,3 +39,10 @@ rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX5N7rwl.cn-hangzhou.mq-internal.aliyuncs.com:8080 rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX5N7rwl.cn-hangzhou.mq-internal.aliyuncs.com:8080
rocketmq.topic=simple_message rocketmq.topic=simple_message
rocketmq.orderTopic=order_message rocketmq.orderTopic=order_message
#oss配置
oss.accessKeyId=LTAI5tKSnAbkEbmT6CeBwNN3
oss.accessKeySecret=PbXOzUFwAvZ2K5zIawwa7NAJE2pFXS
oss.endpoint=oss-cn-shanghai.aliyuncs.com
oss.bucket=vec-coolstore
corp.id = 10e5fa7c74da175d

View File

@@ -45,4 +45,9 @@ rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq-in
rocketmq.topic=simple_message rocketmq.topic=simple_message
rocketmq.orderTopic=order_message rocketmq.orderTopic=order_message
default.database.name=coolcollege_intelligent_hy #oss配置
oss.accessKeyId=LTAI5tKSnAbkEbmT6CeBwNN3
oss.accessKeySecret=PbXOzUFwAvZ2K5zIawwa7NAJE2pFXS
oss.endpoint=oss-cn-shanghai.aliyuncs.com
oss.bucket=vec-coolstore
corp.id = 10e5fa7c74da175d

View File

@@ -39,3 +39,10 @@ rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX5N7rwl.cn-hangzhou.mq-internal.aliyuncs.com:8080 rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX5N7rwl.cn-hangzhou.mq-internal.aliyuncs.com:8080
rocketmq.topic=simple_message rocketmq.topic=simple_message
rocketmq.orderTopic=order_message rocketmq.orderTopic=order_message
#oss配置
oss.accessKeyId=LTAI5tKSnAbkEbmT6CeBwNN3
oss.accessKeySecret=PbXOzUFwAvZ2K5zIawwa7NAJE2pFXS
oss.endpoint=oss-cn-shanghai.aliyuncs.com
oss.bucket=vec-coolstore
corp.id = 10e5fa7c74da175d

View File

@@ -39,3 +39,10 @@ rocketmq.secretKey=yuomDstRjSdihtN5zo8viDbWu8Z0ig
rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX5N7rwl.cn-hangzhou.mq-internal.aliyuncs.com:8080 rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX5N7rwl.cn-hangzhou.mq-internal.aliyuncs.com:8080
rocketmq.topic=simple_message rocketmq.topic=simple_message
rocketmq.orderTopic=order_message rocketmq.orderTopic=order_message
#oss配置
oss.accessKeyId=LTAI5tKSnAbkEbmT6CeBwNN3
oss.accessKeySecret=PbXOzUFwAvZ2K5zIawwa7NAJE2pFXS
oss.endpoint=oss-cn-shanghai.aliyuncs.com
oss.bucket=vec-coolstore
corp.id = 10e5fa7c74da175d

View File

@@ -40,4 +40,9 @@ rocketmq.nameSrvAdder=http://MQ_INST_1947409023213164_BX3sLZnA.cn-hangzhou.mq-in
rocketmq.topic=simple_message rocketmq.topic=simple_message
rocketmq.orderTopic=order_message rocketmq.orderTopic=order_message
default.database.name=coolcollege_intelligent_hy #oss配置
oss.accessKeyId=LTAI5tKSnAbkEbmT6CeBwNN3
oss.accessKeySecret=PbXOzUFwAvZ2K5zIawwa7NAJE2pFXS
oss.endpoint=oss-cn-shanghai.aliyuncs.com
oss.bucket=vec-coolstore
corp.id = 10e5fa7c74da175d