update ADD大屏设计数据源接口
parent
bf271be769
commit
0a587d3811
@ -0,0 +1,118 @@
|
|||||||
|
package org.dromara.system.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import org.dromara.common.log.annotation.Log;
|
||||||
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
|
import org.dromara.system.domain.vo.SysDesignDataSourceVo;
|
||||||
|
import org.dromara.system.domain.bo.SysDesignDataSourceBo;
|
||||||
|
import org.dromara.system.service.ISysDesignDataSourceService;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大屏设计数据源
|
||||||
|
* 前端访问路由地址为:/system/designDataSource
|
||||||
|
*
|
||||||
|
* @author Yinq
|
||||||
|
* @date 2025-05-20
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/designDataSource")
|
||||||
|
public class SysDesignDataSourceController extends BaseController {
|
||||||
|
|
||||||
|
private final ISysDesignDataSourceService sysDesignDataSourceService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询大屏设计数据源列表
|
||||||
|
*/
|
||||||
|
//@SaCheckPermission("system:designDataSource:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<SysDesignDataSourceVo> list(SysDesignDataSourceBo bo, PageQuery pageQuery) {
|
||||||
|
return sysDesignDataSourceService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出大屏设计数据源列表
|
||||||
|
*/
|
||||||
|
//@SaCheckPermission("system:designDataSource:export")
|
||||||
|
@Log(title = "大屏设计数据源", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(SysDesignDataSourceBo bo, HttpServletResponse response) {
|
||||||
|
List<SysDesignDataSourceVo> list = sysDesignDataSourceService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "大屏设计数据源", SysDesignDataSourceVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取大屏设计数据源详细信息
|
||||||
|
*
|
||||||
|
* @param dataSourceId 主键
|
||||||
|
*/
|
||||||
|
//@SaCheckPermission("system:designDataSource:query")
|
||||||
|
@GetMapping("/{dataSourceId}")
|
||||||
|
public R<SysDesignDataSourceVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long dataSourceId) {
|
||||||
|
return R.ok(sysDesignDataSourceService.queryById(dataSourceId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增大屏设计数据源
|
||||||
|
*/
|
||||||
|
//@SaCheckPermission("system:designDataSource:add")
|
||||||
|
@Log(title = "大屏设计数据源", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody SysDesignDataSourceBo bo) {
|
||||||
|
return toAjax(sysDesignDataSourceService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改大屏设计数据源
|
||||||
|
*/
|
||||||
|
//@SaCheckPermission("system:designDataSource:edit")
|
||||||
|
@Log(title = "大屏设计数据源", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysDesignDataSourceBo bo) {
|
||||||
|
return toAjax(sysDesignDataSourceService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除大屏设计数据源
|
||||||
|
*
|
||||||
|
* @param dataSourceIds 主键串
|
||||||
|
*/
|
||||||
|
//@SaCheckPermission("system:designDataSource:remove")
|
||||||
|
@Log(title = "大屏设计数据源", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{dataSourceIds}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] dataSourceIds) {
|
||||||
|
return toAjax(sysDesignDataSourceService.deleteWithValidByIds(List.of(dataSourceIds), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下拉框查询大屏设计数据源列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/getSysDesignDataSourceList")
|
||||||
|
public R<List<SysDesignDataSourceVo>> getSysDesignDataSourceList(SysDesignDataSourceBo bo) {
|
||||||
|
List<SysDesignDataSourceVo> list = sysDesignDataSourceService.queryList(bo);
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,117 @@
|
|||||||
|
package org.dromara.system.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import org.dromara.common.log.annotation.Log;
|
||||||
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
|
import org.dromara.system.domain.vo.SysDesignPageConfigVo;
|
||||||
|
import org.dromara.system.domain.bo.SysDesignPageConfigBo;
|
||||||
|
import org.dromara.system.service.ISysDesignPageConfigService;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大屏设计页面配置
|
||||||
|
* 前端访问路由地址为:/system/designPageConfig
|
||||||
|
*
|
||||||
|
* @author Yinq
|
||||||
|
* @date 2025-05-20
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/designPageConfig")
|
||||||
|
public class SysDesignPageConfigController extends BaseController {
|
||||||
|
|
||||||
|
private final ISysDesignPageConfigService sysDesignPageConfigService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询大屏设计页面配置列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:designPageConfig:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<SysDesignPageConfigVo> list(SysDesignPageConfigBo bo, PageQuery pageQuery) {
|
||||||
|
return sysDesignPageConfigService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出大屏设计页面配置列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:designPageConfig:export")
|
||||||
|
@Log(title = "大屏设计页面配置", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(SysDesignPageConfigBo bo, HttpServletResponse response) {
|
||||||
|
List<SysDesignPageConfigVo> list = sysDesignPageConfigService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "大屏设计页面配置", SysDesignPageConfigVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取大屏设计页面配置详细信息
|
||||||
|
*
|
||||||
|
* @param pageConfigId 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:designPageConfig:query")
|
||||||
|
@GetMapping("/{pageConfigId}")
|
||||||
|
public R<SysDesignPageConfigVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long pageConfigId) {
|
||||||
|
return R.ok(sysDesignPageConfigService.queryById(pageConfigId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增大屏设计页面配置
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:designPageConfig:add")
|
||||||
|
@Log(title = "大屏设计页面配置", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody SysDesignPageConfigBo bo) {
|
||||||
|
return toAjax(sysDesignPageConfigService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改大屏设计页面配置
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:designPageConfig:edit")
|
||||||
|
@Log(title = "大屏设计页面配置", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysDesignPageConfigBo bo) {
|
||||||
|
return toAjax(sysDesignPageConfigService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除大屏设计页面配置
|
||||||
|
*
|
||||||
|
* @param pageConfigIds 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("system:designPageConfig:remove")
|
||||||
|
@Log(title = "大屏设计页面配置", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{pageConfigIds}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] pageConfigIds) {
|
||||||
|
return toAjax(sysDesignPageConfigService.deleteWithValidByIds(List.of(pageConfigIds), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下拉框查询大屏设计页面配置列表
|
||||||
|
*/
|
||||||
|
|
||||||
|
@GetMapping("/getSysDesignPageConfigList")
|
||||||
|
public R<List<SysDesignPageConfigVo>> getSysDesignPageConfigList(SysDesignPageConfigBo bo) {
|
||||||
|
List<SysDesignPageConfigVo> list = sysDesignPageConfigService.queryList(bo);
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.system.mapper;
|
||||||
|
|
||||||
|
import org.dromara.system.domain.SysDesignDataField;
|
||||||
|
import org.dromara.system.domain.vo.SysDesignDataFieldVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大屏设计数据字段Mapper接口
|
||||||
|
*
|
||||||
|
* @author Yinq
|
||||||
|
* @date 2025-05-20
|
||||||
|
*/
|
||||||
|
public interface SysDesignDataFieldMapper extends BaseMapperPlus<SysDesignDataField, SysDesignDataFieldVo> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.system.mapper;
|
||||||
|
|
||||||
|
import org.dromara.system.domain.SysDesignDataSource;
|
||||||
|
import org.dromara.system.domain.vo.SysDesignDataSourceVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大屏设计数据源Mapper接口
|
||||||
|
*
|
||||||
|
* @author Yinq
|
||||||
|
* @date 2025-05-20
|
||||||
|
*/
|
||||||
|
public interface SysDesignDataSourceMapper extends BaseMapperPlus<SysDesignDataSource, SysDesignDataSourceVo> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.system.mapper;
|
||||||
|
|
||||||
|
import org.dromara.system.domain.SysDesignPageConfig;
|
||||||
|
import org.dromara.system.domain.vo.SysDesignPageConfigVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大屏设计页面配置Mapper接口
|
||||||
|
*
|
||||||
|
* @author Yinq
|
||||||
|
* @date 2025-05-20
|
||||||
|
*/
|
||||||
|
public interface SysDesignPageConfigMapper extends BaseMapperPlus<SysDesignPageConfig, SysDesignPageConfigVo> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,68 @@
|
|||||||
|
package org.dromara.system.service;
|
||||||
|
|
||||||
|
import org.dromara.system.domain.vo.SysDesignDataSourceVo;
|
||||||
|
import org.dromara.system.domain.bo.SysDesignDataSourceBo;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大屏设计数据源Service接口
|
||||||
|
*
|
||||||
|
* @author Yinq
|
||||||
|
* @date 2025-05-20
|
||||||
|
*/
|
||||||
|
public interface ISysDesignDataSourceService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询大屏设计数据源
|
||||||
|
*
|
||||||
|
* @param dataSourceId 主键
|
||||||
|
* @return 大屏设计数据源
|
||||||
|
*/
|
||||||
|
SysDesignDataSourceVo queryById(Long dataSourceId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询大屏设计数据源列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 大屏设计数据源分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<SysDesignDataSourceVo> queryPageList(SysDesignDataSourceBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的大屏设计数据源列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 大屏设计数据源列表
|
||||||
|
*/
|
||||||
|
List<SysDesignDataSourceVo> queryList(SysDesignDataSourceBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增大屏设计数据源
|
||||||
|
*
|
||||||
|
* @param bo 大屏设计数据源
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(SysDesignDataSourceBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改大屏设计数据源
|
||||||
|
*
|
||||||
|
* @param bo 大屏设计数据源
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(SysDesignDataSourceBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除大屏设计数据源信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
package org.dromara.system.service;
|
||||||
|
|
||||||
|
import org.dromara.system.domain.SysDesignPageConfig;
|
||||||
|
import org.dromara.system.domain.vo.SysDesignPageConfigVo;
|
||||||
|
import org.dromara.system.domain.bo.SysDesignPageConfigBo;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大屏设计页面配置Service接口
|
||||||
|
*
|
||||||
|
* @author Yinq
|
||||||
|
* @date 2025-05-20
|
||||||
|
*/
|
||||||
|
public interface ISysDesignPageConfigService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询大屏设计页面配置
|
||||||
|
*
|
||||||
|
* @param pageConfigId 主键
|
||||||
|
* @return 大屏设计页面配置
|
||||||
|
*/
|
||||||
|
SysDesignPageConfigVo queryById(Long pageConfigId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询大屏设计页面配置列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 大屏设计页面配置分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<SysDesignPageConfigVo> queryPageList(SysDesignPageConfigBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的大屏设计页面配置列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 大屏设计页面配置列表
|
||||||
|
*/
|
||||||
|
List<SysDesignPageConfigVo> queryList(SysDesignPageConfigBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增大屏设计页面配置
|
||||||
|
*
|
||||||
|
* @param bo 大屏设计页面配置
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(SysDesignPageConfigBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改大屏设计页面配置
|
||||||
|
*
|
||||||
|
* @param bo 大屏设计页面配置
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(SysDesignPageConfigBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除大屏设计页面配置信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
}
|
@ -0,0 +1,177 @@
|
|||||||
|
package org.dromara.system.service.impl;
|
||||||
|
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.github.yulichang.toolkit.JoinWrappers;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.system.domain.SysDesignDataField;
|
||||||
|
import org.dromara.system.mapper.SysDesignDataFieldMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.dromara.system.domain.bo.SysDesignDataSourceBo;
|
||||||
|
import org.dromara.system.domain.vo.SysDesignDataSourceVo;
|
||||||
|
import org.dromara.system.domain.SysDesignDataSource;
|
||||||
|
import org.dromara.system.mapper.SysDesignDataSourceMapper;
|
||||||
|
import org.dromara.system.service.ISysDesignDataSourceService;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大屏设计数据源Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Yinq
|
||||||
|
* @date 2025-05-20
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class SysDesignDataSourceServiceImpl implements ISysDesignDataSourceService {
|
||||||
|
|
||||||
|
private final SysDesignDataSourceMapper baseMapper;
|
||||||
|
|
||||||
|
private final SysDesignDataFieldMapper designDataFieldMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询大屏设计数据源
|
||||||
|
*
|
||||||
|
* @param dataSourceId 主键
|
||||||
|
* @return 大屏设计数据源
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysDesignDataSourceVo queryById(Long dataSourceId) {
|
||||||
|
SysDesignDataSourceVo dataSourceVo = baseMapper.selectVoById(dataSourceId);
|
||||||
|
MPJLambdaWrapper<SysDesignDataField> lqw = JoinWrappers.lambda(SysDesignDataField.class);
|
||||||
|
lqw.eq(SysDesignDataField::getDataSourceId, dataSourceId);
|
||||||
|
List<SysDesignDataField> dataFieldList = designDataFieldMapper.selectList(lqw);
|
||||||
|
dataSourceVo.setDesignDataFieldList(dataFieldList);
|
||||||
|
return dataSourceVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询大屏设计数据源列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 大屏设计数据源分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<SysDesignDataSourceVo> queryPageList(SysDesignDataSourceBo bo, PageQuery pageQuery) {
|
||||||
|
MPJLambdaWrapper<SysDesignDataSource> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<SysDesignDataSourceVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的大屏设计数据源列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 大屏设计数据源列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysDesignDataSourceVo> queryList(SysDesignDataSourceBo bo) {
|
||||||
|
MPJLambdaWrapper<SysDesignDataSource> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private MPJLambdaWrapper<SysDesignDataSource> buildQueryWrapper(SysDesignDataSourceBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
MPJLambdaWrapper<SysDesignDataSource> lqw = JoinWrappers.lambda(SysDesignDataSource.class)
|
||||||
|
.selectAll(SysDesignDataSource.class)
|
||||||
|
.eq(bo.getDataSourceId() != null, SysDesignDataSource::getDataSourceId, bo.getDataSourceId())
|
||||||
|
.like(StringUtils.isNotBlank(bo.getDataSourceName()), SysDesignDataSource::getDataSourceName, bo.getDataSourceName())
|
||||||
|
.eq(StringUtils.isNotBlank(bo.getRequestMethod()), SysDesignDataSource::getRequestMethod, bo.getRequestMethod())
|
||||||
|
.eq(StringUtils.isNotBlank(bo.getRequestUrl()), SysDesignDataSource::getRequestUrl, bo.getRequestUrl())
|
||||||
|
.eq(StringUtils.isNotBlank(bo.getDataSourceGroup()), SysDesignDataSource::getDataSourceGroup, bo.getDataSourceGroup())
|
||||||
|
.eq(StringUtils.isNotBlank(bo.getRequestContentType()), SysDesignDataSource::getRequestContentType, bo.getRequestContentType())
|
||||||
|
.eq(StringUtils.isNotBlank(bo.getResponseType()), SysDesignDataSource::getResponseType, bo.getResponseType())
|
||||||
|
.eq(StringUtils.isNotBlank(bo.getVersionCode()), SysDesignDataSource::getVersionCode, bo.getVersionCode())
|
||||||
|
.eq(bo.getSortOrder() != null, SysDesignDataSource::getSortOrder, bo.getSortOrder())
|
||||||
|
.eq(StringUtils.isNotBlank(bo.getFieldOne()), SysDesignDataSource::getFieldOne, bo.getFieldOne())
|
||||||
|
.eq(StringUtils.isNotBlank(bo.getFieldTwo()), SysDesignDataSource::getFieldTwo, bo.getFieldTwo())
|
||||||
|
.eq(StringUtils.isNotBlank(bo.getFieldThree()), SysDesignDataSource::getFieldThree, bo.getFieldThree())
|
||||||
|
.eq(StringUtils.isNotBlank(bo.getFieldFour()), SysDesignDataSource::getFieldFour, bo.getFieldFour())
|
||||||
|
.eq(StringUtils.isNotBlank(bo.getFieldFive()), SysDesignDataSource::getFieldFive, bo.getFieldFive())
|
||||||
|
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), SysDesignDataSource::getActiveFlag, bo.getActiveFlag())
|
||||||
|
.orderByAsc(SysDesignDataSource::getCreateTime);
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增大屏设计数据源
|
||||||
|
*
|
||||||
|
* @param bo 大屏设计数据源
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean insertByBo(SysDesignDataSourceBo bo) {
|
||||||
|
SysDesignDataSource add = MapstructUtils.convert(bo, SysDesignDataSource.class);
|
||||||
|
List<SysDesignDataField> designDataFieldList = bo.getDesignDataFieldList();
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
assert add != null;
|
||||||
|
bo.setDataSourceId(add.getDataSourceId());
|
||||||
|
if (!designDataFieldList.isEmpty()) {
|
||||||
|
for (SysDesignDataField designDataField : designDataFieldList) {
|
||||||
|
designDataField.setDataSourceId(add.getDataSourceId());
|
||||||
|
designDataFieldMapper.insert(designDataField);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改大屏设计数据源
|
||||||
|
*
|
||||||
|
* @param bo 大屏设计数据源
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean updateByBo(SysDesignDataSourceBo bo) {
|
||||||
|
SysDesignDataSource update = MapstructUtils.convert(bo, SysDesignDataSource.class);
|
||||||
|
List<SysDesignDataField> designDataFieldList = bo.getDesignDataFieldList();
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
if (!designDataFieldList.isEmpty()) {
|
||||||
|
// MPJLambdaWrapper<SysDesignDataField> lqw = JoinWrappers.lambda(SysDesignDataField.class);
|
||||||
|
// lqw.eq(bo.getDataSourceId() != null, SysDesignDataField::getDataSourceId, bo.getDataSourceId());
|
||||||
|
// List<SysDesignDataField> dataFieldList = designDataFieldMapper.selectList(lqw);
|
||||||
|
// for (SysDesignDataField field : dataFieldList) {
|
||||||
|
// designDataFieldMapper.deleteById(field.getDataFieldId());
|
||||||
|
// }
|
||||||
|
for (SysDesignDataField dataField : designDataFieldList) {
|
||||||
|
designDataFieldMapper.insertOrUpdate(dataField);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(SysDesignDataSource entity) {
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除大屏设计数据源信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if (isValid) {
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,142 @@
|
|||||||
|
package org.dromara.system.service.impl;
|
||||||
|
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.github.yulichang.toolkit.JoinWrappers;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.dromara.system.domain.bo.SysDesignPageConfigBo;
|
||||||
|
import org.dromara.system.domain.vo.SysDesignPageConfigVo;
|
||||||
|
import org.dromara.system.domain.SysDesignPageConfig;
|
||||||
|
import org.dromara.system.mapper.SysDesignPageConfigMapper;
|
||||||
|
import org.dromara.system.service.ISysDesignPageConfigService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大屏设计页面配置Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Yinq
|
||||||
|
* @date 2025-05-20
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class SysDesignPageConfigServiceImpl implements ISysDesignPageConfigService {
|
||||||
|
|
||||||
|
private final SysDesignPageConfigMapper baseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询大屏设计页面配置
|
||||||
|
*
|
||||||
|
* @param pageConfigId 主键
|
||||||
|
* @return 大屏设计页面配置
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysDesignPageConfigVo queryById(Long pageConfigId){
|
||||||
|
return baseMapper.selectVoById(pageConfigId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询大屏设计页面配置列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 大屏设计页面配置分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<SysDesignPageConfigVo> queryPageList(SysDesignPageConfigBo bo, PageQuery pageQuery) {
|
||||||
|
MPJLambdaWrapper<SysDesignPageConfig> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<SysDesignPageConfigVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的大屏设计页面配置列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 大屏设计页面配置列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysDesignPageConfigVo> queryList(SysDesignPageConfigBo bo) {
|
||||||
|
MPJLambdaWrapper<SysDesignPageConfig> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private MPJLambdaWrapper<SysDesignPageConfig> buildQueryWrapper(SysDesignPageConfigBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
MPJLambdaWrapper<SysDesignPageConfig> lqw = JoinWrappers.lambda(SysDesignPageConfig.class)
|
||||||
|
.selectAll(SysDesignPageConfig.class)
|
||||||
|
.eq(bo.getPageConfigId() != null, SysDesignPageConfig::getPageConfigId, bo.getPageConfigId())
|
||||||
|
.like(StringUtils.isNotBlank(bo.getPageConfigName()), SysDesignPageConfig::getPageConfigName, bo.getPageConfigName())
|
||||||
|
.eq(StringUtils.isNotBlank(bo.getPageBackground()), SysDesignPageConfig::getPageBackground, bo.getPageBackground())
|
||||||
|
.eq(StringUtils.isNotBlank(bo.getPageRouting()), SysDesignPageConfig::getPageRouting, bo.getPageRouting())
|
||||||
|
.eq(StringUtils.isNotBlank(bo.getCustomContent()), SysDesignPageConfig::getCustomContent, bo.getCustomContent())
|
||||||
|
.eq(bo.getSortOrder() != null, SysDesignPageConfig::getSortOrder, bo.getSortOrder())
|
||||||
|
.eq(StringUtils.isNotBlank(bo.getFieldOne()), SysDesignPageConfig::getFieldOne, bo.getFieldOne())
|
||||||
|
.eq(StringUtils.isNotBlank(bo.getFieldTwo()), SysDesignPageConfig::getFieldTwo, bo.getFieldTwo())
|
||||||
|
.eq(StringUtils.isNotBlank(bo.getFieldThree()), SysDesignPageConfig::getFieldThree, bo.getFieldThree())
|
||||||
|
.eq(StringUtils.isNotBlank(bo.getFieldFour()), SysDesignPageConfig::getFieldFour, bo.getFieldFour())
|
||||||
|
.eq(StringUtils.isNotBlank(bo.getFieldFive()), SysDesignPageConfig::getFieldFive, bo.getFieldFive())
|
||||||
|
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), SysDesignPageConfig::getActiveFlag, bo.getActiveFlag())
|
||||||
|
.orderByDesc(SysDesignPageConfig::getCreateTime);
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增大屏设计页面配置
|
||||||
|
*
|
||||||
|
* @param bo 大屏设计页面配置
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(SysDesignPageConfigBo bo) {
|
||||||
|
SysDesignPageConfig add = MapstructUtils.convert(bo, SysDesignPageConfig.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setPageConfigId(add.getPageConfigId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改大屏设计页面配置
|
||||||
|
*
|
||||||
|
* @param bo 大屏设计页面配置
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(SysDesignPageConfigBo bo) {
|
||||||
|
SysDesignPageConfig update = MapstructUtils.convert(bo, SysDesignPageConfig.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(SysDesignPageConfig entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除大屏设计页面配置信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
<?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="org.dromara.system.mapper.SysDesignDataFieldMapper">
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,7 @@
|
|||||||
|
<?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="org.dromara.system.mapper.SysDesignDataSourceMapper">
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,7 @@
|
|||||||
|
<?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="org.dromara.system.mapper.SysDesignPageConfigMapper">
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue