1、代码生成尚融宝服务各个模块及文件,新建配置文件和启动类

pull/254/head
xjs 4 years ago
parent 8347a75272
commit aabf4510e0

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.
Refer to https://manuals.jrebel.com/jrebel/standalone/config.html for more information.
-->
<application generated-by="intellij" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_3.xsd">
<id>srb-service-base</id>
<classpath>
<dir name="D:/Dev/IdeaPerject/GitHub/RuoYi-Cloud/xjs-business/xjs-business-srb/srb-service-base/target/classes">
</dir>
</classpath>
</application>

@ -0,0 +1,25 @@
package com.xjs.srb.core;
import com.ruoyi.common.security.annotation.EnableCustomConfig;
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* core
* @author xiejs
* @since 2022-02-28
*/
@SpringBootApplication
@EnableCustomConfig
@EnableCustomSwagger2
@EnableRyFeignClients
//这个服务开启boot内置定时任务
@EnableScheduling
public class XjsSrbCoreApp {
public static void main(String[] args) {
SpringApplication.run(XjsSrbCoreApp.class, args);
}
}

@ -0,0 +1,21 @@
package com.xjs.srb.core.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
/**
* <p>
*
* </p>
*
* @author xiejs
* @since 2022-02-28
*/
@Controller
@RequestMapping("/core/borrowInfo")
public class BorrowInfoController {
}

@ -0,0 +1,67 @@
package com.xjs.srb.core.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* <p>
*
* </p>
*
* @author xiejs
* @since 2022-02-28
*/
@Getter
@Setter
@TableName("borrow_info")
@ApiModel(value = "BorrowInfo对象", description = "借款信息表")
public class BorrowInfo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("编号")
@TableId(value = "id")
private Long id;
@ApiModelProperty("借款用户id")
private Long userId;
@ApiModelProperty("借款金额")
private BigDecimal amount;
@ApiModelProperty("借款期限")
private Integer period;
@ApiModelProperty("年化利率")
private BigDecimal borrowYearRate;
@ApiModelProperty("还款方式 1-等额本息 2-等额本金 3-每月还息一次还本 4-一次还本")
private Integer returnMethod;
@ApiModelProperty("资金用途")
private Integer moneyUse;
@ApiModelProperty("状态0未提交1审核中 2审核通过 -1审核不通过")
private Integer status;
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
@ApiModelProperty("更新时间")
private LocalDateTime updateTime;
@ApiModelProperty("逻辑删除(1:已删除0:未删除)")
@TableLogic
private Boolean isDeleted;
}

@ -0,0 +1,16 @@
package com.xjs.srb.core.mapper;
import com.xjs.srb.core.entity.BorrowInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper
* </p>
*
* @author xiejs
* @since 2022-02-28
*/
public interface BorrowInfoMapper extends BaseMapper<BorrowInfo> {
}

@ -0,0 +1,16 @@
package com.xjs.srb.core.service;
import com.xjs.srb.core.entity.BorrowInfo;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
*
* </p>
*
* @author xiejs
* @since 2022-02-28
*/
public interface IBorrowInfoService extends IService<BorrowInfo> {
}

@ -0,0 +1,20 @@
package com.xjs.srb.core.service.impl;
import com.xjs.srb.core.entity.BorrowInfo;
import com.xjs.srb.core.mapper.BorrowInfoMapper;
import com.xjs.srb.core.service.IBorrowInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
*
* </p>
*
* @author xiejs
* @since 2022-02-28
*/
@Service
public class BorrowInfoServiceImpl extends ServiceImpl<BorrowInfoMapper, BorrowInfo> implements IBorrowInfoService {
}

@ -0,0 +1,8 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}
____ ___ ____. _________ _____.___._____.___.________ _________
\ \/ / | |/ _____/ \__ | |\__ | |\______ \ / _____/
\ / | |\_____ \ ______ / | | / | | | | \ \_____ \
/ \/\__| |/ \ /_____/ \____ | \____ | | ` \/ \
/___/\ \________/_______ / / ______| / ______|/_______ /_______ /
\_/ \/ \/ \/ \/ \/

@ -0,0 +1,29 @@
# Tomcat
server:
port: 9950
# Spring
spring:
application:
# 应用名称
name: srb-service-core
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
#配置组
group: xjs
#命名空间
namespace: xjs-666

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/srb-service-core"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.xjs" level="info" />
<!--打印feign DEBUG日志-->
<logger name="com.xjs.common.client" level="debug"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn" />
<root level="info">
<appender-ref ref="console" />
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
</root>
</configuration>

@ -0,0 +1,5 @@
<?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.xjs.srb.core.mapper.BorrowInfoMapper">
</mapper>

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.
Refer to https://manuals.jrebel.com/jrebel/standalone/config.html for more information.
-->
<application generated-by="intellij" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_3.xsd">
<id>srb-service-core</id>
<classpath>
<dir name="D:/Dev/IdeaPerject/GitHub/RuoYi-Cloud/xjs-business/xjs-business-srb/srb-service-core/target/classes">
</dir>
</classpath>
</application>

@ -0,0 +1,43 @@
package com.xjs;
import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.engine.VelocityTemplateEngine;
import org.junit.jupiter.api.Test;
import java.util.Collections;
public class CodeGenerator {
@Test
public void genCode() {
FastAutoGenerator.create("jdbc:mysql://localhost:3306/xjs-srb-core?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8",
"root", "root")
.globalConfig(builder -> {
builder.author("xiejs") // 设置作者
.enableSwagger() // 开启 swagger 模式
.fileOverride() // 覆盖已生成文件
.outputDir("D:\\Dev\\IdeaPerject\\GitHub\\RuoYi-Cloud\\xjs-business\\xjs-business-srb\\srb-service-core\\src\\main\\java"); // 指定输出目录
})
.packageConfig(builder -> {
builder.parent("com.xjs.srb") // 设置父包名
.moduleName("core") // 设置父包模块名
.pathInfo(Collections.singletonMap(OutputFile.mapperXml, "D:\\Dev\\IdeaPerject\\GitHub\\RuoYi-Cloud\\xjs-business\\xjs-business-srb\\srb-service-core\\src\\main\\resources\\mapper")); // 设置mapperXml生成路径
})
.strategyConfig(builder -> {
builder.addInclude("borrow_info")
.entityBuilder()
.enableLombok()
.logicDeleteColumnName("is_deleted")
.build()
; // 设置需要生成的表名
//.addTablePrefix("t_", "c_"); // 设置过滤表前缀
})
.templateEngine(new VelocityTemplateEngine()) // 使用Freemarker引擎模板默认的是Velocity引擎模板
.execute();
}
}
Loading…
Cancel
Save