Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EL-ADMIN
Project
Project
Details
Activity
Releases
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
JiangSN
EL-ADMIN
Commits
ff140027
Commit
ff140027
authored
Nov 02, 2021
by
JiangSN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除字典管理模块
parent
3f4791ae
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
0 additions
and
1009 deletions
+0
-1009
Dict.java
...src/main/java/me/zhengjie/modules/system/domain/Dict.java
+0
-55
DictDetail.java
...in/java/me/zhengjie/modules/system/domain/DictDetail.java
+0
-57
DictDetailRepository.java
...ngjie/modules/system/repository/DictDetailRepository.java
+0
-36
DictRepository.java
...me/zhengjie/modules/system/repository/DictRepository.java
+0
-43
DictController.java
.../java/me/zhengjie/modules/system/rest/DictController.java
+0
-99
DictDetailController.java
...me/zhengjie/modules/system/rest/DictDetailController.java
+0
-99
DictDetailService.java
...me/zhengjie/modules/system/service/DictDetailService.java
+0
-63
DictService.java
.../java/me/zhengjie/modules/system/service/DictService.java
+0
-75
DictDetailDto.java
...me/zhengjie/modules/system/service/dto/DictDetailDto.java
+0
-40
DictDetailQueryCriteria.java
...e/modules/system/service/dto/DictDetailQueryCriteria.java
+0
-33
DictDto.java
.../java/me/zhengjie/modules/system/service/dto/DictDto.java
+0
-39
DictQueryCriteria.java
...hengjie/modules/system/service/dto/DictQueryCriteria.java
+0
-30
DictSmallDto.java
.../me/zhengjie/modules/system/service/dto/DictSmallDto.java
+0
-31
DictDetailServiceImpl.java
...ie/modules/system/service/impl/DictDetailServiceImpl.java
+0
-95
DictServiceImpl.java
...zhengjie/modules/system/service/impl/DictServiceImpl.java
+0
-121
DictDetailMapper.java
...ie/modules/system/service/mapstruct/DictDetailMapper.java
+0
-31
DictMapper.java
...zhengjie/modules/system/service/mapstruct/DictMapper.java
+0
-31
DictSmallMapper.java
...jie/modules/system/service/mapstruct/DictSmallMapper.java
+0
-31
No files found.
eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/Dict.java
deleted
100644 → 0
View file @
3f4791ae
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
modules
.
system
.
domain
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
import
me.zhengjie.base.BaseEntity
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @author Zheng Jie
* @date 2019-04-10
*/
@Entity
@Getter
@Setter
@Table
(
name
=
"SJGX_SYS_DICT"
)
public
class
Dict
extends
BaseEntity
implements
Serializable
{
@Id
@Column
(
name
=
"DICT_ID"
)
@NotNull
(
groups
=
Update
.
class
)
@ApiModelProperty
(
value
=
"ID"
,
hidden
=
true
)
@SequenceGenerator
(
name
=
"dictGenerator"
,
sequenceName
=
"SEQ_SJGX_DICT"
)
@GeneratedValue
(
strategy
=
GenerationType
.
SEQUENCE
,
generator
=
"dictGenerator"
)
private
Long
id
;
@OneToMany
(
mappedBy
=
"dict"
,
cascade
={
CascadeType
.
PERSIST
,
CascadeType
.
REMOVE
})
private
List
<
DictDetail
>
dictDetails
;
@NotBlank
@ApiModelProperty
(
value
=
"名称"
)
private
String
name
;
@ApiModelProperty
(
value
=
"描述"
)
private
String
description
;
}
eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/domain/DictDetail.java
deleted
100644 → 0
View file @
3f4791ae
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
modules
.
system
.
domain
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
import
me.zhengjie.base.BaseEntity
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* @author Zheng Jie
* @date 2019-04-10
*/
@Entity
@Getter
@Setter
@Table
(
name
=
"SJGX_SYS_DICT_DETAIL"
)
public
class
DictDetail
extends
BaseEntity
implements
Serializable
{
@Id
@Column
(
name
=
"DETAIL_ID"
)
@NotNull
(
groups
=
Update
.
class
)
@ApiModelProperty
(
value
=
"ID"
,
hidden
=
true
)
@SequenceGenerator
(
name
=
"dictdetailGenerator"
,
sequenceName
=
"SEQ_SJGX_DICTDETAIL"
)
@GeneratedValue
(
strategy
=
GenerationType
.
SEQUENCE
,
generator
=
"dictdetailGenerator"
)
private
Long
id
;
@JoinColumn
(
name
=
"DICT_ID"
)
@ManyToOne
(
fetch
=
FetchType
.
LAZY
)
@ApiModelProperty
(
value
=
"字典"
,
hidden
=
true
)
private
Dict
dict
;
@ApiModelProperty
(
value
=
"字典标签"
)
private
String
label
;
@ApiModelProperty
(
value
=
"字典值"
)
private
String
value
;
@ApiModelProperty
(
value
=
"排序"
)
private
Integer
dictSort
=
999
;
}
eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/DictDetailRepository.java
deleted
100644 → 0
View file @
3f4791ae
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
modules
.
system
.
repository
;
import
me.zhengjie.modules.system.domain.DictDetail
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
java.util.List
;
/**
* @author Zheng Jie
* @date 2019-04-10
*/
public
interface
DictDetailRepository
extends
JpaRepository
<
DictDetail
,
Long
>,
JpaSpecificationExecutor
<
DictDetail
>
{
/**
* 根据字典名称查询
* @param name /
* @return /
*/
List
<
DictDetail
>
findByDictName
(
String
name
);
}
\ No newline at end of file
eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/repository/DictRepository.java
deleted
100644 → 0
View file @
3f4791ae
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
modules
.
system
.
repository
;
import
me.zhengjie.modules.system.domain.Dict
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
java.util.List
;
import
java.util.Set
;
/**
* @author Zheng Jie
* @date 2019-04-10
*/
public
interface
DictRepository
extends
JpaRepository
<
Dict
,
Long
>,
JpaSpecificationExecutor
<
Dict
>
{
/**
* 删除
* @param ids /
*/
void
deleteByIdIn
(
Set
<
Long
>
ids
);
/**
* 查询
* @param ids /
* @return /
*/
List
<
Dict
>
findByIdIn
(
Set
<
Long
>
ids
);
}
\ No newline at end of file
eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictController.java
deleted
100644 → 0
View file @
3f4791ae
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
modules
.
system
.
rest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
me.zhengjie.annotation.Log
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.modules.system.domain.Dict
;
import
me.zhengjie.modules.system.service.DictService
;
import
me.zhengjie.modules.system.service.dto.DictQueryCriteria
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.Set
;
/**
* @author Zheng Jie
* @date 2019-04-10
*/
@RestController
@RequiredArgsConstructor
@Api
(
tags
=
"系统:字典管理"
)
@RequestMapping
(
"/api/dict"
)
public
class
DictController
{
private
final
DictService
dictService
;
private
static
final
String
ENTITY_NAME
=
"dict"
;
@ApiOperation
(
"导出字典数据"
)
@GetMapping
(
value
=
"/download"
)
@PreAuthorize
(
"@el.check('dict:list')"
)
public
void
download
(
HttpServletResponse
response
,
DictQueryCriteria
criteria
)
throws
IOException
{
dictService
.
download
(
dictService
.
queryAll
(
criteria
),
response
);
}
@ApiOperation
(
"查询字典"
)
@GetMapping
(
value
=
"/all"
)
@PreAuthorize
(
"@el.check('dict:list')"
)
public
ResponseEntity
<
Object
>
queryAll
(){
return
new
ResponseEntity
<>(
dictService
.
queryAll
(
new
DictQueryCriteria
()),
HttpStatus
.
OK
);
}
@ApiOperation
(
"查询字典"
)
@GetMapping
@PreAuthorize
(
"@el.check('dict:list')"
)
public
ResponseEntity
<
Object
>
query
(
DictQueryCriteria
resources
,
Pageable
pageable
){
return
new
ResponseEntity
<>(
dictService
.
queryAll
(
resources
,
pageable
),
HttpStatus
.
OK
);
}
@Log
(
"新增字典"
)
@ApiOperation
(
"新增字典"
)
@PostMapping
@PreAuthorize
(
"@el.check('dict:add')"
)
public
ResponseEntity
<
Object
>
create
(
@Validated
@RequestBody
Dict
resources
){
if
(
resources
.
getId
()
!=
null
)
{
throw
new
BadRequestException
(
"A new "
+
ENTITY_NAME
+
" cannot already have an ID"
);
}
dictService
.
create
(
resources
);
return
new
ResponseEntity
<>(
HttpStatus
.
CREATED
);
}
@Log
(
"修改字典"
)
@ApiOperation
(
"修改字典"
)
@PutMapping
@PreAuthorize
(
"@el.check('dict:edit')"
)
public
ResponseEntity
<
Object
>
update
(
@Validated
(
Dict
.
Update
.
class
)
@RequestBody
Dict
resources
){
dictService
.
update
(
resources
);
return
new
ResponseEntity
<>(
HttpStatus
.
NO_CONTENT
);
}
@Log
(
"删除字典"
)
@ApiOperation
(
"删除字典"
)
@DeleteMapping
@PreAuthorize
(
"@el.check('dict:del')"
)
public
ResponseEntity
<
Object
>
delete
(
@RequestBody
Set
<
Long
>
ids
){
dictService
.
delete
(
ids
);
return
new
ResponseEntity
<>(
HttpStatus
.
OK
);
}
}
\ No newline at end of file
eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictDetailController.java
deleted
100644 → 0
View file @
3f4791ae
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
modules
.
system
.
rest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.RequiredArgsConstructor
;
import
me.zhengjie.annotation.Log
;
import
me.zhengjie.exception.BadRequestException
;
import
me.zhengjie.modules.system.domain.DictDetail
;
import
me.zhengjie.modules.system.service.DictDetailService
;
import
me.zhengjie.modules.system.service.dto.DictDetailDto
;
import
me.zhengjie.modules.system.service.dto.DictDetailQueryCriteria
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.web.PageableDefault
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author Zheng Jie
* @date 2019-04-10
*/
@RestController
@RequiredArgsConstructor
@Api
(
tags
=
"系统:字典详情管理"
)
@RequestMapping
(
"/api/dictDetail"
)
public
class
DictDetailController
{
private
final
DictDetailService
dictDetailService
;
private
static
final
String
ENTITY_NAME
=
"dictDetail"
;
@ApiOperation
(
"查询字典详情"
)
@GetMapping
public
ResponseEntity
<
Object
>
query
(
DictDetailQueryCriteria
criteria
,
@PageableDefault
(
sort
=
{
"dictSort"
},
direction
=
Sort
.
Direction
.
ASC
)
Pageable
pageable
){
return
new
ResponseEntity
<>(
dictDetailService
.
queryAll
(
criteria
,
pageable
),
HttpStatus
.
OK
);
}
@ApiOperation
(
"查询多个字典详情"
)
@GetMapping
(
value
=
"/map"
)
public
ResponseEntity
<
Object
>
getDictDetailMaps
(
@RequestParam
String
dictName
){
String
[]
names
=
dictName
.
split
(
"[,,]"
);
Map
<
String
,
List
<
DictDetailDto
>>
dictMap
=
new
HashMap
<>(
16
);
for
(
String
name
:
names
)
{
dictMap
.
put
(
name
,
dictDetailService
.
getDictByName
(
name
));
}
return
new
ResponseEntity
<>(
dictMap
,
HttpStatus
.
OK
);
}
@Log
(
"新增字典详情"
)
@ApiOperation
(
"新增字典详情"
)
@PostMapping
@PreAuthorize
(
"@el.check('dict:add')"
)
public
ResponseEntity
<
Object
>
create
(
@Validated
@RequestBody
DictDetail
resources
){
if
(
resources
.
getId
()
!=
null
)
{
throw
new
BadRequestException
(
"A new "
+
ENTITY_NAME
+
" cannot already have an ID"
);
}
dictDetailService
.
create
(
resources
);
return
new
ResponseEntity
<>(
HttpStatus
.
CREATED
);
}
@Log
(
"修改字典详情"
)
@ApiOperation
(
"修改字典详情"
)
@PutMapping
@PreAuthorize
(
"@el.check('dict:edit')"
)
public
ResponseEntity
<
Object
>
update
(
@Validated
(
DictDetail
.
Update
.
class
)
@RequestBody
DictDetail
resources
){
dictDetailService
.
update
(
resources
);
return
new
ResponseEntity
<>(
HttpStatus
.
NO_CONTENT
);
}
@Log
(
"删除字典详情"
)
@ApiOperation
(
"删除字典详情"
)
@DeleteMapping
(
value
=
"/{id}"
)
@PreAuthorize
(
"@el.check('dict:del')"
)
public
ResponseEntity
<
Object
>
delete
(
@PathVariable
Long
id
){
dictDetailService
.
delete
(
id
);
return
new
ResponseEntity
<>(
HttpStatus
.
OK
);
}
}
\ No newline at end of file
eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/DictDetailService.java
deleted
100644 → 0
View file @
3f4791ae
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
modules
.
system
.
service
;
import
me.zhengjie.modules.system.domain.DictDetail
;
import
me.zhengjie.modules.system.service.dto.DictDetailDto
;
import
me.zhengjie.modules.system.service.dto.DictDetailQueryCriteria
;
import
org.springframework.data.domain.Pageable
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author Zheng Jie
* @date 2019-04-10
*/
public
interface
DictDetailService
{
/**
* 创建
* @param resources /
*/
void
create
(
DictDetail
resources
);
/**
* 编辑
* @param resources /
*/
void
update
(
DictDetail
resources
);
/**
* 删除
* @param id /
*/
void
delete
(
Long
id
);
/**
* 分页查询
* @param criteria 条件
* @param pageable 分页参数
* @return /
*/
Map
<
String
,
Object
>
queryAll
(
DictDetailQueryCriteria
criteria
,
Pageable
pageable
);
/**
* 根据字典名称获取字典详情
* @param name 字典名称
* @return /
*/
List
<
DictDetailDto
>
getDictByName
(
String
name
);
}
\ No newline at end of file
eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/DictService.java
deleted
100644 → 0
View file @
3f4791ae
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
modules
.
system
.
service
;
import
me.zhengjie.modules.system.domain.Dict
;
import
me.zhengjie.modules.system.service.dto.DictDto
;
import
me.zhengjie.modules.system.service.dto.DictQueryCriteria
;
import
org.springframework.data.domain.Pageable
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
/**
* @author Zheng Jie
* @date 2019-04-10
*/
public
interface
DictService
{
/**
* 分页查询
* @param criteria 条件
* @param pageable 分页参数
* @return /
*/
Map
<
String
,
Object
>
queryAll
(
DictQueryCriteria
criteria
,
Pageable
pageable
);
/**
* 查询全部数据
* @param dict /
* @return /
*/
List
<
DictDto
>
queryAll
(
DictQueryCriteria
dict
);
/**
* 创建
* @param resources /
* @return /
*/
void
create
(
Dict
resources
);
/**
* 编辑
* @param resources /
*/
void
update
(
Dict
resources
);
/**
* 删除
* @param ids /
*/
void
delete
(
Set
<
Long
>
ids
);
/**
* 导出数据
* @param queryAll 待导出的数据
* @param response /
* @throws IOException /
*/
void
download
(
List
<
DictDto
>
queryAll
,
HttpServletResponse
response
)
throws
IOException
;
}
\ No newline at end of file
eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DictDetailDto.java
deleted
100644 → 0
View file @
3f4791ae
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
modules
.
system
.
service
.
dto
;
import
lombok.Getter
;
import
lombok.Setter
;
import
me.zhengjie.base.BaseDTO
;
import
java.io.Serializable
;
/**
* @author Zheng Jie
* @date 2019-04-10
*/
@Getter
@Setter
public
class
DictDetailDto
extends
BaseDTO
implements
Serializable
{
private
Long
id
;
private
DictSmallDto
dict
;
private
String
label
;
private
String
value
;
private
Integer
dictSort
;
}
\ No newline at end of file
eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DictDetailQueryCriteria.java
deleted
100644 → 0
View file @
3f4791ae
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
modules
.
system
.
service
.
dto
;
import
lombok.Data
;
import
me.zhengjie.annotation.Query
;
/**
* @author Zheng Jie
* @date 2019-04-10
*/
@Data
public
class
DictDetailQueryCriteria
{
@Query
(
type
=
Query
.
Type
.
INNER_LIKE
)
private
String
label
;
@Query
(
propName
=
"name"
,
joinName
=
"dict"
)
private
String
dictName
;
}
\ No newline at end of file
eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DictDto.java
deleted
100644 → 0
View file @
3f4791ae
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
modules
.
system
.
service
.
dto
;
import
lombok.Getter
;
import
lombok.Setter
;
import
me.zhengjie.base.BaseDTO
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @author Zheng Jie
* @date 2019-04-10
*/
@Getter
@Setter
public
class
DictDto
extends
BaseDTO
implements
Serializable
{
private
Long
id
;
private
List
<
DictDetailDto
>
dictDetails
;
private
String
name
;
private
String
description
;
}
eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DictQueryCriteria.java
deleted
100644 → 0
View file @
3f4791ae
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
modules
.
system
.
service
.
dto
;
import
lombok.Data
;
import
me.zhengjie.annotation.Query
;
/**
* @author Zheng Jie
* 公共查询类
*/
@Data
public
class
DictQueryCriteria
{
@Query
(
blurry
=
"name,description"
)
private
String
blurry
;
}
eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/dto/DictSmallDto.java
deleted
100644 → 0
View file @
3f4791ae
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
modules
.
system
.
service
.
dto
;
import
lombok.Getter
;
import
lombok.Setter
;
import
java.io.Serializable
;
/**
* @author Zheng Jie
* @date 2019-04-10
*/
@Getter
@Setter
public
class
DictSmallDto
implements
Serializable
{
private
Long
id
;
}
eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DictDetailServiceImpl.java
deleted
100644 → 0
View file @
3f4791ae
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
modules
.
system
.
service
.
impl
;
import
lombok.RequiredArgsConstructor
;
import
me.zhengjie.modules.system.domain.Dict
;
import
me.zhengjie.modules.system.domain.DictDetail
;
import
me.zhengjie.modules.system.repository.DictRepository
;
import
me.zhengjie.modules.system.service.dto.DictDetailQueryCriteria
;
import
me.zhengjie.utils.*
;
import
me.zhengjie.modules.system.repository.DictDetailRepository
;
import
me.zhengjie.modules.system.service.DictDetailService
;
import
me.zhengjie.modules.system.service.dto.DictDetailDto
;
import
me.zhengjie.modules.system.service.mapstruct.DictDetailMapper
;
import
org.springframework.cache.annotation.CacheConfig
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author Zheng Jie
* @date 2019-04-10
*/
@Service
@RequiredArgsConstructor
@CacheConfig
(
cacheNames
=
"dict"
)
public
class
DictDetailServiceImpl
implements
DictDetailService
{
private
final
DictRepository
dictRepository
;
private
final
DictDetailRepository
dictDetailRepository
;
private
final
DictDetailMapper
dictDetailMapper
;
private
final
RedisUtils
redisUtils
;
@Override
public
Map
<
String
,
Object
>
queryAll
(
DictDetailQueryCriteria
criteria
,
Pageable
pageable
)
{
Page
<
DictDetail
>
page
=
dictDetailRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
QueryHelp
.
getPredicate
(
root
,
criteria
,
criteriaBuilder
),
pageable
);
return
PageUtil
.
toPage
(
page
.
map
(
dictDetailMapper:
:
toDto
));
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
create
(
DictDetail
resources
)
{
dictDetailRepository
.
save
(
resources
);
// 清理缓存
delCaches
(
resources
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
update
(
DictDetail
resources
)
{
DictDetail
dictDetail
=
dictDetailRepository
.
findById
(
resources
.
getId
()).
orElseGet
(
DictDetail:
:
new
);
ValidationUtil
.
isNull
(
dictDetail
.
getId
(),
"DictDetail"
,
"id"
,
resources
.
getId
());
resources
.
setId
(
dictDetail
.
getId
());
dictDetailRepository
.
save
(
resources
);
// 清理缓存
delCaches
(
resources
);
}
@Override
@Cacheable
(
key
=
"'name:' + #p0"
)
public
List
<
DictDetailDto
>
getDictByName
(
String
name
)
{
return
dictDetailMapper
.
toDto
(
dictDetailRepository
.
findByDictName
(
name
));
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
delete
(
Long
id
)
{
DictDetail
dictDetail
=
dictDetailRepository
.
findById
(
id
).
orElseGet
(
DictDetail:
:
new
);
// 清理缓存
delCaches
(
dictDetail
);
dictDetailRepository
.
deleteById
(
id
);
}
public
void
delCaches
(
DictDetail
dictDetail
){
Dict
dict
=
dictRepository
.
findById
(
dictDetail
.
getDict
().
getId
()).
orElseGet
(
Dict:
:
new
);
redisUtils
.
del
(
CacheKey
.
DICT_NAME
+
dict
.
getName
());
}
}
\ No newline at end of file
eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DictServiceImpl.java
deleted
100644 → 0
View file @
3f4791ae
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
modules
.
system
.
service
.
impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
lombok.RequiredArgsConstructor
;
import
me.zhengjie.modules.system.domain.Dict
;
import
me.zhengjie.modules.system.service.dto.DictDetailDto
;
import
me.zhengjie.modules.system.service.dto.DictQueryCriteria
;
import
me.zhengjie.utils.*
;
import
me.zhengjie.modules.system.repository.DictRepository
;
import
me.zhengjie.modules.system.service.DictService
;
import
me.zhengjie.modules.system.service.dto.DictDto
;
import
me.zhengjie.modules.system.service.mapstruct.DictMapper
;
import
org.springframework.cache.annotation.CacheConfig
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.*
;
/**
* @author Zheng Jie
* @date 2019-04-10
*/
@Service
@RequiredArgsConstructor
@CacheConfig
(
cacheNames
=
"dict"
)
public
class
DictServiceImpl
implements
DictService
{
private
final
DictRepository
dictRepository
;
private
final
DictMapper
dictMapper
;
private
final
RedisUtils
redisUtils
;
@Override
public
Map
<
String
,
Object
>
queryAll
(
DictQueryCriteria
dict
,
Pageable
pageable
){
Page
<
Dict
>
page
=
dictRepository
.
findAll
((
root
,
query
,
cb
)
->
QueryHelp
.
getPredicate
(
root
,
dict
,
cb
),
pageable
);
return
PageUtil
.
toPage
(
page
.
map
(
dictMapper:
:
toDto
));
}
@Override
public
List
<
DictDto
>
queryAll
(
DictQueryCriteria
dict
)
{
List
<
Dict
>
list
=
dictRepository
.
findAll
((
root
,
query
,
cb
)
->
QueryHelp
.
getPredicate
(
root
,
dict
,
cb
));
return
dictMapper
.
toDto
(
list
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
create
(
Dict
resources
)
{
dictRepository
.
save
(
resources
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
update
(
Dict
resources
)
{
// 清理缓存
delCaches
(
resources
);
Dict
dict
=
dictRepository
.
findById
(
resources
.
getId
()).
orElseGet
(
Dict:
:
new
);
ValidationUtil
.
isNull
(
dict
.
getId
(),
"Dict"
,
"id"
,
resources
.
getId
());
dict
.
setName
(
resources
.
getName
());
dict
.
setDescription
(
resources
.
getDescription
());
dictRepository
.
save
(
dict
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
delete
(
Set
<
Long
>
ids
)
{
// 清理缓存
List
<
Dict
>
dicts
=
dictRepository
.
findByIdIn
(
ids
);
for
(
Dict
dict
:
dicts
)
{
delCaches
(
dict
);
}
dictRepository
.
deleteByIdIn
(
ids
);
}
@Override
public
void
download
(
List
<
DictDto
>
dictDtos
,
HttpServletResponse
response
)
throws
IOException
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
for
(
DictDto
dictDTO
:
dictDtos
)
{
if
(
CollectionUtil
.
isNotEmpty
(
dictDTO
.
getDictDetails
())){
for
(
DictDetailDto
dictDetail
:
dictDTO
.
getDictDetails
())
{
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
map
.
put
(
"字典名称"
,
dictDTO
.
getName
());
map
.
put
(
"字典描述"
,
dictDTO
.
getDescription
());
map
.
put
(
"字典标签"
,
dictDetail
.
getLabel
());
map
.
put
(
"字典值"
,
dictDetail
.
getValue
());
map
.
put
(
"创建日期"
,
dictDetail
.
getCreateTime
());
list
.
add
(
map
);
}
}
else
{
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<>();
map
.
put
(
"字典名称"
,
dictDTO
.
getName
());
map
.
put
(
"字典描述"
,
dictDTO
.
getDescription
());
map
.
put
(
"字典标签"
,
null
);
map
.
put
(
"字典值"
,
null
);
map
.
put
(
"创建日期"
,
dictDTO
.
getCreateTime
());
list
.
add
(
map
);
}
}
FileUtil
.
downloadExcel
(
list
,
response
);
}
public
void
delCaches
(
Dict
dict
){
redisUtils
.
del
(
CacheKey
.
DICT_NAME
+
dict
.
getName
());
}
}
\ No newline at end of file
eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/DictDetailMapper.java
deleted
100644 → 0
View file @
3f4791ae
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
modules
.
system
.
service
.
mapstruct
;
import
me.zhengjie.base.BaseMapper
;
import
me.zhengjie.modules.system.domain.DictDetail
;
import
me.zhengjie.modules.system.service.dto.DictDetailDto
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.ReportingPolicy
;
/**
* @author Zheng Jie
* @date 2019-04-10
*/
@Mapper
(
componentModel
=
"spring"
,
uses
=
{
DictSmallMapper
.
class
},
unmappedTargetPolicy
=
ReportingPolicy
.
IGNORE
)
public
interface
DictDetailMapper
extends
BaseMapper
<
DictDetailDto
,
DictDetail
>
{
}
\ No newline at end of file
eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/DictMapper.java
deleted
100644 → 0
View file @
3f4791ae
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
modules
.
system
.
service
.
mapstruct
;
import
me.zhengjie.base.BaseMapper
;
import
me.zhengjie.modules.system.domain.Dict
;
import
me.zhengjie.modules.system.service.dto.DictDto
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.ReportingPolicy
;
/**
* @author Zheng Jie
* @date 2019-04-10
*/
@Mapper
(
componentModel
=
"spring"
,
unmappedTargetPolicy
=
ReportingPolicy
.
IGNORE
)
public
interface
DictMapper
extends
BaseMapper
<
DictDto
,
Dict
>
{
}
\ No newline at end of file
eladmin/eladmin-system/src/main/java/me/zhengjie/modules/system/service/mapstruct/DictSmallMapper.java
deleted
100644 → 0
View file @
3f4791ae
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
me
.
zhengjie
.
modules
.
system
.
service
.
mapstruct
;
import
me.zhengjie.base.BaseMapper
;
import
me.zhengjie.modules.system.domain.Dict
;
import
me.zhengjie.modules.system.service.dto.DictSmallDto
;
import
org.mapstruct.Mapper
;
import
org.mapstruct.ReportingPolicy
;
/**
* @author Zheng Jie
* @date 2019-04-10
*/
@Mapper
(
componentModel
=
"spring"
,
unmappedTargetPolicy
=
ReportingPolicy
.
IGNORE
)
public
interface
DictSmallMapper
extends
BaseMapper
<
DictSmallDto
,
Dict
>
{
}
\ No newline at end of file
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