Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
41b562f3
"eladmin-system/src/vscode:/vscode.git/clone" did not exist on "0f7cefaf4b6c2b516d2bf6e8e3783c1677cf18f6"
Commit
41b562f3
authored
Nov 17, 2019
by
dqjdda
Browse files
代码生成器优化
parent
5ab7fb5b
Changes
13
Show whitespace changes
Inline
Side-by-side
eladmin-generator/src/main/java/me/zhengjie/domain/ColumnInfo.java
0 → 100644
View file @
41b562f3
package
me.zhengjie.domain
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.persistence.*
;
/**
* 列的数据信息
* @author Zheng Jie
* @date 2019-01-02
*/
@Data
@Entity
@NoArgsConstructor
@Table
(
name
=
"column_config"
)
public
class
ColumnInfo
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"id"
)
private
Long
id
;
private
String
tableName
;
// 数据库字段名称
private
String
columnName
;
// 数据库字段类型
private
String
columnType
;
// 数据库字段键类型
private
String
keyType
;
// 字段额外的参数
private
String
extra
;
// 数据库字段描述
private
String
remark
;
// 必填
private
Boolean
notNull
;
// 是否在列表显示
private
Boolean
listShow
;
// 是否表单显示
private
Boolean
formShow
;
// 表单类型
private
String
formType
;
// 查询 1:模糊 2:精确
private
String
queryType
;
// 字典名称
private
String
dictName
;
// 关联表名
private
String
joinName
;
public
ColumnInfo
(
String
tableName
,
String
columnName
,
Boolean
notNull
,
String
columnType
,
String
remark
,
String
keyType
,
String
extra
)
{
this
.
tableName
=
tableName
;
this
.
columnName
=
columnName
;
this
.
columnType
=
columnType
;
this
.
keyType
=
keyType
;
this
.
extra
=
extra
;
this
.
remark
=
remark
;
this
.
notNull
=
notNull
;
this
.
listShow
=
true
;
this
.
formShow
=
true
;
}
}
eladmin-generator/src/main/java/me/zhengjie/domain/GenConfig.java
View file @
41b562f3
package
me.zhengjie.domain
;
package
me.zhengjie.domain
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.persistence.*
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotBlank
;
/**
/**
* 代码生成配置
* 代码生成配置
...
@@ -10,20 +12,35 @@ import javax.persistence.*;
...
@@ -10,20 +12,35 @@ import javax.persistence.*;
*/
*/
@Data
@Data
@Entity
@Entity
@NoArgsConstructor
@Table
(
name
=
"gen_config"
)
@Table
(
name
=
"gen_config"
)
public
class
GenConfig
{
public
class
GenConfig
{
public
GenConfig
(
String
tableName
)
{
this
.
cover
=
false
;
this
.
moduleName
=
"eladmin-system"
;
this
.
tableName
=
tableName
;
}
@Id
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"id"
)
private
Long
id
;
private
Long
id
;
@NotBlank
private
String
tableName
;
// 包路径
// 包路径
@NotBlank
private
String
pack
;
private
String
pack
;
// 模块名
// 模块名
@Column
(
name
=
"module_name"
)
@Column
(
name
=
"module_name"
)
@NotBlank
private
String
moduleName
;
private
String
moduleName
;
// 前端文件路径
// 前端文件路径
@NotBlank
private
String
path
;
private
String
path
;
// 前端文件路径
// 前端文件路径
...
...
eladmin-generator/src/main/java/me/zhengjie/domain/vo/ColumnInfo.java
deleted
100644 → 0
View file @
5ab7fb5b
package
me.zhengjie.domain.vo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* 列的数据信息
* @author Zheng Jie
* @date 2019-01-02
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
ColumnInfo
{
// 数据库字段名称
private
Object
columnName
;
// 允许空值
private
Object
isNullable
;
// 数据库字段类型
private
Object
columnType
;
// 数据库字段注释
private
Object
columnComment
;
// 数据库字段键类型
private
Object
columnKey
;
// 额外的参数
private
Object
extra
;
// 查询 1:模糊 2:精确
private
String
columnQuery
;
// 是否在列表显示
private
String
columnShow
;
}
eladmin-generator/src/main/java/me/zhengjie/repository/ColumnInfoRepository.java
0 → 100644
View file @
41b562f3
package
me.zhengjie.repository
;
import
me.zhengjie.domain.ColumnInfo
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
java.util.List
;
/**
* @author Zheng Jie
* @date 2019-01-14
*/
public
interface
ColumnInfoRepository
extends
JpaRepository
<
ColumnInfo
,
Long
>
{
List
<
ColumnInfo
>
findByTableNameOrderByIdAsc
(
String
tableName
);
}
eladmin-generator/src/main/java/me/zhengjie/repository/GenConfigRepository.java
View file @
41b562f3
...
@@ -8,4 +8,6 @@ import org.springframework.data.jpa.repository.JpaRepository;
...
@@ -8,4 +8,6 @@ import org.springframework.data.jpa.repository.JpaRepository;
* @date 2019-01-14
* @date 2019-01-14
*/
*/
public
interface
GenConfigRepository
extends
JpaRepository
<
GenConfig
,
Long
>
{
public
interface
GenConfigRepository
extends
JpaRepository
<
GenConfig
,
Long
>
{
GenConfig
findByTableName
(
String
tableName
);
}
}
eladmin-generator/src/main/java/me/zhengjie/rest/GenConfigController.java
View file @
41b562f3
...
@@ -25,14 +25,14 @@ public class GenConfigController {
...
@@ -25,14 +25,14 @@ public class GenConfigController {
}
}
@ApiOperation
(
"查询"
)
@ApiOperation
(
"查询"
)
@GetMapping
@GetMapping
(
value
=
"/{tableName}"
)
public
ResponseEntity
get
(){
public
ResponseEntity
get
(
@PathVariable
String
tableName
){
return
new
ResponseEntity
<>(
genConfigService
.
find
(),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
genConfigService
.
find
(
tableName
),
HttpStatus
.
OK
);
}
}
@ApiOperation
(
"修改"
)
@ApiOperation
(
"修改"
)
@PutMapping
@PutMapping
public
ResponseEntity
emailConfig
(
@Validated
@RequestBody
GenConfig
genConfig
){
public
ResponseEntity
emailConfig
(
@Validated
@RequestBody
GenConfig
genConfig
){
return
new
ResponseEntity
<>(
genConfigService
.
update
(
genConfig
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
genConfigService
.
update
(
genConfig
.
getTableName
(),
genConfig
),
HttpStatus
.
OK
);
}
}
}
}
eladmin-generator/src/main/java/me/zhengjie/rest/GeneratorController.java
View file @
41b562f3
package
me.zhengjie.rest
;
package
me.zhengjie.rest
;
import
cn.hutool.core.util.PageUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
me.zhengjie.domain.
vo.
ColumnInfo
;
import
me.zhengjie.domain.ColumnInfo
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.service.GenConfigService
;
import
me.zhengjie.service.GenConfigService
;
import
me.zhengjie.service.GeneratorService
;
import
me.zhengjie.service.GeneratorService
;
import
me.zhengjie.utils.PageUtil
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
...
@@ -34,7 +34,7 @@ public class GeneratorController {
...
@@ -34,7 +34,7 @@ public class GeneratorController {
this
.
genConfigService
=
genConfigService
;
this
.
genConfigService
=
genConfigService
;
}
}
@ApiOperation
(
"查询数据库
元
数据"
)
@ApiOperation
(
"查询数据库数据"
)
@GetMapping
(
value
=
"/tables"
)
@GetMapping
(
value
=
"/tables"
)
public
ResponseEntity
getTables
(
@RequestParam
(
defaultValue
=
""
)
String
name
,
public
ResponseEntity
getTables
(
@RequestParam
(
defaultValue
=
""
)
String
name
,
@RequestParam
(
defaultValue
=
"0"
)
Integer
page
,
@RequestParam
(
defaultValue
=
"0"
)
Integer
page
,
...
@@ -43,10 +43,21 @@ public class GeneratorController {
...
@@ -43,10 +43,21 @@ public class GeneratorController {
return
new
ResponseEntity
<>(
generatorService
.
getTables
(
name
,
startEnd
),
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
generatorService
.
getTables
(
name
,
startEnd
),
HttpStatus
.
OK
);
}
}
@ApiOperation
(
"查询
表内元
数据"
)
@ApiOperation
(
"查询
字段
数据"
)
@GetMapping
(
value
=
"/columns"
)
@GetMapping
(
value
=
"/columns"
)
public
ResponseEntity
getTables
(
@RequestParam
String
tableName
){
public
ResponseEntity
getTables
(
@RequestParam
String
tableName
){
return
new
ResponseEntity
<>(
generatorService
.
getColumns
(
tableName
),
HttpStatus
.
OK
);
List
<
ColumnInfo
>
columnInfos
=
generatorService
.
getColumns
(
tableName
);
// 异步同步表信息
generatorService
.
sync
(
columnInfos
);
return
new
ResponseEntity
<>(
PageUtil
.
toPage
(
columnInfos
,
columnInfos
.
size
()),
HttpStatus
.
OK
);
}
@ApiOperation
(
"保存字段数据"
)
@PutMapping
public
ResponseEntity
save
(
@RequestBody
List
<
ColumnInfo
>
columnInfos
){
// 异步同步表信息
generatorService
.
save
(
columnInfos
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
}
}
@ApiOperation
(
"生成代码"
)
@ApiOperation
(
"生成代码"
)
...
@@ -55,7 +66,7 @@ public class GeneratorController {
...
@@ -55,7 +66,7 @@ public class GeneratorController {
if
(!
generatorEnabled
){
if
(!
generatorEnabled
){
throw
new
BadRequestException
(
"此环境不允许生成代码!"
);
throw
new
BadRequestException
(
"此环境不允许生成代码!"
);
}
}
generatorService
.
generator
(
columnInfos
,
genConfigService
.
find
(),
tableName
);
generatorService
.
generator
(
columnInfos
,
genConfigService
.
find
(
tableName
),
tableName
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
}
}
}
}
eladmin-generator/src/main/java/me/zhengjie/service/GenConfigService.java
View file @
41b562f3
...
@@ -8,7 +8,7 @@ import me.zhengjie.domain.GenConfig;
...
@@ -8,7 +8,7 @@ import me.zhengjie.domain.GenConfig;
*/
*/
public
interface
GenConfigService
{
public
interface
GenConfigService
{
GenConfig
find
();
GenConfig
find
(
String
tableName
);
GenConfig
update
(
GenConfig
genConfig
);
GenConfig
update
(
String
tableName
,
GenConfig
genConfig
);
}
}
eladmin-generator/src/main/java/me/zhengjie/service/GeneratorService.java
View file @
41b562f3
package
me.zhengjie.service
;
package
me.zhengjie.service
;
import
me.zhengjie.domain.GenConfig
;
import
me.zhengjie.domain.GenConfig
;
import
me.zhengjie.domain.vo.ColumnInfo
;
import
me.zhengjie.domain.ColumnInfo
;
import
org.springframework.scheduling.annotation.Async
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -23,7 +25,7 @@ public interface GeneratorService {
...
@@ -23,7 +25,7 @@ public interface GeneratorService {
* @param name 表名
* @param name 表名
* @return /
* @return /
*/
*/
Object
getColumns
(
String
name
);
List
<
ColumnInfo
>
getColumns
(
String
name
);
/**
/**
* 生成代码
* 生成代码
...
@@ -32,4 +34,17 @@ public interface GeneratorService {
...
@@ -32,4 +34,17 @@ public interface GeneratorService {
* @param tableName 表名
* @param tableName 表名
*/
*/
void
generator
(
List
<
ColumnInfo
>
columnInfos
,
GenConfig
genConfig
,
String
tableName
);
void
generator
(
List
<
ColumnInfo
>
columnInfos
,
GenConfig
genConfig
,
String
tableName
);
/**
* 同步表数据
* @param columnInfos /
*/
@Async
void
sync
(
List
<
ColumnInfo
>
columnInfos
);
/**
* 保持数据
* @param columnInfos /
*/
void
save
(
List
<
ColumnInfo
>
columnInfos
);
}
}
eladmin-generator/src/main/java/me/zhengjie/service/impl/GenConfigServiceImpl.java
View file @
41b562f3
...
@@ -4,11 +4,10 @@ import me.zhengjie.domain.GenConfig;
...
@@ -4,11 +4,10 @@ import me.zhengjie.domain.GenConfig;
import
me.zhengjie.repository.GenConfigRepository
;
import
me.zhengjie.repository.GenConfigRepository
;
import
me.zhengjie.service.GenConfigService
;
import
me.zhengjie.service.GenConfigService
;
import
org.springframework.cache.annotation.CacheConfig
;
import
org.springframework.cache.annotation.CacheConfig
;
import
org.springframework.cache.annotation.Cache
Evic
t
;
import
org.springframework.cache.annotation.Cache
Pu
t
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.io.File
;
import
java.io.File
;
import
java.util.Optional
;
/**
/**
* @author Zheng Jie
* @author Zheng Jie
...
@@ -25,16 +24,18 @@ public class GenConfigServiceImpl implements GenConfigService {
...
@@ -25,16 +24,18 @@ public class GenConfigServiceImpl implements GenConfigService {
}
}
@Override
@Override
@Cacheable
(
key
=
"'1'"
)
@Cacheable
(
key
=
"#p0"
)
public
GenConfig
find
()
{
public
GenConfig
find
(
String
tableName
)
{
Optional
<
GenConfig
>
genConfig
=
genConfigRepository
.
findById
(
1L
);
GenConfig
genConfig
=
genConfigRepository
.
findByTableName
(
tableName
);
return
genConfig
.
orElseGet
(
GenConfig:
:
new
);
if
(
genConfig
==
null
){
return
new
GenConfig
(
tableName
);
}
return
genConfig
;
}
}
@Override
@Override
@CacheEvict
(
allEntries
=
true
)
@CachePut
(
key
=
"#p0"
)
public
GenConfig
update
(
GenConfig
genConfig
)
{
public
GenConfig
update
(
String
tableName
,
GenConfig
genConfig
)
{
genConfig
.
setId
(
1L
);
// 自动设置Api路径,注释掉前需要同步取消前端的注释
// 自动设置Api路径,注释掉前需要同步取消前端的注释
String
separator
=
File
.
separator
;
String
separator
=
File
.
separator
;
String
[]
paths
;
String
[]
paths
;
...
...
eladmin-generator/src/main/java/me/zhengjie/service/impl/GeneratorServiceImpl.java
View file @
41b562f3
package
me.zhengjie.service.impl
;
package
me.zhengjie.service.impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
me.zhengjie.domain.GenConfig
;
import
me.zhengjie.domain.GenConfig
;
import
me.zhengjie.domain.
vo.
ColumnInfo
;
import
me.zhengjie.domain.ColumnInfo
;
import
me.zhengjie.domain.vo.TableInfo
;
import
me.zhengjie.domain.vo.TableInfo
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.repository.ColumnInfoRepository
;
import
me.zhengjie.service.GeneratorService
;
import
me.zhengjie.service.GeneratorService
;
import
me.zhengjie.utils.GenUtil
;
import
me.zhengjie.utils.GenUtil
;
import
me.zhengjie.utils.PageUtil
;
import
me.zhengjie.utils.PageUtil
;
...
@@ -27,6 +29,12 @@ public class GeneratorServiceImpl implements GeneratorService {
...
@@ -27,6 +29,12 @@ public class GeneratorServiceImpl implements GeneratorService {
@PersistenceContext
@PersistenceContext
private
EntityManager
em
;
private
EntityManager
em
;
private
final
ColumnInfoRepository
columnInfoRepository
;
public
GeneratorServiceImpl
(
ColumnInfoRepository
columnInfoRepository
)
{
this
.
columnInfoRepository
=
columnInfoRepository
;
}
@Override
@Override
@SuppressWarnings
(
"all"
)
@SuppressWarnings
(
"all"
)
public
Object
getTables
(
String
name
,
int
[]
startEnd
)
{
public
Object
getTables
(
String
name
,
int
[]
startEnd
)
{
...
@@ -50,20 +58,49 @@ public class GeneratorServiceImpl implements GeneratorService {
...
@@ -50,20 +58,49 @@ public class GeneratorServiceImpl implements GeneratorService {
}
}
@Override
@Override
public
List
<
ColumnInfo
>
getColumns
(
String
tableName
)
{
List
<
ColumnInfo
>
columnInfos
=
columnInfoRepository
.
findByTableNameOrderByIdAsc
(
tableName
);
if
(
CollectionUtil
.
isNotEmpty
(
columnInfos
)){
return
columnInfos
;
}
else
{
columnInfos
=
query
(
tableName
);
return
columnInfoRepository
.
saveAll
(
columnInfos
);
}
}
@SuppressWarnings
(
"all"
)
@SuppressWarnings
(
"all"
)
public
Object
getColumns
(
String
n
ame
)
{
public
List
<
ColumnInfo
>
query
(
String
tableN
ame
){
// 使用预编译防止sql注入
// 使用预编译防止sql注入
String
sql
=
"select column_name, is_nullable, data_type, column_comment, column_key, extra from information_schema.columns "
+
String
sql
=
"select column_name, is_nullable, data_type, column_comment, column_key, extra from information_schema.columns "
+
"where table_name = ? and table_schema = (select database()) order by ordinal_position"
;
"where table_name = ? and table_schema = (select database()) order by ordinal_position"
;
Query
query
=
em
.
createNativeQuery
(
sql
);
Query
query
=
em
.
createNativeQuery
(
sql
);
query
.
setParameter
(
1
,
StringUtils
.
isNotBlank
(
name
)
?
name
:
null
);
query
.
setParameter
(
1
,
tableName
);
List
result
=
query
.
getResultList
();
List
result
=
query
.
getResultList
();
List
<
ColumnInfo
>
columnInfos
=
new
ArrayList
<>();
List
<
ColumnInfo
>
columnInfos
=
new
ArrayList
<>();
for
(
Object
obj
:
result
)
{
for
(
Object
obj
:
result
)
{
Object
[]
arr
=
(
Object
[])
obj
;
Object
[]
arr
=
(
Object
[])
obj
;
columnInfos
.
add
(
new
ColumnInfo
(
arr
[
0
],
arr
[
1
],
arr
[
2
],
arr
[
3
],
arr
[
4
],
arr
[
5
],
null
,
"true"
));
columnInfos
.
add
(
new
ColumnInfo
(
tableName
,
arr
[
0
].
toString
(),
arr
[
1
].
equals
(
"NO"
),
arr
[
2
].
toString
(),
ObjectUtil
.
isNotNull
(
arr
[
3
])
?
arr
[
3
].
toString
()
:
null
,
ObjectUtil
.
isNotNull
(
arr
[
4
])
?
arr
[
4
].
toString
()
:
null
,
ObjectUtil
.
isNotNull
(
arr
[
5
])
?
arr
[
5
].
toString
()
:
null
)
);
}
return
columnInfos
;
}
}
return
PageUtil
.
toPage
(
columnInfos
,
columnInfos
.
size
());
@Override
public
void
sync
(
List
<
ColumnInfo
>
columnInfos
)
{
}
@Override
public
void
save
(
List
<
ColumnInfo
>
columnInfos
)
{
columnInfoRepository
.
saveAll
(
columnInfos
);
}
}
@Override
@Override
...
...
eladmin-generator/src/main/java/me/zhengjie/utils/GenUtil.java
View file @
41b562f3
...
@@ -4,7 +4,7 @@ import cn.hutool.core.util.StrUtil;
...
@@ -4,7 +4,7 @@ import cn.hutool.core.util.StrUtil;
import
cn.hutool.extra.template.*
;
import
cn.hutool.extra.template.*
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
me.zhengjie.domain.GenConfig
;
import
me.zhengjie.domain.GenConfig
;
import
me.zhengjie.domain.
vo.
ColumnInfo
;
import
me.zhengjie.domain.ColumnInfo
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileWriter
;
import
java.io.FileWriter
;
...
@@ -95,13 +95,13 @@ public class GenUtil {
...
@@ -95,13 +95,13 @@ public class GenUtil {
List
<
Map
<
String
,
Object
>>
queryColumns
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
queryColumns
=
new
ArrayList
<>();
for
(
ColumnInfo
column
:
columnInfos
)
{
for
(
ColumnInfo
column
:
columnInfos
)
{
Map
<
String
,
Object
>
listMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
listMap
=
new
HashMap
<>();
listMap
.
put
(
"columnComment"
,
column
.
get
ColumnComment
());
listMap
.
put
(
"columnComment"
,
column
.
get
Remark
());
listMap
.
put
(
"columnKey"
,
column
.
get
ColumnKey
());
listMap
.
put
(
"columnKey"
,
column
.
get
KeyType
());
String
colType
=
ColUtil
.
cloToJava
(
column
.
getColumnType
().
toString
());
String
colType
=
ColUtil
.
cloToJava
(
column
.
getColumnType
().
toString
());
String
changeColumnName
=
StringUtils
.
toCamelCase
(
column
.
getColumnName
().
toString
());
String
changeColumnName
=
StringUtils
.
toCamelCase
(
column
.
getColumnName
().
toString
());
String
capitalColumnName
=
StringUtils
.
toCapitalizeCamelCase
(
column
.
getColumnName
().
toString
());
String
capitalColumnName
=
StringUtils
.
toCapitalizeCamelCase
(
column
.
getColumnName
().
toString
());
if
(
PK
.
equals
(
column
.
get
ColumnKey
())){
if
(
PK
.
equals
(
column
.
get
KeyType
())){
map
.
put
(
"pkColumnType"
,
colType
);
map
.
put
(
"pkColumnType"
,
colType
);
map
.
put
(
"pkChangeColName"
,
changeColumnName
);
map
.
put
(
"pkChangeColName"
,
changeColumnName
);
map
.
put
(
"pkCapitalColName"
,
capitalColumnName
);
map
.
put
(
"pkCapitalColName"
,
capitalColumnName
);
...
@@ -117,14 +117,14 @@ public class GenUtil {
...
@@ -117,14 +117,14 @@ public class GenUtil {
}
}
listMap
.
put
(
"columnType"
,
colType
);
listMap
.
put
(
"columnType"
,
colType
);
listMap
.
put
(
"columnName"
,
column
.
getColumnName
());
listMap
.
put
(
"columnName"
,
column
.
getColumnName
());
listMap
.
put
(
"isNullable"
,
column
.
get
Is
Null
able
());
listMap
.
put
(
"isNullable"
,
column
.
get
Not
Null
());
listMap
.
put
(
"columnShow"
,
column
.
get
Column
Show
());
listMap
.
put
(
"columnShow"
,
column
.
get
List
Show
());
listMap
.
put
(
"changeColumnName"
,
changeColumnName
);
listMap
.
put
(
"changeColumnName"
,
changeColumnName
);
listMap
.
put
(
"capitalColumnName"
,
capitalColumnName
);
listMap
.
put
(
"capitalColumnName"
,
capitalColumnName
);
// 判断是否有查询,如有则把查询的字段set进columnQuery
// 判断是否有查询,如有则把查询的字段set进columnQuery
if
(!
StringUtils
.
isBlank
(
column
.
get
Column
Query
())){
if
(!
StringUtils
.
isBlank
(
column
.
getQuery
Type
())){
listMap
.
put
(
"columnQuery"
,
column
.
get
Column
Query
());
listMap
.
put
(
"columnQuery"
,
column
.
getQuery
Type
());
map
.
put
(
"hasQuery"
,
true
);
map
.
put
(
"hasQuery"
,
true
);
if
(
TIMESTAMP
.
equals
(
colType
)){
if
(
TIMESTAMP
.
equals
(
colType
)){
map
.
put
(
"queryHasTimestamp"
,
true
);
map
.
put
(
"queryHasTimestamp"
,
true
);
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictController.java
View file @
41b562f3
...
@@ -42,6 +42,14 @@ public class DictController {
...
@@ -42,6 +42,14 @@ public class DictController {
dictService
.
download
(
dictService
.
queryAll
(
criteria
),
response
);
dictService
.
download
(
dictService
.
queryAll
(
criteria
),
response
);
}
}
@Log
(
"查询字典"
)
@ApiOperation
(
"查询字典"
)
@GetMapping
(
value
=
"/all"
)
@PreAuthorize
(
"@el.check('dict:list')"
)
public
ResponseEntity
all
(){
return
new
ResponseEntity
<>(
dictService
.
queryAll
(
new
DictQueryCriteria
()),
HttpStatus
.
OK
);
}
@Log
(
"查询字典"
)
@Log
(
"查询字典"
)
@ApiOperation
(
"查询字典"
)
@ApiOperation
(
"查询字典"
)
@GetMapping
@GetMapping
...
...
Write
Preview
Supports
Markdown
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