Commit 4531923a authored by 赵啸非's avatar 赵啸非

修改部分生成代码逻辑

parent 5b6faec7
......@@ -3,9 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "vue-cli-service serve",
"dev2": "vue-cli-service serve --use ",
"dev3": "vue-cli-service serve --use 现网",
"stage": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
......
......@@ -17,7 +17,7 @@ module.exports = {
hot: true,//自动保存
proxy: {
'/m': {
target: 'http://127.0.0.1:17211',
target: 'http://127.0.0.1:17311',
changeOrigin: true,
secure: false,
cookieDomainRewrite: 'plm.testnew.com',
......
......@@ -110,17 +110,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<!-- 去除resources下的所有文件 -->
<excludes>
<exclude>**/*.properties</exclude>
<exclude>**/*.xml</exclude>
<exclude>**/*.yml</exclude>
<exclude>etlsql/**</exclude>
<exclude>sqlmap/**</exclude>
<exclude>config/**</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
......@@ -139,12 +128,6 @@
<outputDirectory>${project.parent.basedir}/dist/${project.parent.artifactId}/boot</outputDirectory>
<layout>ZIP</layout>
<!-- 打包时,本jar包不包含其他依赖包 , 否则打出的jar包还是很大 -->
<includes>
<include>
<groupId>nothing</groupId>
<artifactId>nothing</artifactId>
</include>
</includes>
</configuration>
</plugin>
<plugin>
......@@ -156,61 +139,11 @@
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<!--设置jar所依赖的三方jar包存放的路径 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dep</id>
<phase>prepare-package</phase>
<goals>
<goal>
copy-dependencies
</goal>
</goals>
<configuration>
<outputDirectory>${project.parent.basedir}/dist/${project.parent.artifactId}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<!-- 是否不包含间接依赖 -->
<excludeTransitive>false</excludeTransitive>
<!-- 忽略版本 -->
<stripVersion>false</stripVersion>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<outputDirectory>${project.parent.basedir}/dist/${project.parent.artifactId}/conf</outputDirectory>
<resources>
<resource>
<directory>src/main/resources/</directory>
<includes>
<include>etlsql/**</include>
<include>sqlmap/**</include>
<include>config/**</include>
<include>*.yml</include>
<include>*.xml</include>
<include>*.properties</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-bin</id>
<phase>package</phase>
......
......@@ -8,9 +8,10 @@
package com.mortals.xhx.base.system.param.model;
import java.util.Date;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.framework.service.IParam;
import java.util.Date;
/**
* <p>Title: 参数信息</p>
......@@ -20,8 +21,8 @@ import com.mortals.framework.model.BaseEntityLong;
* @author
* @version 1.0.0
*/
public class ParamEntity extends BaseEntityLong{
private static final long serialVersionUID = 1547777703336L;
public class ParamEntity extends BaseEntityLong implements IParam {
private static final long serialVersionUID = 1536307966363L;
/** 参数名称 */
private String name;
......@@ -44,7 +45,7 @@ public class ParamEntity extends BaseEntityLong{
/** 参数修改状态,0:隐藏,1:页面仅查看,2:页面可修改,3:页面可删除,4:页面可修改删除,默认4 */
private Integer modStatus;
/** 展现类型,0:普通文本框,1:多行文本框,2:开关,3:块输入框,默认:0 */
/** 展现类型,0:普通文本框,1:多行文本框,2:开关,3:块输入框,4:密码输入框,默认:0 */
private Integer displayType;
/** 备注 */
......@@ -53,7 +54,7 @@ public class ParamEntity extends BaseEntityLong{
/** 创建时间 */
private Date createTime;
/** 创建用户 */
/** 创建用户ID */
private Long createUserId;
/** 创建用户名称 */
......@@ -176,7 +177,7 @@ public class ParamEntity extends BaseEntityLong{
}
/**
* 获取 展现类型,0:普通文本框,1:多行文本框,2:开关,3:块输入框,默认:0
* 获取 展现类型,0:普通文本框,1:多行文本框,2:开关,3:块输入框,4:密码输入框,默认:0
* @return displayType
*/
public Integer getDisplayType(){
......@@ -184,7 +185,7 @@ public class ParamEntity extends BaseEntityLong{
}
/**
* 设置 展现类型,0:普通文本框,1:多行文本框,2:开关,3:块输入框,默认:0
* 设置 展现类型,0:普通文本框,1:多行文本框,2:开关,3:块输入框,4:密码输入框,默认:0
* @param displayType
*/
public void setDisplayType(Integer displayType){
......@@ -224,7 +225,7 @@ public class ParamEntity extends BaseEntityLong{
}
/**
* 获取 创建用户
* 获取 创建用户ID
* @return createUserId
*/
public Long getCreateUserId(){
......@@ -232,7 +233,7 @@ public class ParamEntity extends BaseEntityLong{
}
/**
* 设置 创建用户
* 设置 创建用户ID
* @param createUserId
*/
public void setCreateUserId(Long createUserId){
......
......@@ -2,6 +2,7 @@ package com.mortals.xhx.base.system.param.service;
import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.framework.service.IParamService;
import com.mortals.xhx.base.system.param.model.ParamEntity;
import java.util.Map;
......@@ -15,7 +16,7 @@ import java.util.Map;
* @version 1.0.0
*/
public interface ParamService extends ICRUDCacheService<ParamEntity, Long> {
public interface ParamService extends ICRUDCacheService<ParamEntity, Long>, IParamService {
/**
* 通过Key获取参数值
......@@ -33,4 +34,14 @@ public interface ParamService extends ICRUDCacheService<ParamEntity, Long> {
*/
Map<String, String> getParamByFirstOrganize(String firstOrganize, String... excludeParamKeys);
/**
* 通过firstOrganize获取配置参数key-value
*
* @param firstOrganize
* @param excludeParamKeys 需要过虑掉的paramKey
* @return
*/
Map<String, String> getParamBySecondOrganize(String firstOrganize,String secondOrganize, String... excludeParamKeys);
}
\ No newline at end of file
package com.mortals.xhx.base.system.param.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.code.YesNo;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.IParam;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.param.dao.ParamDao;
import com.mortals.xhx.base.system.param.model.ParamEntity;
import com.mortals.xhx.base.system.param.model.ParamQuery;
import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.stereotype.Service;
import java.util.Arrays;
......@@ -32,16 +36,16 @@ public class ParamServiceImpl extends AbstractCRUDCacheServiceImpl<ParamDao, Par
protected String getExtKey(ParamEntity data) {
return data.getParamKey();
}
@Override
protected String getCacheName() {
return "ParamEntity.paramKey";
}
@Override
public void putCache(String key, ParamEntity data) {
cacheService.set(data.getParamKey(), data.getParamValue());
}
// @Override
// public void putCache(String key, ParamEntity data) {
// cacheService.set(data.getParamKey(), data.getParamValue());
// }
@Override
public void removeCache(String key) {
......@@ -62,16 +66,247 @@ public class ParamServiceImpl extends AbstractCRUDCacheServiceImpl<ParamDao, Par
@Override
public String getValueByKey(String key) {
return cacheService.get(key);
return cacheService.hget(getCacheName(),key,ParamEntity.class).getParamValue();
//return cacheService.hget(key);
}
@Override
public Map<String, String> getParamByFirstOrganize(String firstOrganize, String... excludeParamKeys) {
ParamQuery query = new ParamQuery();
query.setFirstOrganize(firstOrganize);
List<ParamEntity> list = this.getDao().getList(query);
return list.stream().filter(s -> {
List<ParamEntity> list =this.getCacheList();
// ParamQuery query = new ParamQuery();
// query.setFirstOrganize(firstOrganize);
// List<ParamEntity> list = this.getDao().getList(query);
return list.stream()
.filter(f->firstOrganize.equals(f.getFirstOrganize()))
.filter(s -> {
return !Arrays.asList(excludeParamKeys).contains(s.getParamKey());
}).collect(Collectors.toMap(ParamEntity::getParamKey, ParamEntity::getParamValue,(o,n)->n));
}
public Map<String, String> getParamBySecondOrganize(String firstOrganize, String secondOrganize, String... excludeParamKeys) {
List<ParamEntity> list =this.getCacheList();
// ParamQuery query = new ParamQuery();
// query.setFirstOrganize(firstOrganize);
// query.setSecondOrganize(secondOrganize);
// List<ParamEntity> list = this.getDao().getList(query);
return list.stream()
.filter(f->firstOrganize.equals(f.getFirstOrganize()))
.filter(f->secondOrganize.equals(f.getSecondOrganize()))
.filter(s -> {
return !Arrays.asList(excludeParamKeys).contains(s.getParamKey());
}).collect(Collectors.toMap(ParamEntity::getParamKey, ParamEntity::getParamValue));
}).collect(Collectors.toMap(ParamEntity::getParamKey, ParamEntity::getParamValue,(o,n)->n));
}
@Override
public boolean needRefresh() {
if (super.cacheService.isShareCache())//共享缓存,不需要实时刷新
{
return false;
}
IParam param = this.findByKey(IParam.KEY_PARAM_REFRESH_COUNT);
if (param != null) {
String value = StringUtils.trim(param.getParamValue());
IParam memParam = getParamByKey(IParam.KEY_PARAM_REFRESH_COUNT);
if (memParam == null || !value.equals(StringUtils.trim(memParam.getParamValue()))) {
return true;
}
}
return false;
}
@Override
public void refresh() {
log.info("开始初始化系统参数...");
try {
super.removeAllCache();
super.loadCache();
log.info("系统参数初始化完成!");
} catch (Exception e) {
log.error("查询系统参数异常", e);
}
}
@Override
public IParam findByKey(String key) throws AppException {
ParamQuery params = new ParamQuery();
params.setValidStatus(YesNo.YES.getValue());
params.setParamKey(key);
List<ParamEntity> list = super.find(params, null);
if (list != null && !list.isEmpty()) {
return list.get(0);
}
return null;
}
@Override
public List<? extends IParam> findAll() throws AppException {
ParamQuery params = new ParamQuery();
params.setValidStatus(YesNo.YES.getValue());
return super.find(params, null);
}
@Override
public boolean containsParamKey(String key) {
return cacheService.hget(getCacheName(), key) != null;
}
@Override
public IParam getParamByKey(String key) {
return getExtCache(key);
}
@Override
public String getParamValue(String key) {
IParam param = wrapParamObject(cacheService.hget(getCacheName(), key));
// IParam param = getExtCache(key);
if (param != null) {
return StringUtils.trim(param.getParamValue());
}
return "";
}
private IParam wrapParamObject(String entityString) {
JSONObject jsonObject = JSON.parseObject(entityString);
ParamEntity param = new ParamEntity();
param.setCreateTime(jsonObject.getDate("createTime"));
param.setCreateUserId(jsonObject.getLong("createUserId"));
param.setDisplayType(jsonObject.getInteger("displayType"));
param.setFirstOrganize(jsonObject.getString("firstOrganize"));
param.setId(jsonObject.getLong("id"));
param.setModStatus(jsonObject.getInteger("modStatus"));
param.setName(jsonObject.getString("name"));
param.setParamKey(jsonObject.getString("paramKey"));
param.setParamValue(jsonObject.getString("paramValue"));
param.setValidStatus(jsonObject.getInteger("validStatus"));
return param;
}
@Override
public String getParamValue(String key, String defaultValue) {
if (containsParamKey(key)) {
String value = getParamValue(key);
if (StringUtils.isEmpty(value)) {
return defaultValue;
}
return value;
} else {
log.debug("cannot found key[" + key + "], use default value[" + defaultValue + "]");
return defaultValue;
}
}
@Override
public int getParamIntValue(String key) {
ParamEntity extCache = getExtCache(key);
IParam param = (IParam) extCache;
try {
if (param == null) {
return 0;
}
String value = param.getParamValue();
if (StringUtils.isEmpty(value)) {
return 0;
} else {
return Integer.parseInt(value);
}
} catch (Exception e) {
return 0;
}
}
@Override
public int getParamIntValue(String key, int defaultValue) {
if (containsParamKey(key)) {
String value = getParamValue(key);
if (StringUtils.isEmpty(value)) {
return defaultValue;
}
try {
return Integer.parseInt(value);
} catch (Exception e) {
log.debug("cannot conver key[" + key + "]'s value[" + value + "] to int, use default value[" + defaultValue + "]");
return defaultValue;
}
} else {
log.debug("cannot found key[" + key + "], use default value[" + defaultValue + "]");
return defaultValue;
}
}
@Override
public long getParamLongValue(String key) {
IParam param = getExtCache(key);
try {
if (param == null) {
return 0;
}
String value = param.getParamValue();
if (StringUtils.isEmpty(value)) {
return 0;
} else {
return Long.parseLong(value);
}
} catch (Exception e) {
return 0;
}
}
@Override
public long getParamLongValue(String key, long defaultValue) {
if (containsParamKey(key)) {
String value = getParamValue(key);
if (StringUtils.isEmpty(value)) {
return defaultValue;
}
try {
return Long.parseLong(value);
} catch (Exception e) {
log.debug("cannot conver key[" + key + "]'s value[" + value + "] to long, use default value[" + defaultValue + "]");
return defaultValue;
}
} else {
log.debug("cannot found key[" + key + "], use default value[" + defaultValue + "]");
return defaultValue;
}
}
@Override
public boolean getParamBooleanValue(String key) {
IParam param = getExtCache(key);
try {
if (param == null) {
return false;
}
String value = param.getParamValue();
if (StringUtils.isEmpty(value)) {
return false;
} else {
return Boolean.parseBoolean(value);
}
} catch (Exception e) {
return false;
}
}
@Override
public boolean getParamBooleanValue(String key, boolean defaultValue) {
if (containsParamKey(key)) {
String value = getParamValue(key);
if (StringUtils.isEmpty(value)) {
return defaultValue;
}
try {
return Boolean.parseBoolean(value);
} catch (Exception e) {
log.debug("cannot conver key[" + key + "]'s value[" + value + "] to boolean, use default value[" + defaultValue + "]");
return defaultValue;
}
} else {
log.debug("cannot found key[" + key + "], use default value[" + defaultValue + "]");
return defaultValue;
}
}
}
\ No newline at end of file
......@@ -117,12 +117,11 @@ public class GenUtils {
column.setIsQuery(GenConstants.NOREQUIRE);
//拆解枚举类,格式必须为(1.啊啊啊,2.不不不)
String temp1 = StringUtils.substringBetween(column.getColumnComment(), "(", ")");
String temp2 = StringUtils.substringBetween(column.getColumnComment(), "(", ")");
String temp = column.getColumnComment().replaceAll("(", "(").replaceAll(")", ")");
String temp1 = StringUtils.substringBetween(temp, "(", ")");
//String temp2 = StringUtils.substringBetween(column.getColumnComment(), "(", ")");
checkDict(column, temp1);
checkDict(column, temp2);
//checkDict(column, temp2);
if(!ObjectUtils.isEmpty(column.getDict())){
if(column.getDict().size()>2){
......@@ -164,7 +163,7 @@ public class GenUtils {
temp=temp.replaceAll(",",",");
temp=temp.replaceAll(";",",");
temp=temp.replaceAll("、",".");
//temp=temp.replaceAll("、",".");
temp=temp.replaceAll("。",".");
String[] split = checkSplitStr(temp, ",");
......
......@@ -94,7 +94,7 @@ public class ${ClassName}Entity extends ${ClassName}Vo {
<#--get set属性 -->
<#list columns as column>
<#if !column.isSuperColumn(column.javaField)>
<#if column.javaField[1..2]?matches("[A-Z]")>
<#if column.javaField[0..1]?matches("[A-Z]")>
<#assign AttrName = column.javaField>
<#else>
<#assign AttrName = column.javaField?cap_first>
......
......@@ -82,7 +82,7 @@
<trim suffixOverrides="," suffix="">
<#list columns as column>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('${column.javaField}') or colPickMode == 1 and data.containsKey('${column.javaField}')))">
a.${column.columnName} as ${column.javaField},
a.${column.columnName},
</if>
</#list>
</trim>
......@@ -91,7 +91,7 @@
<!-- 子表所有列 -->
<sql id="_columns_sub">
<trim suffixOverrides="," suffix="">
<#list subColumns as column>b.${column.columnName} as ${column.javaField},</#list>
<#list subColumns as column>b.${column.columnName},</#list>
</trim>
</sql>
</#if>
......
......@@ -33,7 +33,7 @@
</activation>
<properties>
<profiles.active>develop</profiles.active>
<profiles.server.port>17211</profiles.server.port>
<profiles.server.port>17311</profiles.server.port>
<profiles.datasource.uri>
<![CDATA[jdbc:mysql://localhost:3306/appbuild-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]></profiles.datasource.uri>
<profiles.datasource.username>root</profiles.datasource.username>
......@@ -53,9 +53,9 @@
<id>test</id>
<properties>
<profiles.active>test</profiles.active>
<profiles.server.port>17211</profiles.server.port>
<profiles.server.port>17311</profiles.server.port>
<profiles.datasource.uri>
<![CDATA[jdbc:mysql://192.168.0.252:3306/appbuild-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]></profiles.datasource.uri>
<![CDATA[jdbc:mysql://192.168.0.98:3306/appbuild-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]></profiles.datasource.uri>
<profiles.datasource.username>root</profiles.datasource.username>
<profiles.datasource.password>nacos@2020</profiles.datasource.password>
<profiles.redis.uri>192.168.0.252</profiles.redis.uri>
......@@ -77,36 +77,6 @@
</profile>
</profiles>
<repositories>
<repository>
<id>nexus</id>
<name>nexus</name>
<!--仓库地址-->
<url>http://192.168.0.251:8081/repository/xhx-group/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<!--插件地址-->
<id>nexus</id>
<name>nexus</name>
<url>http://192.168.0.251:8081/repository/xhx-group/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<dependencyManagement>
<dependencies>
<dependency>
......
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