Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-tool
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张帅
amos-tool
Commits
d28b7aa6
Commit
d28b7aa6
authored
Jul 13, 2023
by
rjb
Browse files
Options
Browse Files
Download
Plain Diff
修改2
parents
fd022168
b82e4f86
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
1077 additions
and
30 deletions
+1077
-30
pom.xml
pom.xml
+16
-0
DataApiResource.java
...com/yeejoin/amos/api/tool/controller/DataApiResource.java
+67
-0
SourceEnum.java
...main/java/com/yeejoin/amos/api/tool/enums/SourceEnum.java
+33
-0
StudioResource.java
.../com/yeejoin/amos/api/tool/face/model/StudioResource.java
+51
-0
StudioResourceModel.java
...yeejoin/amos/api/tool/face/model/StudioResourceModel.java
+43
-0
StudioResourceMapper.java
...join/amos/api/tool/face/orm/dao/StudioResourceMapper.java
+23
-0
TableColumn.java
...om/yeejoin/amos/api/tool/face/orm/entity/TableColumn.java
+14
-0
DataBaseService.java
...m/yeejoin/amos/api/tool/face/service/DataBaseService.java
+1
-2
StudioResourceService.java
...oin/amos/api/tool/face/service/StudioResourceService.java
+301
-0
TemplateService.java
...m/yeejoin/amos/api/tool/face/service/TemplateService.java
+1
-1
AESUtils.java
src/main/java/com/yeejoin/amos/api/tool/utils/AESUtils.java
+1
-1
DateUtils.java
src/main/java/com/yeejoin/amos/api/tool/utils/DateUtils.java
+357
-0
PictureUtil.java
...ain/java/com/yeejoin/amos/api/tool/utils/PictureUtil.java
+1
-1
SqlHelper.java
src/main/java/com/yeejoin/amos/api/tool/utils/SqlHelper.java
+143
-0
application.properties
src/main/resources/application.properties
+4
-0
AmosDemoMapper.xml
src/main/resources/mapper/AmosDemoMapper.xml
+0
-5
ApiInfoMapper.xml
src/main/resources/mapper/ApiInfoMapper.xml
+0
-6
ApiSourceMapper.xml
src/main/resources/mapper/ApiSourceMapper.xml
+0
-5
RelationMapper.xml
src/main/resources/mapper/RelationMapper.xml
+0
-4
StudioResourceMapper.xml
src/main/resources/mapper/StudioResourceMapper.xml
+21
-0
VisualDesignerMapper.xml
src/main/resources/mapper/VisualDesignerMapper.xml
+0
-5
No files found.
pom.xml
View file @
d28b7aa6
...
@@ -76,6 +76,11 @@
...
@@ -76,6 +76,11 @@
<artifactId>
fastjson
</artifactId>
<artifactId>
fastjson
</artifactId>
<version>
1.2.67_noneautotype2
</version>
<version>
1.2.67_noneautotype2
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-text
</artifactId>
<version>
1.8
</version>
</dependency>
<dependency>
<dependency>
<groupId>
org.typroject
</groupId>
<groupId>
org.typroject
</groupId>
...
@@ -141,6 +146,17 @@
...
@@ -141,6 +146,17 @@
</exclusion>
</exclusion>
</exclusions>
</exclusions>
</dependency>
</dependency>
<dependency>
<groupId>
org.typroject
</groupId>
<artifactId>
tyboot-component-emq
</artifactId>
<version>
${tyboot-version}
</version>
<exclusions>
<exclusion>
<groupId>
org.typroject
</groupId>
<artifactId>
*
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencies>
<dependencyManagement>
<dependencyManagement>
...
...
src/main/java/com/yeejoin/amos/api/tool/controller/DataApiResource.java
0 → 100644
View file @
d28b7aa6
package
com
.
yeejoin
.
amos
.
api
.
tool
.
controller
;
import
com.yeejoin.amos.api.tool.face.service.StudioResourceService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
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.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.doc.TycloudResource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.sql.SQLException
;
import
java.util.Enumeration
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* <p>
* 测试 前端控制器
* </p>
*
* @author 子杨
* @since 2023-06-06
*/
@RestController
@TycloudResource
(
module
=
"atl"
,
value
=
"dataApi"
)
@RequestMapping
(
value
=
"/v1/dataApi"
)
@Api
(
tags
=
"atl-导出"
)
public
class
DataApiResource
{
private
final
Logger
logger
=
LogManager
.
getLogger
(
DataApiResource
.
class
);
@Autowired
private
StudioResourceService
studioResourceService
;
/**
* 依据参数导出 应用快搭增量脚本
* @throws SQLException
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
ANONYMOUS
,
needAuth
=
false
)
@ApiOperation
(
value
=
"导出应用快搭增量脚本"
)
@RequestMapping
(
value
=
"/generateSQL"
,
method
=
RequestMethod
.
GET
)
public
void
generateSQL
(
@RequestParam
(
"resourceCode"
)
String
resourceCode
,
@RequestParam
(
"dimension"
)
String
dimension
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
SQLException
{
Map
<
String
,
Object
>
variables
=
new
HashMap
<>();
Enumeration
<
String
>
keys
=
request
.
getParameterNames
();
while
(
keys
.
hasMoreElements
()){
String
name
=
(
String
)
keys
.
nextElement
();
String
value
=
request
.
getParameter
(
name
);
variables
.
put
(
name
,
value
);
}
variables
.
remove
(
"resourceCode"
);
variables
.
remove
(
"dimension"
);
studioResourceService
.
generateSQL
(
resourceCode
,
dimension
,
variables
,
response
);
}
}
src/main/java/com/yeejoin/amos/api/tool/enums/SourceEnum.java
0 → 100644
View file @
d28b7aa6
package
com
.
yeejoin
.
amos
.
api
.
tool
.
enums
;
/**
* 数据来源枚举
*/
public
enum
SourceEnum
{
IDX
(
"idx"
,
"指标系统"
);
String
source
;
String
desc
;
SourceEnum
(
String
source
,
String
desc
)
{
this
.
source
=
source
;
this
.
desc
=
desc
;
}
public
String
getSource
()
{
return
source
;
}
public
void
setSource
(
String
source
)
{
this
.
source
=
source
;
}
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
}
src/main/java/com/yeejoin/amos/api/tool/face/model/StudioResource.java
0 → 100644
View file @
d28b7aa6
package
com
.
yeejoin
.
amos
.
api
.
tool
.
face
.
model
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
org.typroject.tyboot.core.rdbms.orm.entity.BaseEntity
;
/**
* <p>
*
* </p>
*
* @author 子杨
* @since 2022-08-16
*/
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
@TableName
(
"studio_resource"
)
public
class
StudioResource
extends
BaseEntity
{
/**
* 资源编码
*/
@TableField
(
"RESOURCE_CODE"
)
private
String
resourceCode
;
/**
* 资源名称
*/
@TableField
(
"RESOURCE_NAME"
)
private
String
resourceName
;
// @TableField("RESOURCE_TABLE")
// private String resourceTable;
/**
* 资源参数
*/
@TableField
(
"RESOURCE_PARAMS"
)
private
String
resourceParams
;
/**
* 删除资源sql
*/
@TableField
(
"RESOURCE_DELETE_SQL"
)
private
String
resourceDeleteSql
;
/**
* 插入资源sql
*/
@TableField
(
"RESOURCE_INSERT_SQL"
)
private
String
resourceInsertSql
;
}
src/main/java/com/yeejoin/amos/api/tool/face/model/StudioResourceModel.java
0 → 100644
View file @
d28b7aa6
package
com
.
yeejoin
.
amos
.
api
.
tool
.
face
.
model
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
org.typroject.tyboot.core.rdbms.model.BaseModel
;
/**
* <p>
*
* </p>
*
* @author 子杨
* @since 2022-08-16
*/
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
public
class
StudioResourceModel
extends
BaseModel
{
/**
* 资源编码
*/
private
String
resourceCode
;
/**
* 资源名称
*/
private
String
resourceName
;
// private String resourceTable;
/**
* 资源参数
*/
private
String
resourceParams
;
/**
* 删除资源sql
*/
private
String
resourceDeleteSql
;
/**
* 插入资源sql
*/
private
String
resourceInsertSql
;
}
src/main/java/com/yeejoin/amos/api/tool/face/orm/dao/StudioResourceMapper.java
0 → 100644
View file @
d28b7aa6
package
com
.
yeejoin
.
amos
.
api
.
tool
.
face
.
orm
.
dao
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.api.tool.face.model.StudioResource
;
import
com.yeejoin.amos.api.tool.face.orm.entity.TableColumn
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* <p>
* Mapper 接口
* </p>
*
* @author 子杨
* @since 2022-08-16
*/
public
interface
StudioResourceMapper
extends
BaseMapper
<
StudioResource
>
{
List
<
TableColumn
>
queryForListByTableName
(
@Param
(
"tableName"
)
String
tableName
);
}
\ No newline at end of file
src/main/java/com/yeejoin/amos/api/tool/face/orm/entity/TableColumn.java
0 → 100644
View file @
d28b7aa6
package
com
.
yeejoin
.
amos
.
api
.
tool
.
face
.
orm
.
entity
;
import
lombok.Data
;
@Data
public
class
TableColumn
{
private
String
columnName
;
private
Boolean
isRequired
;
private
Boolean
isPk
;
private
int
sort
;
private
String
columnComment
;
private
Boolean
isIncrement
;
private
String
columnType
;
}
src/main/java/com/yeejoin/amos/api/tool/face/service/DataBaseService.java
View file @
d28b7aa6
...
@@ -5,8 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...
@@ -5,8 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.yeejoin.amos.api.tool.face.model.DataBaseModel
;
import
com.yeejoin.amos.api.tool.face.model.DataBaseModel
;
import
com.yeejoin.amos.api.tool.face.orm.dao.DataBaseMapper
;
import
com.yeejoin.amos.api.tool.face.orm.dao.DataBaseMapper
;
import
com.yeejoin.amos.api.tool.face.orm.entity.DataBase
;
import
com.yeejoin.amos.api.tool.face.orm.entity.DataBase
;
import
com.yeejoin.amos.api.tool.face.util.AESUtils
;
import
com.yeejoin.amos.api.tool.utils.AESUtils
;
import
org.apache.commons.beanutils.ConvertUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
...
...
src/main/java/com/yeejoin/amos/api/tool/face/service/StudioResourceService.java
0 → 100644
View file @
d28b7aa6
package
com
.
yeejoin
.
amos
.
api
.
tool
.
face
.
service
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.api.tool.enums.SourceEnum
;
import
com.yeejoin.amos.api.tool.face.model.StudioResource
;
import
com.yeejoin.amos.api.tool.face.model.StudioResourceModel
;
import
com.yeejoin.amos.api.tool.face.orm.dao.StudioResourceMapper
;
import
com.yeejoin.amos.api.tool.face.orm.entity.TableColumn
;
import
com.yeejoin.amos.api.tool.utils.DateUtils
;
import
com.yeejoin.amos.api.tool.utils.SqlHelper
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
import
org.apache.commons.text.StringSubstitutor
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.sql.DataSource
;
import
java.io.*
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
/**
* <p>
* 服务类
* </p>
*
* @author 子杨
* @since 2022-08-16
*/
@Component
public
class
StudioResourceService
extends
BaseService
<
StudioResourceModel
,
StudioResource
,
StudioResourceMapper
>
{
/**
* 数据库备份路径
*/
public
static
final
String
BACKUP_PATH
=
"/db/"
;
/**
* 数据库备份文本前缀
*/
public
static
String
ONESQL_PREFIX
=
""
;
private
static
String
SUFFIX
=
"sql"
;
private
static
String
BR
=
"\r\n"
;
private
static
String
SLASH
=
"/"
;
private
static
String
BRANCH
=
";"
;
private
static
String
SPLIT
=
"`"
;
private
static
String
SPACE
=
" "
;
private
static
String
INSERT_INTO
=
" INSERT INTO "
;
private
static
String
CREATE_INTO
=
" CREATE TABLE "
;
private
static
String
VALUES
=
"VALUES"
;
private
static
String
LEFTBRACE
=
"("
;
private
static
String
RIGHTBRACE
=
")"
;
private
static
String
QUOTES
=
"'"
;
private
static
String
COMMA
=
","
;
private
static
String
DISABLEFOREIGN
=
"SET FOREIGN_KEY_CHECKS = 0;\r\n"
;
private
static
String
ABLEFOREIGN
=
"SET FOREIGN_KEY_CHECKS = 1;\r\n"
;
private
static
String
DELIMITER
=
"###################################"
;
@Autowired
JdbcTemplate
jdbcTemplate
;
@Autowired
DataSource
datasource
;
@Autowired
private
SqlHelper
sqlHelper
;
@Autowired
EmqKeeper
emqKeeper
;
/**
* 分页查询
*/
public
Page
<
StudioResourceModel
>
queryForStudioResourcePage
(
Page
page
,
String
agencyCode
)
{
return
this
.
queryForPage
(
page
,
null
,
false
,
agencyCode
);
}
/**
* 列表查询 示例
*/
public
List
<
StudioResourceModel
>
queryForStudioResourceList
(
String
resourceCode
)
{
return
this
.
queryForList
(
""
,
false
,
resourceCode
);
}
public
void
generateSQL
(
String
resourceCode
,
String
dimension
,
Map
<
String
,
Object
>
variables
,
HttpServletResponse
response
)
{
try
{
// if (resourceCode.equals("StudioApplication")){
// ApplicationModel model = applicationService.queryBySeq(Long.valueOf(variables.get(dimension).toString()));
// variables.put("agencyCode", model.getAgencyCode());
// }
List
<
StudioResourceModel
>
resourceList
=
queryForStudioResourceList
(
resourceCode
);
File
directory
=
new
File
(
""
);
// 参数为空
String
coursePath
=
directory
.
getCanonicalPath
();
File
parentFile
=
new
File
(
coursePath
).
getParentFile
();
String
backPath
=
parentFile
.
getCanonicalPath
()
+
BACKUP_PATH
;
File
sqlDirectory
=
new
File
(
backPath
);
if
(!
sqlDirectory
.
exists
())
{
sqlDirectory
.
mkdir
();
}
print
(
variables
.
get
(
dimension
).
toString
(),
"开始执行"
,
"start"
);
// 备份文件路径名称
String
fileName
=
(
SourceEnum
.
IDX
.
getSource
().
equals
(
resourceCode
.
toLowerCase
())
?
(
resourceCode
.
toLowerCase
()
+
"_"
)
:
"studio_"
)
+
DateFormatUtils
.
format
(
new
Date
(),
"yyyyMMdd"
)
+
"."
+
SUFFIX
;
String
sqlFilePath
=
backPath
+
SLASH
+
fileName
;
File
file
=
new
File
(
sqlFilePath
);
FileOutputStream
out
;
OutputStreamWriter
writer
=
null
;
out
=
new
FileOutputStream
(
file
);
writer
=
new
OutputStreamWriter
(
out
,
"utf8"
);
StringBuffer
deleteSql
=
new
StringBuffer
();
StringBuffer
insertSql
=
new
StringBuffer
();
for
(
StudioResourceModel
model
:
resourceList
)
{
if
(!
validationParameters
(
model
,
variables
))
{
continue
;
}
if
(!
ObjectUtils
.
isEmpty
(
model
.
getResourceDeleteSql
()))
{
String
json
=
format
(
model
.
getResourceDeleteSql
(),
variables
);
JSONObject
dimensionData
=
JSONObject
.
parseObject
(
json
);
String
deleteAllSql
=
dimensionData
.
getString
(
dimension
);
deleteAllSql
.
replaceAll
(
";"
,
";"
+
BR
);
deleteSql
.
append
(
deleteAllSql
).
append
(
BRANCH
).
append
(
BR
);
}
if
(!
ObjectUtils
.
isEmpty
(
model
.
getResourceInsertSql
()))
{
String
sql
=
buildInsertSql
(
model
,
dimension
,
variables
);
if
(!
ObjectUtils
.
isEmpty
(
sql
))
insertSql
.
append
(
sql
);
}
}
if
(
deleteSql
.
length
()
>
0
)
{
print
(
variables
.
get
(
dimension
).
toString
(),
"开始创建delete语句..."
,
"running"
);
writer
.
write
(
BR
+
DELIMITER
+
BR
);
writer
.
write
(
"/**"
+
BR
+
"* 删除历史资源数据 "
+
BR
+
"**/"
+
BR
);
writer
.
write
(
BR
+
DELIMITER
+
BR
);
writer
.
write
(
deleteSql
.
toString
());
writer
.
write
(
BR
+
BR
+
DELIMITER
+
BR
);
print
(
variables
.
get
(
dimension
).
toString
(),
"delete语句创建完成..."
,
"running"
);
}
if
(
insertSql
.
length
()
>
0
)
{
print
(
variables
.
get
(
dimension
).
toString
(),
"开始创建insert语句..."
,
"running"
);
writer
.
write
(
BR
+
DELIMITER
+
BR
);
writer
.
write
(
"/**"
+
BR
+
"* 资源数据"
+
BR
+
"**/"
+
BR
);
writer
.
write
(
BR
+
DELIMITER
+
BR
);
writer
.
write
(
insertSql
.
toString
());
writer
.
write
(
BR
+
BR
+
DELIMITER
+
BR
);
print
(
variables
.
get
(
dimension
).
toString
(),
"insert语句创建完成..."
,
"running"
);
}
writer
.
flush
();
writer
.
close
();
out
.
close
();
if
(
deleteSql
.
length
()
==
0
&&
insertSql
.
length
()
==
0
){
print
(
variables
.
get
(
dimension
).
toString
(),
"该项目下数据路径字段为空,不支持导出..."
,
"start"
);
return
;
}
download
(
response
,
fileName
,
sqlFilePath
);
print
(
variables
.
get
(
dimension
).
toString
(),
"执行结束"
,
"end"
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
private
boolean
validationParameters
(
StudioResourceModel
model
,
Map
<
String
,
Object
>
variables
)
{
String
text
=
model
.
getResourceParams
();
JSONArray
fields
=
JSONObject
.
parseArray
(
text
);
for
(
int
i
=
0
;
i
<
fields
.
size
();
i
++)
{
if
(!
variables
.
containsKey
(
fields
.
getJSONObject
(
i
).
getString
(
"name"
)))
{
return
false
;
}
}
return
true
;
}
private
String
buildInsertSql
(
StudioResourceModel
resource
,
String
dimension
,
Map
<
String
,
Object
>
variables
)
{
StringBuffer
sbsql
=
new
StringBuffer
();
String
json
=
format
(
resource
.
getResourceInsertSql
(),
variables
);
JSONObject
dimensionData
=
JSONObject
.
parseObject
(
json
);
JSONObject
selectAllSql
=
dimensionData
.
getJSONObject
(
dimension
);
if
(
ObjectUtils
.
isEmpty
(
selectAllSql
.
keySet
()))
{
return
""
;
}
for
(
String
tableName
:
selectAllSql
.
keySet
())
{
List
<
TableColumn
>
columns
=
null
;
List
<
Map
<
String
,
Object
>>
dataList
=
null
;
String
selectsql
=
format
(
selectAllSql
.
getString
(
tableName
),
variables
);
if
(
SourceEnum
.
IDX
.
getSource
().
equals
(
resource
.
getResourceCode
().
toLowerCase
()))
{
// String sql = sqlHelper.getNamespaceSql("com.yeejoin.amos.api.studio.face.orm.dao.StudioResourceMapper.queryForListByTableName", tableName);
// Query query = new Query();
// query.setSql(sql);
// List result = IndicatorsManager.indicatorClient.queryBySql(query).getResult();
// List<TableColumn> finalColumns = new ArrayList<>();
// result.stream().forEach(x -> {
// TableColumn column = JsonUtils.jsonToBean(JSON.toJSONString(x), TableColumn.class);
// finalColumns.add(column);
// });
// columns = finalColumns;
//
// query.setSql(selectsql);
// dataList = IndicatorsManager.indicatorClient.queryBySql(query).getResult();
}
else
{
columns
=
this
.
getBaseMapper
().
queryForListByTableName
(
tableName
);
dataList
=
jdbcTemplate
.
queryForList
(
selectsql
.
toString
());
}
for
(
Map
<
String
,
Object
>
map
:
dataList
)
{
sbsql
.
append
(
INSERT_INTO
);
sbsql
.
append
(
SPACE
).
append
(
tableName
).
append
(
SPACE
);
sbsql
.
append
(
LEFTBRACE
);
for
(
TableColumn
column
:
columns
)
{
sbsql
.
append
(
SPLIT
);
sbsql
.
append
(
column
.
getColumnName
());
sbsql
.
append
(
SPLIT
);
sbsql
.
append
(
COMMA
);
}
sbsql
.
deleteCharAt
(
sbsql
.
length
()
-
1
);
sbsql
.
append
(
RIGHTBRACE
);
sbsql
.
append
(
VALUES
);
sbsql
.
append
(
LEFTBRACE
);
for
(
TableColumn
column
:
columns
)
{
if
(
column
.
getColumnType
().
contains
(
"bigint"
)
||
column
.
getColumnType
().
contains
(
"int"
)
||
column
.
getColumnType
().
contains
(
"bit(1)"
))
{
if
(!
ObjectUtils
.
isEmpty
(
map
.
get
(
column
.
getColumnName
())))
{
sbsql
.
append
(
map
.
get
(
column
.
getColumnName
()));
}
else
{
sbsql
.
append
(
"0"
);
}
}
else
{
if
(!
ObjectUtils
.
isEmpty
(
map
.
get
(
column
.
getColumnName
())))
{
sbsql
.
append
(
"'"
).
append
(
map
.
get
(
column
.
getColumnName
())).
append
(
"'"
);
}
else
{
sbsql
.
append
(
"null"
);
}
}
sbsql
.
append
(
COMMA
);
}
sbsql
.
deleteCharAt
(
sbsql
.
length
()
-
1
);
sbsql
.
append
(
RIGHTBRACE
);
sbsql
.
append
(
BRANCH
).
append
(
BR
);
}
}
return
sbsql
.
toString
();
}
public
static
String
format
(
String
sqlTemplate
,
Map
<
String
,
Object
>
parameter
)
{
StringSubstitutor
ss
=
new
StringSubstitutor
(
parameter
);
String
newTemplateStr
=
ss
.
replace
(
sqlTemplate
);
return
newTemplateStr
;
}
public
void
download
(
HttpServletResponse
response
,
String
fileName
,
String
sqlFilePath
)
throws
IOException
{
File
f
=
new
File
(
sqlFilePath
);
BufferedInputStream
br
=
new
BufferedInputStream
(
new
FileInputStream
(
f
));
byte
[]
buf
=
new
byte
[
1024
];
int
len
=
0
;
response
.
reset
();
// 非常重要
response
.
setContentType
(
"application/x-msdownload"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment; filename="
+
fileName
);
OutputStream
out
=
response
.
getOutputStream
();
while
((
len
=
br
.
read
(
buf
))
>
0
)
out
.
write
(
buf
,
0
,
len
);
br
.
close
();
out
.
close
();
}
private
void
print
(
String
id
,
String
msg
,
String
step
)
{
String
percent
=
"0"
;
percent
=
ValidationUtil
.
equals
(
step
,
"end"
)
?
"100"
:
ValidationUtil
.
equals
(
step
,
"running"
)
?
"50"
:
"10"
;
JSONObject
event
=
new
JSONObject
();
event
.
put
(
"percent"
,
percent
);
event
.
put
(
"status"
,
"running"
);
event
.
put
(
"logInfo"
,
msg
);
event
.
put
(
"time"
,
DateUtils
.
toDateStr
(
DateUtils
.
format
()));
try
{
emqKeeper
.
getMqttClient
().
publish
(
"/topicTable/solidify/"
+
(
id
.
indexOf
(
','
)
!=
-
1
?
id
.
split
(
","
)[
0
]
:
id
),
event
.
toString
().
getBytes
(),
0
,
false
);
}
catch
(
MqttException
e
)
{
e
.
printStackTrace
();
}
}
}
src/main/java/com/yeejoin/amos/api/tool/face/service/TemplateService.java
View file @
d28b7aa6
...
@@ -7,7 +7,7 @@ import com.yeejoin.amos.api.tool.face.model.TemplateModel;
...
@@ -7,7 +7,7 @@ import com.yeejoin.amos.api.tool.face.model.TemplateModel;
import
com.yeejoin.amos.api.tool.face.model.TemplateVoModel
;
import
com.yeejoin.amos.api.tool.face.model.TemplateVoModel
;
import
com.yeejoin.amos.api.tool.face.orm.dao.TemplateMapper
;
import
com.yeejoin.amos.api.tool.face.orm.dao.TemplateMapper
;
import
com.yeejoin.amos.api.tool.face.orm.entity.Template
;
import
com.yeejoin.amos.api.tool.face.orm.entity.Template
;
import
com.yeejoin.amos.api.tool.
face.util
.PictureUtil
;
import
com.yeejoin.amos.api.tool.
utils
.PictureUtil
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
...
src/main/java/com/yeejoin/amos/api/tool/
face/util
/AESUtils.java
→
src/main/java/com/yeejoin/amos/api/tool/
utils
/AESUtils.java
View file @
d28b7aa6
package
com
.
yeejoin
.
amos
.
api
.
tool
.
face
.
util
;
package
com
.
yeejoin
.
amos
.
api
.
tool
.
utils
;
import
javax.crypto.Cipher
;
import
javax.crypto.Cipher
;
import
javax.crypto.spec.SecretKeySpec
;
import
javax.crypto.spec.SecretKeySpec
;
...
...
src/main/java/com/yeejoin/amos/api/tool/utils/DateUtils.java
0 → 100644
View file @
d28b7aa6
package
com
.
yeejoin
.
amos
.
api
.
tool
.
utils
;
import
java.text.DateFormat
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
public
class
DateUtils
{
public
static
String
LONG_PATTERN
=
"yyyy-MM-dd HH:mm:ss"
;
public
static
String
MID_PATTERN
=
"yyyy-MM-dd HH:mm"
;
public
static
String
SHORT_PATTERN
=
"yyyy-MM-dd"
;
public
static
String
MONTH_PATTERN
=
"yyyy-MM"
;
private
static
final
SimpleDateFormat
monthSdf
=
new
SimpleDateFormat
(
"yyyy-MM"
);
private
static
final
SimpleDateFormat
shortSdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
private
static
final
SimpleDateFormat
longSdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
public
static
Date
parseDate
(
String
date
)
{
try
{
return
new
SimpleDateFormat
(
"yyyy-MM-dd hh:mm:ss"
).
parse
(
date
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
public
static
String
toDateStr
(
Date
date
)
{
return
new
SimpleDateFormat
(
"yyyy-MM-dd hh:mm:ss"
).
format
(
date
);
}
public
static
Date
addDate
(
Date
date
,
int
field
,
int
amount
)
{
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
date
);
c
.
add
(
field
,
amount
);
return
c
.
getTime
();
}
public
static
boolean
isValidDate
(
String
str
,
String
format
)
{
DateFormat
formatter
=
new
SimpleDateFormat
(
format
);
try
{
Date
date
=
(
Date
)
formatter
.
parse
(
str
);
return
str
.
equals
(
formatter
.
format
(
date
));
}
catch
(
Exception
e
)
{
return
false
;
}
}
/**
* 获取某年某月的第一天日期
*
* @param date
* @param format
* @return
*/
public
static
String
getStartMonthDate
(
String
date
,
String
format
)
{
if
(
date
==
null
||
date
.
length
()
<
6
||
format
==
null
)
{
return
null
;
}
int
year
=
Integer
.
parseInt
(
date
.
substring
(
0
,
4
));
int
month
=
date
.
contains
(
"-"
)
?
month
=
Integer
.
parseInt
(
date
.
substring
(
5
,
7
))
:
Integer
.
parseInt
(
date
.
substring
(
4
,
6
));
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
set
(
year
,
month
-
1
,
1
);
return
shortSdf
.
format
(
cal
.
getTime
())
+
" 00:00:00"
;
}
/**
* 获取某年某月的最后一天日期
*
* @param date
* @param format
* @return
*/
public
static
String
getEndMonthDate
(
String
date
,
String
format
)
{
if
(
date
==
null
||
date
.
length
()
<
6
||
format
==
null
)
{
return
null
;
}
int
year
=
Integer
.
parseInt
(
date
.
substring
(
0
,
4
));
int
month
=
date
.
contains
(
"-"
)
?
month
=
Integer
.
parseInt
(
date
.
substring
(
5
,
7
))
:
Integer
.
parseInt
(
date
.
substring
(
4
,
6
));
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
set
(
year
,
month
-
1
,
1
);
int
day
=
cal
.
getActualMaximum
(
5
);
cal
.
set
(
year
,
month
-
1
,
day
);
return
shortSdf
.
format
(
cal
.
getTime
())
+
" 23:59:59"
;
}
/**
* 获取某天的开始时间
*
* @param date
* @param format
* @return
*/
public
static
String
getStartDayDate
(
String
date
,
String
format
)
{
try
{
return
getCurrentDayStartTime
(
new
SimpleDateFormat
(
SHORT_PATTERN
).
parse
(
date
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
/**
* 获取某天的结束时间
*
* @param date
* @param format
* @return
*/
public
static
String
getEndDayDate
(
String
date
,
String
format
)
{
try
{
return
getCurrentDayEndTime
(
new
SimpleDateFormat
(
SHORT_PATTERN
).
parse
(
date
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
/**
* 获得本天的开始时间,即2012-01-01 00:00:00
*
* @return
*/
public
static
String
getCurrentDayStartTime
(
Date
date
)
throws
Exception
{
date
=
shortSdf
.
parse
(
shortSdf
.
format
(
date
)
+
" 00:00:00"
);
return
longSdf
.
format
(
date
);
}
/**
* 获得本天的结束时间,即2012-01-01 23:59:59
*
* @return
*/
public
static
String
getCurrentDayEndTime
(
Date
date
)
throws
Exception
{
date
=
longSdf
.
parse
(
shortSdf
.
format
(
date
)
+
" 23:59:59"
);
return
longSdf
.
format
(
date
);
}
/**
* 获得本周的第一天,周一
*
* @return
*/
public
static
String
getCurrentWeekDayStartTime
(
Date
date
)
throws
Exception
{
Calendar
c
=
Calendar
.
getInstance
();
Date
dt
=
null
;
c
.
setTime
(
date
);
int
weekday
=
c
.
get
(
Calendar
.
DAY_OF_WEEK
)
-
2
;
c
.
add
(
Calendar
.
DATE
,
-
weekday
);
dt
=
longSdf
.
parse
(
shortSdf
.
format
(
c
.
getTime
())
+
" 00:00:00"
);
return
longSdf
.
format
(
dt
);
}
/**
* 获得本周的最后一天,周日
*
* @return
*/
public
static
String
getCurrentWeekDayEndTime
(
Date
date
)
throws
Exception
{
Calendar
c
=
Calendar
.
getInstance
();
Date
dt
=
null
;
c
.
setTime
(
date
);
int
weekday
=
c
.
get
(
Calendar
.
DAY_OF_WEEK
);
c
.
add
(
Calendar
.
DATE
,
8
-
weekday
);
dt
=
longSdf
.
parse
(
shortSdf
.
format
(
c
.
getTime
())
+
" 23:59:59"
);
return
longSdf
.
format
(
dt
);
}
/**
* 获得本月的开始时间,即2012-01-01 00:00:00
*
* @return
*/
public
static
String
getCurrentMonthStartTime
(
Date
date
)
throws
Exception
{
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
date
);
Date
dt
=
null
;
c
.
set
(
Calendar
.
DATE
,
1
);
dt
=
shortSdf
.
parse
(
shortSdf
.
format
(
c
.
getTime
())
+
" 00:00:00"
);
return
longSdf
.
format
(
dt
);
}
/**
* 当前月的结束时间,即2012-01-31 23:59:59
*
* @return
*/
public
static
String
getCurrentMonthEndTime
(
Date
date
)
{
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
date
);
Date
now
=
null
;
c
.
set
(
Calendar
.
DATE
,
1
);
c
.
add
(
Calendar
.
MONTH
,
1
);
c
.
add
(
Calendar
.
DATE
,
-
1
);
try
{
now
=
longSdf
.
parse
(
shortSdf
.
format
(
c
.
getTime
())
+
" 23:59:59"
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
return
longSdf
.
format
(
now
);
}
/**
* 当前季度的开始时间,即2012-01-1 00:00:00
*
* @return
*/
public
static
String
getCurrentQuarterStartTime
(
Date
date
)
throws
Exception
{
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
date
);
int
currentMonth
=
c
.
get
(
Calendar
.
MONTH
)
+
1
;
Date
dt
=
null
;
if
(
currentMonth
>=
1
&&
currentMonth
<=
3
)
c
.
set
(
Calendar
.
MONTH
,
0
);
else
if
(
currentMonth
>=
4
&&
currentMonth
<=
6
)
c
.
set
(
Calendar
.
MONTH
,
3
);
else
if
(
currentMonth
>=
7
&&
currentMonth
<=
9
)
c
.
set
(
Calendar
.
MONTH
,
4
);
else
if
(
currentMonth
>=
10
&&
currentMonth
<=
12
)
c
.
set
(
Calendar
.
MONTH
,
9
);
c
.
set
(
Calendar
.
DATE
,
1
);
dt
=
longSdf
.
parse
(
shortSdf
.
format
(
c
.
getTime
())
+
" 00:00:00"
);
return
longSdf
.
format
(
dt
);
}
/**
* 当前季度的结束时间,即2012-03-31 23:59:59
*
* @return
*/
public
static
String
getCurrentQuarterEndTime
(
Date
date
)
throws
Exception
{
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
date
);
int
currentMonth
=
c
.
get
(
Calendar
.
MONTH
)
+
1
;
Date
dt
=
null
;
if
(
currentMonth
>=
1
&&
currentMonth
<=
3
)
{
c
.
set
(
Calendar
.
MONTH
,
2
);
c
.
set
(
Calendar
.
DATE
,
31
);
}
else
if
(
currentMonth
>=
4
&&
currentMonth
<=
6
)
{
c
.
set
(
Calendar
.
MONTH
,
5
);
c
.
set
(
Calendar
.
DATE
,
30
);
}
else
if
(
currentMonth
>=
7
&&
currentMonth
<=
9
)
{
c
.
set
(
Calendar
.
MONTH
,
8
);
c
.
set
(
Calendar
.
DATE
,
30
);
}
else
if
(
currentMonth
>=
10
&&
currentMonth
<=
12
)
{
c
.
set
(
Calendar
.
MONTH
,
11
);
c
.
set
(
Calendar
.
DATE
,
31
);
}
dt
=
longSdf
.
parse
(
shortSdf
.
format
(
c
.
getTime
())
+
" 23:59:59"
);
return
longSdf
.
format
(
dt
);
}
/**
* 当前年的开始时间,即2012-01-01 00:00:00
*
* @return
*/
public
static
String
getCurrentYearStartTime
(
Date
date
)
throws
Exception
{
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
date
);
Date
dt
=
null
;
c
.
set
(
Calendar
.
MONTH
,
0
);
c
.
set
(
Calendar
.
DATE
,
1
);
dt
=
shortSdf
.
parse
(
shortSdf
.
format
(
c
.
getTime
())
+
" 00:00:00"
);
return
longSdf
.
format
(
dt
);
}
/**
* 当前年的结束时间,即2012-12-31 23:59:59
*
* @return
*/
public
static
String
getCurrentYearEndTime
(
Date
date
)
throws
Exception
{
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
date
);
Date
dt
=
null
;
c
.
set
(
Calendar
.
MONTH
,
11
);
c
.
set
(
Calendar
.
DATE
,
31
);
dt
=
longSdf
.
parse
(
shortSdf
.
format
(
c
.
getTime
())
+
" 23:59:59"
);
return
longSdf
.
format
(
dt
);
}
/**
* 获取当前时间
*
* @return
*/
public
static
Date
format
()
{
Date
date
=
new
Date
();
return
date
;
}
/**
* 获取前一天日期
*
* @return
*/
public
static
Date
getYesterday
()
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
format
());
cal
.
add
(
Calendar
.
DATE
,
-
1
);
return
cal
.
getTime
();
}
/**
* 获取过去七天
*
* @return
*/
public
static
Date
getBeforeWeek
(
Date
date
)
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
format
());
cal
.
add
(
Calendar
.
DATE
,
-
7
);
Date
beforeWeek
=
cal
.
getTime
();
return
beforeWeek
;
}
/**
* 获取过去一月
*
* @return
*/
public
static
Date
getBeforeMonth
(
Date
date
)
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
format
());
cal
.
add
(
Calendar
.
MONTH
,
-
1
);
Date
beforeWeek
=
cal
.
getTime
();
return
beforeWeek
;
}
/**
* 获取过去三个月
*
* @return
*/
public
static
Date
getBeforeQuarter
(
Date
date
)
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
format
());
cal
.
add
(
Calendar
.
MONTH
,
-
3
);
Date
beforeQuarter
=
cal
.
getTime
();
return
beforeQuarter
;
}
/**
* 获取去年今日
*
* @return
*/
public
static
Date
getBeforeYear
(
Date
date
)
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
date
);
cal
.
add
(
Calendar
.
YEAR
,
-
1
);
Date
y
=
cal
.
getTime
();
String
year
=
shortSdf
.
format
(
y
);
return
y
;
}
}
src/main/java/com/yeejoin/amos/api/tool/
face/util
/PictureUtil.java
→
src/main/java/com/yeejoin/amos/api/tool/
utils
/PictureUtil.java
View file @
d28b7aa6
package
com
.
yeejoin
.
amos
.
api
.
tool
.
face
.
util
;
package
com
.
yeejoin
.
amos
.
api
.
tool
.
utils
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
java.util.List
;
import
java.util.List
;
...
...
src/main/java/com/yeejoin/amos/api/tool/utils/SqlHelper.java
0 → 100644
View file @
d28b7aa6
package
com
.
yeejoin
.
amos
.
api
.
tool
.
utils
;
import
org.apache.ibatis.mapping.BoundSql
;
import
org.apache.ibatis.mapping.MappedStatement
;
import
org.apache.ibatis.mapping.ParameterMapping
;
import
org.apache.ibatis.mapping.ParameterMode
;
import
org.apache.ibatis.reflection.MetaObject
;
import
org.apache.ibatis.reflection.factory.DefaultObjectFactory
;
import
org.apache.ibatis.reflection.factory.ObjectFactory
;
import
org.apache.ibatis.reflection.wrapper.DefaultObjectWrapperFactory
;
import
org.apache.ibatis.reflection.wrapper.ObjectWrapperFactory
;
import
org.apache.ibatis.session.Configuration
;
import
org.apache.ibatis.session.SqlSessionFactory
;
import
org.apache.ibatis.type.JdbcType
;
import
org.apache.ibatis.type.TypeHandlerRegistry
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @Author: xl
* @Description:
* @Date: 2023/1/9 19:10
*/
@Component
public
class
SqlHelper
{
@Autowired
private
SqlSessionFactory
sqlSessionFactory
;
private
final
ObjectFactory
DEFAULT_OBJECT_FACTORY
=
new
DefaultObjectFactory
();
private
final
ObjectWrapperFactory
DEFAULT_OBJECT_WRAPPER_FACTORY
=
new
DefaultObjectWrapperFactory
();
/**
* 通过命名空间方式获取sql
*
* @param namespace
* @param params
* @return
*/
public
String
getNamespaceSql
(
String
namespace
,
Object
params
)
{
params
=
wrapCollection
(
params
);
Configuration
configuration
=
sqlSessionFactory
.
openSession
().
getConfiguration
();
MappedStatement
mappedStatement
=
configuration
.
getMappedStatement
(
namespace
);
TypeHandlerRegistry
typeHandlerRegistry
=
mappedStatement
.
getConfiguration
().
getTypeHandlerRegistry
();
BoundSql
boundSql
=
mappedStatement
.
getBoundSql
(
params
);
List
<
ParameterMapping
>
parameterMappings
=
boundSql
.
getParameterMappings
();
String
sql
=
boundSql
.
getSql
();
if
(
parameterMappings
!=
null
)
{
for
(
int
i
=
0
;
i
<
parameterMappings
.
size
();
i
++)
{
ParameterMapping
parameterMapping
=
parameterMappings
.
get
(
i
);
if
(
parameterMapping
.
getMode
()
!=
ParameterMode
.
OUT
)
{
Object
value
;
String
propertyName
=
parameterMapping
.
getProperty
();
if
(
boundSql
.
hasAdditionalParameter
(
propertyName
))
{
value
=
boundSql
.
getAdditionalParameter
(
propertyName
);
}
else
if
(
params
==
null
)
{
value
=
null
;
}
else
if
(
typeHandlerRegistry
.
hasTypeHandler
(
params
.
getClass
()))
{
value
=
params
;
}
else
{
MetaObject
metaObject
=
configuration
.
newMetaObject
(
params
);
value
=
metaObject
.
getValue
(
propertyName
);
}
JdbcType
jdbcType
=
parameterMapping
.
getJdbcType
();
if
(
value
==
null
&&
jdbcType
==
null
)
jdbcType
=
configuration
.
getJdbcTypeForNull
();
sql
=
replaceParameter
(
sql
,
value
,
jdbcType
,
parameterMapping
.
getJavaType
());
}
}
}
return
sql
;
}
/**
* 根据类型替换参数
* 仅作为数字和字符串两种类型进行处理,需要特殊处理的可以继续完善这里
*
* @param sql
* @param value
* @param jdbcType
* @param javaType
* @return
*/
private
String
replaceParameter
(
String
sql
,
Object
value
,
JdbcType
jdbcType
,
Class
javaType
)
{
String
strValue
=
String
.
valueOf
(
value
);
if
(
jdbcType
!=
null
)
{
switch
(
jdbcType
)
{
// 数字
case
BIT:
case
TINYINT:
case
SMALLINT:
case
INTEGER:
case
BIGINT:
case
FLOAT:
case
REAL:
case
DOUBLE:
case
NUMERIC:
case
DECIMAL:
break
;
// 日期
case
DATE:
case
TIME:
case
TIMESTAMP:
// 其他,包含字符串和其他特殊类型
default
:
strValue
=
"'"
+
strValue
+
"'"
;
}
}
else
if
(
Number
.
class
.
isAssignableFrom
(
javaType
))
{
// 不加单引号
}
else
{
strValue
=
"'"
+
strValue
+
"'"
;
}
return
sql
.
replaceFirst
(
"\\?"
,
strValue
);
}
/**
* 简单包装参数
*
* @param object
* @return
*/
private
Object
wrapCollection
(
final
Object
object
)
{
if
(
object
instanceof
List
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"list"
,
object
);
return
map
;
}
else
if
(
object
!=
null
&&
object
.
getClass
().
isArray
())
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"array"
,
object
);
return
map
;
}
return
object
;
}
public
void
setSqlSessionFactory
(
SqlSessionFactory
sqlSessionFactory
)
{
this
.
sqlSessionFactory
=
sqlSessionFactory
;
}
}
src/main/resources/application.properties
View file @
d28b7aa6
spring.application.name
=
DemoProject
spring.application.name
=
DemoProject
server.servlet.context-path
=
/atl
server.servlet.context-path
=
/atl
<<<<<<<
HEAD
server.port
=
20000
server.port
=
20000
=======
server.port
=
30201
>>>>>>>
b82e4f86d8f4e802ea22c8ecfbaa100e38c6a192
spring.profiles.active
=
dev
spring.profiles.active
=
dev
management.health.elasticsearch.enabled
=
false
management.health.elasticsearch.enabled
=
false
...
...
src/main/resources/mapper/AmosDemoMapper.xml
deleted
100644 → 0
View file @
fd022168
<?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.yeejoin.amos.api.tool.face.orm.dao.AmosDemoMapper"
>
</mapper>
src/main/resources/mapper/ApiInfoMapper.xml
deleted
100644 → 0
View file @
fd022168
<?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.yeejoin.amos.api.tool.face.orm.dao.ApiInfoMapper"
>
</mapper>
\ No newline at end of file
src/main/resources/mapper/ApiSourceMapper.xml
deleted
100644 → 0
View file @
fd022168
<?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.yeejoin.amos.api.tool.face.orm.dao.ApiSourceMapper"
>
</mapper>
src/main/resources/mapper/RelationMapper.xml
deleted
100644 → 0
View file @
fd022168
<?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.yeejoin.amos.api.tool.face.orm.dao.RelationMapper"
>
</mapper>
src/main/resources/mapper/StudioResourceMapper.xml
0 → 100644
View file @
d28b7aa6
<?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.yeejoin.amos.api.tool.face.orm.dao.StudioResourceMapper"
>
<select
id=
"queryForListByTableName"
resultType=
"com.yeejoin.amos.api.tool.face.orm.entity.TableColumn"
>
SELECT
column_name as columnName,
( CASE WHEN ( is_nullable = 'no'
<![CDATA[ && ]]>
column_key != 'PRI' ) THEN '1' ELSE NULL END ) AS isRequired,
( CASE WHEN column_key = 'PRI' THEN '1' ELSE '0' END ) AS isPk,
ordinal_position AS sort,
column_comment as columnComment,
( CASE WHEN extra = 'auto_increment' THEN '1' ELSE '0' END ) AS isIncrement,
column_type as columnType
FROM
information_schema.COLUMNS
WHERE
table_schema = database()
AND table_name = #{tableName}
ORDER BY
ordinal_position
</select>
</mapper>
src/main/resources/mapper/VisualDesignerMapper.xml
deleted
100644 → 0
View file @
fd022168
<?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.yeejoin.amos.api.tool.face.orm.dao.VisualDesignerMapper"
>
</mapper>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment