Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67d3a30584 | ||
|
|
2d77fb02f7 | ||
|
|
1d8f613999 | ||
|
|
67d29ca51c | ||
|
|
0e1a3404dc | ||
|
|
8a51bd9ed7 |
File diff suppressed because it is too large
Load Diff
41
renren-api/src/main/java/io/renren/dao/SysConfigMapper.java
Normal file
41
renren-api/src/main/java/io/renren/dao/SysConfigMapper.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package io.renren.dao;
|
||||
|
||||
|
||||
import io.renren.entity.SysConfig;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 参数配置 数据层
|
||||
*
|
||||
* @author dcsoft
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysConfigMapper
|
||||
{
|
||||
/**
|
||||
* 查询参数配置信息
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 参数配置信息
|
||||
*/
|
||||
public SysConfig selectConfig(SysConfig config);
|
||||
|
||||
/**
|
||||
* 通过ID查询配置
|
||||
*
|
||||
* @param configId 参数ID
|
||||
* @return 参数配置信息
|
||||
*/
|
||||
public SysConfig selectConfigById(Long configId);
|
||||
|
||||
/**
|
||||
* 查询参数配置列表
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 参数配置集合
|
||||
*/
|
||||
public List<SysConfig> selectConfigList(SysConfig config);
|
||||
|
||||
}
|
||||
104
renren-api/src/main/java/io/renren/entity/SysConfig.java
Normal file
104
renren-api/src/main/java/io/renren/entity/SysConfig.java
Normal file
@@ -0,0 +1,104 @@
|
||||
package io.renren.entity;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 参数配置表 sys_config
|
||||
*
|
||||
* @author dcsoft
|
||||
*/
|
||||
public class SysConfig extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 参数主键 */
|
||||
private Long configId;
|
||||
|
||||
/** 参数名称 */
|
||||
private String configName;
|
||||
|
||||
/** 参数键名 */
|
||||
private String configKey;
|
||||
|
||||
/** 参数键值 */
|
||||
private String configValue;
|
||||
|
||||
/** 系统内置(Y是 N否) */
|
||||
private String configType;
|
||||
|
||||
public Long getConfigId()
|
||||
{
|
||||
return configId;
|
||||
}
|
||||
|
||||
public void setConfigId(Long configId)
|
||||
{
|
||||
this.configId = configId;
|
||||
}
|
||||
|
||||
@NotBlank(message = "参数名称不能为空")
|
||||
@Size(min = 0, max = 100, message = "参数名称不能超过100个字符")
|
||||
public String getConfigName()
|
||||
{
|
||||
return configName;
|
||||
}
|
||||
|
||||
public void setConfigName(String configName)
|
||||
{
|
||||
this.configName = configName;
|
||||
}
|
||||
|
||||
@NotBlank(message = "参数键名长度不能为空")
|
||||
@Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符")
|
||||
public String getConfigKey()
|
||||
{
|
||||
return configKey;
|
||||
}
|
||||
|
||||
public void setConfigKey(String configKey)
|
||||
{
|
||||
this.configKey = configKey;
|
||||
}
|
||||
|
||||
@NotBlank(message = "参数键值不能为空")
|
||||
@Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符")
|
||||
public String getConfigValue()
|
||||
{
|
||||
return configValue;
|
||||
}
|
||||
|
||||
public void setConfigValue(String configValue)
|
||||
{
|
||||
this.configValue = configValue;
|
||||
}
|
||||
|
||||
public String getConfigType()
|
||||
{
|
||||
return configType;
|
||||
}
|
||||
|
||||
public void setConfigType(String configType)
|
||||
{
|
||||
this.configType = configType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("configId", getConfigId())
|
||||
.append("configName", getConfigName())
|
||||
.append("configKey", getConfigKey())
|
||||
.append("configValue", getConfigValue())
|
||||
.append("configType", getConfigType())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -100,6 +100,15 @@ public class SysPeople extends BaseEntity {
|
||||
|
||||
private String isConsume;
|
||||
|
||||
private Integer consumeStats;
|
||||
|
||||
public Integer getConsumeStats() {
|
||||
return consumeStats;
|
||||
}
|
||||
|
||||
public void setConsumeStats(Integer consumeStats) {
|
||||
this.consumeStats = consumeStats;
|
||||
}
|
||||
|
||||
public String getOpenid() {
|
||||
return openid;
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package io.renren.service;
|
||||
|
||||
import io.renren.entity.SysConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 参数配置 服务层
|
||||
*
|
||||
* @author dcsoft
|
||||
*/
|
||||
public interface ISysConfigService {
|
||||
|
||||
/**
|
||||
* 查询参数配置信息
|
||||
*
|
||||
* @param configId 参数配置ID
|
||||
* @return 参数配置信息
|
||||
*/
|
||||
public SysConfig selectConfigById(Long configId);
|
||||
|
||||
/**
|
||||
* 根据键名查询参数配置信息
|
||||
*
|
||||
* @param configKey 参数键名
|
||||
* @return 参数键值
|
||||
*/
|
||||
public String selectConfigByKey(String configKey);
|
||||
|
||||
/**
|
||||
* 查询参数配置列表
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 参数配置集合
|
||||
*/
|
||||
public List<SysConfig> selectConfigList(SysConfig config);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package io.renren.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.renren.common.redis.RedisUtils;
|
||||
import io.renren.dao.SysConfigMapper;
|
||||
import io.renren.entity.SysConfig;
|
||||
import io.renren.service.ISysConfigService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 参数配置 服务层实现
|
||||
*
|
||||
* @author dcsoft
|
||||
*/
|
||||
@Service
|
||||
public class SysConfigServiceImpl implements ISysConfigService
|
||||
{
|
||||
@Autowired
|
||||
private SysConfigMapper configMapper;
|
||||
|
||||
@Autowired
|
||||
private RedisUtils redisService;
|
||||
|
||||
/**
|
||||
* 查询参数配置信息
|
||||
*
|
||||
* @param configId 参数配置ID
|
||||
* @return 参数配置信息
|
||||
*/
|
||||
@Override
|
||||
public SysConfig selectConfigById(Long configId)
|
||||
{
|
||||
SysConfig config = new SysConfig();
|
||||
config.setConfigId(configId);
|
||||
return configMapper.selectConfig(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据键名查询参数配置信息
|
||||
*
|
||||
* @param configKey 参数key
|
||||
* @return 参数键值
|
||||
*/
|
||||
@Override
|
||||
public String selectConfigByKey(String configKey) {
|
||||
Object configValue = redisService.get(getCacheKey(configKey));
|
||||
if (ObjectUtil.isNotNull(configValue) && StrUtil.isNotEmpty(configValue.toString())) {
|
||||
|
||||
return configValue.toString();
|
||||
}
|
||||
SysConfig config = new SysConfig();
|
||||
config.setConfigKey(configKey);
|
||||
SysConfig retConfig = configMapper.selectConfig(config);
|
||||
if (ObjectUtil.isNotNull(retConfig)) {
|
||||
redisService.set(getCacheKey(configKey), retConfig.getConfigValue());
|
||||
return retConfig.getConfigValue();
|
||||
}
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询参数配置列表
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 参数配置集合
|
||||
*/
|
||||
@Override
|
||||
public List<SysConfig> selectConfigList(SysConfig config)
|
||||
{
|
||||
return configMapper.selectConfigList(config);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置cache key
|
||||
*
|
||||
* @param configKey 参数键
|
||||
* @return 缓存键key
|
||||
*/
|
||||
private String getCacheKey(String configKey)
|
||||
{
|
||||
return "sys_config:" + configKey;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,15 +2,9 @@ spring:
|
||||
datasource:
|
||||
druid:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
#url: jdbc:mysql://127.0.0.1:3306/fk_cloud?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
|
||||
#username: root
|
||||
#password: 111111
|
||||
url: jdbc:mysql://192.168.124.185:3306/taihe_cloud?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
|
||||
url: jdbc:mysql://127.0.0.1:3306/xa_cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: SQLsql123
|
||||
#url: jdbc:mysql://127.0.0.1:8123/chungu?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
|
||||
#username: root
|
||||
#password: 3dxz2023
|
||||
password: root
|
||||
initial-size: 10
|
||||
max-active: 100
|
||||
min-idle: 10
|
||||
@@ -37,3 +31,16 @@ spring:
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
|
||||
redis:
|
||||
host: 192.168.2.30
|
||||
password: redis2025
|
||||
database: 5
|
||||
port: 6379
|
||||
timeout: 6000ms # 连接超时时长(毫秒)
|
||||
jedis:
|
||||
pool:
|
||||
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制)
|
||||
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-idle: 10 # 连接池中的最大空闲连接
|
||||
min-idle: 5 # 连接池中的最小空闲连接
|
||||
@@ -31,3 +31,15 @@ spring:
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
redis:
|
||||
database: 0
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password: # 密码(默认为空)
|
||||
timeout: 6000ms # 连接超时时长(毫秒)
|
||||
jedis:
|
||||
pool:
|
||||
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制)
|
||||
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-idle: 10 # 连接池中的最大空闲连接
|
||||
min-idle: 5 # 连接池中的最小空闲连接
|
||||
@@ -25,6 +25,7 @@ spring:
|
||||
# 环境 dev|test|prod
|
||||
profiles:
|
||||
active: prod
|
||||
# active: dev
|
||||
messages:
|
||||
encoding: UTF-8
|
||||
basename: i18n/messages
|
||||
@@ -40,18 +41,18 @@ spring:
|
||||
max-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
enabled: true
|
||||
redis:
|
||||
database: 0
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password: # 密码(默认为空)
|
||||
timeout: 6000ms # 连接超时时长(毫秒)
|
||||
jedis:
|
||||
pool:
|
||||
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制)
|
||||
max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-idle: 10 # 连接池中的最大空闲连接
|
||||
min-idle: 5 # 连接池中的最小空闲连接
|
||||
# redis:
|
||||
# database: 0
|
||||
# host: 127.0.0.1
|
||||
# port: 6379
|
||||
# password: # 密码(默认为空)
|
||||
# timeout: 6000ms # 连接超时时长(毫秒)
|
||||
# jedis:
|
||||
# pool:
|
||||
# max-active: 1000 # 连接池最大连接数(使用负值表示没有限制)
|
||||
# max-wait: -1ms # 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
# max-idle: 10 # 连接池中的最大空闲连接
|
||||
# min-idle: 5 # 连接池中的最小空闲连接
|
||||
|
||||
renren:
|
||||
redis:
|
||||
|
||||
@@ -1,21 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<include resource="org/springframework/boot/logging/logback/base.xml" />
|
||||
<logger name="org.springframework.web" level="INFO"/>
|
||||
<logger name="org.springboot.sample" level="TRACE" />
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/thxf" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
|
||||
<!-- 开发、测试环境 -->
|
||||
<springProfile name="dev,test">
|
||||
<logger name="org.springframework.web" level="INFO"/>
|
||||
<logger name="org.springboot.sample" level="INFO" />
|
||||
<logger name="io.renren" level="DEBUG" />
|
||||
</springProfile>
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 生产环境 -->
|
||||
<springProfile name="prod">
|
||||
<logger name="org.springframework.web" level="ERROR"/>
|
||||
<logger name="org.springboot.sample" level="ERROR" />
|
||||
<logger name="io.renren" level="ERROR" />
|
||||
</springProfile>
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_all" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/xf.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/xf.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="io.renren" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_all" />
|
||||
</root>
|
||||
</configuration>
|
||||
67
renren-api/src/main/resources/mapper/SysConfigMapper.xml
Normal file
67
renren-api/src/main/resources/mapper/SysConfigMapper.xml
Normal file
@@ -0,0 +1,67 @@
|
||||
<?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="io.renren.dao.SysConfigMapper">
|
||||
|
||||
<resultMap type="SysConfig" id="SysConfigResult">
|
||||
<id property="configId" column="config_id" />
|
||||
<result property="configName" column="config_name" />
|
||||
<result property="configKey" column="config_key" />
|
||||
<result property="configValue" column="config_value" />
|
||||
<result property="configType" column="config_type" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectConfigVo">
|
||||
select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark
|
||||
from sys_config
|
||||
</sql>
|
||||
|
||||
<!-- 查询条件 -->
|
||||
<sql id="sqlwhereSearch">
|
||||
<where>
|
||||
<if test="configId !=null">
|
||||
and config_id = #{configId}
|
||||
</if>
|
||||
<if test="configKey !=null and configKey != ''">
|
||||
and config_key = #{configKey}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<select id="selectConfig" parameterType="SysConfig" resultMap="SysConfigResult">
|
||||
<include refid="selectConfigVo"/>
|
||||
<include refid="sqlwhereSearch"/>
|
||||
</select>
|
||||
|
||||
<select id="selectConfigList" parameterType="SysConfig" resultMap="SysConfigResult">
|
||||
<include refid="selectConfigVo"/>
|
||||
<where>
|
||||
<if test="configName != null and configName != ''">
|
||||
AND config_name like concat('%', #{configName}, '%')
|
||||
</if>
|
||||
<if test="configType != null and configType != ''">
|
||||
AND config_type = #{configType}
|
||||
</if>
|
||||
<if test="configKey != null and configKey != ''">
|
||||
AND config_key like concat('%', #{configKey}, '%')
|
||||
</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
and date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
and date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectConfigById" parameterType="Long" resultMap="SysConfigResult">
|
||||
<include refid="selectConfigVo"/>
|
||||
where config_id = #{configId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -69,6 +69,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="branchId != null ">
|
||||
AND (p.branch_id = #{branchId} OR p.branch_id IN ( SELECT t.id FROM sys_branch t WHERE find_in_set(#{branchId}, ancestors) ))
|
||||
</if>
|
||||
<if test="consumeStats != null ">
|
||||
AND (p.avatar is not null or p.door_no is not null)
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
<if test="delFlag == 0">
|
||||
<if test="equipmentId != null and equipmentId != ''"> and spe.equipment_id is null </if>
|
||||
|
||||
Reference in New Issue
Block a user