update 初始化主数据维护、主数据明细

master
yinq 1 week ago
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,131 @@
package org.dromara.system.domain;
import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* sys_master_data
*
* @author Yinq
* @date 2025-01-10
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_master_data")
public class SysMasterData extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "master_data_id", type = IdType.AUTO)
private Long masterDataId;
/**
* 1MES 2WMS 3DMS 4QMS 5EMS
*/
@TableField("module_type")
private String moduleType;
/**
* ;1 0
*/
@TableField("parent_flag")
private String parentFlag;
/**
* ID
*/
@TableField("menu_id")
private Long menuId;
/**
*
*/
@TableField("query_param")
private String queryParam;
/**
* ;
*/
@TableField("master_data_title")
private String masterDataTitle;
/**
* 1
*/
@TableField("field_name_1")
private String fieldName1;
/**
* 1;1 0
*/
@TableField("display_flag_1")
private String displayFlag1;
/**
* 2
*/
@TableField("field_name_2")
private String fieldName2;
/**
* 2;1 0
*/
@TableField("display_flag_2")
private String displayFlag2;
/**
* 3
*/
@TableField("field_name_3")
private String fieldName3;
/**
* 3;1 0
*/
@TableField("display_flag_3")
private String displayFlag3;
/**
* 4
*/
@TableField("field_name_4")
private String fieldName4;
/**
* 4;1 0
*/
@TableField("display_flag_4")
private String displayFlag4;
/**
* 5
*/
@TableField("field_name_5")
private String fieldName5;
/**
* 5;1 0
*/
@TableField("display_flag_5")
private String displayFlag5;
/**
* (1 0)
*/
@TableField("active_flag")
private String activeFlag;
/**
*
*/
@TableField("remark")
private String remark;
}

@ -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,124 @@
package org.dromara.system.domain.bo;
import org.dromara.system.domain.SysMasterData;
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
*
* @author Yinq
* @date 2025-01-10
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = SysMasterData.class, reverseConvertGenerate = false)
public class SysMasterDataBo extends BaseEntity {
/**
*
*/
private Long masterDataId;
/**
* 1MES 2WMS 3DMS 4QMS 5EMS
*/
@NotBlank(message = "所属模块1MES 2WMS 3DMS 4QMS 5EMS不能为空", groups = { AddGroup.class, EditGroup.class })
private String moduleType;
/**
* ;1 0
*/
@NotBlank(message = "父级标识;1是 0否不能为空", groups = { AddGroup.class, EditGroup.class })
private String parentFlag;
/**
* ID
*/
private Long menuId;
/**
*
*/
@NotBlank(message = "路由参数不能为空", groups = { AddGroup.class, EditGroup.class })
private String queryParam;
/**
* ;
*/
@NotBlank(message = "主数据标题;例:品牌、层级、花纹不能为空", groups = { AddGroup.class, EditGroup.class })
private String masterDataTitle;
/**
* 1
*/
private String fieldName1;
/**
* 1;1 0
*/
@NotBlank(message = "预留字段1显示标识;1是 0否不能为空", groups = { AddGroup.class, EditGroup.class })
private String displayFlag1;
/**
* 2
*/
private String fieldName2;
/**
* 2;1 0
*/
@NotBlank(message = "预留字段2显示标识;1是 0否不能为空", groups = { AddGroup.class, EditGroup.class })
private String displayFlag2;
/**
* 3
*/
private String fieldName3;
/**
* 3;1 0
*/
@NotBlank(message = "预留字段3显示标识;1是 0否不能为空", groups = { AddGroup.class, EditGroup.class })
private String displayFlag3;
/**
* 4
*/
private String fieldName4;
/**
* 4;1 0
*/
@NotBlank(message = "预留字段4显示标识;1是 0否不能为空", groups = { AddGroup.class, EditGroup.class })
private String displayFlag4;
/**
* 5
*/
private String fieldName5;
/**
* 5;1 0
*/
@NotBlank(message = "预留字段5显示标识;1是 0否不能为空", groups = { AddGroup.class, EditGroup.class })
private String displayFlag5;
/**
* (1 0)
*/
@NotBlank(message = "激活标识(1是 0否)不能为空", groups = { AddGroup.class, EditGroup.class })
private String activeFlag;
/**
*
*/
private String remark;
}

@ -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,148 @@
package org.dromara.system.domain.vo;
import org.dromara.system.domain.SysMasterData;
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
*
* @author Yinq
* @date 2025-01-10
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = SysMasterData.class)
public class SysMasterDataVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
*
*/
@ExcelProperty(value = "主键标识")
private Long masterDataId;
/**
* 1MES 2WMS 3DMS 4QMS 5EMS
*/
@ExcelProperty(value = "所属模块", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "sys_module_type")
private String moduleType;
/**
* ;1 0
*/
@ExcelProperty(value = "父级标识", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "active_flag")
private String parentFlag;
/**
* ID
*/
@ExcelProperty(value = "菜单ID")
private Long menuId;
/**
*
*/
@ExcelProperty(value = "路由参数")
private String queryParam;
/**
* ;
*/
@ExcelProperty(value = "主数据标题;例:品牌、层级、花纹")
private String masterDataTitle;
/**
* 1
*/
@ExcelProperty(value = "预留字段1名称")
private String fieldName1;
/**
* 1;1 0
*/
@ExcelProperty(value = "预留字段1显示标识;", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "active_flag")
private String displayFlag1;
/**
* 2
*/
@ExcelProperty(value = "预留字段2名称")
private String fieldName2;
/**
* 2;1 0
*/
@ExcelProperty(value = "预留字段2显示标识;", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "active_flag")
private String displayFlag2;
/**
* 3
*/
@ExcelProperty(value = "预留字段3名称")
private String fieldName3;
/**
* 3;1 0
*/
@ExcelProperty(value = "预留字段3显示标识;", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "active_flag")
private String displayFlag3;
/**
* 4
*/
@ExcelProperty(value = "预留字段4名称")
private String fieldName4;
/**
* 4;1 0
*/
@ExcelProperty(value = "预留字段4显示标识;", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "active_flag")
private String displayFlag4;
/**
* 5
*/
@ExcelProperty(value = "预留字段5名称")
private String fieldName5;
/**
* 5;1 0
*/
@ExcelProperty(value = "预留字段5显示标识;", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "active_flag")
private String displayFlag5;
/**
* (1 0)
*/
@ExcelProperty(value = "激活标识(1是 0否)", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "active_flag")
private String activeFlag;
/**
*
*/
@ExcelProperty(value = "备注")
private String remark;
}

@ -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…
Cancel
Save