重构返回结果集
This commit is contained in:
parent
59493751d6
commit
5aed8f5f77
|
|
@ -149,6 +149,12 @@
|
|||
<version>1.5.21</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.24</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ import javax.annotation.Resource;
|
|||
@RestController
|
||||
@RequestMapping("/tool/apiclass")
|
||||
public class ApiClassController extends BaseController {
|
||||
protected final Logger logger = LoggerFactory.getLogger(ApiClassController.class);
|
||||
|
||||
@Resource
|
||||
private ApiClassService apiClassService;
|
||||
|
|
|
|||
|
|
@ -1,38 +1,27 @@
|
|||
package com.ebts.generator.controller;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ebts.common.annotation.Log;
|
||||
import com.ebts.common.constant.ReturnConstants;
|
||||
import com.ebts.common.core.controller.BaseController;
|
||||
import com.ebts.common.core.entity.Result;
|
||||
import com.ebts.common.core.entity.ResultBackI;
|
||||
import com.ebts.common.core.page.TableDataInfo;
|
||||
import com.ebts.common.core.text.Convert;
|
||||
import com.ebts.common.enums.BusinessType;
|
||||
import com.ebts.common.utils.ServerResult;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ebts.generator.entity.GenTable;
|
||||
import com.ebts.generator.entity.GenTableColumn;
|
||||
import com.ebts.generator.service.GenTableColumnService;
|
||||
import com.ebts.generator.service.GenTableService;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 代码生成 操作处理
|
||||
|
|
@ -42,7 +31,6 @@ import com.ebts.generator.service.GenTableService;
|
|||
@RestController
|
||||
@RequestMapping("/tool/gen")
|
||||
public class GenController extends BaseController {
|
||||
private Logger logger = LoggerFactory.getLogger(GenController.class);
|
||||
|
||||
@Autowired
|
||||
private GenTableService genTableService;
|
||||
|
|
|
|||
|
|
@ -10,8 +10,6 @@ import com.ebts.common.core.entity.Result;
|
|||
import com.ebts.common.enums.BusinessType;
|
||||
import com.ebts.generator.dto.InterTableDto;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
|
@ -36,7 +34,6 @@ import javax.servlet.http.HttpServletResponse;
|
|||
@RestController
|
||||
@RequestMapping("/generator/intertable")
|
||||
public class InterTableController extends BaseController {
|
||||
protected final Logger logger = LoggerFactory.getLogger(InterTableController.class);
|
||||
|
||||
@Resource
|
||||
private InterTableService interTableService;
|
||||
|
|
@ -103,12 +100,12 @@ public class InterTableController extends BaseController {
|
|||
@GetMapping("/modulegen/{id}")
|
||||
public Result<byte[]> moduleGenerator(@PathVariable("id") Long id, HttpServletResponse response) throws IOException {
|
||||
Result<byte[]> result = interTableService.generatorCodeModule(id);
|
||||
if (result.isSuccess()) {
|
||||
genCode(response, result.getData());
|
||||
return Result.ok();
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
if (result.isSuccess()) {
|
||||
genCode(response, result.getData());
|
||||
return Result.ok();
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,6 @@ import com.ebts.common.core.entity.Result;
|
|||
import com.ebts.common.enums.BusinessType;
|
||||
import com.ebts.common.utils.StringUtils;
|
||||
import com.ebts.common.utils.poi.ExcelUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
|
@ -35,7 +33,6 @@ import com.ebts.generator.service.ModuleService;
|
|||
@RestController
|
||||
@RequestMapping("/tool/module")
|
||||
public class ModuleController extends BaseController {
|
||||
protected final Logger logger = LoggerFactory.getLogger(ModuleController.class);
|
||||
|
||||
@Autowired
|
||||
private ModuleService moduleService;
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ import com.github.pagehelper.PageHelper;
|
|||
import com.ebts.generator.entity.UniCon;
|
||||
import com.ebts.generator.entity.UniQuery;
|
||||
import com.ebts.generator.service.QueryService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
|
|
|||
|
|
@ -1,30 +1,20 @@
|
|||
package com.ebts.generator.controller;
|
||||
|
||||
import com.ebts.common.annotation.Log;
|
||||
import com.ebts.common.core.controller.BaseController;
|
||||
import com.ebts.common.core.entity.Result;
|
||||
import com.ebts.common.enums.BusinessType;
|
||||
import com.ebts.common.utils.poi.ExcelUtil;
|
||||
import com.ebts.generator.entity.Regular;
|
||||
import com.ebts.generator.service.RegularService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.ebts.common.annotation.Log;
|
||||
import com.ebts.common.core.controller.BaseController;
|
||||
import com.ebts.common.core.entity.ResultBackI;
|
||||
import com.ebts.common.enums.BusinessType;
|
||||
import com.ebts.common.utils.ServerResult;
|
||||
import com.ebts.common.utils.poi.ExcelUtil;
|
||||
import com.ebts.generator.entity.Regular;
|
||||
import com.ebts.generator.service.RegularService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 校验规则Controller
|
||||
*
|
||||
|
|
@ -34,7 +24,6 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
@RestController
|
||||
@RequestMapping("/tool/regular")
|
||||
public class RegularController extends BaseController {
|
||||
protected final Logger logger = LoggerFactory.getLogger(RegularController.class);
|
||||
|
||||
@Autowired
|
||||
private RegularService regularService;
|
||||
|
|
@ -49,11 +38,11 @@ public class RegularController extends BaseController {
|
|||
@GetMapping("/list")
|
||||
public Serializable list(Regular regular) {
|
||||
startPage();
|
||||
ServerResult<List<Regular>> ServerResult = regularService.selectRegularList(regular);
|
||||
if (ServerResult.isStart()) {
|
||||
return getDataTable(ServerResult.getData());
|
||||
Result<List<Regular>> result = regularService.selectRegularList(regular);
|
||||
if (result.isSuccess()) {
|
||||
return getDataTable(result.getData());
|
||||
} else {
|
||||
return ResultBackI.info(ServerResult.getMsg());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -66,11 +55,11 @@ public class RegularController extends BaseController {
|
|||
@GetMapping("/option")
|
||||
public Serializable option() {
|
||||
startPage();
|
||||
ServerResult<List<Regular>> ServerResult = regularService.selectRegularOption();
|
||||
if (ServerResult.isStart()) {
|
||||
return getDataTable(ServerResult.getData());
|
||||
Result<List<Regular>> result = regularService.selectRegularOption();
|
||||
if (result.isSuccess()) {
|
||||
return getDataTable(result.getData());
|
||||
} else {
|
||||
return ResultBackI.info(ServerResult.getMsg());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -83,13 +72,13 @@ public class RegularController extends BaseController {
|
|||
@PreAuthorize("@ebts.hasPermi('tool:regular:export')")
|
||||
@Log(title = "校验规则", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public ResultBackI export(Regular regular) {
|
||||
ServerResult<List<Regular>> ServerResult = regularService.selectRegularList(regular);
|
||||
public Result<Regular> export(Regular regular) {
|
||||
Result<List<Regular>> result = regularService.selectRegularList(regular);
|
||||
ExcelUtil<Regular> util = new ExcelUtil<Regular>(Regular.class);
|
||||
if (ServerResult.isStart()) {
|
||||
return util.exportExcel(ServerResult.getData(), "regular");
|
||||
if (result.isSuccess()) {
|
||||
return util.exportExcelRest(result.getData(), "regular");
|
||||
} else {
|
||||
return ResultBackI.error(ServerResult.getMsg());
|
||||
return Result.error(result.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -101,13 +90,8 @@ public class RegularController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ebts.hasPermi('tool:regular:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public ResultBackI getInfo(@PathVariable("id") Long id) {
|
||||
ServerResult<Regular> ServerResult = regularService.selectRegularById(id);
|
||||
if (ServerResult.isStart()) {
|
||||
return ResultBackI.success(ServerResult.getData());
|
||||
} else {
|
||||
return ResultBackI.info(ServerResult.getMsg());
|
||||
}
|
||||
public Result<Regular> getInfo(@PathVariable("id") Long id) {
|
||||
return regularService.selectRegularById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -119,25 +103,11 @@ public class RegularController extends BaseController {
|
|||
@PreAuthorize("@ebts.hasPermi('tool:regular:add')")
|
||||
@Log(title = "校验规则", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public ResultBackI add(@RequestBody Regular regular) {
|
||||
if (regular.getName() == null || regular.getName().equals("")) {
|
||||
return ResultBackI.error("正则名称不能为空!");
|
||||
}
|
||||
if (regular.getRegular() == null || regular.getRegular().equals("")) {
|
||||
return ResultBackI.error("正则内容不能为空!");
|
||||
}
|
||||
if (regular.getEnable() == null || regular.getEnable() < 0) {
|
||||
return ResultBackI.error("是否启用不能为空!");
|
||||
}
|
||||
public Result<Integer> add(@RequestBody Regular regular) {
|
||||
if (!verifyRegular(regular)) {
|
||||
return ResultBackI.error("正则表达式校验不通过!");
|
||||
}
|
||||
ServerResult<Integer> ServerResult = regularService.insertRegular(regular);
|
||||
if (ServerResult.isStart()) {
|
||||
return ResultBackI.success();
|
||||
} else {
|
||||
return ResultBackI.error(ServerResult.getMsg());
|
||||
return Result.error("正则表达式校验不通过!");
|
||||
}
|
||||
return regularService.insertRegular(regular);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -149,25 +119,11 @@ public class RegularController extends BaseController {
|
|||
@PreAuthorize("@ebts.hasPermi('tool:regular:edit')")
|
||||
@Log(title = "校验规则", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public ResultBackI edit(@RequestBody Regular regular) {
|
||||
if (regular.getName() == null || regular.getName().equals("")) {
|
||||
return ResultBackI.error("正则名称不能为空!");
|
||||
}
|
||||
if (regular.getRegular() == null || regular.getRegular().equals("")) {
|
||||
return ResultBackI.error("正则内容不能为空!");
|
||||
}
|
||||
if (regular.getEnable() == null || regular.getEnable() < 0) {
|
||||
return ResultBackI.error("是否启用不能为空!");
|
||||
}
|
||||
public Result<Integer> edit(@RequestBody Regular regular) {
|
||||
if (!verifyRegular(regular)) {
|
||||
return ResultBackI.error("正则表达式校验不通过!");
|
||||
}
|
||||
ServerResult<Integer> ServerResult = regularService.updateRegular(regular);
|
||||
if (ServerResult.isStart()) {
|
||||
return ResultBackI.success();
|
||||
} else {
|
||||
return ResultBackI.error(ServerResult.getMsg());
|
||||
return Result.error("正则表达式校验不通过!");
|
||||
}
|
||||
return regularService.updateRegular(regular);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -179,16 +135,11 @@ public class RegularController extends BaseController {
|
|||
@PreAuthorize("@ebts.hasPermi('tool:regular:remove')")
|
||||
@Log(title = "校验规则", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public ResultBackI remove(@PathVariable Long[] ids) {
|
||||
public Result<Integer> remove(@PathVariable Long[] ids) {
|
||||
if (ids.length == 0) {
|
||||
return ResultBackI.error("需要删除id数不能为空!");
|
||||
}
|
||||
ServerResult<Integer> ServerResult = regularService.deleteRegularByIds(ids);
|
||||
if (ServerResult.isStart()) {
|
||||
return ResultBackI.success();
|
||||
} else {
|
||||
return ResultBackI.error(ServerResult.getMsg());
|
||||
return Result.error("需要删除id数不能为空!");
|
||||
}
|
||||
return regularService.deleteRegularByIds(ids);
|
||||
}
|
||||
|
||||
public boolean verifyRegular(Regular regular) {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
package com.ebts.generator.controller;
|
||||
|
||||
import com.ebts.common.core.entity.Result;
|
||||
import com.ebts.common.core.entity.ResultBackI;
|
||||
import com.ebts.common.utils.ServerResult;
|
||||
import com.ebts.generator.entity.RelColumn;
|
||||
import com.ebts.generator.entity.RelTable;
|
||||
import com.ebts.generator.service.RelService;
|
||||
|
|
|
|||
|
|
@ -1,27 +1,22 @@
|
|||
package com.ebts.generator.controller;
|
||||
|
||||
import com.ebts.common.annotation.Log;
|
||||
import com.ebts.common.core.controller.EBTSController;
|
||||
import com.ebts.common.core.entity.Result;
|
||||
import com.ebts.common.core.text.Convert;
|
||||
import com.ebts.common.enums.BusinessType;
|
||||
import com.ebts.common.utils.poi.ExcelUtil;
|
||||
import com.ebts.generator.entity.TopSearchTable;
|
||||
import com.ebts.generator.service.TopSearchTableService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
import com.ebts.common.core.controller.EBTSController;
|
||||
import com.ebts.common.core.entity.Result;
|
||||
import com.ebts.common.core.entity.ResultBackI;
|
||||
import com.ebts.common.core.text.Convert;
|
||||
import com.ebts.common.utils.ServerResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.ebts.common.annotation.Log;
|
||||
import com.ebts.common.enums.BusinessType;
|
||||
import com.ebts.generator.entity.TopSearchTable;
|
||||
import com.ebts.generator.service.TopSearchTableService;
|
||||
import com.ebts.common.utils.poi.ExcelUtil;
|
||||
|
||||
/**
|
||||
* top万能查询主Controller
|
||||
*
|
||||
|
|
@ -32,7 +27,6 @@ import com.ebts.common.utils.poi.ExcelUtil;
|
|||
@RestController
|
||||
@RequestMapping("/tool/table")
|
||||
public class TopSearchTableController extends EBTSController {
|
||||
protected final Logger logger = LoggerFactory.getLogger(TopSearchTableController.class);
|
||||
|
||||
@Autowired
|
||||
private TopSearchTableService topSearchTableService;
|
||||
|
|
|
|||
|
|
@ -1,34 +1,21 @@
|
|||
package com.ebts.generator.controller;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import com.ebts.common.annotation.Log;
|
||||
import com.ebts.common.core.controller.BaseController;
|
||||
import com.ebts.common.core.entity.Result;
|
||||
import com.ebts.common.core.entity.ResultBackI;
|
||||
import com.ebts.common.enums.BusinessType;
|
||||
import com.ebts.common.utils.ServerResult;
|
||||
import com.ebts.common.utils.poi.ExcelUtil;
|
||||
import com.ebts.generator.entity.UniQuery;
|
||||
import com.ebts.generator.service.UniQueryService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 万能查询Controller
|
||||
|
|
@ -39,9 +26,8 @@ import javax.validation.constraints.NotNull;
|
|||
@RestController
|
||||
@RequestMapping("/tool/query")
|
||||
public class UniQueryController extends BaseController {
|
||||
protected final Logger logger = LoggerFactory.getLogger(UniQueryController.class);
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private UniQueryService uniQueryService;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import com.ebts.common.core.entity.BaseEntity;
|
|||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 校验规则对象 sys_regular
|
||||
*
|
||||
|
|
@ -23,24 +25,28 @@ public class Regular extends BaseEntity {
|
|||
* 正则名称
|
||||
*/
|
||||
@Excel(name = "正则名称")
|
||||
@NotBlank(message = "正则名称不能为空!")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 正则内容
|
||||
*/
|
||||
@Excel(name = "正则内容")
|
||||
@NotBlank(message = "正则内容不能为空!")
|
||||
private String regular;
|
||||
|
||||
/**
|
||||
* 验证内容
|
||||
*/
|
||||
@Excel(name = "验证内容")
|
||||
@NotBlank(message = "验证内容不能为空!")
|
||||
private String validation;
|
||||
|
||||
/**
|
||||
* 是否启用 1:启动 2:关闭
|
||||
*/
|
||||
@Excel(name = "是否启用 1:启动 2:关闭")
|
||||
@NotBlank(message = "是否启用不能为空!")
|
||||
private Integer enable;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package com.ebts.generator.service;
|
|||
import java.util.Map;
|
||||
|
||||
import com.ebts.common.core.entity.Result;
|
||||
import com.ebts.common.utils.ServerResult;
|
||||
import com.ebts.generator.dto.InterTableDto;
|
||||
import com.ebts.generator.entity.InterTable;
|
||||
|
||||
|
|
@ -20,7 +19,7 @@ public interface InterTableService {
|
|||
* @param id 接口信息ID
|
||||
* @return 接口信息
|
||||
*/
|
||||
ServerResult<InterTable> selectInterTableById(Long id);
|
||||
Result<InterTable> selectInterTableById(Long id);
|
||||
|
||||
/**
|
||||
* 查询接口信息列表
|
||||
|
|
@ -36,7 +35,7 @@ public interface InterTableService {
|
|||
* @param interTable 接口信息
|
||||
* @return 结果
|
||||
*/
|
||||
ServerResult<Integer> insertInterTable(InterTable interTable);
|
||||
Result<Integer> insertInterTable(InterTable interTable);
|
||||
|
||||
/**
|
||||
* 修改接口信息
|
||||
|
|
@ -52,7 +51,7 @@ public interface InterTableService {
|
|||
* @param ids 需要删除的接口信息ID
|
||||
* @return 结果
|
||||
*/
|
||||
ServerResult<Integer> deleteInterTableByIds(Long[] ids);
|
||||
Result<Integer> deleteInterTableByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除接口信息信息
|
||||
|
|
@ -60,7 +59,7 @@ public interface InterTableService {
|
|||
* @param id 接口信息ID
|
||||
* @return 结果
|
||||
*/
|
||||
ServerResult<Integer> deleteInterTableById(Long id);
|
||||
Result<Integer> deleteInterTableById(Long id);
|
||||
|
||||
/**
|
||||
* 预览代码(工作流)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package com.ebts.generator.service;
|
||||
|
||||
import com.ebts.common.utils.ServerResult;
|
||||
import com.ebts.common.core.entity.Result;
|
||||
import com.ebts.generator.entity.Regular;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -18,7 +18,7 @@ public interface RegularService {
|
|||
* @param id 校验规则ID
|
||||
* @return 校验规则
|
||||
*/
|
||||
ServerResult<Regular> selectRegularById(Long id);
|
||||
Result<Regular> selectRegularById(Long id);
|
||||
|
||||
/**
|
||||
* 查询校验规则列表
|
||||
|
|
@ -26,13 +26,13 @@ public interface RegularService {
|
|||
* @param regular 校验规则
|
||||
* @return 校验规则集合
|
||||
*/
|
||||
ServerResult<List<Regular>> selectRegularList(Regular regular);
|
||||
Result<List<Regular>> selectRegularList(Regular regular);
|
||||
/**
|
||||
* 查询校验规则下拉框列表
|
||||
*
|
||||
* @return 校验规则集合
|
||||
*/
|
||||
ServerResult<List<Regular>> selectRegularOption();
|
||||
Result<List<Regular>> selectRegularOption();
|
||||
|
||||
/**
|
||||
* 新增校验规则
|
||||
|
|
@ -40,7 +40,7 @@ public interface RegularService {
|
|||
* @param regular 校验规则
|
||||
* @return 结果
|
||||
*/
|
||||
ServerResult<Integer> insertRegular(Regular regular);
|
||||
Result<Integer> insertRegular(Regular regular);
|
||||
|
||||
/**
|
||||
* 修改校验规则
|
||||
|
|
@ -48,7 +48,7 @@ public interface RegularService {
|
|||
* @param regular 校验规则
|
||||
* @return 结果
|
||||
*/
|
||||
ServerResult<Integer> updateRegular(Regular regular);
|
||||
Result<Integer> updateRegular(Regular regular);
|
||||
|
||||
/**
|
||||
* 批量删除校验规则
|
||||
|
|
@ -56,7 +56,7 @@ public interface RegularService {
|
|||
* @param ids 需要删除的校验规则ID
|
||||
* @return 结果
|
||||
*/
|
||||
ServerResult<Integer> deleteRegularByIds(Long[] ids);
|
||||
Result<Integer> deleteRegularByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除校验规则信息
|
||||
|
|
@ -64,5 +64,5 @@ public interface RegularService {
|
|||
* @param id 校验规则ID
|
||||
* @return 结果
|
||||
*/
|
||||
ServerResult<Integer> deleteRegularById(Long id);
|
||||
Result<Integer> deleteRegularById(Long id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +1,18 @@
|
|||
package com.ebts.generator.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ebts.common.constant.ReturnConstants;
|
||||
import com.ebts.common.core.entity.Result;
|
||||
import com.ebts.common.exception.EbtsException;
|
||||
import com.ebts.common.utils.SecurityUtils;
|
||||
import com.ebts.common.utils.ServerResult;
|
||||
import com.ebts.generator.dao.ApiClassDao;
|
||||
import com.ebts.generator.entity.ApiClass;
|
||||
import com.ebts.generator.service.ApiClassService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 接口类名Service业务层处理
|
||||
*
|
||||
|
|
@ -25,9 +21,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
*/
|
||||
@Service
|
||||
public class ApiClassServiceImpl implements ApiClassService {
|
||||
private Logger logger = LoggerFactory.getLogger(ApiClassServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private ApiClassDao apiclassDao;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,22 +1,18 @@
|
|||
package com.ebts.generator.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.ebts.common.constant.ReturnConstants;
|
||||
import com.ebts.common.core.entity.Result;
|
||||
import com.ebts.common.core.text.Convert;
|
||||
import com.ebts.common.exception.EbtsException;
|
||||
import com.ebts.generator.service.GenTableColumnService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ebts.generator.entity.GenTableColumn;
|
||||
import com.ebts.generator.dao.GenTableColumnDao;
|
||||
import com.ebts.generator.entity.GenTableColumn;
|
||||
import com.ebts.generator.service.GenTableColumnService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 业务字段 服务层实现
|
||||
*
|
||||
|
|
@ -24,9 +20,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
*/
|
||||
@Service
|
||||
public class GenTableColumnServiceImpl implements GenTableColumnService {
|
||||
private Logger logger = LoggerFactory.getLogger(GenTableColumnServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private GenTableColumnDao genTableColumnDao;
|
||||
|
||||
/**
|
||||
|
|
@ -39,9 +34,9 @@ public class GenTableColumnServiceImpl implements GenTableColumnService {
|
|||
@Transactional(propagation = Propagation.SUPPORTS)
|
||||
public Result<List<GenTableColumn>> selectGenTableColumnListByTableId(Long tableId) {
|
||||
List<GenTableColumn> columnList = genTableColumnDao.selectGenTableColumnListByTableId(tableId);
|
||||
if (columnList.size() !=0){
|
||||
if (columnList.size() != 0) {
|
||||
return Result.ok(columnList);
|
||||
}else {
|
||||
} else {
|
||||
return Result.info();
|
||||
}
|
||||
}
|
||||
|
|
@ -54,12 +49,7 @@ public class GenTableColumnServiceImpl implements GenTableColumnService {
|
|||
*/
|
||||
@Override
|
||||
public int insertGenTableColumn(GenTableColumn genTableColumn) {
|
||||
try {
|
||||
return genTableColumnDao.insertGenTableColumn(genTableColumn);
|
||||
}catch (RuntimeException e){
|
||||
logger.error(e.getMessage());
|
||||
throw new EbtsException(ReturnConstants.OP_ERROR,e);
|
||||
}
|
||||
return genTableColumnDao.insertGenTableColumn(genTableColumn);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -70,14 +60,9 @@ public class GenTableColumnServiceImpl implements GenTableColumnService {
|
|||
*/
|
||||
@Override
|
||||
public int updateGenTableColumn(GenTableColumn genTableColumn) {
|
||||
try {
|
||||
List<GenTableColumn> genTableColumns = new ArrayList<GenTableColumn>();
|
||||
genTableColumns.add(genTableColumn);
|
||||
return genTableColumnDao.updateGenTableColumn(genTableColumns);
|
||||
}catch (RuntimeException e){
|
||||
logger.error(e.getMessage());
|
||||
throw new EbtsException(ReturnConstants.OP_ERROR,e);
|
||||
}
|
||||
List<GenTableColumn> genTableColumns = new ArrayList<GenTableColumn>();
|
||||
genTableColumns.add(genTableColumn);
|
||||
return genTableColumnDao.updateGenTableColumn(genTableColumns);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -88,11 +73,6 @@ public class GenTableColumnServiceImpl implements GenTableColumnService {
|
|||
*/
|
||||
@Override
|
||||
public int deleteGenTableColumnByIds(String ids) {
|
||||
try {
|
||||
return genTableColumnDao.deleteGenTableColumnByIds(Convert.toLongArray(ids));
|
||||
}catch (RuntimeException e){
|
||||
logger.error(e.getMessage());
|
||||
throw new EbtsException(ReturnConstants.OP_ERROR,e);
|
||||
}
|
||||
return genTableColumnDao.deleteGenTableColumnByIds(Convert.toLongArray(ids));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,27 +1,27 @@
|
|||
package com.ebts.generator.service.impl;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ebts.common.constant.Constants;
|
||||
import com.ebts.common.constant.ReturnConstants;
|
||||
import com.ebts.common.core.entity.Result;
|
||||
import com.ebts.common.core.text.CharsetKit;
|
||||
import com.ebts.common.exception.CustomException;
|
||||
import com.ebts.common.exception.EbtsException;
|
||||
import com.ebts.common.utils.SecurityUtils;
|
||||
import com.ebts.common.utils.StringUtils;
|
||||
import com.ebts.generator.dao.GenTableColumnDao;
|
||||
import com.ebts.generator.dao.GenTableDao;
|
||||
import com.ebts.generator.dao.RelDao;
|
||||
import com.ebts.generator.entity.*;
|
||||
import com.ebts.generator.entity.GenTable;
|
||||
import com.ebts.generator.entity.GenTableColumn;
|
||||
import com.ebts.generator.entity.RelColumn;
|
||||
import com.ebts.generator.entity.RelTable;
|
||||
import com.ebts.generator.service.GenTableService;
|
||||
import com.ebts.generator.utils.*;
|
||||
import com.ebts.generator.utils.GenUtils;
|
||||
import com.ebts.generator.utils.VelocityInitializer;
|
||||
import com.ebts.generator.utils.VelocityUtils;
|
||||
import com.ebts.generator.utils.constant.GenConstants;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.velocity.Template;
|
||||
|
|
@ -32,12 +32,16 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ebts.generator.dao.GenTableColumnDao;
|
||||
import com.ebts.generator.dao.GenTableDao;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
/**
|
||||
* 业务 服务层实现
|
||||
|
|
@ -45,8 +49,9 @@ import javax.annotation.Resource;
|
|||
* @author binlin
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class GenTableServiceImpl implements GenTableService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(GenTableServiceImpl.class);
|
||||
|
||||
|
||||
@Resource
|
||||
private GenTableDao genTableDao;
|
||||
|
|
@ -65,15 +70,11 @@ public class GenTableServiceImpl implements GenTableService {
|
|||
* @return 业务信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.SUPPORTS)
|
||||
public GenTable selectGenTableById(Long id) {
|
||||
try {
|
||||
GenTable genTable = genTableDao.selectGenTableById(id);
|
||||
setTableFromOptions(genTable);
|
||||
return genTable;
|
||||
} catch (RuntimeException e) {
|
||||
logger.error(e.getMessage());
|
||||
throw new EbtsException(ReturnConstants.OP_ERROR, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -83,13 +84,9 @@ public class GenTableServiceImpl implements GenTableService {
|
|||
* @return 业务集合
|
||||
*/
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.SUPPORTS)
|
||||
public List<GenTable> selectGenTableList(GenTable genTable) {
|
||||
try {
|
||||
return genTableDao.selectGenTableList(genTable);
|
||||
} catch (RuntimeException e) {
|
||||
logger.error(e.getMessage());
|
||||
throw new EbtsException(ReturnConstants.OP_ERROR, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -339,7 +336,7 @@ public class GenTableServiceImpl implements GenTableService {
|
|||
String path = getGenPath(table, template);
|
||||
FileUtils.writeStringToFile(new File(path), stringWriter.toString(), CharsetKit.UTF_8);
|
||||
} catch (IOException e) {
|
||||
logger.error("渲染模板失败,表名:" + table.getTableName());
|
||||
log.error("渲染模板失败,表名:" + table.getTableName());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -358,7 +355,7 @@ public class GenTableServiceImpl implements GenTableService {
|
|||
String path = getGenPath(table, template);
|
||||
FileUtils.writeStringToFile(new File(path), sw.toString(), CharsetKit.UTF_8);
|
||||
} catch (IOException e) {
|
||||
logger.error("渲染模板失败,表名:" + table.getTableName());
|
||||
log.error("渲染模板失败,表名:" + table.getTableName());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -473,7 +470,7 @@ public class GenTableServiceImpl implements GenTableService {
|
|||
zip.flush();
|
||||
zip.closeEntry();
|
||||
} catch (IOException e) {
|
||||
logger.error("渲染模板失败,表名:" + table.getTableName(), e);
|
||||
log.error("渲染模板失败,表名:" + table.getTableName(), e);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
|
|
@ -496,7 +493,7 @@ public class GenTableServiceImpl implements GenTableService {
|
|||
zip.flush();
|
||||
zip.closeEntry();
|
||||
} catch (IOException e) {
|
||||
logger.error("渲染模板失败,表名:" + table.getTableName(), e);
|
||||
log.error("渲染模板失败,表名:" + table.getTableName(), e);
|
||||
}
|
||||
}
|
||||
return zip;
|
||||
|
|
|
|||
|
|
@ -13,9 +13,7 @@ import java.util.zip.ZipOutputStream;
|
|||
import com.ebts.common.constant.Constants;
|
||||
import com.ebts.common.constant.ReturnConstants;
|
||||
import com.ebts.common.core.entity.Result;
|
||||
import com.ebts.common.exception.EbtsException;
|
||||
import com.ebts.common.utils.SecurityUtils;
|
||||
import com.ebts.common.utils.ServerResult;
|
||||
import com.ebts.generator.dao.ApiClassDao;
|
||||
import com.ebts.generator.dao.GenTableDao;
|
||||
import com.ebts.generator.dao.ModuleDao;
|
||||
|
|
@ -27,16 +25,14 @@ import org.apache.commons.io.IOUtils;
|
|||
import org.apache.velocity.Template;
|
||||
import org.apache.velocity.VelocityContext;
|
||||
import org.apache.velocity.app.Velocity;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ebts.generator.dao.InterTableDao;
|
||||
import com.ebts.generator.entity.InterTable;
|
||||
import com.ebts.generator.service.InterTableService;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 接口信息Service业务层处理
|
||||
|
|
@ -46,15 +42,14 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|||
*/
|
||||
@Service
|
||||
public class InterTableServiceImpl implements InterTableService {
|
||||
private Logger logger = LoggerFactory.getLogger(InterTableServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private InterTableDao interTableDao;
|
||||
@Autowired
|
||||
@Resource
|
||||
private ApiClassDao apiclassDao;
|
||||
@Autowired
|
||||
@Resource
|
||||
private ModuleDao moduleDao;
|
||||
@Autowired
|
||||
@Resource
|
||||
private GenTableDao genTableDao;
|
||||
|
||||
/**
|
||||
|
|
@ -64,17 +59,12 @@ public class InterTableServiceImpl implements InterTableService {
|
|||
* @return 接口信息
|
||||
*/
|
||||
@Override
|
||||
public ServerResult<InterTable> selectInterTableById(Long id) {
|
||||
try {
|
||||
InterTable interTable = interTableDao.selectInterTableById(id);
|
||||
if (interTable != null) {
|
||||
return new ServerResult<InterTable>(true, interTable);
|
||||
} else {
|
||||
return new ServerResult<InterTable>(false, ReturnConstants.RESULT_EMPTY);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
logger.error(e.getMessage());
|
||||
throw new EbtsException(ReturnConstants.OP_ERROR, e);
|
||||
public Result<InterTable> selectInterTableById(Long id) {
|
||||
InterTable interTable = interTableDao.selectInterTableById(id);
|
||||
if (interTable != null) {
|
||||
return Result.ok(interTable);
|
||||
} else {
|
||||
return Result.info(ReturnConstants.RESULT_EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -106,19 +96,10 @@ public class InterTableServiceImpl implements InterTableService {
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public ServerResult<Integer> insertInterTable(InterTable interTable) {
|
||||
try {
|
||||
interTable.setCreateBy(SecurityUtils.getUserId());
|
||||
Integer renewal = interTableDao.insertInterTable(interTable);
|
||||
if (renewal > 0) {
|
||||
return new ServerResult<Integer>(true, renewal);
|
||||
} else {
|
||||
return new ServerResult<Integer>(false, ReturnConstants.SYS_FAILL);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
logger.error(e.getMessage());
|
||||
throw new EbtsException(ReturnConstants.OP_ERROR, e);
|
||||
}
|
||||
public Result<Integer> insertInterTable(InterTable interTable) {
|
||||
interTable.setCreateBy(SecurityUtils.getUserId());
|
||||
interTableDao.insertInterTable(interTable);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -156,18 +137,9 @@ public class InterTableServiceImpl implements InterTableService {
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public ServerResult<Integer> deleteInterTableByIds(Long[] ids) {
|
||||
try {
|
||||
Integer renewal = interTableDao.deleteInterTableByIds(ids);
|
||||
if (renewal > 0) {
|
||||
return new ServerResult<Integer>(true, renewal);
|
||||
} else {
|
||||
return new ServerResult<Integer>(false, ReturnConstants.SYS_FAILL);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
logger.error(e.getMessage());
|
||||
throw new EbtsException(ReturnConstants.OP_ERROR, e);
|
||||
}
|
||||
public Result<Integer> deleteInterTableByIds(Long[] ids) {
|
||||
interTableDao.deleteInterTableByIds(ids);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -178,18 +150,9 @@ public class InterTableServiceImpl implements InterTableService {
|
|||
*/
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||
public ServerResult<Integer> deleteInterTableById(Long id) {
|
||||
try {
|
||||
Integer renewal = interTableDao.deleteInterTableById(id);
|
||||
if (renewal > 0) {
|
||||
return new ServerResult<Integer>(true, renewal);
|
||||
} else {
|
||||
return new ServerResult<Integer>(false, ReturnConstants.SYS_FAILL);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
logger.error(e.getMessage());
|
||||
throw new EbtsException(ReturnConstants.OP_ERROR, e);
|
||||
}
|
||||
public Result<Integer> deleteInterTableById(Long id) {
|
||||
interTableDao.deleteInterTableById(id);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -273,7 +236,7 @@ public class InterTableServiceImpl implements InterTableService {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.SUPPORTS,rollbackFor = Exception.class)
|
||||
@Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class)
|
||||
public Result<byte[]> generatorCodeModule(Long mid) {
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
ZipOutputStream zip = new ZipOutputStream(outputStream);
|
||||
|
|
@ -314,7 +277,7 @@ public class InterTableServiceImpl implements InterTableService {
|
|||
zip.closeEntry();
|
||||
return zip;
|
||||
} catch (IOException e) {
|
||||
logger.error(e.getMessage());
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,17 @@
|
|||
package com.ebts.generator.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ebts.common.constant.ReturnConstants;
|
||||
import com.ebts.common.core.entity.Result;
|
||||
import com.ebts.common.exception.EbtsException;
|
||||
import com.ebts.common.utils.SecurityUtils;
|
||||
import com.ebts.common.utils.ServerResult;
|
||||
import com.ebts.generator.dao.ModuleDao;
|
||||
import com.ebts.generator.entity.Module;
|
||||
import com.ebts.generator.service.ModuleService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 模块管理Service业务层处理
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.ebts.generator.dao.UniQueryDao;
|
|||
import com.ebts.generator.entity.UniCon;
|
||||
import com.ebts.generator.entity.UniQuery;
|
||||
import com.ebts.generator.service.QueryService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -27,8 +28,8 @@ import java.util.Map;
|
|||
* Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class QueryServiceImpl implements QueryService {
|
||||
private final Logger logger = LoggerFactory.getLogger(QueryServiceImpl.class);
|
||||
|
||||
@Resource
|
||||
private QueryDao queryDao;
|
||||
|
|
@ -171,7 +172,7 @@ public class QueryServiceImpl implements QueryService {
|
|||
sql += uniCon.getUcKey() + " between '" + startTime + "' AND '" + endTime + "'";
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
logger.error(e.getMessage());
|
||||
log.error(e.getMessage());
|
||||
sql = "";
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.ebts.generator.service.impl;
|
|||
import java.util.List;
|
||||
|
||||
import com.ebts.common.constant.ReturnConstants;
|
||||
import com.ebts.common.core.entity.Result;
|
||||
import com.ebts.common.exception.EbtsException;
|
||||
import com.ebts.common.utils.DateUtils;
|
||||
import com.ebts.common.utils.SecurityUtils;
|
||||
|
|
@ -10,11 +11,11 @@ import com.ebts.common.utils.ServerResult;
|
|||
import com.ebts.generator.dao.RegularDao;
|
||||
import com.ebts.generator.entity.Regular;
|
||||
import com.ebts.generator.service.RegularService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 校验规则Service业务层处理
|
||||
*
|
||||
|
|
@ -22,10 +23,10 @@ import org.springframework.stereotype.Service;
|
|||
* @date 2021-01-18
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class RegularServiceImpl implements RegularService {
|
||||
private Logger logger = LoggerFactory.getLogger(RegularServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private RegularDao regularDao;
|
||||
|
||||
/**
|
||||
|
|
@ -35,17 +36,12 @@ public class RegularServiceImpl implements RegularService {
|
|||
* @return 校验规则
|
||||
*/
|
||||
@Override
|
||||
public ServerResult<Regular> selectRegularById(Long id) {
|
||||
try {
|
||||
Regular regular = regularDao.selectRegularById(id);
|
||||
if (regular != null) {
|
||||
return new ServerResult<>(true, regular);
|
||||
} else {
|
||||
return new ServerResult<>(false, ReturnConstants.RESULT_EMPTY);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
logger.error(e.getMessage());
|
||||
throw new EbtsException(ReturnConstants.OP_ERROR,e);
|
||||
public Result<Regular> selectRegularById(Long id) {
|
||||
Regular regular = regularDao.selectRegularById(id);
|
||||
if (regular != null) {
|
||||
return Result.ok(regular);
|
||||
} else {
|
||||
return Result.info(ReturnConstants.RESULT_EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -56,36 +52,27 @@ public class RegularServiceImpl implements RegularService {
|
|||
* @return 校验规则
|
||||
*/
|
||||
@Override
|
||||
public ServerResult<List<Regular>> selectRegularList(Regular regular) {
|
||||
try {
|
||||
List<Regular> regulars = regularDao.selectRegularList(regular);
|
||||
if (regulars.size() > 0) {
|
||||
return new ServerResult<>(true, regulars);
|
||||
} else {
|
||||
return new ServerResult<>(false, ReturnConstants.RESULT_EMPTY);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
logger.error(e.getMessage());
|
||||
throw new EbtsException(ReturnConstants.OP_ERROR,e);
|
||||
public Result<List<Regular>> selectRegularList(Regular regular) {
|
||||
List<Regular> regulars = regularDao.selectRegularList(regular);
|
||||
if (regulars.size() > 0) {
|
||||
return Result.ok(regulars);
|
||||
} else {
|
||||
return Result.info(ReturnConstants.RESULT_EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询校验规则下拉框列表
|
||||
*
|
||||
* @return 校验规则
|
||||
*/
|
||||
@Override
|
||||
public ServerResult<List<Regular>> selectRegularOption() {
|
||||
try {
|
||||
List<Regular> regulars = regularDao.selectRegularOption();
|
||||
if (regulars.size() > 0) {
|
||||
return new ServerResult<>(true, regulars);
|
||||
} else {
|
||||
return new ServerResult<>(false, ReturnConstants.RESULT_EMPTY);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
logger.error(e.getMessage());
|
||||
throw new EbtsException(ReturnConstants.OP_ERROR,e);
|
||||
public Result<List<Regular>> selectRegularOption() {
|
||||
List<Regular> regulars = regularDao.selectRegularOption();
|
||||
if (regulars.size() > 0) {
|
||||
return Result.ok(regulars);
|
||||
} else {
|
||||
return Result.info(ReturnConstants.RESULT_EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -96,16 +83,11 @@ public class RegularServiceImpl implements RegularService {
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public ServerResult<Integer> insertRegular(Regular regular) {
|
||||
try {
|
||||
regular.setCreateTime(DateUtils.getNowDate());
|
||||
regular.setCreateBy(SecurityUtils.getUserId());
|
||||
int renewal = regularDao.insertRegular(regular);
|
||||
return new ServerResult<>(true, renewal);
|
||||
} catch (RuntimeException e) {
|
||||
logger.error(e.getMessage());
|
||||
throw new EbtsException(ReturnConstants.OP_ERROR,e);
|
||||
}
|
||||
public Result<Integer> insertRegular(Regular regular) {
|
||||
regular.setCreateTime(DateUtils.getNowDate());
|
||||
regular.setCreateBy(SecurityUtils.getUserId());
|
||||
regularDao.insertRegular(regular);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -115,16 +97,11 @@ public class RegularServiceImpl implements RegularService {
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public ServerResult<Integer> updateRegular(Regular regular) {
|
||||
try {
|
||||
regular.setUpdateTime(DateUtils.getNowDate());
|
||||
regular.setUpdateBy(SecurityUtils.getUserId());
|
||||
int renewal = regularDao.updateRegular(regular);
|
||||
return new ServerResult<>(true, renewal);
|
||||
} catch (RuntimeException e) {
|
||||
logger.error(e.getMessage());
|
||||
throw new EbtsException(ReturnConstants.OP_ERROR,e);
|
||||
}
|
||||
public Result<Integer> updateRegular(Regular regular) {
|
||||
regular.setUpdateTime(DateUtils.getNowDate());
|
||||
regular.setUpdateBy(SecurityUtils.getUserId());
|
||||
regularDao.updateRegular(regular);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -134,14 +111,9 @@ public class RegularServiceImpl implements RegularService {
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public ServerResult<Integer> deleteRegularByIds(Long[] ids) {
|
||||
try {
|
||||
Integer renewals = regularDao.deleteRegularByIds(ids);
|
||||
return new ServerResult<>(true, renewals);
|
||||
} catch (RuntimeException e) {
|
||||
logger.error(e.getMessage());
|
||||
throw new EbtsException(ReturnConstants.OP_ERROR,e);
|
||||
}
|
||||
public Result<Integer> deleteRegularByIds(Long[] ids) {
|
||||
regularDao.deleteRegularByIds(ids);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -151,13 +123,8 @@ public class RegularServiceImpl implements RegularService {
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public ServerResult<Integer> deleteRegularById(Long id) {
|
||||
try {
|
||||
Integer renewal = regularDao.deleteRegularById(id);
|
||||
return new ServerResult<>(true, renewal);
|
||||
} catch (RuntimeException e) {
|
||||
logger.error(e.getMessage());
|
||||
throw new EbtsException(ReturnConstants.OP_ERROR,e);
|
||||
}
|
||||
public Result<Integer> deleteRegularById(Long id) {
|
||||
regularDao.deleteRegularById(id);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
package com.ebts.generator.service.impl;
|
||||
|
||||
import com.ebts.common.core.entity.Result;
|
||||
import com.ebts.common.exception.EbtsException;
|
||||
import com.ebts.common.utils.ServerResult;
|
||||
import com.ebts.generator.dao.RelDao;
|
||||
import com.ebts.generator.entity.RelColumn;
|
||||
import com.ebts.generator.entity.RelTable;
|
||||
|
|
@ -10,7 +8,6 @@ import com.ebts.generator.service.RelService;
|
|||
import com.ebts.generator.utils.RelUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
|
|||
|
|
@ -14,12 +14,10 @@ import com.ebts.generator.dto.TopResult;
|
|||
import com.ebts.generator.entity.*;
|
||||
import com.ebts.generator.service.TopQueryService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
|
@ -34,15 +32,14 @@ import java.util.concurrent.atomic.AtomicReference;
|
|||
*/
|
||||
@Service
|
||||
public class TopQueryServiceImpl implements TopQueryService {
|
||||
private final Logger logger = LoggerFactory.getLogger(TopQueryServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private TopSearchTableDao topSearchTableDao;
|
||||
@Autowired
|
||||
@Resource
|
||||
private RelationalMapDao relationalMapDao;
|
||||
@Autowired
|
||||
@Resource
|
||||
private QueryDao queryDao;
|
||||
@Autowired
|
||||
@Resource
|
||||
private UniQueryDao uniQueryDao;
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,31 +1,28 @@
|
|||
package com.ebts.generator.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ebts.common.constant.ReturnConstants;
|
||||
import com.ebts.common.core.entity.Result;
|
||||
import com.ebts.common.exception.EbtsException;
|
||||
import com.ebts.common.utils.SecurityUtils;
|
||||
import com.ebts.common.utils.ServerResult;
|
||||
import com.ebts.common.utils.StringUtils;
|
||||
import com.ebts.generator.dao.RelationalMapDao;
|
||||
import com.ebts.generator.dao.SearchTableRoleDao;
|
||||
import com.ebts.generator.dao.TopSearchTableDao;
|
||||
import com.ebts.generator.entity.RelationalMap;
|
||||
import com.ebts.generator.entity.SearchTableRole;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ebts.common.utils.StringUtils;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.ebts.generator.entity.TopSearchColumn;
|
||||
import com.ebts.generator.dao.TopSearchTableDao;
|
||||
import com.ebts.generator.entity.TopSearchTable;
|
||||
import com.ebts.generator.service.TopSearchTableService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* top万能查询主Service业务层处理
|
||||
|
|
@ -34,14 +31,14 @@ import com.ebts.generator.service.TopSearchTableService;
|
|||
* @date 2021-07-20
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class TopSearchTableServiceImpl implements TopSearchTableService {
|
||||
private Logger logger = LoggerFactory.getLogger(TopSearchTableServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private TopSearchTableDao topSearchTableDao;
|
||||
@Autowired
|
||||
@Resource
|
||||
private SearchTableRoleDao searchTableRoleDao;
|
||||
@Autowired
|
||||
@Resource
|
||||
private RelationalMapDao relationalMapDao;
|
||||
|
||||
/**
|
||||
|
|
@ -145,7 +142,7 @@ public class TopSearchTableServiceImpl implements TopSearchTableService {
|
|||
// try {
|
||||
//
|
||||
// }catch (RuntimeException e){
|
||||
// logger.error("无数据");
|
||||
// log.error("无数据");
|
||||
// }
|
||||
// }
|
||||
|
||||
|
|
@ -155,7 +152,7 @@ public class TopSearchTableServiceImpl implements TopSearchTableService {
|
|||
try {
|
||||
return topSearchTableDao.selectDbTableList(params);
|
||||
} catch (RuntimeException e) {
|
||||
logger.error(e.getMessage());
|
||||
log.error(e.getMessage());
|
||||
throw new EbtsException(ReturnConstants.OP_ERROR, e);
|
||||
}
|
||||
}
|
||||
|
|
@ -215,7 +212,7 @@ public class TopSearchTableServiceImpl implements TopSearchTableService {
|
|||
return new ServerResult<>(false, ReturnConstants.SYS_FAILL);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
logger.error(e.getMessage());
|
||||
log.error(e.getMessage());
|
||||
throw new EbtsException(ReturnConstants.OP_ERROR, e);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,16 @@
|
|||
package com.ebts.generator.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ebts.common.constant.ReturnConstants;
|
||||
import com.ebts.common.core.entity.Result;
|
||||
import com.ebts.common.exception.EbtsException;
|
||||
import com.ebts.common.utils.SecurityUtils;
|
||||
import com.ebts.common.utils.ServerResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ebts.generator.dao.UniQueryDao;
|
||||
import com.ebts.generator.entity.UniQuery;
|
||||
import com.ebts.generator.service.UniQueryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 万能查询Service业务层处理
|
||||
|
|
@ -25,9 +20,8 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|||
*/
|
||||
@Service
|
||||
public class UniQueryServiceImpl implements UniQueryService {
|
||||
private Logger logger = LoggerFactory.getLogger(UniQueryServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private UniQueryDao uniQueryDao;
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue