add mybatisplus and compatible with jpa && upgrade springboot to 2.7.3 && other changes
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package priv.alawn.aladmin.base;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -45,21 +47,25 @@ public class BaseEntity implements Serializable {
|
||||
@CreatedBy
|
||||
@Column(name = "create_by", updatable = false)
|
||||
@ApiModelProperty(value = "创建人", hidden = true)
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String createBy;
|
||||
|
||||
@LastModifiedBy
|
||||
@Column(name = "update_by")
|
||||
@ApiModelProperty(value = "更新人", hidden = true)
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private String updateBy;
|
||||
|
||||
@CreationTimestamp
|
||||
@Column(name = "create_time", updatable = false)
|
||||
@ApiModelProperty(value = "创建时间", hidden = true)
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Timestamp createTime;
|
||||
|
||||
@UpdateTimestamp
|
||||
@Column(name = "update_time")
|
||||
@ApiModelProperty(value = "更新时间", hidden = true)
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Timestamp updateTime;
|
||||
|
||||
/* 分组校验 */
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ import java.util.List;
|
||||
* @author Alawn
|
||||
* @date 2018-11-23
|
||||
*/
|
||||
public interface BaseMapper<D, E> {
|
||||
public interface SuperMapper<D, E> {
|
||||
|
||||
/**
|
||||
* DTO转Entity
|
||||
+2
-2
@@ -26,12 +26,12 @@ import org.springframework.stereotype.Component;
|
||||
**/
|
||||
@Data
|
||||
@Component
|
||||
public class AlAdminProperties {
|
||||
public class AdminProperties {
|
||||
|
||||
public static Boolean ipLocal;
|
||||
|
||||
@Value("${ip.local-parsing}")
|
||||
public void setIpLocal(Boolean ipLocal) {
|
||||
AlAdminProperties.ipLocal = ipLocal;
|
||||
AdminProperties.ipLocal = ipLocal;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -25,8 +25,8 @@ import java.util.stream.Collectors;
|
||||
/**
|
||||
* @author Alawn
|
||||
*/
|
||||
@Service(value = "el")
|
||||
public class ElPermissionConfig {
|
||||
@Service(value = "perm")
|
||||
public class PermissionConfig {
|
||||
|
||||
public Boolean check(String ...permissions){
|
||||
// 获取当前用户的所有权限
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package priv.alawn.aladmin.config.mybatisplus;
|
||||
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
import priv.alawn.aladmin.utils.SecurityUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Component
|
||||
public class MyMetaObjectHandler implements MetaObjectHandler {
|
||||
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
this.strictInsertFill(metaObject, "createTime", () -> LocalDateTime.now(), LocalDateTime.class);
|
||||
this.strictInsertFill(metaObject, "updateTime", () -> LocalDateTime.now(), LocalDateTime.class);
|
||||
this.strictInsertFill(metaObject, "updateBy", () -> SecurityUtils.getCurrentUsername(), String.class);
|
||||
this.strictInsertFill(metaObject, "createBy", () -> SecurityUtils.getCurrentUsername(), String.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
this.strictInsertFill(metaObject, "updateTime", () -> LocalDateTime.now(), LocalDateTime.class);
|
||||
this.strictInsertFill(metaObject, "updateBy", () -> SecurityUtils.getCurrentUsername(), String.class);
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import priv.alawn.aladmin.config.AlAdminProperties;
|
||||
import priv.alawn.aladmin.config.AdminProperties;
|
||||
import net.dreamlu.mica.ip2region.core.Ip2regionSearcher;
|
||||
import net.dreamlu.mica.ip2region.core.IpInfo;
|
||||
import nl.basjes.parse.useragent.UserAgent;
|
||||
@@ -174,7 +174,7 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
|
||||
* 根据ip获取详细地址
|
||||
*/
|
||||
public static String getCityInfo(String ip) {
|
||||
if (AlAdminProperties.ipLocal) {
|
||||
if (AdminProperties.ipLocal) {
|
||||
return getLocalCityInfo(ip);
|
||||
} else {
|
||||
return getHttpCityInfo(ip);
|
||||
|
||||
@@ -45,7 +45,7 @@ public class LogController {
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check()")
|
||||
@PreAuthorize("@perm.check()")
|
||||
public void exportLog(HttpServletResponse response, LogQueryCriteria criteria) throws IOException {
|
||||
criteria.setLogType("INFO");
|
||||
logService.download(logService.queryAll(criteria), response);
|
||||
@@ -54,14 +54,14 @@ public class LogController {
|
||||
@Log("导出错误数据")
|
||||
@ApiOperation("导出错误数据")
|
||||
@GetMapping(value = "/error/download")
|
||||
@PreAuthorize("@el.check()")
|
||||
@PreAuthorize("@perm.check()")
|
||||
public void exportErrorLog(HttpServletResponse response, LogQueryCriteria criteria) throws IOException {
|
||||
criteria.setLogType("ERROR");
|
||||
logService.download(logService.queryAll(criteria), response);
|
||||
}
|
||||
@GetMapping
|
||||
@ApiOperation("日志查询")
|
||||
@PreAuthorize("@el.check()")
|
||||
@PreAuthorize("@perm.check()")
|
||||
public ResponseEntity<Object> queryLog(LogQueryCriteria criteria, Pageable pageable){
|
||||
criteria.setLogType("INFO");
|
||||
return new ResponseEntity<>(logService.queryAll(criteria,pageable), HttpStatus.OK);
|
||||
@@ -77,7 +77,7 @@ public class LogController {
|
||||
|
||||
@GetMapping(value = "/error")
|
||||
@ApiOperation("错误日志查询")
|
||||
@PreAuthorize("@el.check()")
|
||||
@PreAuthorize("@perm.check()")
|
||||
public ResponseEntity<Object> queryErrorLog(LogQueryCriteria criteria, Pageable pageable){
|
||||
criteria.setLogType("ERROR");
|
||||
return new ResponseEntity<>(logService.queryAll(criteria,pageable), HttpStatus.OK);
|
||||
@@ -85,14 +85,14 @@ public class LogController {
|
||||
|
||||
@GetMapping(value = "/error/{id}")
|
||||
@ApiOperation("日志异常详情查询")
|
||||
@PreAuthorize("@el.check()")
|
||||
@PreAuthorize("@perm.check()")
|
||||
public ResponseEntity<Object> queryErrorLogDetail(@PathVariable Long id){
|
||||
return new ResponseEntity<>(logService.findByErrDetail(id), HttpStatus.OK);
|
||||
}
|
||||
@DeleteMapping(value = "/del/error")
|
||||
@Log("删除所有ERROR日志")
|
||||
@ApiOperation("删除所有ERROR日志")
|
||||
@PreAuthorize("@el.check()")
|
||||
@PreAuthorize("@perm.check()")
|
||||
public ResponseEntity<Object> delAllErrorLog(){
|
||||
logService.delAllByError();
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
@@ -101,7 +101,7 @@ public class LogController {
|
||||
@DeleteMapping(value = "/del/info")
|
||||
@Log("删除所有INFO日志")
|
||||
@ApiOperation("删除所有INFO日志")
|
||||
@PreAuthorize("@el.check()")
|
||||
@PreAuthorize("@perm.check()")
|
||||
public ResponseEntity<Object> delAllInfoLog(){
|
||||
logService.delAllByInfo();
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@ package priv.alawn.aladmin.service.mapstruct;
|
||||
|
||||
import priv.alawn.aladmin.domain.Log;
|
||||
import priv.alawn.aladmin.service.dto.LogErrorDTO;
|
||||
import priv.alawn.aladmin.base.BaseMapper;
|
||||
import priv.alawn.aladmin.base.SuperMapper;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
@@ -26,6 +26,6 @@ import org.mapstruct.ReportingPolicy;
|
||||
* @date 2019-5-22
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface LogErrorMapper extends BaseMapper<LogErrorDTO, Log> {
|
||||
public interface LogErrorMapper extends SuperMapper<LogErrorDTO, Log> {
|
||||
|
||||
}
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
package priv.alawn.aladmin.service.mapstruct;
|
||||
|
||||
import priv.alawn.aladmin.domain.Log;
|
||||
import priv.alawn.aladmin.base.BaseMapper;
|
||||
import priv.alawn.aladmin.base.SuperMapper;
|
||||
import priv.alawn.aladmin.service.dto.LogSmallDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
@@ -26,6 +26,6 @@ import org.mapstruct.ReportingPolicy;
|
||||
* @date 2019-5-22
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface LogSmallMapper extends BaseMapper<LogSmallDTO, Log> {
|
||||
public interface LogSmallMapper extends SuperMapper<LogSmallDTO, Log> {
|
||||
|
||||
}
|
||||
@@ -19,6 +19,14 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- 指标管理 -->
|
||||
<dependency>
|
||||
<groupId>priv.alawn</groupId>
|
||||
<artifactId>aladmin-index</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 代码生成模块 -->
|
||||
<dependency>
|
||||
<groupId>priv.alawn</groupId>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package priv.alawn.aladmin;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import priv.alawn.aladmin.annotation.rest.AnonymousGetMapping;
|
||||
import priv.alawn.aladmin.utils.SpringContextHolder;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
@@ -41,6 +42,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@SpringBootApplication
|
||||
@EnableTransactionManagement
|
||||
@EnableJpaAuditing(auditorAwareRef = "auditorAware")
|
||||
//@MapperScan("priv.alawn.aladmin.modules.idx.mapper")
|
||||
public class Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -46,14 +46,14 @@ public class AppController {
|
||||
|
||||
@ApiOperation("导出应用数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('app:list')")
|
||||
@PreAuthorize("@perm.check('app:list')")
|
||||
public void exportApp(HttpServletResponse response, AppQueryCriteria criteria) throws IOException {
|
||||
appService.download(appService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询应用")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('app:list')")
|
||||
@PreAuthorize("@perm.check('app:list')")
|
||||
public ResponseEntity<Object> queryApp(AppQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(appService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class AppController {
|
||||
@Log("新增应用")
|
||||
@ApiOperation(value = "新增应用")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('app:add')")
|
||||
@PreAuthorize("@perm.check('app:add')")
|
||||
public ResponseEntity<Object> createApp(@Validated @RequestBody App resources){
|
||||
appService.create(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
@@ -70,7 +70,7 @@ public class AppController {
|
||||
@Log("修改应用")
|
||||
@ApiOperation(value = "修改应用")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('app:edit')")
|
||||
@PreAuthorize("@perm.check('app:edit')")
|
||||
public ResponseEntity<Object> updateApp(@Validated @RequestBody App resources){
|
||||
appService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -79,7 +79,7 @@ public class AppController {
|
||||
@Log("删除应用")
|
||||
@ApiOperation(value = "删除应用")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('app:del')")
|
||||
@PreAuthorize("@perm.check('app:del')")
|
||||
public ResponseEntity<Object> deleteApp(@RequestBody Set<Long> ids){
|
||||
appService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
||||
+7
-7
@@ -54,14 +54,14 @@ public class DatabaseController {
|
||||
|
||||
@ApiOperation("导出数据库数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('database:list')")
|
||||
@PreAuthorize("@perm.check('database:list')")
|
||||
public void exportDatabase(HttpServletResponse response, DatabaseQueryCriteria criteria) throws IOException {
|
||||
databaseService.download(databaseService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询数据库")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('database:list')")
|
||||
@PreAuthorize("@perm.check('database:list')")
|
||||
public ResponseEntity<Object> queryDatabase(DatabaseQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(databaseService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
@@ -69,7 +69,7 @@ public class DatabaseController {
|
||||
@Log("新增数据库")
|
||||
@ApiOperation(value = "新增数据库")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('database:add')")
|
||||
@PreAuthorize("@perm.check('database:add')")
|
||||
public ResponseEntity<Object> createDatabase(@Validated @RequestBody Database resources){
|
||||
databaseService.create(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
@@ -78,7 +78,7 @@ public class DatabaseController {
|
||||
@Log("修改数据库")
|
||||
@ApiOperation(value = "修改数据库")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('database:edit')")
|
||||
@PreAuthorize("@perm.check('database:edit')")
|
||||
public ResponseEntity<Object> updateDatabase(@Validated @RequestBody Database resources){
|
||||
databaseService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -87,7 +87,7 @@ public class DatabaseController {
|
||||
@Log("删除数据库")
|
||||
@ApiOperation(value = "删除数据库")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('database:del')")
|
||||
@PreAuthorize("@perm.check('database:del')")
|
||||
public ResponseEntity<Object> deleteDatabase(@RequestBody Set<String> ids){
|
||||
databaseService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
@@ -96,7 +96,7 @@ public class DatabaseController {
|
||||
@Log("测试数据库链接")
|
||||
@ApiOperation(value = "测试数据库链接")
|
||||
@PostMapping("/testConnect")
|
||||
@PreAuthorize("@el.check('database:testConnect')")
|
||||
@PreAuthorize("@perm.check('database:testConnect')")
|
||||
public ResponseEntity<Object> testConnect(@Validated @RequestBody Database resources){
|
||||
return new ResponseEntity<>(databaseService.testConnection(resources),HttpStatus.CREATED);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public class DatabaseController {
|
||||
@Log("执行SQL脚本")
|
||||
@ApiOperation(value = "执行SQL脚本")
|
||||
@PostMapping(value = "/upload")
|
||||
@PreAuthorize("@el.check('database:add')")
|
||||
@PreAuthorize("@perm.check('database:add')")
|
||||
public ResponseEntity<Object> uploadDatabase(@RequestBody MultipartFile file, HttpServletRequest request)throws Exception{
|
||||
String id = request.getParameter("id");
|
||||
DatabaseDto database = databaseService.findById(id);
|
||||
|
||||
+10
-10
@@ -56,14 +56,14 @@ public class DeployController {
|
||||
|
||||
@ApiOperation("导出部署数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('database:list')")
|
||||
@PreAuthorize("@perm.check('database:list')")
|
||||
public void exportDeployData(HttpServletResponse response, DeployQueryCriteria criteria) throws IOException {
|
||||
deployService.download(deployService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询部署")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('deploy:list')")
|
||||
@PreAuthorize("@perm.check('deploy:list')")
|
||||
public ResponseEntity<Object> queryDeployData(DeployQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(deployService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
@@ -71,7 +71,7 @@ public class DeployController {
|
||||
@Log("新增部署")
|
||||
@ApiOperation(value = "新增部署")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('deploy:add')")
|
||||
@PreAuthorize("@perm.check('deploy:add')")
|
||||
public ResponseEntity<Object> createDeploy(@Validated @RequestBody Deploy resources){
|
||||
deployService.create(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
@@ -80,7 +80,7 @@ public class DeployController {
|
||||
@Log("修改部署")
|
||||
@ApiOperation(value = "修改部署")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('deploy:edit')")
|
||||
@PreAuthorize("@perm.check('deploy:edit')")
|
||||
public ResponseEntity<Object> updateDeploy(@Validated @RequestBody Deploy resources){
|
||||
deployService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -89,7 +89,7 @@ public class DeployController {
|
||||
@Log("删除部署")
|
||||
@ApiOperation(value = "删除部署")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('deploy:del')")
|
||||
@PreAuthorize("@perm.check('deploy:del')")
|
||||
public ResponseEntity<Object> deleteDeploy(@RequestBody Set<Long> ids){
|
||||
deployService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
@@ -98,7 +98,7 @@ public class DeployController {
|
||||
@Log("上传文件部署")
|
||||
@ApiOperation(value = "上传文件部署")
|
||||
@PostMapping(value = "/upload")
|
||||
@PreAuthorize("@el.check('deploy:edit')")
|
||||
@PreAuthorize("@perm.check('deploy:edit')")
|
||||
public ResponseEntity<Object> uploadDeploy(@RequestBody MultipartFile file, HttpServletRequest request)throws Exception{
|
||||
Long id = Long.valueOf(request.getParameter("id"));
|
||||
String fileName = "";
|
||||
@@ -121,7 +121,7 @@ public class DeployController {
|
||||
@Log("系统还原")
|
||||
@ApiOperation(value = "系统还原")
|
||||
@PostMapping(value = "/serverReduction")
|
||||
@PreAuthorize("@el.check('deploy:edit')")
|
||||
@PreAuthorize("@perm.check('deploy:edit')")
|
||||
public ResponseEntity<Object> serverReduction(@Validated @RequestBody DeployHistory resources){
|
||||
String result = deployService.serverReduction(resources);
|
||||
return new ResponseEntity<>(result,HttpStatus.OK);
|
||||
@@ -129,7 +129,7 @@ public class DeployController {
|
||||
@Log("服务运行状态")
|
||||
@ApiOperation(value = "服务运行状态")
|
||||
@PostMapping(value = "/serverStatus")
|
||||
@PreAuthorize("@el.check('deploy:edit')")
|
||||
@PreAuthorize("@perm.check('deploy:edit')")
|
||||
public ResponseEntity<Object> serverStatus(@Validated @RequestBody Deploy resources){
|
||||
String result = deployService.serverStatus(resources);
|
||||
return new ResponseEntity<>(result,HttpStatus.OK);
|
||||
@@ -137,7 +137,7 @@ public class DeployController {
|
||||
@Log("启动服务")
|
||||
@ApiOperation(value = "启动服务")
|
||||
@PostMapping(value = "/startServer")
|
||||
@PreAuthorize("@el.check('deploy:edit')")
|
||||
@PreAuthorize("@perm.check('deploy:edit')")
|
||||
public ResponseEntity<Object> startServer(@Validated @RequestBody Deploy resources){
|
||||
String result = deployService.startServer(resources);
|
||||
return new ResponseEntity<>(result,HttpStatus.OK);
|
||||
@@ -145,7 +145,7 @@ public class DeployController {
|
||||
@Log("停止服务")
|
||||
@ApiOperation(value = "停止服务")
|
||||
@PostMapping(value = "/stopServer")
|
||||
@PreAuthorize("@el.check('deploy:edit')")
|
||||
@PreAuthorize("@perm.check('deploy:edit')")
|
||||
public ResponseEntity<Object> stopServer(@Validated @RequestBody Deploy resources){
|
||||
String result = deployService.stopServer(resources);
|
||||
return new ResponseEntity<>(result,HttpStatus.OK);
|
||||
|
||||
+3
-3
@@ -44,14 +44,14 @@ public class DeployHistoryController {
|
||||
|
||||
@ApiOperation("导出部署历史数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('deployHistory:list')")
|
||||
@PreAuthorize("@perm.check('deployHistory:list')")
|
||||
public void exportDeployHistory(HttpServletResponse response, DeployHistoryQueryCriteria criteria) throws IOException {
|
||||
deployhistoryService.download(deployhistoryService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询部署历史")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('deployHistory:list')")
|
||||
@PreAuthorize("@perm.check('deployHistory:list')")
|
||||
public ResponseEntity<Object> queryDeployHistory(DeployHistoryQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(deployhistoryService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class DeployHistoryController {
|
||||
@Log("删除DeployHistory")
|
||||
@ApiOperation(value = "删除部署历史")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('deployHistory:del')")
|
||||
@PreAuthorize("@perm.check('deployHistory:del')")
|
||||
public ResponseEntity<Object> deleteDeployHistory(@RequestBody Set<String> ids){
|
||||
deployhistoryService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
||||
+6
-6
@@ -46,14 +46,14 @@ public class ServerDeployController {
|
||||
|
||||
@ApiOperation("导出服务器数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('serverDeploy:list')")
|
||||
@PreAuthorize("@perm.check('serverDeploy:list')")
|
||||
public void exportServerDeploy(HttpServletResponse response, ServerDeployQueryCriteria criteria) throws IOException {
|
||||
serverDeployService.download(serverDeployService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询服务器")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('serverDeploy:list')")
|
||||
@PreAuthorize("@perm.check('serverDeploy:list')")
|
||||
public ResponseEntity<Object> queryServerDeploy(ServerDeployQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(serverDeployService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class ServerDeployController {
|
||||
@Log("新增服务器")
|
||||
@ApiOperation(value = "新增服务器")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('serverDeploy:add')")
|
||||
@PreAuthorize("@perm.check('serverDeploy:add')")
|
||||
public ResponseEntity<Object> createServerDeploy(@Validated @RequestBody ServerDeploy resources){
|
||||
serverDeployService.create(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
@@ -70,7 +70,7 @@ public class ServerDeployController {
|
||||
@Log("修改服务器")
|
||||
@ApiOperation(value = "修改服务器")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('serverDeploy:edit')")
|
||||
@PreAuthorize("@perm.check('serverDeploy:edit')")
|
||||
public ResponseEntity<Object> updateServerDeploy(@Validated @RequestBody ServerDeploy resources){
|
||||
serverDeployService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -79,7 +79,7 @@ public class ServerDeployController {
|
||||
@Log("删除服务器")
|
||||
@ApiOperation(value = "删除Server")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('serverDeploy:del')")
|
||||
@PreAuthorize("@perm.check('serverDeploy:del')")
|
||||
public ResponseEntity<Object> deleteServerDeploy(@RequestBody Set<Long> ids){
|
||||
serverDeployService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
@@ -88,7 +88,7 @@ public class ServerDeployController {
|
||||
@Log("测试连接服务器")
|
||||
@ApiOperation(value = "测试连接服务器")
|
||||
@PostMapping("/testConnect")
|
||||
@PreAuthorize("@el.check('serverDeploy:add')")
|
||||
@PreAuthorize("@perm.check('serverDeploy:add')")
|
||||
public ResponseEntity<Object> testConnectServerDeploy(@Validated @RequestBody ServerDeploy resources){
|
||||
return new ResponseEntity<>(serverDeployService.testConnect(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
package priv.alawn.aladmin.modules.mnt.service.mapstruct;
|
||||
|
||||
import priv.alawn.aladmin.modules.mnt.service.dto.AppDto;
|
||||
import priv.alawn.aladmin.base.BaseMapper;
|
||||
import priv.alawn.aladmin.base.SuperMapper;
|
||||
import priv.alawn.aladmin.modules.mnt.domain.App;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
@@ -26,6 +26,6 @@ import org.mapstruct.ReportingPolicy;
|
||||
* @date 2019-08-24
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface AppMapper extends BaseMapper<AppDto, App> {
|
||||
public interface AppMapper extends SuperMapper<AppDto, App> {
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package priv.alawn.aladmin.modules.mnt.service.mapstruct;
|
||||
|
||||
import priv.alawn.aladmin.base.BaseMapper;
|
||||
import priv.alawn.aladmin.base.SuperMapper;
|
||||
import priv.alawn.aladmin.modules.mnt.domain.Database;
|
||||
import priv.alawn.aladmin.modules.mnt.service.dto.DatabaseDto;
|
||||
import org.mapstruct.Mapper;
|
||||
@@ -26,6 +26,6 @@ import org.mapstruct.ReportingPolicy;
|
||||
* @date 2019-08-24
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface DatabaseMapper extends BaseMapper<DatabaseDto, Database> {
|
||||
public interface DatabaseMapper extends SuperMapper<DatabaseDto, Database> {
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package priv.alawn.aladmin.modules.mnt.service.mapstruct;
|
||||
|
||||
import priv.alawn.aladmin.base.BaseMapper;
|
||||
import priv.alawn.aladmin.base.SuperMapper;
|
||||
import priv.alawn.aladmin.modules.mnt.domain.DeployHistory;
|
||||
import priv.alawn.aladmin.modules.mnt.service.dto.DeployHistoryDto;
|
||||
import org.mapstruct.Mapper;
|
||||
@@ -26,6 +26,6 @@ import org.mapstruct.ReportingPolicy;
|
||||
* @date 2019-08-24
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface DeployHistoryMapper extends BaseMapper<DeployHistoryDto, DeployHistory> {
|
||||
public interface DeployHistoryMapper extends SuperMapper<DeployHistoryDto, DeployHistory> {
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
package priv.alawn.aladmin.modules.mnt.service.mapstruct;
|
||||
|
||||
import priv.alawn.aladmin.modules.mnt.service.dto.DeployDto;
|
||||
import priv.alawn.aladmin.base.BaseMapper;
|
||||
import priv.alawn.aladmin.base.SuperMapper;
|
||||
import priv.alawn.aladmin.modules.mnt.domain.Deploy;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
@@ -26,6 +26,6 @@ import org.mapstruct.ReportingPolicy;
|
||||
* @date 2019-08-24
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {AppMapper.class, ServerDeployMapper.class},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface DeployMapper extends BaseMapper<DeployDto, Deploy> {
|
||||
public interface DeployMapper extends SuperMapper<DeployDto, Deploy> {
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package priv.alawn.aladmin.modules.mnt.service.mapstruct;
|
||||
|
||||
import priv.alawn.aladmin.base.BaseMapper;
|
||||
import priv.alawn.aladmin.base.SuperMapper;
|
||||
import priv.alawn.aladmin.modules.mnt.domain.ServerDeploy;
|
||||
import priv.alawn.aladmin.modules.mnt.service.dto.ServerDeployDto;
|
||||
import org.mapstruct.Mapper;
|
||||
@@ -26,6 +26,6 @@ import org.mapstruct.ReportingPolicy;
|
||||
* @date 2019-08-24
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface ServerDeployMapper extends BaseMapper<ServerDeployDto, ServerDeploy> {
|
||||
public interface ServerDeployMapper extends SuperMapper<ServerDeployDto, ServerDeploy> {
|
||||
|
||||
}
|
||||
|
||||
+9
-9
@@ -51,28 +51,28 @@ public class QuartzJobController {
|
||||
|
||||
@ApiOperation("查询定时任务")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('timing:list')")
|
||||
@PreAuthorize("@perm.check('timing:list')")
|
||||
public ResponseEntity<Object> queryQuartzJob(JobQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(quartzJobService.queryAll(criteria,pageable), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出任务数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('timing:list')")
|
||||
@PreAuthorize("@perm.check('timing:list')")
|
||||
public void exportQuartzJob(HttpServletResponse response, JobQueryCriteria criteria) throws IOException {
|
||||
quartzJobService.download(quartzJobService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("导出日志数据")
|
||||
@GetMapping(value = "/logs/download")
|
||||
@PreAuthorize("@el.check('timing:list')")
|
||||
@PreAuthorize("@perm.check('timing:list')")
|
||||
public void exportQuartzJobLog(HttpServletResponse response, JobQueryCriteria criteria) throws IOException {
|
||||
quartzJobService.downloadLog(quartzJobService.queryAllLog(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("查询任务执行日志")
|
||||
@GetMapping(value = "/logs")
|
||||
@PreAuthorize("@el.check('timing:list')")
|
||||
@PreAuthorize("@perm.check('timing:list')")
|
||||
public ResponseEntity<Object> queryQuartzJobLog(JobQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(quartzJobService.queryAllLog(criteria,pageable), HttpStatus.OK);
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public class QuartzJobController {
|
||||
@Log("新增定时任务")
|
||||
@ApiOperation("新增定时任务")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('timing:add')")
|
||||
@PreAuthorize("@perm.check('timing:add')")
|
||||
public ResponseEntity<Object> createQuartzJob(@Validated @RequestBody QuartzJob resources){
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
@@ -94,7 +94,7 @@ public class QuartzJobController {
|
||||
@Log("修改定时任务")
|
||||
@ApiOperation("修改定时任务")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('timing:edit')")
|
||||
@PreAuthorize("@perm.check('timing:edit')")
|
||||
public ResponseEntity<Object> updateQuartzJob(@Validated(QuartzJob.Update.class) @RequestBody QuartzJob resources){
|
||||
// 验证Bean是不是合法的,合法的定时任务 Bean 需要用 @Service 定义
|
||||
checkBean(resources.getBeanName());
|
||||
@@ -105,7 +105,7 @@ public class QuartzJobController {
|
||||
@Log("更改定时任务状态")
|
||||
@ApiOperation("更改定时任务状态")
|
||||
@PutMapping(value = "/{id}")
|
||||
@PreAuthorize("@el.check('timing:edit')")
|
||||
@PreAuthorize("@perm.check('timing:edit')")
|
||||
public ResponseEntity<Object> updateQuartzJobStatus(@PathVariable Long id){
|
||||
quartzJobService.updateIsPause(quartzJobService.findById(id));
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -114,7 +114,7 @@ public class QuartzJobController {
|
||||
@Log("执行定时任务")
|
||||
@ApiOperation("执行定时任务")
|
||||
@PutMapping(value = "/exec/{id}")
|
||||
@PreAuthorize("@el.check('timing:edit')")
|
||||
@PreAuthorize("@perm.check('timing:edit')")
|
||||
public ResponseEntity<Object> executionQuartzJob(@PathVariable Long id){
|
||||
quartzJobService.execution(quartzJobService.findById(id));
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -123,7 +123,7 @@ public class QuartzJobController {
|
||||
@Log("删除定时任务")
|
||||
@ApiOperation("删除定时任务")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('timing:del')")
|
||||
@PreAuthorize("@perm.check('timing:del')")
|
||||
public ResponseEntity<Object> deleteQuartzJob(@RequestBody Set<Long> ids){
|
||||
quartzJobService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
||||
+3
-3
@@ -42,21 +42,21 @@ public class OnlineController {
|
||||
|
||||
@ApiOperation("查询在线用户")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check()")
|
||||
@PreAuthorize("@perm.check()")
|
||||
public ResponseEntity<Object> queryOnlineUser(String filter, Pageable pageable){
|
||||
return new ResponseEntity<>(onlineUserService.getAll(filter, pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check()")
|
||||
@PreAuthorize("@perm.check()")
|
||||
public void exportOnlineUser(HttpServletResponse response, String filter) throws IOException {
|
||||
onlineUserService.download(onlineUserService.getAll(filter), response);
|
||||
}
|
||||
|
||||
@ApiOperation("踢出用户")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check()")
|
||||
@PreAuthorize("@perm.check()")
|
||||
public ResponseEntity<Object> deleteOnlineUser(@RequestBody Set<String> keys) throws Exception {
|
||||
for (String key : keys) {
|
||||
// 解密Key
|
||||
|
||||
+6
-6
@@ -49,14 +49,14 @@ public class DeptController {
|
||||
|
||||
@ApiOperation("导出部门数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('dept:list')")
|
||||
@PreAuthorize("@perm.check('dept:list')")
|
||||
public void exportDept(HttpServletResponse response, DeptQueryCriteria criteria) throws Exception {
|
||||
deptService.download(deptService.queryAll(criteria, false), response);
|
||||
}
|
||||
|
||||
@ApiOperation("查询部门")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('user:list','dept:list')")
|
||||
@PreAuthorize("@perm.check('user:list','dept:list')")
|
||||
public ResponseEntity<Object> queryDept(DeptQueryCriteria criteria) throws Exception {
|
||||
List<DeptDto> deptDtos = deptService.queryAll(criteria, true);
|
||||
return new ResponseEntity<>(PageUtil.toPage(deptDtos, deptDtos.size()),HttpStatus.OK);
|
||||
@@ -64,7 +64,7 @@ public class DeptController {
|
||||
|
||||
@ApiOperation("查询部门:根据ID获取同级与上级数据")
|
||||
@PostMapping("/superior")
|
||||
@PreAuthorize("@el.check('user:list','dept:list')")
|
||||
@PreAuthorize("@perm.check('user:list','dept:list')")
|
||||
public ResponseEntity<Object> getDeptSuperior(@RequestBody List<Long> ids) {
|
||||
Set<DeptDto> deptDtos = new LinkedHashSet<>();
|
||||
for (Long id : ids) {
|
||||
@@ -78,7 +78,7 @@ public class DeptController {
|
||||
@Log("新增部门")
|
||||
@ApiOperation("新增部门")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('dept:add')")
|
||||
@PreAuthorize("@perm.check('dept:add')")
|
||||
public ResponseEntity<Object> createDept(@Validated @RequestBody Dept resources){
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
@@ -90,7 +90,7 @@ public class DeptController {
|
||||
@Log("修改部门")
|
||||
@ApiOperation("修改部门")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('dept:edit')")
|
||||
@PreAuthorize("@perm.check('dept:edit')")
|
||||
public ResponseEntity<Object> updateDept(@Validated(Dept.Update.class) @RequestBody Dept resources){
|
||||
deptService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -99,7 +99,7 @@ public class DeptController {
|
||||
@Log("删除部门")
|
||||
@ApiOperation("删除部门")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('dept:del')")
|
||||
@PreAuthorize("@perm.check('dept:del')")
|
||||
public ResponseEntity<Object> deleteDept(@RequestBody Set<Long> ids){
|
||||
Set<DeptDto> deptDtos = new HashSet<>();
|
||||
for (Long id : ids) {
|
||||
|
||||
+6
-6
@@ -48,21 +48,21 @@ public class DictController {
|
||||
|
||||
@ApiOperation("导出字典数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('dict:list')")
|
||||
@PreAuthorize("@perm.check('dict:list')")
|
||||
public void exportDict(HttpServletResponse response, DictQueryCriteria criteria) throws IOException {
|
||||
dictService.download(dictService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("查询字典")
|
||||
@GetMapping(value = "/all")
|
||||
@PreAuthorize("@el.check('dict:list')")
|
||||
@PreAuthorize("@perm.check('dict:list')")
|
||||
public ResponseEntity<Object> queryAllDict(){
|
||||
return new ResponseEntity<>(dictService.queryAll(new DictQueryCriteria()),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("查询字典")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('dict:list')")
|
||||
@PreAuthorize("@perm.check('dict:list')")
|
||||
public ResponseEntity<Object> queryDict(DictQueryCriteria resources, Pageable pageable){
|
||||
return new ResponseEntity<>(dictService.queryAll(resources,pageable),HttpStatus.OK);
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public class DictController {
|
||||
@Log("新增字典")
|
||||
@ApiOperation("新增字典")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('dict:add')")
|
||||
@PreAuthorize("@perm.check('dict:add')")
|
||||
public ResponseEntity<Object> createDict(@Validated @RequestBody Dict resources){
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
@@ -82,7 +82,7 @@ public class DictController {
|
||||
@Log("修改字典")
|
||||
@ApiOperation("修改字典")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('dict:edit')")
|
||||
@PreAuthorize("@perm.check('dict:edit')")
|
||||
public ResponseEntity<Object> updateDict(@Validated(Dict.Update.class) @RequestBody Dict resources){
|
||||
dictService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -91,7 +91,7 @@ public class DictController {
|
||||
@Log("删除字典")
|
||||
@ApiOperation("删除字典")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('dict:del')")
|
||||
@PreAuthorize("@perm.check('dict:del')")
|
||||
public ResponseEntity<Object> deleteDict(@RequestBody Set<Long> ids){
|
||||
dictService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
||||
+3
-3
@@ -70,7 +70,7 @@ public class DictDetailController {
|
||||
@Log("新增字典详情")
|
||||
@ApiOperation("新增字典详情")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('dict:add')")
|
||||
@PreAuthorize("@perm.check('dict:add')")
|
||||
public ResponseEntity<Object> createDictDetail(@Validated @RequestBody DictDetail resources){
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
@@ -82,7 +82,7 @@ public class DictDetailController {
|
||||
@Log("修改字典详情")
|
||||
@ApiOperation("修改字典详情")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('dict:edit')")
|
||||
@PreAuthorize("@perm.check('dict:edit')")
|
||||
public ResponseEntity<Object> updateDictDetail(@Validated(DictDetail.Update.class) @RequestBody DictDetail resources){
|
||||
dictDetailService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -91,7 +91,7 @@ public class DictDetailController {
|
||||
@Log("删除字典详情")
|
||||
@ApiOperation("删除字典详情")
|
||||
@DeleteMapping(value = "/{id}")
|
||||
@PreAuthorize("@el.check('dict:del')")
|
||||
@PreAuthorize("@perm.check('dict:del')")
|
||||
public ResponseEntity<Object> deleteDictDetail(@PathVariable Long id){
|
||||
dictDetailService.delete(id);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
||||
+5
-5
@@ -48,14 +48,14 @@ public class JobController {
|
||||
|
||||
@ApiOperation("导出岗位数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('job:list')")
|
||||
@PreAuthorize("@perm.check('job:list')")
|
||||
public void exportJob(HttpServletResponse response, JobQueryCriteria criteria) throws IOException {
|
||||
jobService.download(jobService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("查询岗位")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('job:list','user:list')")
|
||||
@PreAuthorize("@perm.check('job:list','user:list')")
|
||||
public ResponseEntity<Object> queryJob(JobQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(jobService.queryAll(criteria, pageable),HttpStatus.OK);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public class JobController {
|
||||
@Log("新增岗位")
|
||||
@ApiOperation("新增岗位")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('job:add')")
|
||||
@PreAuthorize("@perm.check('job:add')")
|
||||
public ResponseEntity<Object> createJob(@Validated @RequestBody Job resources){
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
@@ -75,7 +75,7 @@ public class JobController {
|
||||
@Log("修改岗位")
|
||||
@ApiOperation("修改岗位")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('job:edit')")
|
||||
@PreAuthorize("@perm.check('job:edit')")
|
||||
public ResponseEntity<Object> updateJob(@Validated(Job.Update.class) @RequestBody Job resources){
|
||||
jobService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -84,7 +84,7 @@ public class JobController {
|
||||
@Log("删除岗位")
|
||||
@ApiOperation("删除岗位")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('job:del')")
|
||||
@PreAuthorize("@perm.check('job:del')")
|
||||
public ResponseEntity<Object> deleteJob(@RequestBody Set<Long> ids){
|
||||
// 验证是否被用户关联
|
||||
jobService.verification(ids);
|
||||
|
||||
+8
-8
@@ -54,7 +54,7 @@ public class MenuController {
|
||||
|
||||
@ApiOperation("导出菜单数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('menu:list')")
|
||||
@PreAuthorize("@perm.check('menu:list')")
|
||||
public void exportMenu(HttpServletResponse response, MenuQueryCriteria criteria) throws Exception {
|
||||
menuService.download(menuService.queryAll(criteria, false), response);
|
||||
}
|
||||
@@ -69,14 +69,14 @@ public class MenuController {
|
||||
|
||||
@ApiOperation("返回全部的菜单")
|
||||
@GetMapping(value = "/lazy")
|
||||
@PreAuthorize("@el.check('menu:list','roles:list')")
|
||||
@PreAuthorize("@perm.check('menu:list','roles:list')")
|
||||
public ResponseEntity<Object> queryAllMenu(@RequestParam Long pid){
|
||||
return new ResponseEntity<>(menuService.getMenus(pid),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("根据菜单ID返回所有子节点ID,包含自身ID")
|
||||
@GetMapping(value = "/child")
|
||||
@PreAuthorize("@el.check('menu:list','roles:list')")
|
||||
@PreAuthorize("@perm.check('menu:list','roles:list')")
|
||||
public ResponseEntity<Object> childMenu(@RequestParam Long id){
|
||||
Set<Menu> menuSet = new HashSet<>();
|
||||
List<MenuDto> menuList = menuService.getMenus(id);
|
||||
@@ -88,7 +88,7 @@ public class MenuController {
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询菜单")
|
||||
@PreAuthorize("@el.check('menu:list')")
|
||||
@PreAuthorize("@perm.check('menu:list')")
|
||||
public ResponseEntity<Object> queryMenu(MenuQueryCriteria criteria) throws Exception {
|
||||
List<MenuDto> menuDtoList = menuService.queryAll(criteria, true);
|
||||
return new ResponseEntity<>(PageUtil.toPage(menuDtoList, menuDtoList.size()),HttpStatus.OK);
|
||||
@@ -96,7 +96,7 @@ public class MenuController {
|
||||
|
||||
@ApiOperation("查询菜单:根据ID获取同级与上级数据")
|
||||
@PostMapping("/superior")
|
||||
@PreAuthorize("@el.check('menu:list')")
|
||||
@PreAuthorize("@perm.check('menu:list')")
|
||||
public ResponseEntity<Object> getMenuSuperior(@RequestBody List<Long> ids) {
|
||||
Set<MenuDto> menuDtos = new LinkedHashSet<>();
|
||||
if(CollectionUtil.isNotEmpty(ids)){
|
||||
@@ -112,7 +112,7 @@ public class MenuController {
|
||||
@Log("新增菜单")
|
||||
@ApiOperation("新增菜单")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('menu:add')")
|
||||
@PreAuthorize("@perm.check('menu:add')")
|
||||
public ResponseEntity<Object> createMenu(@Validated @RequestBody Menu resources){
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
@@ -124,7 +124,7 @@ public class MenuController {
|
||||
@Log("修改菜单")
|
||||
@ApiOperation("修改菜单")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('menu:edit')")
|
||||
@PreAuthorize("@perm.check('menu:edit')")
|
||||
public ResponseEntity<Object> updateMenu(@Validated(Menu.Update.class) @RequestBody Menu resources){
|
||||
menuService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -133,7 +133,7 @@ public class MenuController {
|
||||
@Log("删除菜单")
|
||||
@ApiOperation("删除菜单")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('menu:del')")
|
||||
@PreAuthorize("@perm.check('menu:del')")
|
||||
public ResponseEntity<Object> deleteMenu(@RequestBody Set<Long> ids){
|
||||
Set<Menu> menuSet = new HashSet<>();
|
||||
for (Long id : ids) {
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ public class MonitorController {
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询服务监控")
|
||||
@PreAuthorize("@el.check('monitor:list')")
|
||||
@PreAuthorize("@perm.check('monitor:list')")
|
||||
public ResponseEntity<Object> queryMonitor(){
|
||||
return new ResponseEntity<>(serverService.getServers(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
+8
-8
@@ -56,28 +56,28 @@ public class RoleController {
|
||||
|
||||
@ApiOperation("获取单个role")
|
||||
@GetMapping(value = "/{id}")
|
||||
@PreAuthorize("@el.check('roles:list')")
|
||||
@PreAuthorize("@perm.check('roles:list')")
|
||||
public ResponseEntity<Object> findRoleById(@PathVariable Long id){
|
||||
return new ResponseEntity<>(roleService.findById(id), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出角色数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('role:list')")
|
||||
@PreAuthorize("@perm.check('role:list')")
|
||||
public void exportRole(HttpServletResponse response, RoleQueryCriteria criteria) throws IOException {
|
||||
roleService.download(roleService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("返回全部的角色")
|
||||
@GetMapping(value = "/all")
|
||||
@PreAuthorize("@el.check('roles:list','user:add','user:edit')")
|
||||
@PreAuthorize("@perm.check('roles:list','user:add','user:edit')")
|
||||
public ResponseEntity<Object> queryAllRole(){
|
||||
return new ResponseEntity<>(roleService.queryAll(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("查询角色")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('roles:list')")
|
||||
@PreAuthorize("@perm.check('roles:list')")
|
||||
public ResponseEntity<Object> queryRole(RoleQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(roleService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
@@ -91,7 +91,7 @@ public class RoleController {
|
||||
@Log("新增角色")
|
||||
@ApiOperation("新增角色")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('roles:add')")
|
||||
@PreAuthorize("@perm.check('roles:add')")
|
||||
public ResponseEntity<Object> createRole(@Validated @RequestBody Role resources){
|
||||
if (resources.getId() != null) {
|
||||
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
|
||||
@@ -104,7 +104,7 @@ public class RoleController {
|
||||
@Log("修改角色")
|
||||
@ApiOperation("修改角色")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('roles:edit')")
|
||||
@PreAuthorize("@perm.check('roles:edit')")
|
||||
public ResponseEntity<Object> updateRole(@Validated(Role.Update.class) @RequestBody Role resources){
|
||||
getLevels(resources.getLevel());
|
||||
roleService.update(resources);
|
||||
@@ -114,7 +114,7 @@ public class RoleController {
|
||||
@Log("修改角色菜单")
|
||||
@ApiOperation("修改角色菜单")
|
||||
@PutMapping(value = "/menu")
|
||||
@PreAuthorize("@el.check('roles:edit')")
|
||||
@PreAuthorize("@perm.check('roles:edit')")
|
||||
public ResponseEntity<Object> updateRoleMenu(@RequestBody Role resources){
|
||||
RoleDto role = roleService.findById(resources.getId());
|
||||
getLevels(role.getLevel());
|
||||
@@ -125,7 +125,7 @@ public class RoleController {
|
||||
@Log("删除角色")
|
||||
@ApiOperation("删除角色")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('roles:del')")
|
||||
@PreAuthorize("@perm.check('roles:del')")
|
||||
public ResponseEntity<Object> deleteRole(@RequestBody Set<Long> ids){
|
||||
for (Long id : ids) {
|
||||
RoleDto role = roleService.findById(id);
|
||||
|
||||
+5
-5
@@ -71,14 +71,14 @@ public class UserController {
|
||||
|
||||
@ApiOperation("导出用户数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('user:list')")
|
||||
@PreAuthorize("@perm.check('user:list')")
|
||||
public void exportUser(HttpServletResponse response, UserQueryCriteria criteria) throws IOException {
|
||||
userService.download(userService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("查询用户")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('user:list')")
|
||||
@PreAuthorize("@perm.check('user:list')")
|
||||
public ResponseEntity<Object> queryUser(UserQueryCriteria criteria, Pageable pageable){
|
||||
if (!ObjectUtils.isEmpty(criteria.getDeptId())) {
|
||||
criteria.getDeptIds().add(criteria.getDeptId());
|
||||
@@ -107,7 +107,7 @@ public class UserController {
|
||||
@Log("新增用户")
|
||||
@ApiOperation("新增用户")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('user:add')")
|
||||
@PreAuthorize("@perm.check('user:add')")
|
||||
public ResponseEntity<Object> createUser(@Validated @RequestBody User resources){
|
||||
checkLevel(resources);
|
||||
// 默认密码 123456
|
||||
@@ -119,7 +119,7 @@ public class UserController {
|
||||
@Log("修改用户")
|
||||
@ApiOperation("修改用户")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('user:edit')")
|
||||
@PreAuthorize("@perm.check('user:edit')")
|
||||
public ResponseEntity<Object> updateUser(@Validated(User.Update.class) @RequestBody User resources) throws Exception {
|
||||
checkLevel(resources);
|
||||
userService.update(resources);
|
||||
@@ -140,7 +140,7 @@ public class UserController {
|
||||
@Log("删除用户")
|
||||
@ApiOperation("删除用户")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@el.check('user:del')")
|
||||
@PreAuthorize("@perm.check('user:del')")
|
||||
public ResponseEntity<Object> deleteUser(@RequestBody Set<Long> ids){
|
||||
for (Long id : ids) {
|
||||
Integer currentLevel = Collections.min(roleService.findByUsersId(SecurityUtils.getCurrentUserId()).stream().map(RoleSmallDto::getLevel).collect(Collectors.toList()));
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package priv.alawn.aladmin.modules.system.service.mapstruct;
|
||||
|
||||
import priv.alawn.aladmin.base.BaseMapper;
|
||||
import priv.alawn.aladmin.base.SuperMapper;
|
||||
import priv.alawn.aladmin.modules.system.domain.Dept;
|
||||
import priv.alawn.aladmin.modules.system.service.dto.DeptDto;
|
||||
import org.mapstruct.Mapper;
|
||||
@@ -26,5 +26,5 @@ import org.mapstruct.ReportingPolicy;
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface DeptMapper extends BaseMapper<DeptDto, Dept> {
|
||||
public interface DeptMapper extends SuperMapper<DeptDto, Dept> {
|
||||
}
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package priv.alawn.aladmin.modules.system.service.mapstruct;
|
||||
|
||||
import priv.alawn.aladmin.base.BaseMapper;
|
||||
import priv.alawn.aladmin.base.SuperMapper;
|
||||
import priv.alawn.aladmin.modules.system.domain.Dept;
|
||||
import priv.alawn.aladmin.modules.system.service.dto.DeptSmallDto;
|
||||
import org.mapstruct.Mapper;
|
||||
@@ -26,6 +26,6 @@ import org.mapstruct.ReportingPolicy;
|
||||
* @date 2019-03-25
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface DeptSmallMapper extends BaseMapper<DeptSmallDto, Dept> {
|
||||
public interface DeptSmallMapper extends SuperMapper<DeptSmallDto, Dept> {
|
||||
|
||||
}
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package priv.alawn.aladmin.modules.system.service.mapstruct;
|
||||
|
||||
import priv.alawn.aladmin.base.BaseMapper;
|
||||
import priv.alawn.aladmin.base.SuperMapper;
|
||||
import priv.alawn.aladmin.modules.system.domain.DictDetail;
|
||||
import priv.alawn.aladmin.modules.system.service.dto.DictDetailDto;
|
||||
import org.mapstruct.Mapper;
|
||||
@@ -26,6 +26,6 @@ import org.mapstruct.ReportingPolicy;
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
@Mapper(componentModel = "spring", uses = {DictSmallMapper.class}, unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface DictDetailMapper extends BaseMapper<DictDetailDto, DictDetail> {
|
||||
public interface DictDetailMapper extends SuperMapper<DictDetailDto, DictDetail> {
|
||||
|
||||
}
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package priv.alawn.aladmin.modules.system.service.mapstruct;
|
||||
|
||||
import priv.alawn.aladmin.base.BaseMapper;
|
||||
import priv.alawn.aladmin.base.SuperMapper;
|
||||
import priv.alawn.aladmin.modules.system.domain.Dict;
|
||||
import priv.alawn.aladmin.modules.system.service.dto.DictDto;
|
||||
import org.mapstruct.Mapper;
|
||||
@@ -26,6 +26,6 @@ import org.mapstruct.ReportingPolicy;
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface DictMapper extends BaseMapper<DictDto, Dict> {
|
||||
public interface DictMapper extends SuperMapper<DictDto, Dict> {
|
||||
|
||||
}
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package priv.alawn.aladmin.modules.system.service.mapstruct;
|
||||
|
||||
import priv.alawn.aladmin.base.BaseMapper;
|
||||
import priv.alawn.aladmin.base.SuperMapper;
|
||||
import priv.alawn.aladmin.modules.system.domain.Dict;
|
||||
import priv.alawn.aladmin.modules.system.service.dto.DictSmallDto;
|
||||
import org.mapstruct.Mapper;
|
||||
@@ -26,6 +26,6 @@ import org.mapstruct.ReportingPolicy;
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface DictSmallMapper extends BaseMapper<DictSmallDto, Dict> {
|
||||
public interface DictSmallMapper extends SuperMapper<DictSmallDto, Dict> {
|
||||
|
||||
}
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package priv.alawn.aladmin.modules.system.service.mapstruct;
|
||||
|
||||
import priv.alawn.aladmin.base.BaseMapper;
|
||||
import priv.alawn.aladmin.base.SuperMapper;
|
||||
import priv.alawn.aladmin.modules.system.domain.Job;
|
||||
import priv.alawn.aladmin.modules.system.service.dto.JobDto;
|
||||
import org.mapstruct.Mapper;
|
||||
@@ -26,5 +26,5 @@ import org.mapstruct.ReportingPolicy;
|
||||
* @date 2019-03-29
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {DeptMapper.class},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface JobMapper extends BaseMapper<JobDto, Job> {
|
||||
public interface JobMapper extends SuperMapper<JobDto, Job> {
|
||||
}
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package priv.alawn.aladmin.modules.system.service.mapstruct;
|
||||
|
||||
import priv.alawn.aladmin.base.BaseMapper;
|
||||
import priv.alawn.aladmin.base.SuperMapper;
|
||||
import priv.alawn.aladmin.modules.system.domain.Job;
|
||||
import priv.alawn.aladmin.modules.system.service.dto.JobSmallDto;
|
||||
import org.mapstruct.Mapper;
|
||||
@@ -26,6 +26,6 @@ import org.mapstruct.ReportingPolicy;
|
||||
* @date 2019-03-29
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface JobSmallMapper extends BaseMapper<JobSmallDto, Job> {
|
||||
public interface JobSmallMapper extends SuperMapper<JobSmallDto, Job> {
|
||||
|
||||
}
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package priv.alawn.aladmin.modules.system.service.mapstruct;
|
||||
|
||||
import priv.alawn.aladmin.base.BaseMapper;
|
||||
import priv.alawn.aladmin.base.SuperMapper;
|
||||
import priv.alawn.aladmin.modules.system.domain.Menu;
|
||||
import priv.alawn.aladmin.modules.system.service.dto.MenuDto;
|
||||
import org.mapstruct.Mapper;
|
||||
@@ -26,5 +26,5 @@ import org.mapstruct.ReportingPolicy;
|
||||
* @date 2018-12-17
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface MenuMapper extends BaseMapper<MenuDto, Menu> {
|
||||
public interface MenuMapper extends SuperMapper<MenuDto, Menu> {
|
||||
}
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package priv.alawn.aladmin.modules.system.service.mapstruct;
|
||||
|
||||
import priv.alawn.aladmin.base.BaseMapper;
|
||||
import priv.alawn.aladmin.base.SuperMapper;
|
||||
import priv.alawn.aladmin.modules.system.domain.Role;
|
||||
import priv.alawn.aladmin.modules.system.service.dto.RoleDto;
|
||||
import org.mapstruct.Mapper;
|
||||
@@ -26,6 +26,6 @@ import org.mapstruct.ReportingPolicy;
|
||||
* @date 2018-11-23
|
||||
*/
|
||||
@Mapper(componentModel = "spring", uses = {MenuMapper.class, DeptMapper.class}, unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface RoleMapper extends BaseMapper<RoleDto, Role> {
|
||||
public interface RoleMapper extends SuperMapper<RoleDto, Role> {
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package priv.alawn.aladmin.modules.system.service.mapstruct;
|
||||
|
||||
import priv.alawn.aladmin.base.BaseMapper;
|
||||
import priv.alawn.aladmin.base.SuperMapper;
|
||||
import priv.alawn.aladmin.modules.system.domain.Role;
|
||||
import priv.alawn.aladmin.modules.system.service.dto.RoleSmallDto;
|
||||
import org.mapstruct.Mapper;
|
||||
@@ -26,6 +26,6 @@ import org.mapstruct.ReportingPolicy;
|
||||
* @date 2019-5-23
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface RoleSmallMapper extends BaseMapper<RoleSmallDto, Role> {
|
||||
public interface RoleSmallMapper extends SuperMapper<RoleSmallDto, Role> {
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package priv.alawn.aladmin.modules.system.service.mapstruct;
|
||||
|
||||
import priv.alawn.aladmin.base.BaseMapper;
|
||||
import priv.alawn.aladmin.base.SuperMapper;
|
||||
import priv.alawn.aladmin.modules.system.domain.User;
|
||||
import priv.alawn.aladmin.modules.system.service.dto.UserLoginDto;
|
||||
import org.mapstruct.Mapper;
|
||||
@@ -26,5 +26,5 @@ import org.mapstruct.ReportingPolicy;
|
||||
* @date 2018-11-23
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {RoleMapper.class, DeptMapper.class, JobMapper.class},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface UserLoginMapper extends BaseMapper<UserLoginDto, User> {
|
||||
public interface UserLoginMapper extends SuperMapper<UserLoginDto, User> {
|
||||
}
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package priv.alawn.aladmin.modules.system.service.mapstruct;
|
||||
|
||||
import priv.alawn.aladmin.base.BaseMapper;
|
||||
import priv.alawn.aladmin.base.SuperMapper;
|
||||
import priv.alawn.aladmin.modules.system.domain.User;
|
||||
import priv.alawn.aladmin.modules.system.service.dto.UserDto;
|
||||
import org.mapstruct.Mapper;
|
||||
@@ -26,5 +26,5 @@ import org.mapstruct.ReportingPolicy;
|
||||
* @date 2018-11-23
|
||||
*/
|
||||
@Mapper(componentModel = "spring",uses = {RoleMapper.class, DeptMapper.class, JobMapper.class},unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface UserMapper extends BaseMapper<UserDto, User> {
|
||||
public interface UserMapper extends SuperMapper<UserDto, User> {
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ spring:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
# H2 配置
|
||||
driverClassName: org.h2.Driver
|
||||
url: jdbc:h2:tcp://localhost:9092/~/.h2/aladmin;MODE=MYSQL;OLD_INFORMATION_SCHEMA=TRUE
|
||||
url: jdbc:h2:tcp://localhost:9092/~/.h2/aladmin;NON_KEYWORDS=VALUE,USER;DATABASE_TO_LOWER=TRUE;MODE=MySQL;OLD_INFORMATION_SCHEMA=TRUE
|
||||
#;AUTO_SERVER=TRUE;DB_CLOSE_DELAY=-1
|
||||
username: sa
|
||||
password: sa
|
||||
@@ -15,6 +15,7 @@ spring:
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:aladmin}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
||||
# username: ${DB_USER:root}
|
||||
# password: ${DB_PWD:123456}
|
||||
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
# 最小连接数
|
||||
@@ -90,7 +91,8 @@ jwt:
|
||||
# 必须使用最少88位的Base64对该令牌进行编码
|
||||
base64-secret: ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWU2MmQ3MjY1NzJmNTE0MzI=
|
||||
# 令牌过期时间 此处单位/毫秒 ,默认4小时,可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html
|
||||
token-validity-in-seconds: 14400000
|
||||
# token-validity-in-seconds: 14400000
|
||||
token-validity-in-seconds: 31536000000 # 365天
|
||||
# 在线用户key
|
||||
online-key: online-token-
|
||||
# 验证码
|
||||
|
||||
@@ -18,11 +18,13 @@ spring:
|
||||
#配置 Jpa
|
||||
jpa:
|
||||
hibernate:
|
||||
# ddl-auto: update
|
||||
ddl-auto: none
|
||||
open-in-view: true
|
||||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.MySQL5InnoDBDialect
|
||||
# show-sql: true
|
||||
|
||||
redis:
|
||||
#数据库索引
|
||||
|
||||
+5
-5
@@ -46,7 +46,7 @@ public class ${className}Controller {
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('${changeClassName}:list')")
|
||||
@PreAuthorize("@perm.check('${changeClassName}:list')")
|
||||
public void export${className}(HttpServletResponse response, ${className}QueryCriteria criteria) throws IOException {
|
||||
${changeClassName}Service.download(${changeClassName}Service.queryAll(criteria), response);
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public class ${className}Controller {
|
||||
@GetMapping
|
||||
@Log("查询${apiAlias}")
|
||||
@ApiOperation("查询${apiAlias}")
|
||||
@PreAuthorize("@el.check('${changeClassName}:list')")
|
||||
@PreAuthorize("@perm.check('${changeClassName}:list')")
|
||||
public ResponseEntity<Object> query${className}(${className}QueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(${changeClassName}Service.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public class ${className}Controller {
|
||||
@PostMapping
|
||||
@Log("新增${apiAlias}")
|
||||
@ApiOperation("新增${apiAlias}")
|
||||
@PreAuthorize("@el.check('${changeClassName}:add')")
|
||||
@PreAuthorize("@perm.check('${changeClassName}:add')")
|
||||
public ResponseEntity<Object> create${className}(@Validated @RequestBody ${className} resources){
|
||||
return new ResponseEntity<>(${changeClassName}Service.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public class ${className}Controller {
|
||||
@PutMapping
|
||||
@Log("修改${apiAlias}")
|
||||
@ApiOperation("修改${apiAlias}")
|
||||
@PreAuthorize("@el.check('${changeClassName}:edit')")
|
||||
@PreAuthorize("@perm.check('${changeClassName}:edit')")
|
||||
public ResponseEntity<Object> update${className}(@Validated @RequestBody ${className} resources){
|
||||
${changeClassName}Service.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
@@ -79,7 +79,7 @@ public class ${className}Controller {
|
||||
@DeleteMapping
|
||||
@Log("删除${apiAlias}")
|
||||
@ApiOperation("删除${apiAlias}")
|
||||
@PreAuthorize("@el.check('${changeClassName}:del')")
|
||||
@PreAuthorize("@perm.check('${changeClassName}:del')")
|
||||
public ResponseEntity<Object> delete${className}(@RequestBody ${pkColumnType}[] ids) {
|
||||
${changeClassName}Service.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package priv.alawn.aladmin.config;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.web.servlet.MultipartConfigFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -25,7 +26,7 @@ import java.io.File;
|
||||
* @date 2018-12-28
|
||||
* @author https://blog.csdn.net/llibin1024530411/article/details/79474953
|
||||
*/
|
||||
@Configuration
|
||||
@AutoConfiguration
|
||||
public class MultipartConfig {
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,21 +47,21 @@ public class LocalStorageController {
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询文件")
|
||||
@PreAuthorize("@el.check('storage:list')")
|
||||
@PreAuthorize("@perm.check('storage:list')")
|
||||
public ResponseEntity<Object> queryFile(LocalStorageQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(localStorageService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('storage:list')")
|
||||
@PreAuthorize("@perm.check('storage:list')")
|
||||
public void exportFile(HttpServletResponse response, LocalStorageQueryCriteria criteria) throws IOException {
|
||||
localStorageService.download(localStorageService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("上传文件")
|
||||
@PreAuthorize("@el.check('storage:add')")
|
||||
@PreAuthorize("@perm.check('storage:add')")
|
||||
public ResponseEntity<Object> createFile(@RequestParam String name, @RequestParam("file") MultipartFile file){
|
||||
localStorageService.create(name, file);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
@@ -82,7 +82,7 @@ public class LocalStorageController {
|
||||
@PutMapping
|
||||
@Log("修改文件")
|
||||
@ApiOperation("修改文件")
|
||||
@PreAuthorize("@el.check('storage:edit')")
|
||||
@PreAuthorize("@perm.check('storage:edit')")
|
||||
public ResponseEntity<Object> updateFile(@Validated @RequestBody LocalStorage resources){
|
||||
localStorageService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package priv.alawn.aladmin.service.mapstruct;
|
||||
|
||||
import priv.alawn.aladmin.base.BaseMapper;
|
||||
import priv.alawn.aladmin.base.SuperMapper;
|
||||
import priv.alawn.aladmin.service.dto.LocalStorageDto;
|
||||
import priv.alawn.aladmin.domain.LocalStorage;
|
||||
import org.mapstruct.Mapper;
|
||||
@@ -26,6 +26,6 @@ import org.mapstruct.ReportingPolicy;
|
||||
* @date 2019-09-05
|
||||
*/
|
||||
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface LocalStorageMapper extends BaseMapper<LocalStorageDto, LocalStorage> {
|
||||
public interface LocalStorageMapper extends SuperMapper<LocalStorageDto, LocalStorage> {
|
||||
|
||||
}
|
||||
@@ -23,8 +23,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<!-- <version>2.7.1</version>-->
|
||||
<version>2.6.4</version>
|
||||
<version>2.7.3</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
@@ -37,13 +36,30 @@
|
||||
<swagger.version>2.9.2</swagger.version>
|
||||
<fastjson.version>1.2.83</fastjson.version>
|
||||
<druid.version>1.2.9</druid.version>
|
||||
<!-- <druid.version>1.2.8</druid.version>-->
|
||||
<commons-pool2.version>2.11.1</commons-pool2.version>
|
||||
<mapstruct.version>1.4.2.Final</mapstruct.version>
|
||||
<h2.version>2.1.214</h2.version>
|
||||
<mybatis-plus.version>3.5.2</mybatis-plus.version>
|
||||
<jsqlparser.version>4.5</jsqlparser.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatis-plus.version}</version>>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>javax.persistence</groupId>
|
||||
<artifactId>persistence-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.github.jsqlparser</groupId>
|
||||
<artifactId>jsqlparser</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!--Spring boot 核心-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@@ -54,7 +70,6 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
|
||||
</dependency>
|
||||
|
||||
<!--Spring boot 测试-->
|
||||
@@ -105,9 +120,9 @@
|
||||
<!-- https://mvnrepository.com/artifact/com.github.xiaoymin/knife4j-spring-boot-starter -->
|
||||
<dependency>
|
||||
<!-- <groupId>com.github.xiaoymin</groupId>-->
|
||||
<!-- <version>3.0.3</version>-->
|
||||
<groupId>com.github.shijingsh</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<!-- <version>3.0.3</version>-->
|
||||
<version>3.0.5</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user