创建 yudao-user-server

This commit is contained in:
YunaiV
2021-05-07 00:19:07 +08:00
parent d0a7c0593f
commit 930cdfe2b2
20 changed files with 745 additions and 5 deletions

View File

@ -0,0 +1,13 @@
package cn.iocoder.yudao.userserver;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class UserServerApplication {
public static void main(String[] args) {
SpringApplication.run(UserServerApplication.class, args);
}
}

View File

@ -0,0 +1,9 @@
package cn.iocoder.yudao.userserver.framework.async.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
@Configuration
@EnableAsync
public class AsyncConfiguration {
}

View File

@ -0,0 +1,4 @@
/**
* 异步执行,基于 Spring @Async 实现
*/
package cn.iocoder.yudao.userserver.framework.async;

View File

@ -0,0 +1 @@
<http://www.iocoder.cn/Spring-Boot/Async-Job/?yudao>

View File

@ -0,0 +1,6 @@
/**
* 属于整个 yudao-user-server 的 framework 封装
*
* @author 芋道源码
*/
package cn.iocoder.yudao.userserver.framework;

View File

@ -0,0 +1,64 @@
package cn.iocoder.yudao.userserver.modules.infra.dal.dataobject.config;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
/**
* 参数配置表
*
* @author ruoyi
*/
@TableName("inf_config")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class InfConfigDO extends BaseDO {
/**
* 参数主键
*/
@TableId
private Long id;
/**
* 参数分组
*/
@TableField("`group`")
private String group;
/**
* 参数名称
*/
private String name;
/**
* 参数键名
*/
@TableField("`key`")
private String key;
/**
* 参数键值
*/
private String value;
/**
* 参数类型
*
* 枚举 {@link InfConfigTypeEnum}
*/
@TableField("`type`")
private Integer type;
/**
* 是否敏感
*
* 对于敏感配置,需要管理权限才能查看
*/
@TableField("`sensitive`")
private Boolean sensitive;
/**
* 备注
*/
private String remark;
}

View File

@ -0,0 +1,43 @@
package cn.iocoder.yudao.userserver.modules.infra.dal.dataobject.file;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.io.InputStream;
/**
* 文件表
*
* @author 芋道源码
*/
@Data
@TableName("inf_file")
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class InfFileDO extends BaseDO {
/**
* 文件路径
*/
@TableId(type = IdType.INPUT)
private String id;
/**
* 文件类型
*
* 通过 {@link cn.hutool.core.io.FileTypeUtil#getType(InputStream)} 获取
*/
@TableField(value = "`type`")
private String type;
/**
* 文件内容
*/
private byte[] content;
}

View File

@ -0,0 +1,39 @@
package cn.iocoder.yudao.userserver.modules.infra.dal.mysql.config;
import cn.iocoder.yudao.framework.apollo.internals.ConfigFrameworkDAO;
import cn.iocoder.yudao.framework.apollo.internals.dto.ConfigRespDTO;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import javax.sql.DataSource;
import java.sql.ResultSet;
import java.util.Date;
import java.util.List;
/**
* ConfigFrameworkDAO 实现类
*
* @author 芋道源码
*/
public class InfConfigDAOImpl implements ConfigFrameworkDAO {
private final JdbcTemplate jdbcTemplate;
public InfConfigDAOImpl(String jdbcUrl, String username, String password) {
DataSource dataSource = new DriverManagerDataSource(jdbcUrl, username, password);
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
@Override
public boolean selectExistsByUpdateTimeAfter(Date maxUpdateTime) {
return jdbcTemplate.query("SELECT id FROM inf_config WHERE update_time > ? LIMIT 1",
ResultSet::next, maxUpdateTime);
}
@Override
public List<ConfigRespDTO> selectList() {
return jdbcTemplate.query("SELECT `key`, `value`, update_time, deleted FROM inf_config", new BeanPropertyRowMapper<>(ConfigRespDTO.class));
}
}

View File

@ -0,0 +1,10 @@
package cn.iocoder.yudao.userserver.modules.infra.dal.mysql.file;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.userserver.modules.infra.dal.dataobject.file.InfFileDO;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface InfFileMapper extends BaseMapperX<InfFileDO> {
}

View File

@ -0,0 +1,7 @@
/**
* infra 包下,我们放基础设施的运维与管理,支撑上层的通用与核心业务。
* 例如说:定时任务的管理、服务器的信息等等
*
* 缩写inf
*/
package cn.iocoder.yudao.userserver.modules.infra;

View File

@ -0,0 +1 @@
package cn.iocoder.yudao.userserver.modules;