add - 添加数据源管理、用户数据关联管理
parent
6df70b54ff
commit
8d9b3a7e34
@ -0,0 +1,109 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.common.core.utils.uuid.UUID;
|
||||
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;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.system.domain.SysDatasource;
|
||||
import com.ruoyi.system.service.ISysDatasourceService;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 数据管理Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-07-03
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/datasource")
|
||||
public class SysDatasourceController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysDatasourceService sysDatasourceService;
|
||||
|
||||
/**
|
||||
* 查询数据管理列表
|
||||
*/
|
||||
@RequiresPermissions("system:datasource:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysDatasource sysDatasource)
|
||||
{
|
||||
startPage();
|
||||
List<SysDatasource> list = sysDatasourceService.selectSysDatasourceList(sysDatasource);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据管理列表
|
||||
*/
|
||||
@RequiresPermissions("system:datasource:export")
|
||||
@Log(title = "数据管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysDatasource sysDatasource)
|
||||
{
|
||||
List<SysDatasource> list = sysDatasourceService.selectSysDatasourceList(sysDatasource);
|
||||
ExcelUtil<SysDatasource> util = new ExcelUtil<SysDatasource>(SysDatasource.class);
|
||||
util.exportExcel(response, list, "数据管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据管理详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:datasource:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||
{
|
||||
return success(sysDatasourceService.selectSysDatasourceById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据管理
|
||||
*/
|
||||
@RequiresPermissions("system:datasource:add")
|
||||
@Log(title = "数据管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysDatasource sysDatasource)
|
||||
{
|
||||
UUID uuid = UUID.randomUUID();
|
||||
sysDatasource.setId(uuid.toString());
|
||||
return toAjax(sysDatasourceService.insertSysDatasource(sysDatasource));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据管理
|
||||
*/
|
||||
@RequiresPermissions("system:datasource:edit")
|
||||
@Log(title = "数据管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysDatasource sysDatasource)
|
||||
{
|
||||
return toAjax(sysDatasourceService.updateSysDatasource(sysDatasource));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据管理
|
||||
*/
|
||||
@RequiresPermissions("system:datasource:remove")
|
||||
@Log(title = "数据管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
return toAjax(sysDatasourceService.deleteSysDatasourceByIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package com.ruoyi.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
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;
|
||||
import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.system.domain.SysUserDatasource;
|
||||
import com.ruoyi.system.service.ISysUserDatasourceService;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 用户数据Controller
|
||||
*
|
||||
* @author wenjy
|
||||
* @date 2023-07-03
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/userdatasource")
|
||||
public class SysUserDatasourceController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysUserDatasourceService sysUserDatasourceService;
|
||||
|
||||
/**
|
||||
* 查询用户数据列表
|
||||
*/
|
||||
@RequiresPermissions("system:userdatasource:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysUserDatasource sysUserDatasource)
|
||||
{
|
||||
startPage();
|
||||
List<SysUserDatasource> list = sysUserDatasourceService.selectSysUserDatasourceList(sysUserDatasource);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出用户数据列表
|
||||
*/
|
||||
@RequiresPermissions("system:userdatasource:export")
|
||||
@Log(title = "用户数据", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysUserDatasource sysUserDatasource)
|
||||
{
|
||||
List<SysUserDatasource> list = sysUserDatasourceService.selectSysUserDatasourceList(sysUserDatasource);
|
||||
ExcelUtil<SysUserDatasource> util = new ExcelUtil<SysUserDatasource>(SysUserDatasource.class);
|
||||
util.exportExcel(response, list, "用户数据数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户数据详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:userdatasource:query")
|
||||
@GetMapping(value = "/{datasourceId}")
|
||||
public AjaxResult getInfo(@PathVariable("datasourceId") String datasourceId)
|
||||
{
|
||||
return success(sysUserDatasourceService.selectSysUserDatasourceByDatasourceId(datasourceId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户数据
|
||||
*/
|
||||
@RequiresPermissions("system:userdatasource:add")
|
||||
@Log(title = "用户数据", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysUserDatasource sysUserDatasource)
|
||||
{
|
||||
return toAjax(sysUserDatasourceService.insertSysUserDatasource(sysUserDatasource));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户数据
|
||||
*/
|
||||
@RequiresPermissions("system:userdatasource:edit")
|
||||
@Log(title = "用户数据", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysUserDatasource sysUserDatasource)
|
||||
{
|
||||
return toAjax(sysUserDatasourceService.updateSysUserDatasource(sysUserDatasource));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户数据
|
||||
*/
|
||||
@RequiresPermissions("system:userdatasource:remove")
|
||||
@Log(title = "用户数据", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{datasourceIds}")
|
||||
public AjaxResult remove(@PathVariable String[] datasourceIds)
|
||||
{
|
||||
return toAjax(sysUserDatasourceService.deleteSysUserDatasourceByDatasourceIds(datasourceIds));
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 用户数据对象 sys_user_datasource
|
||||
*
|
||||
* @author wenjy
|
||||
* @date 2023-07-03
|
||||
*/
|
||||
public class SysUserDatasource extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 数据ID */
|
||||
@Excel(name = "数据ID")
|
||||
private String datasourceId;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户ID")
|
||||
private String userId;
|
||||
|
||||
public void setDatasourceId(String datasourceId)
|
||||
{
|
||||
this.datasourceId = datasourceId;
|
||||
}
|
||||
|
||||
public String getDatasourceId()
|
||||
{
|
||||
return datasourceId;
|
||||
}
|
||||
public void setUserId(String userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("datasourceId", getDatasourceId())
|
||||
.append("userId", getUserId())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.SysUserDatasource;
|
||||
|
||||
/**
|
||||
* 用户数据Mapper接口
|
||||
*
|
||||
* @author wenjy
|
||||
* @date 2023-07-03
|
||||
*/
|
||||
public interface SysUserDatasourceMapper
|
||||
{
|
||||
/**
|
||||
* 查询用户数据
|
||||
*
|
||||
* @param datasourceId 用户数据主键
|
||||
* @return 用户数据
|
||||
*/
|
||||
public SysUserDatasource selectSysUserDatasourceByDatasourceId(String datasourceId);
|
||||
|
||||
/**
|
||||
* 查询用户数据列表
|
||||
*
|
||||
* @param sysUserDatasource 用户数据
|
||||
* @return 用户数据集合
|
||||
*/
|
||||
public List<SysUserDatasource> selectSysUserDatasourceList(SysUserDatasource sysUserDatasource);
|
||||
|
||||
/**
|
||||
* 新增用户数据
|
||||
*
|
||||
* @param sysUserDatasource 用户数据
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysUserDatasource(SysUserDatasource sysUserDatasource);
|
||||
|
||||
/**
|
||||
* 修改用户数据
|
||||
*
|
||||
* @param sysUserDatasource 用户数据
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysUserDatasource(SysUserDatasource sysUserDatasource);
|
||||
|
||||
/**
|
||||
* 删除用户数据
|
||||
*
|
||||
* @param datasourceId 用户数据主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysUserDatasourceByDatasourceId(String datasourceId);
|
||||
|
||||
/**
|
||||
* 批量删除用户数据
|
||||
*
|
||||
* @param datasourceIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysUserDatasourceByDatasourceIds(String[] datasourceIds);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.SysDatasource;
|
||||
|
||||
/**
|
||||
* 数据管理Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-07-03
|
||||
*/
|
||||
public interface ISysDatasourceService
|
||||
{
|
||||
/**
|
||||
* 查询数据管理
|
||||
*
|
||||
* @param id 数据管理主键
|
||||
* @return 数据管理
|
||||
*/
|
||||
public SysDatasource selectSysDatasourceById(String id);
|
||||
|
||||
/**
|
||||
* 查询数据管理列表
|
||||
*
|
||||
* @param sysDatasource 数据管理
|
||||
* @return 数据管理集合
|
||||
*/
|
||||
public List<SysDatasource> selectSysDatasourceList(SysDatasource sysDatasource);
|
||||
|
||||
/**
|
||||
* 新增数据管理
|
||||
*
|
||||
* @param sysDatasource 数据管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysDatasource(SysDatasource sysDatasource);
|
||||
|
||||
/**
|
||||
* 修改数据管理
|
||||
*
|
||||
* @param sysDatasource 数据管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysDatasource(SysDatasource sysDatasource);
|
||||
|
||||
/**
|
||||
* 批量删除数据管理
|
||||
*
|
||||
* @param ids 需要删除的数据管理主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysDatasourceByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 删除数据管理信息
|
||||
*
|
||||
* @param id 数据管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysDatasourceById(String id);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.SysUserDatasource;
|
||||
|
||||
/**
|
||||
* 用户数据Service接口
|
||||
*
|
||||
* @author wenjy
|
||||
* @date 2023-07-03
|
||||
*/
|
||||
public interface ISysUserDatasourceService
|
||||
{
|
||||
/**
|
||||
* 查询用户数据
|
||||
*
|
||||
* @param datasourceId 用户数据主键
|
||||
* @return 用户数据
|
||||
*/
|
||||
public SysUserDatasource selectSysUserDatasourceByDatasourceId(String datasourceId);
|
||||
|
||||
/**
|
||||
* 查询用户数据列表
|
||||
*
|
||||
* @param sysUserDatasource 用户数据
|
||||
* @return 用户数据集合
|
||||
*/
|
||||
public List<SysUserDatasource> selectSysUserDatasourceList(SysUserDatasource sysUserDatasource);
|
||||
|
||||
/**
|
||||
* 新增用户数据
|
||||
*
|
||||
* @param sysUserDatasource 用户数据
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysUserDatasource(SysUserDatasource sysUserDatasource);
|
||||
|
||||
/**
|
||||
* 修改用户数据
|
||||
*
|
||||
* @param sysUserDatasource 用户数据
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysUserDatasource(SysUserDatasource sysUserDatasource);
|
||||
|
||||
/**
|
||||
* 批量删除用户数据
|
||||
*
|
||||
* @param datasourceIds 需要删除的用户数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysUserDatasourceByDatasourceIds(String[] datasourceIds);
|
||||
|
||||
/**
|
||||
* 删除用户数据信息
|
||||
*
|
||||
* @param datasourceId 用户数据主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysUserDatasourceByDatasourceId(String datasourceId);
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.core.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.SysDatasourceMapper;
|
||||
import com.ruoyi.system.domain.SysDatasource;
|
||||
import com.ruoyi.system.service.ISysDatasourceService;
|
||||
|
||||
/**
|
||||
* 数据管理Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-07-03
|
||||
*/
|
||||
@Service
|
||||
public class SysDatasourceServiceImpl implements ISysDatasourceService
|
||||
{
|
||||
@Autowired
|
||||
private SysDatasourceMapper sysDatasourceMapper;
|
||||
|
||||
/**
|
||||
* 查询数据管理
|
||||
*
|
||||
* @param id 数据管理主键
|
||||
* @return 数据管理
|
||||
*/
|
||||
@Override
|
||||
public SysDatasource selectSysDatasourceById(String id)
|
||||
{
|
||||
return sysDatasourceMapper.selectSysDatasourceById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询数据管理列表
|
||||
*
|
||||
* @param sysDatasource 数据管理
|
||||
* @return 数据管理
|
||||
*/
|
||||
@Override
|
||||
public List<SysDatasource> selectSysDatasourceList(SysDatasource sysDatasource)
|
||||
{
|
||||
return sysDatasourceMapper.selectSysDatasourceList(sysDatasource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据管理
|
||||
*
|
||||
* @param sysDatasource 数据管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysDatasource(SysDatasource sysDatasource)
|
||||
{
|
||||
sysDatasource.setCreateTime(DateUtils.getNowDate());
|
||||
return sysDatasourceMapper.insertSysDatasource(sysDatasource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据管理
|
||||
*
|
||||
* @param sysDatasource 数据管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysDatasource(SysDatasource sysDatasource)
|
||||
{
|
||||
sysDatasource.setUpdateTime(DateUtils.getNowDate());
|
||||
return sysDatasourceMapper.updateSysDatasource(sysDatasource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除数据管理
|
||||
*
|
||||
* @param ids 需要删除的数据管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysDatasourceByIds(String[] ids)
|
||||
{
|
||||
return sysDatasourceMapper.deleteSysDatasourceByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据管理信息
|
||||
*
|
||||
* @param id 数据管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysDatasourceById(String id)
|
||||
{
|
||||
return sysDatasourceMapper.deleteSysDatasourceById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.SysUserDatasourceMapper;
|
||||
import com.ruoyi.system.domain.SysUserDatasource;
|
||||
import com.ruoyi.system.service.ISysUserDatasourceService;
|
||||
|
||||
/**
|
||||
* 用户数据Service业务层处理
|
||||
*
|
||||
* @author wenjy
|
||||
* @date 2023-07-03
|
||||
*/
|
||||
@Service
|
||||
public class SysUserDatasourceServiceImpl implements ISysUserDatasourceService
|
||||
{
|
||||
@Autowired
|
||||
private SysUserDatasourceMapper sysUserDatasourceMapper;
|
||||
|
||||
/**
|
||||
* 查询用户数据
|
||||
*
|
||||
* @param datasourceId 用户数据主键
|
||||
* @return 用户数据
|
||||
*/
|
||||
@Override
|
||||
public SysUserDatasource selectSysUserDatasourceByDatasourceId(String datasourceId)
|
||||
{
|
||||
return sysUserDatasourceMapper.selectSysUserDatasourceByDatasourceId(datasourceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户数据列表
|
||||
*
|
||||
* @param sysUserDatasource 用户数据
|
||||
* @return 用户数据
|
||||
*/
|
||||
@Override
|
||||
public List<SysUserDatasource> selectSysUserDatasourceList(SysUserDatasource sysUserDatasource)
|
||||
{
|
||||
return sysUserDatasourceMapper.selectSysUserDatasourceList(sysUserDatasource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户数据
|
||||
*
|
||||
* @param sysUserDatasource 用户数据
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysUserDatasource(SysUserDatasource sysUserDatasource)
|
||||
{
|
||||
return sysUserDatasourceMapper.insertSysUserDatasource(sysUserDatasource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户数据
|
||||
*
|
||||
* @param sysUserDatasource 用户数据
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysUserDatasource(SysUserDatasource sysUserDatasource)
|
||||
{
|
||||
return sysUserDatasourceMapper.updateSysUserDatasource(sysUserDatasource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户数据
|
||||
*
|
||||
* @param datasourceIds 需要删除的用户数据主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysUserDatasourceByDatasourceIds(String[] datasourceIds)
|
||||
{
|
||||
return sysUserDatasourceMapper.deleteSysUserDatasourceByDatasourceIds(datasourceIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户数据信息
|
||||
*
|
||||
* @param datasourceId 用户数据主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysUserDatasourceByDatasourceId(String datasourceId)
|
||||
{
|
||||
return sysUserDatasourceMapper.deleteSysUserDatasourceByDatasourceId(datasourceId);
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.SysUserDatasourceMapper">
|
||||
|
||||
<resultMap type="SysUserDatasource" id="SysUserDatasourceResult">
|
||||
<result property="datasourceId" column="datasource_id" />
|
||||
<result property="userId" column="user_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysUserDatasourceVo">
|
||||
select datasource_id, user_id from sys_user_datasource
|
||||
</sql>
|
||||
|
||||
<select id="selectSysUserDatasourceList" parameterType="SysUserDatasource" resultMap="SysUserDatasourceResult">
|
||||
<include refid="selectSysUserDatasourceVo"/>
|
||||
<where>
|
||||
<if test="datasourceId != null and datasourceId != ''"> and datasource_id = #{datasourceId}</if>
|
||||
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSysUserDatasourceByDatasourceId" parameterType="String" resultMap="SysUserDatasourceResult">
|
||||
<include refid="selectSysUserDatasourceVo"/>
|
||||
where datasource_id = #{datasourceId}
|
||||
</select>
|
||||
|
||||
<insert id="insertSysUserDatasource" parameterType="SysUserDatasource">
|
||||
insert into sys_user_datasource
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="datasourceId != null and datasourceId != ''">datasource_id,</if>
|
||||
<if test="userId != null and userId != ''">user_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="datasourceId != null and datasourceId != ''">#{datasourceId},</if>
|
||||
<if test="userId != null and userId != ''">#{userId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSysUserDatasource" parameterType="SysUserDatasource">
|
||||
update sys_user_datasource
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="userId != null and userId != ''">user_id = #{userId},</if>
|
||||
</trim>
|
||||
where datasource_id = #{datasourceId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysUserDatasourceByDatasourceId" parameterType="String">
|
||||
delete from sys_user_datasource where datasource_id = #{datasourceId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSysUserDatasourceByDatasourceIds" parameterType="String">
|
||||
delete from sys_user_datasource where datasource_id in
|
||||
<foreach item="datasourceId" collection="array" open="(" separator="," close=")">
|
||||
#{datasourceId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询数据管理列表
|
||||
export function listDatasource(query) {
|
||||
return request({
|
||||
url: '/system/datasource/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询数据管理详细
|
||||
export function getDatasource(id) {
|
||||
return request({
|
||||
url: '/system/datasource/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增数据管理
|
||||
export function addDatasource(data) {
|
||||
return request({
|
||||
url: '/system/datasource',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改数据管理
|
||||
export function updateDatasource(data) {
|
||||
return request({
|
||||
url: '/system/datasource',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除数据管理
|
||||
export function delDatasource(id) {
|
||||
return request({
|
||||
url: '/system/datasource/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询用户数据列表
|
||||
export function listUserdatasource(query) {
|
||||
return request({
|
||||
url: '/system/userdatasource/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询用户数据详细
|
||||
export function getUserdatasource(datasourceId) {
|
||||
return request({
|
||||
url: '/system/userdatasource/' + datasourceId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增用户数据
|
||||
export function addUserdatasource(data) {
|
||||
return request({
|
||||
url: '/system/userdatasource',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改用户数据
|
||||
export function updateUserdatasource(data) {
|
||||
return request({
|
||||
url: '/system/userdatasource',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除用户数据
|
||||
export function delUserdatasource(datasourceId) {
|
||||
return request({
|
||||
url: '/system/userdatasource/' + datasourceId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
@ -0,0 +1,343 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="网络端口" prop="ipPort">
|
||||
<el-input
|
||||
v-model="queryParams.ipPort"
|
||||
placeholder="请输入网络端口"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="数据标识" prop="poolName">
|
||||
<el-input
|
||||
v-model="queryParams.poolName"
|
||||
placeholder="请输入数据源标识"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="帐号状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择帐号状态" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.sys_normal_disable"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['system:datasource:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['system:datasource:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['system:datasource:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['system:datasource:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="datasourceList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- <el-table-column label="主键" align="center" prop="id" />-->
|
||||
<el-table-column label="网络端口" align="center" prop="ipPort" />
|
||||
<el-table-column label="用户名" align="center" prop="userName" />
|
||||
<el-table-column label="密码" align="center" prop="password" />
|
||||
<el-table-column label="驱动" align="center" prop="driveClassName" />
|
||||
<el-table-column label="数据源标识" align="center" prop="poolName" />
|
||||
<el-table-column label="数据源名称" align="center" prop="parkName" />
|
||||
<el-table-column label="帐号状态" align="center" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<!-- <el-table-column label="数据所属部门" align="center" prop="deptId" />-->
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:datasource:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:datasource:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改数据管理对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="地址" prop="url">
|
||||
<el-input v-model="form.url" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="网络端口" prop="ipPort">
|
||||
<el-input v-model="form.ipPort" placeholder="请输入网络端口" />
|
||||
</el-form-item>
|
||||
<el-form-item label="用户名" prop="userName">
|
||||
<el-input v-model="form.userName" placeholder="请输入用户名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="password">
|
||||
<el-input v-model="form.password" placeholder="请输入密码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="驱动" prop="driveClassName">
|
||||
<el-input v-model="form.driveClassName" placeholder="请输入驱动" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数据源标识" prop="poolName">
|
||||
<el-input v-model="form.poolName" placeholder="请输入数据源标识" />
|
||||
</el-form-item>
|
||||
<el-form-item label="数据源名称" prop="parkName">
|
||||
<el-input v-model="form.parkName" placeholder="请输入数据源名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="帐号状态" prop="status">
|
||||
<el-select v-model="form.status" placeholder="请选择帐号状态">
|
||||
<el-option
|
||||
v-for="dict in dict.type.sys_normal_disable"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属部门" prop="deptId">
|
||||
<el-input v-model="form.deptId" placeholder="请输入数据所属部门" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listDatasource, getDatasource, delDatasource, addDatasource, updateDatasource } from "@/api/system/datasource";
|
||||
|
||||
export default {
|
||||
name: "Datasource",
|
||||
dicts: ['sys_normal_disable'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 数据管理表格数据
|
||||
datasourceList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
ipPort: null,
|
||||
poolName: null,
|
||||
status: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
url: [
|
||||
{ required: true, message: "地址不能为空", trigger: "blur" }
|
||||
],
|
||||
userName: [
|
||||
{ required: true, message: "用户名不能为空", trigger: "blur" }
|
||||
],
|
||||
password: [
|
||||
{ required: true, message: "密码不能为空", trigger: "blur" }
|
||||
],
|
||||
driveClassName: [
|
||||
{ required: true, message: "驱动不能为空", trigger: "blur" }
|
||||
],
|
||||
poolName: [
|
||||
{ required: true, message: "数据源标识不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询数据管理列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listDatasource(this.queryParams).then(response => {
|
||||
this.datasourceList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
url: null,
|
||||
ipPort: null,
|
||||
userName: null,
|
||||
password: null,
|
||||
driveClassName: null,
|
||||
poolName: null,
|
||||
parkName: null,
|
||||
status: null,
|
||||
delFlag: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
remark: null,
|
||||
deptId: null,
|
||||
schemaCreated: null,
|
||||
systemType: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加数据管理";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getDatasource(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改数据管理";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateDatasource(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addDatasource(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除数据管理编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delDatasource(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('system/datasource/export', {
|
||||
...this.queryParams
|
||||
}, `datasource_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -0,0 +1,257 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="数据ID" prop="datasourceId">
|
||||
<el-input
|
||||
v-model="queryParams.datasourceId"
|
||||
placeholder="请输入数据ID"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户ID" prop="userId">
|
||||
<el-input
|
||||
v-model="queryParams.userId"
|
||||
placeholder="请输入用户ID"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['system:userdatasource:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['system:userdatasource:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['system:userdatasource:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['system:userdatasource:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="userdatasourceList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="数据ID" align="center" prop="datasourceId" />
|
||||
<el-table-column label="用户ID" align="center" prop="userId" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:userdatasource:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:userdatasource:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改用户数据对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listUserdatasource, getUserdatasource, delUserdatasource, addUserdatasource, updateUserdatasource } from "@/api/system/userdatasource";
|
||||
|
||||
export default {
|
||||
name: "Userdatasource",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 用户数据表格数据
|
||||
userdatasourceList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
datasourceId: null,
|
||||
userId: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
datasourceId: [
|
||||
{ required: true, message: "数据ID不能为空", trigger: "blur" }
|
||||
],
|
||||
userId: [
|
||||
{ required: true, message: "用户ID不能为空", trigger: "blur" }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询用户数据列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listUserdatasource(this.queryParams).then(response => {
|
||||
this.userdatasourceList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
datasourceId: null,
|
||||
userId: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.datasourceId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加用户数据";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const datasourceId = row.datasourceId || this.ids
|
||||
getUserdatasource(datasourceId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改用户数据";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.datasourceId != null) {
|
||||
updateUserdatasource(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addUserdatasource(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const datasourceIds = row.datasourceId || this.ids;
|
||||
this.$modal.confirm('是否确认删除用户数据编号为"' + datasourceIds + '"的数据项?').then(function() {
|
||||
return delUserdatasource(datasourceIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('system/userdatasource/export', {
|
||||
...this.queryParams
|
||||
}, `userdatasource_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue