top升级
This commit is contained in:
parent
047bdad640
commit
1c86d78d1e
|
|
@ -16,9 +16,9 @@ spring:
|
|||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://162.14.111.170:3306/ebts?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: ebts
|
||||
password: zcsbKxPseM8LhFdT
|
||||
url: jdbc:mysql://162.14.111.170:3306/ebtsup?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: ebtsup
|
||||
password: CZzZHHn4feSJ2a8k
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
|
|
|
|||
|
|
@ -17,37 +17,6 @@ ebts:
|
|||
captchaType: math
|
||||
|
||||
|
||||
|
||||
md5:
|
||||
#盐
|
||||
salt: clay
|
||||
#秘钥
|
||||
secretKey: xinanjiaodaxinxi
|
||||
|
||||
|
||||
|
||||
|
||||
wechat:
|
||||
# 微信用户小程序appid
|
||||
userAppid: wx4c2099a19c69664f
|
||||
# 微信职能小程序appid
|
||||
funAppid: wx17aa476b91c2a391
|
||||
# 微信技术端小程序appid
|
||||
eleAppid: wx17aa476b91c2a391
|
||||
# 微信用户小程序secret
|
||||
userSecret: 3c4d9f5deb39bb10319e0ea0582d2bc0
|
||||
# 微信职能小程序secret
|
||||
funSecret: 456464645
|
||||
# 微信技术小程序secret
|
||||
eleSecret: 456464645
|
||||
# 微信小程序 grant_type
|
||||
grant_type: authorization_code
|
||||
|
||||
sms:
|
||||
accessKeyId: LTAI5tKJQmGHKaUuYXco2Jiu
|
||||
accessKeySecret: VZbBW1Je4zqm028PViqKIYwtDOQcxB
|
||||
signName: 尊古
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8085
|
||||
|
|
@ -63,12 +32,6 @@ server:
|
|||
# Tomcat启动初始化的线程数,默认值25
|
||||
min-spare-threads: 30
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.ebts: debug
|
||||
org.springframework: warn
|
||||
|
||||
# Spring配置
|
||||
spring:
|
||||
profiles:
|
||||
|
|
@ -189,3 +152,43 @@ xss:
|
|||
excludes: /system/notice/*
|
||||
# 匹配链接
|
||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.ebts: debug
|
||||
org.springframework: warn'
|
||||
|
||||
|
||||
|
||||
|
||||
md5:
|
||||
#盐
|
||||
salt: clay
|
||||
#秘钥
|
||||
secretKey: xinanjiaodaxinxi
|
||||
|
||||
|
||||
|
||||
|
||||
wechat:
|
||||
# 微信用户小程序appid
|
||||
userAppid: wx4c2099a19c69664f
|
||||
# 微信职能小程序appid
|
||||
funAppid: wx17aa476b91c2a391
|
||||
# 微信技术端小程序appid
|
||||
eleAppid: wx17aa476b91c2a391
|
||||
# 微信用户小程序secret
|
||||
userSecret: 3c4d9f5deb39bb10319e0ea0582d2bc0
|
||||
# 微信职能小程序secret
|
||||
funSecret: 456464645
|
||||
# 微信技术小程序secret
|
||||
eleSecret: 456464645
|
||||
# 微信小程序 grant_type
|
||||
grant_type: authorization_code
|
||||
|
||||
sms:
|
||||
accessKeyId: LTAI5tKJQmGHKaUuYXco2Jiu
|
||||
accessKeySecret: VZbBW1Je4zqm028PViqKIYwtDOQcxB
|
||||
signName: 尊古
|
||||
|
|
|
|||
|
|
@ -5,11 +5,13 @@ import com.ebts.common.core.entity.Result;
|
|||
import com.ebts.common.utils.MapExcelUtil;
|
||||
import com.ebts.common.utils.StringUtils;
|
||||
import com.ebts.generator.entity.UniColumnInfo;
|
||||
import com.ebts.generator.entity.bo.UniQueryBo;
|
||||
import com.ebts.generator.utils.sql.GenSqlUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.ebts.generator.entity.UniCon;
|
||||
import com.ebts.generator.entity.UniQuery;
|
||||
import com.ebts.generator.service.QueryService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
|
@ -99,9 +101,11 @@ public class QueryController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ebts.hasPermi('query:preview')")
|
||||
@PutMapping("preview")
|
||||
public Serializable Preview(@Validated @RequestBody UniQuery uniQuery) {
|
||||
public Serializable Preview(@Validated @RequestBody UniQueryBo uniQuery) {
|
||||
UniQuery query = new UniQuery();
|
||||
BeanUtils.copyProperties(uniQuery,query);
|
||||
startPage(uniQuery);
|
||||
Result<List<Map<String, Object>>> result = queryService.previewQuery(uniQuery);
|
||||
Result<List<Map<String, Object>>> result = queryService.previewQuery(query);
|
||||
if (result.isSuccess()) {
|
||||
return getDataTable(result.getData());
|
||||
} else {
|
||||
|
|
@ -131,7 +135,7 @@ public class QueryController extends BaseController {
|
|||
/**
|
||||
* 设置请求分页数据
|
||||
*/
|
||||
protected void startPage(UniQuery uniQuery) {
|
||||
protected void startPage(UniQueryBo uniQuery) {
|
||||
Integer pageNum = uniQuery.getPageNum();
|
||||
Integer pageSize = uniQuery.getPageSize();
|
||||
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
|
||||
|
|
|
|||
|
|
@ -67,8 +67,7 @@ public class UniQueryController extends BaseController {
|
|||
@PreAuthorize("@ebts.hasPermi('tool:query:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result<UniQuery> getInfo(@PathVariable("id") Long id) {
|
||||
Result<UniQuery> result = uniQueryService.selectUniQueryById(id);
|
||||
return result;
|
||||
return uniQueryService.selectUniQueryById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -77,7 +76,7 @@ public class UniQueryController extends BaseController {
|
|||
@PreAuthorize("@ebts.hasPermi('tool:query:add')")
|
||||
@Log(title = "万能查询", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody @Validated UniQuery uniQuery) {
|
||||
public Result<Integer> add(@RequestBody @Validated UniQuery uniQuery) {
|
||||
return uniQueryService.insertUniQuery(uniQuery);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.ebts.generator.dao;
|
|||
|
||||
|
||||
import com.ebts.generator.entity.UniQuery;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -20,6 +21,13 @@ public interface UniQueryDao {
|
|||
*/
|
||||
UniQuery selectUniQueryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询有误已经发布上线的数据
|
||||
* @param ids
|
||||
* @return count
|
||||
*/
|
||||
int selectUniQueryReleaseByIds(@Param("ids") Long[] ids);
|
||||
|
||||
/**
|
||||
* 查询万能查询列表
|
||||
*
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import java.util.List;
|
|||
* @date 2021-01-30
|
||||
*/
|
||||
public class UniQuery extends BaseEntity {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
|
|
@ -52,9 +51,6 @@ public class UniQuery extends BaseEntity {
|
|||
|
||||
private List<UniCon> uniCons;
|
||||
|
||||
private Integer pageNum;
|
||||
|
||||
private Integer pageSize;
|
||||
|
||||
private List<UniColumnInfo> infoList;
|
||||
|
||||
|
|
@ -102,22 +98,6 @@ public class UniQuery extends BaseEntity {
|
|||
this.isRelease = isRelease;
|
||||
}
|
||||
|
||||
public Integer getPageNum() {
|
||||
return pageNum;
|
||||
}
|
||||
|
||||
public void setPageNum(Integer pageNum) {
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
|
||||
public Integer getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public List<UniCon> getUniCons() {
|
||||
if (uniCons == null) {
|
||||
return uniCons = new ArrayList<UniCon>();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
package com.ebts.generator.entity.bo;
|
||||
|
||||
import com.ebts.generator.entity.UniCon;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
public class UniQueryBo {
|
||||
|
||||
@NotBlank(message = "sql不能为空!")
|
||||
private String uqSql;
|
||||
private List<UniCon> uniCons;
|
||||
@NotNull(message = "pageNum不能为空!")
|
||||
private Integer pageNum;
|
||||
@NotNull(message = "pageSize不能为空!")
|
||||
private Integer pageSize;
|
||||
|
||||
public String getUqSql() {
|
||||
return uqSql;
|
||||
}
|
||||
|
||||
public void setUqSql(String uqSql) {
|
||||
this.uqSql = uqSql;
|
||||
}
|
||||
|
||||
public List<UniCon> getUniCons() {
|
||||
return uniCons;
|
||||
}
|
||||
|
||||
public void setUniCons(List<UniCon> uniCons) {
|
||||
this.uniCons = uniCons;
|
||||
}
|
||||
|
||||
public Integer getPageNum() {
|
||||
return pageNum;
|
||||
}
|
||||
|
||||
public void setPageNum(Integer pageNum) {
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
|
||||
public Integer getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
}
|
||||
|
|
@ -66,25 +66,12 @@ public class QueryServiceImpl implements QueryService {
|
|||
if (uniQuery.getIsRelease() == 1) {
|
||||
UniQuery query = uniQueryDao.selectUniQueryById(uniQuery.getId());
|
||||
Menu Menu = new Menu(query.getId(), query.getUqName(), SecurityUtils.getUserId());
|
||||
Integer insermenu = queryDao.insertMenu(Menu);
|
||||
if (insermenu == 0) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return Result.error(ReturnConstants.OP_ERROR);
|
||||
}
|
||||
queryDao.insertMenu(Menu);
|
||||
} else {
|
||||
Integer deleteMenu = queryDao.deleteMenu("data/" + uniQuery.getId());
|
||||
if (deleteMenu == 0) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return Result.error(ReturnConstants.OP_ERROR);
|
||||
}
|
||||
}
|
||||
Integer release = queryDao.changeRelease(uniQuery);
|
||||
if (release > 0) {
|
||||
return Result.ok();
|
||||
} else {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return Result.error(ReturnConstants.OP_ERROR);
|
||||
queryDao.deleteMenu("data/" + uniQuery.getId());
|
||||
}
|
||||
queryDao.changeRelease(uniQuery);
|
||||
return Result.ok();
|
||||
} else {
|
||||
return Result.error(ReturnConstants.STATE_ERROR);
|
||||
}
|
||||
|
|
@ -114,6 +101,7 @@ public class QueryServiceImpl implements QueryService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.SUPPORTS)
|
||||
public Result<List<Map<String, Object>>> previewQuery(UniQuery uniQuery) {
|
||||
StringBuilder sql = new StringBuilder(uniQuery.getUqSql().toLowerCase());
|
||||
List<UniCon> uniConList = uniQuery.getUniCons();
|
||||
|
|
|
|||
|
|
@ -91,6 +91,10 @@ public class UniQueryServiceImpl implements UniQueryService {
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result<Integer> deleteUniQueryByIds(Long[] ids) {
|
||||
int count = uniQueryDao.selectUniQueryReleaseByIds(ids);
|
||||
if (count>0){
|
||||
return Result.error("选择数据中含有已经发布的内容!");
|
||||
}
|
||||
uniQueryDao.deleteUniQueryByIds(ids);
|
||||
uniQueryDao.deleteUniQueryByUqIds(ids);
|
||||
return Result.ok();
|
||||
|
|
|
|||
|
|
@ -84,11 +84,11 @@
|
|||
|
||||
<select id="selectQueryInfo" parameterType="Long" resultMap="QueryResult">
|
||||
select uq.id, uq.uq_name, uq.uq_sql, uq.uq_describe, uq.create_by, uq.is_release, uq.create_time, uq.update_by, uq.update_time,
|
||||
uc.id as uc_id, uc.uq_id, uc.uc_name, uc.uc_key, uc.uc_con, uc.uc_mock, uc.uc_describe ,uc.uc_type,uc.type,uci.prop,uci.label
|
||||
uc.uq_id, uc.uc_name, uc.uc_key, uc.uc_con, uc.uc_mock, uc.uc_describe ,uc.uc_type,uc.type,uci.prop,uci.label
|
||||
from gen_uni_query uq
|
||||
left join gen_uni_con uc on uc.uq_id = uq.id
|
||||
left join gen_uni_column_info uci on uci.query_id = uq.id
|
||||
where uq.id = #{id}
|
||||
where uq.id = #{id} and uq.is_release = 2
|
||||
</select>
|
||||
|
||||
<delete id="deleteUniCon">
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
</sql>
|
||||
|
||||
<select id="selectUniQueryList" parameterType="UniQuery" resultMap="UniQueryResult">
|
||||
<include refid="selectUniQueryVo"/>
|
||||
select id, uq_name, uq_describe, type, is_release, create_by, create_time, update_by, update_time from gen_uni_query
|
||||
<where>
|
||||
<if test="uqName != null and uqName != ''"> and uq_name like concat('%', #{uqName}, '%')</if>
|
||||
<if test="uqDescribe != null and uqDescribe != ''"> and uq_describe like concat('%', #{uqDescribe}, '%')</if>
|
||||
|
|
@ -34,7 +34,14 @@
|
|||
</select>
|
||||
|
||||
<select id="selectUniQueryById" parameterType="Long" resultMap="UniQueryResult">
|
||||
select * from gen_uni_query where id = #{id}
|
||||
select id, uq_name, uq_describe, top_json, type, is_release, create_by, create_time, update_by, update_time from gen_uni_query
|
||||
where id = #{id} and is_release = 2
|
||||
</select>
|
||||
<select id="selectUniQueryReleaseByIds" resultType="java.lang.Integer">
|
||||
select count(1) from gen_uni_query where is_release = 1 and id in
|
||||
<foreach collection="ids" open="(" close=")" separator="," item="item">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<insert id="insertUniQuery" parameterType="UniQuery" useGeneratedKeys="true" keyProperty="id">
|
||||
|
|
@ -71,7 +78,7 @@
|
|||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
where id = #{id} and is_release = 2
|
||||
</update>
|
||||
|
||||
<delete id="deleteUniQueryById" parameterType="Long">
|
||||
|
|
|
|||
Loading…
Reference in New Issue