update 初始化主数据维护、主数据明细
parent
9f00cc9d9a
commit
cd18e05358
@ -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.SysMasterDataVo;
|
||||
import org.dromara.system.domain.bo.SysMasterDataBo;
|
||||
import org.dromara.system.service.ISysMasterDataService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 主数据维护
|
||||
* 前端访问路由地址为:/system/masterData
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-10
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/masterData")
|
||||
public class SysMasterDataController extends BaseController {
|
||||
|
||||
private final ISysMasterDataService sysMasterDataService;
|
||||
|
||||
/**
|
||||
* 查询主数据维护列表
|
||||
*/
|
||||
@SaCheckPermission("system:masterData:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<SysMasterDataVo> list(SysMasterDataBo bo, PageQuery pageQuery) {
|
||||
return sysMasterDataService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出主数据维护列表
|
||||
*/
|
||||
@SaCheckPermission("system:masterData:export")
|
||||
@Log(title = "主数据维护", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(SysMasterDataBo bo, HttpServletResponse response) {
|
||||
List<SysMasterDataVo> list = sysMasterDataService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "主数据维护", SysMasterDataVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主数据维护详细信息
|
||||
*
|
||||
* @param masterDataId 主键
|
||||
*/
|
||||
@SaCheckPermission("system:masterData:query")
|
||||
@GetMapping("/{masterDataId}")
|
||||
public R<SysMasterDataVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long masterDataId) {
|
||||
return R.ok(sysMasterDataService.queryById(masterDataId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增主数据维护
|
||||
*/
|
||||
@SaCheckPermission("system:masterData:add")
|
||||
@Log(title = "主数据维护", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody SysMasterDataBo bo) {
|
||||
return toAjax(sysMasterDataService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改主数据维护
|
||||
*/
|
||||
@SaCheckPermission("system:masterData:edit")
|
||||
@Log(title = "主数据维护", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysMasterDataBo bo) {
|
||||
return toAjax(sysMasterDataService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除主数据维护
|
||||
*
|
||||
* @param masterDataIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("system:masterData:remove")
|
||||
@Log(title = "主数据维护", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{masterDataIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] masterDataIds) {
|
||||
return toAjax(sysMasterDataService.deleteWithValidByIds(List.of(masterDataIds), true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下拉框查询主数据维护列表
|
||||
*/
|
||||
|
||||
@GetMapping("getSysMasterDataList")
|
||||
public R<List<SysMasterDataVo>> getSysMasterDatalist(SysMasterDataBo bo) {
|
||||
List<SysMasterDataVo> list = sysMasterDataService.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.SysMasterDataDetailVo;
|
||||
import org.dromara.system.domain.bo.SysMasterDataDetailBo;
|
||||
import org.dromara.system.service.ISysMasterDataDetailService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 主数据维护明细
|
||||
* 前端访问路由地址为:/system/masterDataDetail
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-10
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/masterDataDetail")
|
||||
public class SysMasterDataDetailController extends BaseController {
|
||||
|
||||
private final ISysMasterDataDetailService sysMasterDataDetailService;
|
||||
|
||||
/**
|
||||
* 查询主数据维护明细列表
|
||||
*/
|
||||
@SaCheckPermission("system:masterDataDetail:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<SysMasterDataDetailVo> list(SysMasterDataDetailBo bo, PageQuery pageQuery) {
|
||||
return sysMasterDataDetailService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出主数据维护明细列表
|
||||
*/
|
||||
@SaCheckPermission("system:masterDataDetail:export")
|
||||
@Log(title = "主数据维护明细", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(SysMasterDataDetailBo bo, HttpServletResponse response) {
|
||||
List<SysMasterDataDetailVo> list = sysMasterDataDetailService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "主数据维护明细", SysMasterDataDetailVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主数据维护明细详细信息
|
||||
*
|
||||
* @param masterDataDetailId 主键
|
||||
*/
|
||||
@SaCheckPermission("system:masterDataDetail:query")
|
||||
@GetMapping("/{masterDataDetailId}")
|
||||
public R<SysMasterDataDetailVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long masterDataDetailId) {
|
||||
return R.ok(sysMasterDataDetailService.queryById(masterDataDetailId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增主数据维护明细
|
||||
*/
|
||||
@SaCheckPermission("system:masterDataDetail:add")
|
||||
@Log(title = "主数据维护明细", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody SysMasterDataDetailBo bo) {
|
||||
return toAjax(sysMasterDataDetailService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改主数据维护明细
|
||||
*/
|
||||
@SaCheckPermission("system:masterDataDetail:edit")
|
||||
@Log(title = "主数据维护明细", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysMasterDataDetailBo bo) {
|
||||
return toAjax(sysMasterDataDetailService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除主数据维护明细
|
||||
*
|
||||
* @param masterDataDetailIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("system:masterDataDetail:remove")
|
||||
@Log(title = "主数据维护明细", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{masterDataDetailIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] masterDataDetailIds) {
|
||||
return toAjax(sysMasterDataDetailService.deleteWithValidByIds(List.of(masterDataDetailIds), true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下拉框查询主数据维护明细列表
|
||||
*/
|
||||
|
||||
@GetMapping("getSysMasterDataDetailList")
|
||||
public R<List<SysMasterDataDetailVo>> getSysMasterDataDetaillist(SysMasterDataDetailBo bo) {
|
||||
List<SysMasterDataDetailVo> list = sysMasterDataDetailService.queryList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
}
|
@ -0,0 +1,110 @@
|
||||
package org.dromara.system.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 主数据维护明细对象 sys_master_data_detail
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-10
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("sys_master_data_detail")
|
||||
public class SysMasterDataDetail extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键标识
|
||||
*/
|
||||
@TableId(value = "master_data_detail_id", type = IdType.AUTO)
|
||||
private Long masterDataDetailId;
|
||||
|
||||
/**
|
||||
* 主数据ID
|
||||
*/
|
||||
@TableField("master_data_id")
|
||||
private Long masterDataId;
|
||||
|
||||
/**
|
||||
* 父级标识
|
||||
*/
|
||||
@TableField("parent_id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 祖级列表
|
||||
*/
|
||||
@TableField("ancestors")
|
||||
private String ancestors;
|
||||
|
||||
/**
|
||||
* 主数据明细编号
|
||||
*/
|
||||
@TableField("data_detail_code")
|
||||
private String dataDetailCode;
|
||||
|
||||
/**
|
||||
* 主数据明细名称
|
||||
*/
|
||||
@TableField("data_detail_name")
|
||||
private String dataDetailName;
|
||||
|
||||
/**
|
||||
* 预留字段1数据
|
||||
*/
|
||||
@TableField("field_data_1")
|
||||
private String fieldData1;
|
||||
|
||||
/**
|
||||
* 预留字段2数据
|
||||
*/
|
||||
@TableField("field_data_2")
|
||||
private String fieldData2;
|
||||
|
||||
/**
|
||||
* 预留字段3数据
|
||||
*/
|
||||
@TableField("field_data_3")
|
||||
private String fieldData3;
|
||||
|
||||
/**
|
||||
* 预留字段4数据
|
||||
*/
|
||||
@TableField("field_data_4")
|
||||
private String fieldData4;
|
||||
|
||||
/**
|
||||
* 预留字段5数据
|
||||
*/
|
||||
@TableField("field_data_5")
|
||||
private String fieldData5;
|
||||
|
||||
/**
|
||||
* 显示排序
|
||||
*/
|
||||
@TableField("display_sort")
|
||||
private Long displaySort;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField("remark")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 激活标识(1是 0否)
|
||||
*/
|
||||
@TableField("active_flag")
|
||||
private String activeFlag;
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
package org.dromara.system.domain.bo;
|
||||
|
||||
import org.dromara.system.domain.SysMasterDataDetail;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 主数据维护明细业务对象 sys_master_data_detail
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-10
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = SysMasterDataDetail.class, reverseConvertGenerate = false)
|
||||
public class SysMasterDataDetailBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键标识
|
||||
*/
|
||||
private Long masterDataDetailId;
|
||||
|
||||
/**
|
||||
* 主数据ID
|
||||
*/
|
||||
private Long masterDataId;
|
||||
|
||||
/**
|
||||
* 父级标识
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 祖级列表
|
||||
*/
|
||||
private String ancestors;
|
||||
|
||||
/**
|
||||
* 主数据明细编号
|
||||
*/
|
||||
@NotBlank(message = "主数据明细编号不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String dataDetailCode;
|
||||
|
||||
/**
|
||||
* 主数据明细名称
|
||||
*/
|
||||
@NotBlank(message = "主数据明细名称不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String dataDetailName;
|
||||
|
||||
/**
|
||||
* 预留字段1数据
|
||||
*/
|
||||
private String fieldData1;
|
||||
|
||||
/**
|
||||
* 预留字段2数据
|
||||
*/
|
||||
private String fieldData2;
|
||||
|
||||
/**
|
||||
* 预留字段3数据
|
||||
*/
|
||||
private String fieldData3;
|
||||
|
||||
/**
|
||||
* 预留字段4数据
|
||||
*/
|
||||
private String fieldData4;
|
||||
|
||||
/**
|
||||
* 预留字段5数据
|
||||
*/
|
||||
private String fieldData5;
|
||||
|
||||
/**
|
||||
* 显示排序
|
||||
*/
|
||||
private Long displaySort;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 激活标识(1是 0否)
|
||||
*/
|
||||
@NotBlank(message = "激活标识(1是 0否)不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String activeFlag;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
package org.dromara.system.domain.vo;
|
||||
|
||||
import org.dromara.system.domain.SysMasterDataDetail;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 主数据维护明细视图对象 sys_master_data_detail
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-10
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = SysMasterDataDetail.class)
|
||||
public class SysMasterDataDetailVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键标识
|
||||
*/
|
||||
@ExcelProperty(value = "主键标识")
|
||||
private Long masterDataDetailId;
|
||||
|
||||
/**
|
||||
* 主数据ID
|
||||
*/
|
||||
@ExcelProperty(value = "主数据ID")
|
||||
private Long masterDataId;
|
||||
|
||||
/**
|
||||
* 父级标识
|
||||
*/
|
||||
@ExcelProperty(value = "父级标识")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 祖级列表
|
||||
*/
|
||||
@ExcelProperty(value = "祖级列表")
|
||||
private String ancestors;
|
||||
|
||||
/**
|
||||
* 主数据明细编号
|
||||
*/
|
||||
@ExcelProperty(value = "主数据明细编号")
|
||||
private String dataDetailCode;
|
||||
|
||||
/**
|
||||
* 主数据明细名称
|
||||
*/
|
||||
@ExcelProperty(value = "主数据明细名称")
|
||||
private String dataDetailName;
|
||||
|
||||
/**
|
||||
* 预留字段1数据
|
||||
*/
|
||||
@ExcelProperty(value = "预留字段1数据")
|
||||
private String fieldData1;
|
||||
|
||||
/**
|
||||
* 预留字段2数据
|
||||
*/
|
||||
@ExcelProperty(value = "预留字段2数据")
|
||||
private String fieldData2;
|
||||
|
||||
/**
|
||||
* 预留字段3数据
|
||||
*/
|
||||
@ExcelProperty(value = "预留字段3数据")
|
||||
private String fieldData3;
|
||||
|
||||
/**
|
||||
* 预留字段4数据
|
||||
*/
|
||||
@ExcelProperty(value = "预留字段4数据")
|
||||
private String fieldData4;
|
||||
|
||||
/**
|
||||
* 预留字段5数据
|
||||
*/
|
||||
@ExcelProperty(value = "预留字段5数据")
|
||||
private String fieldData5;
|
||||
|
||||
/**
|
||||
* 显示排序
|
||||
*/
|
||||
@ExcelProperty(value = "显示排序")
|
||||
private Long displaySort;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 激活标识(1是 0否)
|
||||
*/
|
||||
@ExcelProperty(value = "激活标识(1是 0否)", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "active_flag")
|
||||
private String activeFlag;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.system.mapper;
|
||||
|
||||
import org.dromara.system.domain.SysMasterDataDetail;
|
||||
import org.dromara.system.domain.vo.SysMasterDataDetailVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 主数据维护明细Mapper接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-10
|
||||
*/
|
||||
public interface SysMasterDataDetailMapper extends BaseMapperPlus<SysMasterDataDetail, SysMasterDataDetailVo> {
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.system.mapper;
|
||||
|
||||
import org.dromara.system.domain.SysMasterData;
|
||||
import org.dromara.system.domain.vo.SysMasterDataVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 主数据维护Mapper接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-10
|
||||
*/
|
||||
public interface SysMasterDataMapper extends BaseMapperPlus<SysMasterData, SysMasterDataVo> {
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package org.dromara.system.service;
|
||||
|
||||
import org.dromara.system.domain.SysMasterDataDetail;
|
||||
import org.dromara.system.domain.vo.SysMasterDataDetailVo;
|
||||
import org.dromara.system.domain.bo.SysMasterDataDetailBo;
|
||||
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-01-10
|
||||
*/
|
||||
public interface ISysMasterDataDetailService {
|
||||
|
||||
/**
|
||||
* 查询主数据维护明细
|
||||
*
|
||||
* @param masterDataDetailId 主键
|
||||
* @return 主数据维护明细
|
||||
*/
|
||||
SysMasterDataDetailVo queryById(Long masterDataDetailId);
|
||||
|
||||
/**
|
||||
* 分页查询主数据维护明细列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 主数据维护明细分页列表
|
||||
*/
|
||||
TableDataInfo<SysMasterDataDetailVo> queryPageList(SysMasterDataDetailBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的主数据维护明细列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 主数据维护明细列表
|
||||
*/
|
||||
List<SysMasterDataDetailVo> queryList(SysMasterDataDetailBo bo);
|
||||
|
||||
/**
|
||||
* 新增主数据维护明细
|
||||
*
|
||||
* @param bo 主数据维护明细
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(SysMasterDataDetailBo bo);
|
||||
|
||||
/**
|
||||
* 修改主数据维护明细
|
||||
*
|
||||
* @param bo 主数据维护明细
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(SysMasterDataDetailBo 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.SysMasterData;
|
||||
import org.dromara.system.domain.vo.SysMasterDataVo;
|
||||
import org.dromara.system.domain.bo.SysMasterDataBo;
|
||||
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-01-10
|
||||
*/
|
||||
public interface ISysMasterDataService {
|
||||
|
||||
/**
|
||||
* 查询主数据维护
|
||||
*
|
||||
* @param masterDataId 主键
|
||||
* @return 主数据维护
|
||||
*/
|
||||
SysMasterDataVo queryById(Long masterDataId);
|
||||
|
||||
/**
|
||||
* 分页查询主数据维护列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 主数据维护分页列表
|
||||
*/
|
||||
TableDataInfo<SysMasterDataVo> queryPageList(SysMasterDataBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的主数据维护列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 主数据维护列表
|
||||
*/
|
||||
List<SysMasterDataVo> queryList(SysMasterDataBo bo);
|
||||
|
||||
/**
|
||||
* 新增主数据维护
|
||||
*
|
||||
* @param bo 主数据维护
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(SysMasterDataBo bo);
|
||||
|
||||
/**
|
||||
* 修改主数据维护
|
||||
*
|
||||
* @param bo 主数据维护
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(SysMasterDataBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除主数据维护信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@ -0,0 +1,144 @@
|
||||
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 com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.system.domain.bo.SysMasterDataDetailBo;
|
||||
import org.dromara.system.domain.vo.SysMasterDataDetailVo;
|
||||
import org.dromara.system.domain.SysMasterDataDetail;
|
||||
import org.dromara.system.mapper.SysMasterDataDetailMapper;
|
||||
import org.dromara.system.service.ISysMasterDataDetailService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 主数据维护明细Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-10
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class SysMasterDataDetailServiceImpl implements ISysMasterDataDetailService {
|
||||
|
||||
private final SysMasterDataDetailMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询主数据维护明细
|
||||
*
|
||||
* @param masterDataDetailId 主键
|
||||
* @return 主数据维护明细
|
||||
*/
|
||||
@Override
|
||||
public SysMasterDataDetailVo queryById(Long masterDataDetailId){
|
||||
return baseMapper.selectVoById(masterDataDetailId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询主数据维护明细列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 主数据维护明细分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<SysMasterDataDetailVo> queryPageList(SysMasterDataDetailBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<SysMasterDataDetail> lqw = buildQueryWrapper(bo);
|
||||
Page<SysMasterDataDetailVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的主数据维护明细列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 主数据维护明细列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysMasterDataDetailVo> queryList(SysMasterDataDetailBo bo) {
|
||||
MPJLambdaWrapper<SysMasterDataDetail> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<SysMasterDataDetail> buildQueryWrapper(SysMasterDataDetailBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<SysMasterDataDetail> lqw = JoinWrappers.lambda(SysMasterDataDetail.class)
|
||||
.selectAll(SysMasterDataDetail.class)
|
||||
.eq(bo.getMasterDataDetailId() != null, SysMasterDataDetail::getMasterDataDetailId, bo.getMasterDataDetailId())
|
||||
.eq(bo.getMasterDataId() != null, SysMasterDataDetail::getMasterDataId, bo.getMasterDataId())
|
||||
.eq(bo.getParentId() != null, SysMasterDataDetail::getParentId, bo.getParentId())
|
||||
.eq(StringUtils.isNotBlank(bo.getAncestors()), SysMasterDataDetail::getAncestors, bo.getAncestors())
|
||||
.eq(StringUtils.isNotBlank(bo.getDataDetailCode()), SysMasterDataDetail::getDataDetailCode, bo.getDataDetailCode())
|
||||
.like(StringUtils.isNotBlank(bo.getDataDetailName()), SysMasterDataDetail::getDataDetailName, bo.getDataDetailName())
|
||||
.eq(StringUtils.isNotBlank(bo.getFieldData1()), SysMasterDataDetail::getFieldData1, bo.getFieldData1())
|
||||
.eq(StringUtils.isNotBlank(bo.getFieldData2()), SysMasterDataDetail::getFieldData2, bo.getFieldData2())
|
||||
.eq(StringUtils.isNotBlank(bo.getFieldData3()), SysMasterDataDetail::getFieldData3, bo.getFieldData3())
|
||||
.eq(StringUtils.isNotBlank(bo.getFieldData4()), SysMasterDataDetail::getFieldData4, bo.getFieldData4())
|
||||
.eq(StringUtils.isNotBlank(bo.getFieldData5()), SysMasterDataDetail::getFieldData5, bo.getFieldData5())
|
||||
.eq(bo.getDisplaySort() != null, SysMasterDataDetail::getDisplaySort, bo.getDisplaySort())
|
||||
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), SysMasterDataDetail::getActiveFlag, bo.getActiveFlag())
|
||||
.orderByDesc(SysMasterDataDetail::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增主数据维护明细
|
||||
*
|
||||
* @param bo 主数据维护明细
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(SysMasterDataDetailBo bo) {
|
||||
SysMasterDataDetail add = MapstructUtils.convert(bo, SysMasterDataDetail.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setMasterDataDetailId(add.getMasterDataDetailId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改主数据维护明细
|
||||
*
|
||||
* @param bo 主数据维护明细
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(SysMasterDataDetailBo bo) {
|
||||
SysMasterDataDetail update = MapstructUtils.convert(bo, SysMasterDataDetail.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(SysMasterDataDetail 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,148 @@
|
||||
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 com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.system.domain.bo.SysMasterDataBo;
|
||||
import org.dromara.system.domain.vo.SysMasterDataVo;
|
||||
import org.dromara.system.domain.SysMasterData;
|
||||
import org.dromara.system.mapper.SysMasterDataMapper;
|
||||
import org.dromara.system.service.ISysMasterDataService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 主数据维护Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-01-10
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class SysMasterDataServiceImpl implements ISysMasterDataService {
|
||||
|
||||
private final SysMasterDataMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询主数据维护
|
||||
*
|
||||
* @param masterDataId 主键
|
||||
* @return 主数据维护
|
||||
*/
|
||||
@Override
|
||||
public SysMasterDataVo queryById(Long masterDataId){
|
||||
return baseMapper.selectVoById(masterDataId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询主数据维护列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 主数据维护分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<SysMasterDataVo> queryPageList(SysMasterDataBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<SysMasterData> lqw = buildQueryWrapper(bo);
|
||||
Page<SysMasterDataVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的主数据维护列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 主数据维护列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysMasterDataVo> queryList(SysMasterDataBo bo) {
|
||||
MPJLambdaWrapper<SysMasterData> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<SysMasterData> buildQueryWrapper(SysMasterDataBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<SysMasterData> lqw = JoinWrappers.lambda(SysMasterData.class)
|
||||
.selectAll(SysMasterData.class)
|
||||
.eq(bo.getMasterDataId() != null, SysMasterData::getMasterDataId, bo.getMasterDataId())
|
||||
.eq(StringUtils.isNotBlank(bo.getModuleType()), SysMasterData::getModuleType, bo.getModuleType())
|
||||
.eq(StringUtils.isNotBlank(bo.getParentFlag()), SysMasterData::getParentFlag, bo.getParentFlag())
|
||||
.eq(bo.getMenuId() != null, SysMasterData::getMenuId, bo.getMenuId())
|
||||
.eq(StringUtils.isNotBlank(bo.getQueryParam()), SysMasterData::getQueryParam, bo.getQueryParam())
|
||||
.eq(StringUtils.isNotBlank(bo.getMasterDataTitle()), SysMasterData::getMasterDataTitle, bo.getMasterDataTitle())
|
||||
.eq(StringUtils.isNotBlank(bo.getFieldName1()), SysMasterData::getFieldName1, bo.getFieldName1())
|
||||
.eq(StringUtils.isNotBlank(bo.getDisplayFlag1()), SysMasterData::getDisplayFlag1, bo.getDisplayFlag1())
|
||||
.eq(StringUtils.isNotBlank(bo.getFieldName2()), SysMasterData::getFieldName2, bo.getFieldName2())
|
||||
.eq(StringUtils.isNotBlank(bo.getDisplayFlag2()), SysMasterData::getDisplayFlag2, bo.getDisplayFlag2())
|
||||
.eq(StringUtils.isNotBlank(bo.getFieldName3()), SysMasterData::getFieldName3, bo.getFieldName3())
|
||||
.eq(StringUtils.isNotBlank(bo.getDisplayFlag3()), SysMasterData::getDisplayFlag3, bo.getDisplayFlag3())
|
||||
.eq(StringUtils.isNotBlank(bo.getFieldName4()), SysMasterData::getFieldName4, bo.getFieldName4())
|
||||
.eq(StringUtils.isNotBlank(bo.getDisplayFlag4()), SysMasterData::getDisplayFlag4, bo.getDisplayFlag4())
|
||||
.eq(StringUtils.isNotBlank(bo.getFieldName5()), SysMasterData::getFieldName5, bo.getFieldName5())
|
||||
.eq(StringUtils.isNotBlank(bo.getDisplayFlag5()), SysMasterData::getDisplayFlag5, bo.getDisplayFlag5())
|
||||
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), SysMasterData::getActiveFlag, bo.getActiveFlag())
|
||||
.orderByDesc(SysMasterData::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增主数据维护
|
||||
*
|
||||
* @param bo 主数据维护
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(SysMasterDataBo bo) {
|
||||
SysMasterData add = MapstructUtils.convert(bo, SysMasterData.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setMasterDataId(add.getMasterDataId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改主数据维护
|
||||
*
|
||||
* @param bo 主数据维护
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(SysMasterDataBo bo) {
|
||||
SysMasterData update = MapstructUtils.convert(bo, SysMasterData.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(SysMasterData 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.SysMasterDataDetailMapper">
|
||||
|
||||
</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.SysMasterDataMapper">
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue