saas模块更新
parent
c29fa2fa1f
commit
fce189d87f
|
@ -1,25 +0,0 @@
|
||||||
package com.muyu.cloud.car;
|
|
||||||
|
|
||||||
import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure;
|
|
||||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceAutoConfiguration;
|
|
||||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
|
||||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|
||||||
|
|
||||||
@EnableCustomConfig
|
|
||||||
//@EnableCustomSwagger2
|
|
||||||
@EnableMyFeignClients
|
|
||||||
@SpringBootApplication(
|
|
||||||
exclude = {
|
|
||||||
DataSourceAutoConfiguration.class,
|
|
||||||
DruidDataSourceAutoConfigure.class,
|
|
||||||
DynamicDataSourceAutoConfiguration.class
|
|
||||||
}
|
|
||||||
)
|
|
||||||
public class CarApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(CarApplication.class, args);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
package com.muyu.cloud.car.controller;
|
|
||||||
|
|
||||||
import com.muyu.cloud.car.domain.User;
|
|
||||||
import com.muyu.cloud.car.service.CarService;
|
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author WangXin
|
|
||||||
* @Data 2024/9/19
|
|
||||||
* @Description 车控制层
|
|
||||||
* @Version 1.0.0
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/test")
|
|
||||||
public class CarController extends BaseController {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CarService carService;
|
|
||||||
|
|
||||||
@GetMapping("/sel")
|
|
||||||
public List<User> sel() {
|
|
||||||
return carService.list();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
package com.muyu.cloud.car.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.muyu.cloud.car.domain.User;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author WangXin
|
|
||||||
* @Data 2024/9/19
|
|
||||||
* @Description
|
|
||||||
* @Version 1.0.0
|
|
||||||
*/
|
|
||||||
public interface CarMapper extends BaseMapper<User> {
|
|
||||||
|
|
||||||
List<User> selectMyList();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.muyu.cloud.car.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.muyu.cloud.car.domain.User;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author WangXin
|
|
||||||
* @Data 2024/9/19
|
|
||||||
* @Description
|
|
||||||
* @Version 1.0.0
|
|
||||||
*/
|
|
||||||
public interface CarService extends IService<User> {
|
|
||||||
|
|
||||||
List<User> selectList();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
package com.muyu.cloud.car.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.muyu.cloud.car.domain.User;
|
|
||||||
import com.muyu.cloud.car.mapper.CarMapper;
|
|
||||||
import com.muyu.cloud.car.service.CarService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author WangXin
|
|
||||||
* @Data 2024/9/19
|
|
||||||
* @Description
|
|
||||||
* @Version 1.0.0
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class CarServiceImpl extends ServiceImpl<CarMapper, User> implements CarService {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CarMapper carMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<User> selectList() {
|
|
||||||
return carMapper.selectMyList();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,58 +0,0 @@
|
||||||
# Tomcat
|
|
||||||
server:
|
|
||||||
port: 49701
|
|
||||||
|
|
||||||
# nacos线上地址
|
|
||||||
nacos:
|
|
||||||
addr: 47.101.53.251:8848
|
|
||||||
user-name: nacos
|
|
||||||
password: nacos
|
|
||||||
namespace: four
|
|
||||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
|
||||||
# Spring
|
|
||||||
spring:
|
|
||||||
amqp:
|
|
||||||
deserialization:
|
|
||||||
trust:
|
|
||||||
all: true
|
|
||||||
main:
|
|
||||||
allow-bean-definition-overriding: true
|
|
||||||
application:
|
|
||||||
# 应用名称
|
|
||||||
name: cloud-saas
|
|
||||||
profiles:
|
|
||||||
# 环境配置
|
|
||||||
active: dev
|
|
||||||
cloud:
|
|
||||||
nacos:
|
|
||||||
discovery:
|
|
||||||
# 服务注册地址
|
|
||||||
server-addr: ${nacos.addr}
|
|
||||||
# nacos用户名
|
|
||||||
username: ${nacos.user-name}
|
|
||||||
# nacos密码
|
|
||||||
password: ${nacos.password}
|
|
||||||
# 命名空间
|
|
||||||
namespace: ${nacos.namespace}
|
|
||||||
config:
|
|
||||||
# 服务注册地址
|
|
||||||
server-addr: ${nacos.addr}
|
|
||||||
# nacos用户名
|
|
||||||
username: ${nacos.user-name}
|
|
||||||
# nacos密码
|
|
||||||
password: ${nacos.password}
|
|
||||||
# 命名空间
|
|
||||||
namespace: ${nacos.namespace}
|
|
||||||
# 配置文件格式
|
|
||||||
file-extension: yml
|
|
||||||
# 共享配置
|
|
||||||
shared-configs:
|
|
||||||
# 系统共享配置
|
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
||||||
# 系统环境Config共享配置
|
|
||||||
- application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
||||||
|
|
||||||
|
|
||||||
logging:
|
|
||||||
level:
|
|
||||||
com.muyu.cloud.mapper: DEBUG
|
|
|
@ -1,28 +1,31 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-modules</artifactId>
|
<artifactId>cloud-modules</artifactId>
|
||||||
<version>3.6.3</version>
|
<version>3.6.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>cloud-car</artifactId>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<properties>
|
<artifactId>cloud-saas</artifactId>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
<description>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
cloud-saas
|
||||||
</properties>
|
</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>cloud-common-saas</artifactId>
|
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||||
|
<version>4.1.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- SpringCloud Alibaba Nacos -->
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
@ -77,6 +80,9 @@
|
||||||
<artifactId>cloud-common-api-doc</artifactId>
|
<artifactId>cloud-common-api-doc</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.muyu.saas;
|
||||||
|
|
||||||
|
import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure;
|
||||||
|
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableMyFeignClients
|
||||||
|
@MapperScan(value = "com.muyu.saas.mapper")
|
||||||
|
public class SaasApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(SaasApplication.class,args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.muyu.saas.controller;
|
||||||
|
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.saas.domain.Datasource;
|
||||||
|
import com.muyu.saas.service.SaasService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("saas")
|
||||||
|
public class SaaSController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SaasService saasService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源查询
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("findDatabaseList")
|
||||||
|
public Result<List<Datasource>> findDatabaseList(){
|
||||||
|
List<Datasource> list=saasService.list();
|
||||||
|
return Result.success(list);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源添加
|
||||||
|
* @param datasource
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("addDatasource")
|
||||||
|
public Result addDatasource(@RequestBody Datasource datasource){
|
||||||
|
saasService.save(datasource);
|
||||||
|
return Result.success("添加成功");
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("updDatasource")
|
||||||
|
public Result updDatasource(@RequestBody Datasource datasource){
|
||||||
|
saasService.updateById(datasource);
|
||||||
|
return Result.success("修改成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除成功
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("delDatasource/{id}")
|
||||||
|
public Result delDatasource(@PathVariable("id") Integer id){
|
||||||
|
saasService.removeById(id);
|
||||||
|
return Result.success("删除成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,28 +1,26 @@
|
||||||
package com.muyu.cloud.car.domain;
|
package com.muyu.saas.domain;
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author WangXin
|
|
||||||
* @Data 2024/9/19
|
|
||||||
* @Description
|
|
||||||
* @Version 1.0.0
|
|
||||||
*/
|
|
||||||
@TableName("user")
|
|
||||||
@Data
|
@Data
|
||||||
@Builder
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class User {
|
@TableName(value = "datasource", autoResultMap = true)
|
||||||
|
public class Datasource {
|
||||||
|
|
||||||
|
@TableId(value = "id",type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
public String firmName;
|
||||||
|
|
||||||
|
public String databaseName;
|
||||||
|
|
||||||
|
|
||||||
@TableId(type = IdType.AUTO)
|
|
||||||
private Integer userId;
|
|
||||||
|
|
||||||
private String userName;
|
|
||||||
}
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.muyu.saas.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.saas.domain.Datasource;
|
||||||
|
|
||||||
|
public interface SaaSMapper extends BaseMapper<Datasource> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.muyu.saas.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.saas.domain.Datasource;
|
||||||
|
|
||||||
|
public interface SaasService extends IService<Datasource> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.muyu.saas.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.saas.domain.Datasource;
|
||||||
|
import com.muyu.saas.mapper.SaaSMapper;
|
||||||
|
import com.muyu.saas.service.SaasService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class SaasServiceImpl extends ServiceImpl<SaaSMapper,Datasource> implements SaasService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SaaSMapper saaSMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
<!-- 日志存放路径 -->
|
<!-- 日志存放路径 -->
|
||||||
<property name="log.path" value="logs/cloud-car"/>
|
<property name="log.path" value="logs/cloud-saas"/>
|
||||||
<!-- 日志输出格式 -->
|
<!-- 日志输出格式 -->
|
||||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
<!-- 日志存放路径 -->
|
<!-- 日志存放路径 -->
|
||||||
<property name="log.path" value="logs/cloud-car"/>
|
<property name="log.path" value="logs/cloud-saas"/>
|
||||||
<!-- 日志输出格式 -->
|
<!-- 日志输出格式 -->
|
||||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
<!-- 日志存放路径 -->
|
<!-- 日志存放路径 -->
|
||||||
<property name="log.path" value="logs/cloud-car"/>
|
<property name="log.path" value="logs/cloud-saas"/>
|
||||||
<!-- 日志输出格式 -->
|
<!-- 日志输出格式 -->
|
||||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
<property name="log.sky.pattern" value="%d{HH:mm:ss.SSS} %yellow([%tid]) [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
|
@ -2,9 +2,7 @@
|
||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.muyu.cloud.car.mapper.CarMapper">
|
<mapper namespace="com.muyu.saas.mapper.SaaSMapper">
|
||||||
|
|
||||||
|
|
||||||
<select id="selectMyList" resultType="com.muyu.cloud.car.domain.User">
|
|
||||||
select * from user
|
|
||||||
</select>
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -18,8 +18,8 @@
|
||||||
<module>cloud-modules-car</module>
|
<module>cloud-modules-car</module>
|
||||||
<module>cloud-modules-wechat</module>
|
<module>cloud-modules-wechat</module>
|
||||||
<module>cloud-modules-breakdown</module>
|
<module>cloud-modules-breakdown</module>
|
||||||
<module>cloud-car</module>
|
|
||||||
<module>cloud-modules-warn</module>
|
<module>cloud-modules-warn</module>
|
||||||
|
<module>cloud-saas</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<artifactId>cloud-modules</artifactId>
|
<artifactId>cloud-modules</artifactId>
|
||||||
|
|
Loading…
Reference in New Issue