【fix sonar】 SysDataSourceController.java 文件
This commit is contained in:
+11
-9
@@ -17,6 +17,7 @@ import com.jero.common.util.dynamic.db.DataSourceCachePool;
|
|||||||
import com.jero.modules.system.entity.SysDataSource;
|
import com.jero.modules.system.entity.SysDataSource;
|
||||||
import com.jero.modules.system.service.ISysDataSourceService;
|
import com.jero.modules.system.service.ISysDataSourceService;
|
||||||
import com.jero.modules.system.util.SecurityUtil;
|
import com.jero.modules.system.util.SecurityUtil;
|
||||||
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
@@ -53,7 +54,7 @@ public class SysDataSourceController extends JeroController<SysDataSource, ISysD
|
|||||||
@AutoLog(value = "多数据源管理-分页列表查询")
|
@AutoLog(value = "多数据源管理-分页列表查询")
|
||||||
@ApiOperation(value = "多数据源管理-分页列表查询", notes = "多数据源管理-分页列表查询")
|
@ApiOperation(value = "多数据源管理-分页列表查询", notes = "多数据源管理-分页列表查询")
|
||||||
@GetMapping(value = "/page")
|
@GetMapping(value = "/page")
|
||||||
public Result<?> queryPageList(
|
public Result<IPage<SysDataSource>> queryPageList(
|
||||||
SysDataSource sysDataSource,
|
SysDataSource sysDataSource,
|
||||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||||
@@ -79,7 +80,7 @@ public class SysDataSourceController extends JeroController<SysDataSource, ISysD
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/options")
|
@GetMapping(value = "/options")
|
||||||
public Result<?> queryOptions(SysDataSource sysDataSource, HttpServletRequest req) {
|
public Result<JSONArray> queryOptions(SysDataSource sysDataSource, HttpServletRequest req) {
|
||||||
QueryWrapper<SysDataSource> queryWrapper = QueryGenerator.initQueryWrapper(sysDataSource, req.getParameterMap());
|
QueryWrapper<SysDataSource> queryWrapper = QueryGenerator.initQueryWrapper(sysDataSource, req.getParameterMap());
|
||||||
List<SysDataSource> pageList = sysDataSourceService.list(queryWrapper);
|
List<SysDataSource> pageList = sysDataSourceService.list(queryWrapper);
|
||||||
JSONArray array = new JSONArray(pageList.size());
|
JSONArray array = new JSONArray(pageList.size());
|
||||||
@@ -102,7 +103,7 @@ public class SysDataSourceController extends JeroController<SysDataSource, ISysD
|
|||||||
@AutoLog(value = "多数据源管理-添加")
|
@AutoLog(value = "多数据源管理-添加")
|
||||||
@ApiOperation(value = "多数据源管理-添加", notes = "多数据源管理-添加")
|
@ApiOperation(value = "多数据源管理-添加", notes = "多数据源管理-添加")
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
public Result<?> add(@RequestBody SysDataSource sysDataSource) {
|
public Result<T> add(@RequestBody SysDataSource sysDataSource) {
|
||||||
try {
|
try {
|
||||||
String dbPassword = sysDataSource.getDbPassword();
|
String dbPassword = sysDataSource.getDbPassword();
|
||||||
if(StringUtils.isNotBlank(dbPassword)){
|
if(StringUtils.isNotBlank(dbPassword)){
|
||||||
@@ -125,7 +126,7 @@ public class SysDataSourceController extends JeroController<SysDataSource, ISysD
|
|||||||
@AutoLog(value = "多数据源管理-编辑")
|
@AutoLog(value = "多数据源管理-编辑")
|
||||||
@ApiOperation(value = "多数据源管理-编辑", notes = "多数据源管理-编辑")
|
@ApiOperation(value = "多数据源管理-编辑", notes = "多数据源管理-编辑")
|
||||||
@PutMapping(value = "/edit")
|
@PutMapping(value = "/edit")
|
||||||
public Result<?> edit(@RequestBody SysDataSource sysDataSource) {
|
public Result<T> edit(@RequestBody SysDataSource sysDataSource) {
|
||||||
try {
|
try {
|
||||||
SysDataSource d = sysDataSourceService.getById(sysDataSource.getId());
|
SysDataSource d = sysDataSourceService.getById(sysDataSource.getId());
|
||||||
DataSourceCachePool.removeCache(d.getCode());
|
DataSourceCachePool.removeCache(d.getCode());
|
||||||
@@ -150,7 +151,7 @@ public class SysDataSourceController extends JeroController<SysDataSource, ISysD
|
|||||||
@AutoLog(value = "多数据源管理-通过id删除")
|
@AutoLog(value = "多数据源管理-通过id删除")
|
||||||
@ApiOperation(value = "多数据源管理-通过id删除", notes = "多数据源管理-通过id删除")
|
@ApiOperation(value = "多数据源管理-通过id删除", notes = "多数据源管理-通过id删除")
|
||||||
@DeleteMapping(value = "/delete")
|
@DeleteMapping(value = "/delete")
|
||||||
public Result<?> delete(@RequestParam(name = "id") String id) {
|
public Result<T> delete(@RequestParam(name = "id") String id) {
|
||||||
SysDataSource sysDataSource = sysDataSourceService.getById(id);
|
SysDataSource sysDataSource = sysDataSourceService.getById(id);
|
||||||
DataSourceCachePool.removeCache(sysDataSource.getCode());
|
DataSourceCachePool.removeCache(sysDataSource.getCode());
|
||||||
sysDataSourceService.removeById(id);
|
sysDataSourceService.removeById(id);
|
||||||
@@ -166,7 +167,7 @@ public class SysDataSourceController extends JeroController<SysDataSource, ISysD
|
|||||||
@AutoLog(value = "多数据源管理-批量删除")
|
@AutoLog(value = "多数据源管理-批量删除")
|
||||||
@ApiOperation(value = "多数据源管理-批量删除", notes = "多数据源管理-批量删除")
|
@ApiOperation(value = "多数据源管理-批量删除", notes = "多数据源管理-批量删除")
|
||||||
@DeleteMapping(value = "/deleteBatch")
|
@DeleteMapping(value = "/deleteBatch")
|
||||||
public Result<?> deleteBatch(@RequestParam(name = "ids") String ids) {
|
public Result<T> deleteBatch(@RequestParam(name = "ids") String ids) {
|
||||||
List<String> idList = Arrays.asList(ids.split(","));
|
List<String> idList = Arrays.asList(ids.split(","));
|
||||||
idList.forEach(item->{
|
idList.forEach(item->{
|
||||||
SysDataSource sysDataSource = sysDataSourceService.getById(item);
|
SysDataSource sysDataSource = sysDataSourceService.getById(item);
|
||||||
@@ -185,7 +186,7 @@ public class SysDataSourceController extends JeroController<SysDataSource, ISysD
|
|||||||
@AutoLog(value = "多数据源管理-通过id查询")
|
@AutoLog(value = "多数据源管理-通过id查询")
|
||||||
@ApiOperation(value = "多数据源管理-通过id查询", notes = "多数据源管理-通过id查询")
|
@ApiOperation(value = "多数据源管理-通过id查询", notes = "多数据源管理-通过id查询")
|
||||||
@GetMapping(value = "/queryById")
|
@GetMapping(value = "/queryById")
|
||||||
public Result<?> queryById(@RequestParam(name = "id") String id) {
|
public Result<SysDataSource> queryById(@RequestParam(name = "id") String id) {
|
||||||
SysDataSource sysDataSource = sysDataSourceService.getById(id);
|
SysDataSource sysDataSource = sysDataSourceService.getById(id);
|
||||||
return Result.OK(sysDataSource);
|
return Result.OK(sysDataSource);
|
||||||
}
|
}
|
||||||
@@ -208,8 +209,9 @@ public class SysDataSourceController extends JeroController<SysDataSource, ISysD
|
|||||||
* @param response
|
* @param response
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
// @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
@PostMapping("/importExcel")
|
||||||
|
public Result<SysDataSource> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||||
return super.importExcel(request, response, SysDataSource.class);
|
return super.importExcel(request, response, SysDataSource.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user