Commit f7fcb70f by XiaHou

系统参数编码提交

parent 36e5a699
...@@ -221,6 +221,11 @@ ...@@ -221,6 +221,11 @@
<artifactId>swagger-bootstrap-ui</artifactId> <artifactId>swagger-bootstrap-ui</artifactId>
<version>1.9.6</version> <version>1.9.6</version>
</dependency> </dependency>
<!--代码生成器@entity等注解标识-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
</dependencies> </dependencies>
<repositories> <repositories>
...@@ -241,6 +246,13 @@ ...@@ -241,6 +246,13 @@
</resource> </resource>
</resources> </resources>
<plugins> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
...@@ -270,10 +282,17 @@ ...@@ -270,10 +282,17 @@
<configuration> <configuration>
<source>${java.version}</source> <source>${java.version}</source>
<target>${java.version}</target> <target>${java.version}</target>
<!--<encoding>${project.build.sourceEncoding}</encoding>--> <encoding>${project.build.sourceEncoding}</encoding>
</configuration> </configuration>
</plugin> </plugin>
<!--<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>-->
<!-- mybatis generator 自动生成代码插件 --> <!-- mybatis generator 自动生成代码插件 -->
<plugin> <plugin>
<groupId>org.mybatis.generator</groupId> <groupId>org.mybatis.generator</groupId>
......
...@@ -15,7 +15,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; ...@@ -15,7 +15,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableCaching @EnableCaching
//springBoot自带的定时任务注解 //springBoot自带的定时任务注解
@EnableScheduling @EnableScheduling
@MapperScan("com.hwstudio.antaile.mapper") @MapperScan(value = {"com.hwstudio.antaile.mapper","com.hwstudio.antaile.mbg.mapper","com.hwstudio.antaile.operation.*.dao"})
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class}) @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
public class AntaileApplication extends SpringBootServletInitializer { public class AntaileApplication extends SpringBootServletInitializer {
......
...@@ -13,11 +13,9 @@ import org.springframework.context.annotation.Configuration; ...@@ -13,11 +13,9 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheManager; import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer; import org.springframework.data.redis.serializer.StringRedisSerializer;
import java.lang.reflect.Method; import java.lang.reflect.Method;
/** /**
...@@ -42,39 +40,43 @@ public class RedisConfig extends CachingConfigurerSupport { ...@@ -42,39 +40,43 @@ public class RedisConfig extends CachingConfigurerSupport {
/** /**
* 生成key的策略 * 生成key的策略
*
* @return * @return
*/ */
public KeyGenerator keyGenerator(){ public KeyGenerator keyGenerator() {
return new KeyGenerator() { return new KeyGenerator() {
@Override @Override
public Object generate(Object target, Method method, Object... params){ public Object generate(Object target, Method method, Object... params) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(target.getClass().getName()); sb.append(target.getClass().getName());
sb.append(method.getName()); sb.append(method.getName());
for (Object obj : params){ for (Object obj : params) {
sb.append(obj.toString()); sb.append(obj.toString());
} }
return sb.toString(); return sb.toString();
} }
}; };
} }
/** /**
* 缓存管理器 * 缓存管理器
*
* @param connectionFactory * @param connectionFactory
* @return * @return
*/ */
@Bean @Bean
public CacheManager cacheManager(RedisConnectionFactory connectionFactory){ public CacheManager cacheManager(RedisConnectionFactory connectionFactory) {
RedisCacheManager cacheManager = RedisCacheManager.create(connectionFactory); RedisCacheManager cacheManager = RedisCacheManager.create(connectionFactory);
return cacheManager; return cacheManager;
} }
/** /**
* RedisTemplate配置 * RedisTemplate配置
*
* @param factory * @param factory
* @return * @return
*/ */
public RedisTemplate<String,Object> redisTemplate(RedisConnectionFactory factory){ public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
RedisTemplate<String, Object> template = new RedisTemplate<>(); RedisTemplate<String, Object> template = new RedisTemplate<>();
// 配置连接工厂 // 配置连接工厂
template.setConnectionFactory(factory); template.setConnectionFactory(factory);
......
package com.hwstudio.antaile.controller; package com.hwstudio.antaile.controller.sys;
import com.hwstudio.antaile.dto.CountryMobilePrefixListDto;
import com.hwstudio.antaile.dto.SysBaijiaxingDetailsDto;
import com.hwstudio.antaile.dto.SysBaijiaxingListDto;
import com.hwstudio.antaile.service.CountryMobilePrefixService;
import com.hwstudio.antaile.service.SysAreaService; import com.hwstudio.antaile.service.SysAreaService;
import com.hwstudio.antaile.service.SysBaijiaxingService;
import com.hwstudio.antaile.utils.JsonResult; import com.hwstudio.antaile.utils.JsonResult;
import com.hwstudio.antaile.vo.SysAreaVo; import com.hwstudio.antaile.vo.SysAreaVo;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @Name: * @Name:
......
package com.hwstudio.antaile.controller.sys;
import com.hwstudio.antaile.operation.system.service.ISysBaseParamService;
import com.hwstudio.antaile.utils.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* @Author xh
* @Date 2020/12/2
* description:
*/
@Controller
@Api(tags = "系统基础参数相关接口", description = "系统基础控制器")
@RequestMapping("/sysBaseParam")
public class SysBaseParamController {
@Autowired
private ISysBaseParamService sysBaseParamService;
@ApiOperation("根据参数编码查询一条系统参数信息")
@RequestMapping(value = "/getOneParamByParamCode", method = RequestMethod.GET)
@ResponseBody
public JsonResult getOneParamByParamCode(@ApiParam(value = "系统参数编码", required = true) @RequestParam(value = "paramCode", required = true) String paramCode) {
return JsonResult.success("查询成功", this.sysBaseParamService.getOneParamByParamCode(paramCode));
}
}
package com.hwstudio.antaile.controller; package com.hwstudio.antaile.controller.sys;
import com.hwstudio.antaile.dto.CountryMobilePrefixListDto; import com.hwstudio.antaile.dto.CountryMobilePrefixListDto;
import com.hwstudio.antaile.dto.SysBaijiaxingDetailsDto; import com.hwstudio.antaile.dto.SysBaijiaxingDetailsDto;
......
package com.hwstudio.antaile.mbg.mapper;
import com.hwstudio.antaile.mbg.po.SysBaseParam;
import com.hwstudio.antaile.mbg.po.SysBaseParamExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface SysBaseParamMapper {
long countByExample(SysBaseParamExample example);
int deleteByExample(SysBaseParamExample example);
int deleteByPrimaryKey(Long id);
int insert(SysBaseParam record);
int insertSelective(SysBaseParam record);
List<SysBaseParam> selectByExample(SysBaseParamExample example);
SysBaseParam selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") SysBaseParam record, @Param("example") SysBaseParamExample example);
int updateByExample(@Param("record") SysBaseParam record, @Param("example") SysBaseParamExample example);
int updateByPrimaryKeySelective(SysBaseParam record);
int updateByPrimaryKey(SysBaseParam record);
}
\ No newline at end of file
package com.hwstudio.antaile.mbg.po;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import org.springframework.format.annotation.DateTimeFormat;
@Entity
public class SysBaseParam implements Serializable {
@ApiModelProperty(value = "主键")
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private Long id;
@ApiModelProperty(value = "参数名")
private String paramName;
@ApiModelProperty(value = "参数编码")
private String paramCode;
@ApiModelProperty(value = "参数值")
private String paramValue;
@ApiModelProperty(value = "参数类型 1|字符串,2|integer整数类型,3|bool类型,4|char类型,5|double精度类型,6|日期类型,7|对象类型,8|数组类型,9|附件类型 10|sql 11|json")
private Integer paramType;
@ApiModelProperty(value = "说明")
private String remark;
@ApiModelProperty(value = "状态")
private Integer status;
@ApiModelProperty(value = "删除标志 0|正常|1删除")
private Integer isDelete;
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@ApiModelProperty(value = "更新时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getParamName() {
return paramName;
}
public void setParamName(String paramName) {
this.paramName = paramName;
}
public String getParamCode() {
return paramCode;
}
public void setParamCode(String paramCode) {
this.paramCode = paramCode;
}
public String getParamValue() {
return paramValue;
}
public void setParamValue(String paramValue) {
this.paramValue = paramValue;
}
public Integer getParamType() {
return paramType;
}
public void setParamType(Integer paramType) {
this.paramType = paramType;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getIsDelete() {
return isDelete;
}
public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", paramName=").append(paramName);
sb.append(", paramCode=").append(paramCode);
sb.append(", paramValue=").append(paramValue);
sb.append(", paramType=").append(paramType);
sb.append(", remark=").append(remark);
sb.append(", status=").append(status);
sb.append(", isDelete=").append(isDelete);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
package com.hwstudio.antaile.operation.system.dao;
/**
* @Author xh
* @Date 2021/4/16
* description:
*/
public interface SysBaseParamDao {
}
package com.hwstudio.antaile.operation.system.service;
import com.hwstudio.antaile.mbg.po.SysBaseParam;
/**
* @Author xh
* @Date 2021/4/16
* description:
*/
public interface ISysBaseParamService {
/**
* 根据参数编码 查询一个系统参数
*
* @param paramCode
* @return
*/
SysBaseParam getOneParamByParamCode(String paramCode);
}
package com.hwstudio.antaile.operation.system.service.impl;
import com.hwstudio.antaile.mbg.mapper.SysBaseParamMapper;
import com.hwstudio.antaile.mbg.po.SysBaseParam;
import com.hwstudio.antaile.mbg.po.SysBaseParamExample;
import com.hwstudio.antaile.operation.system.service.ISysBaseParamService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author xh
* @Date 2021/4/16
* description:
*/
@Service
public class SysBaseParamServiceImpl implements ISysBaseParamService {
@Resource
private SysBaseParamMapper sysBaseParamMapper;
/**
* 根据参数编码 查询一个系统参数
*
* @param paramCode
* @return
*/
@Override
public SysBaseParam getOneParamByParamCode(String paramCode){
SysBaseParamExample example = new SysBaseParamExample();
SysBaseParamExample.Criteria criteria = example.createCriteria();
criteria.andParamCodeEqualTo(paramCode);
List<SysBaseParam> sysBaseParamList = this.sysBaseParamMapper.selectByExample(example);
if(sysBaseParamList == null ||sysBaseParamList.size() <= 0){
return null;
}
return sysBaseParamList.get(0);
}
}
spring: spring:
mvc: mvc:
view: view:
...@@ -15,10 +13,9 @@ spring: ...@@ -15,10 +13,9 @@ spring:
url: jdbc:mysql://yzcdb001w.mysql.rds.aliyuncs.com:3306/atlapp?characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai url: jdbc:mysql://yzcdb001w.mysql.rds.aliyuncs.com:3306/atlapp?characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: usr_atlapp username: usr_atlapp
password: Atl@120726 password: Atl@120726
#url: jdbc:mysql://47.98.216.76:3306/atl-app?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
#username: root #username: root
#password: Atl@ljc1653819 #password: 6just@2019
#url: jdbc:mysql://47.111.181.202:3306/antaile?characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
#url: jdbc:mysql://yzcdb001w.mysql.rds.aliyuncs.com:3306/atlapp?characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
#连接池配置,因为springboot默认是开启了连接池的,它有默认配置,这一段可以忽略 #连接池配置,因为springboot默认是开启了连接池的,它有默认配置,这一段可以忽略
#初始化大小,最小,最大 #初始化大小,最小,最大
...@@ -41,24 +38,6 @@ spring: ...@@ -41,24 +38,6 @@ spring:
#max-pool-prepared-statement-per-connection-size: 20 #max-pool-prepared-statement-per-connection-size: 20
#配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙 #配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
#filters: stat,wall,log4j #filters: stat,wall,log4j
# #thymeleaf配置
# thymeleaf:
# cache: false
# #默认配置,有其他需求在进行更改
# prefix: WEB-INF/view
# suffix: .jsp
# mode: HTML5
# encoding: UTF-8
# servlet:
# content-type: text/html
# chain:
# strategy:
# content:
# enabled: true
# paths: /**
#设置热部署 #设置热部署
devtools: devtools:
restart: restart:
...@@ -66,20 +45,18 @@ spring: ...@@ -66,20 +45,18 @@ spring:
enabled: true enabled: true
#重启范围 #重启范围
additional-paths: src/main/java additional-paths: src/main/java
#redis #redis
redis: redis:
# Redis数据库索引(默认为0) # Redis数据库索引(默认为0)
database: 0 database: 0
# Redis服务器地址 # Redis服务器地址
host: 47.98.96.174 #host: 47.98.96.174
host: 127.0.0.1
# Redis服务器连接端口 # Redis服务器连接端口
port: 6379 port: 6379
# Redis服务器连接密码(默认为空) # Redis服务器连接密码(默认为空)
password: "root123!!" #password: "root123!!"
#password: atl@redis_120726 #password: ""
jedis: jedis:
pool: pool:
# 连接池最大连接数(使用负值表示没有限制) # 连接池最大连接数(使用负值表示没有限制)
...@@ -98,7 +75,7 @@ server: ...@@ -98,7 +75,7 @@ server:
#配置mybatis #配置mybatis
mybatis: mybatis:
mapper-locations: classpath:mapping/*.xml mapper-locations: classpath:mapping/**/*.xml
#全局的映射,不用在xml文件写实体类的全路径 #全局的映射,不用在xml文件写实体类的全路径
type-aliases-package: com.hwstudio.antaile type-aliases-package: com.hwstudio.antaile
#开启驼峰映射 #开启驼峰映射
......
<?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.hwstudio.antaile.operation.system.dao.SysBaseParamDao">
</mapper>
\ No newline at end of file
<?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.hwstudio.antaile.operation.system.dao.SysBaseParamDao">
<resultMap id="baseResultMap" type="com.hwstudio.antaile.mbg.po.SysBaseParam" extends="com.hwstudio.antaile.mbg.mapper.SysBaseParamMapper.BaseResultMap">
</resultMap>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment