init version
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package com.jojubanking.boot.server;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 项目的启动类
|
||||
*
|
||||
*
|
||||
* @author TW
|
||||
*/
|
||||
@SuppressWarnings("SpringComponentScan") // 忽略 IDEA 无法识别 ${joju.info.base-package}
|
||||
@SpringBootApplication(scanBasePackages = {"${joju.info.base-package}.server", "${joju.info.base-package}.module"})
|
||||
public class JojuServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
SpringApplication.run(JojuServerApplication.class, args);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jojubanking.boot.server;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.AbstractWrapper;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Before;
|
||||
import org.aspectj.lang.annotation.Pointcut;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @ClassName: MybatisAspectj
|
||||
* @Description:
|
||||
* @Author T.W
|
||||
* @Date 2023/4/4
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
public class MybatisAspectj {
|
||||
|
||||
// 配置织入点
|
||||
// package com.jojubanking.boot.framework.mybatis.core.mapper.selectOne
|
||||
|
||||
//?
|
||||
@Pointcut("execution(public * com.baomidou.mybatisplus.core.mapper.BaseMapper.selectOne(..))")
|
||||
public void selectOneAspect() {
|
||||
}
|
||||
|
||||
@Before("selectOneAspect()")
|
||||
public void beforeSelect(JoinPoint point) {
|
||||
Object arg = point.getArgs()[0];
|
||||
if (arg instanceof AbstractWrapper) {
|
||||
arg = (AbstractWrapper) arg;
|
||||
((AbstractWrapper) arg).last("limit 1");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 属于整个 joju-server 的 framework 封装
|
||||
*
|
||||
* @author TW
|
||||
*/
|
||||
package com.jojubanking.boot.server.framework;
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.jojubanking.boot.server.framework.ui.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* joju-admin-ui 的配置类
|
||||
*
|
||||
* @author TW
|
||||
*/
|
||||
@Configuration
|
||||
public class AdminUiConfiguration implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/admin-ui/**", "/admin-ui/", "/admin-ui")
|
||||
.addResourceLocations("classpath:/admin-ui/")
|
||||
// 自定义 ClassPathResource 实现类,在前端请求的地址匹配不到对应的路径时,强制使用 /admin-ui/index.html 资源
|
||||
// 本质上,等价于 nginx 在处理不到 Vue 的请求地址时,try_files 到 index.html 地址
|
||||
// 想要彻底理解,可以调试 ResourceHttpRequestHandler 的 resolveResourceLocations 方法,前端请求 /admin-ui/system/tenant 地址
|
||||
.addResourceLocations(new ClassPathResource("/admin-ui/index.html") {
|
||||
|
||||
@Override
|
||||
public Resource createRelative(String relativePath) {
|
||||
return this;
|
||||
}
|
||||
|
||||
})
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.jojubanking.boot.server.framework.ui.core;
|
||||
|
||||
import org.springframework.boot.web.servlet.error.ErrorController;
|
||||
|
||||
//@Controller
|
||||
//@RequestMapping("/admin-ui/")
|
||||
public class AdminUiController implements ErrorController {
|
||||
|
||||
// public String
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* 目的:解决后端开发,不太擅长 node 环境的配置,导致启动 joju-ui-admin 项目一直失败
|
||||
* 所以,本项目将 joju-ui-admin 项目通过 npm run build:demo1024 的方式,将它构建成静态资源,
|
||||
* 然后,使用 Spring Boot 作为静态资源服务器,进行启动访问。
|
||||
* 注意,这个项目仅仅作为后端开发的快速体验,并不要部署到生产环境!!!
|
||||
*/
|
||||
package com.jojubanking.boot.server.framework.ui;
|
||||
Reference in New Issue
Block a user