use of org.jeecg.modules.system.entity.SysDataSource in project jeecg-boot by jeecgboot.
the class SysDataSourceController method edit.
/**
* 编辑
*
* @param sysDataSource
* @return
*/
@AutoLog(value = "多数据源管理-编辑")
@ApiOperation(value = "多数据源管理-编辑", notes = "多数据源管理-编辑")
@RequestMapping(value = "/edit", method = { RequestMethod.PUT, RequestMethod.POST })
public Result<?> edit(@RequestBody SysDataSource sysDataSource) {
try {
SysDataSource d = sysDataSourceService.getById(sysDataSource.getId());
DataSourceCachePool.removeCache(d.getCode());
String dbPassword = sysDataSource.getDbPassword();
if (StringUtils.isNotBlank(dbPassword)) {
String encrypt = SecurityUtil.jiami(dbPassword);
sysDataSource.setDbPassword(encrypt);
}
sysDataSourceService.updateById(sysDataSource);
} catch (Exception e) {
e.printStackTrace();
}
return Result.ok("编辑成功!");
}
use of org.jeecg.modules.system.entity.SysDataSource in project kms by mahonelau.
the class SysDataSourceController method delete.
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "多数据源管理-通过id删除")
@ApiOperation(value = "多数据源管理-通过id删除", notes = "多数据源管理-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name = "id") String id) {
SysDataSource sysDataSource = sysDataSourceService.getById(id);
DataSourceCachePool.removeCache(sysDataSource.getCode());
sysDataSourceService.removeById(id);
return Result.ok("删除成功!");
}
use of org.jeecg.modules.system.entity.SysDataSource in project kms by mahonelau.
the class SysDataSourceController method queryOptions.
@GetMapping(value = "/options")
public Result<?> queryOptions(SysDataSource sysDataSource, HttpServletRequest req) {
QueryWrapper<SysDataSource> queryWrapper = QueryGenerator.initQueryWrapper(sysDataSource, req.getParameterMap());
List<SysDataSource> pageList = sysDataSourceService.list(queryWrapper);
JSONArray array = new JSONArray(pageList.size());
for (SysDataSource item : pageList) {
JSONObject option = new JSONObject(3);
option.put("value", item.getCode());
option.put("label", item.getName());
option.put("text", item.getName());
array.add(option);
}
return Result.ok(array);
}
use of org.jeecg.modules.system.entity.SysDataSource in project kms by mahonelau.
the class SysDataSourceController method edit.
/**
* 编辑
*
* @param sysDataSource
* @return
*/
@AutoLog(value = "多数据源管理-编辑")
@ApiOperation(value = "多数据源管理-编辑", notes = "多数据源管理-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody SysDataSource sysDataSource) {
try {
SysDataSource d = sysDataSourceService.getById(sysDataSource.getId());
DataSourceCachePool.removeCache(d.getCode());
String dbPassword = sysDataSource.getDbPassword();
if (StringUtils.isNotBlank(dbPassword)) {
String encrypt = SecurityUtil.jiami(dbPassword);
sysDataSource.setDbPassword(encrypt);
}
sysDataSourceService.updateById(sysDataSource);
} catch (Exception e) {
e.printStackTrace();
}
return Result.ok("编辑成功!");
}
use of org.jeecg.modules.system.entity.SysDataSource in project kykms by mahonelau.
the class SysDataSourceController method delete.
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "多数据源管理-通过id删除")
@ApiOperation(value = "多数据源管理-通过id删除", notes = "多数据源管理-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name = "id") String id) {
SysDataSource sysDataSource = sysDataSourceService.getById(id);
DataSourceCachePool.removeCache(sysDataSource.getCode());
sysDataSourceService.removeById(id);
return Result.ok("删除成功!");
}
Aggregations