diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/SysMasterDataController.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/SysMasterDataController.java new file mode 100644 index 00000000..c1157c7d --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/SysMasterDataController.java @@ -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 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 list = sysMasterDataService.queryList(bo); + ExcelUtil.exportExcel(list, "主数据维护", SysMasterDataVo.class, response); + } + + /** + * 获取主数据维护详细信息 + * + * @param masterDataId 主键 + */ + @SaCheckPermission("system:masterData:query") + @GetMapping("/{masterDataId}") + public R 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 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 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 remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] masterDataIds) { + return toAjax(sysMasterDataService.deleteWithValidByIds(List.of(masterDataIds), true)); + } + + + /** + * 下拉框查询主数据维护列表 + */ + + @GetMapping("getSysMasterDataList") + public R> getSysMasterDatalist(SysMasterDataBo bo) { + List list = sysMasterDataService.queryList(bo); + return R.ok(list); + } +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/SysMasterDataDetailController.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/SysMasterDataDetailController.java new file mode 100644 index 00000000..3a867dea --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/SysMasterDataDetailController.java @@ -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 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 list = sysMasterDataDetailService.queryList(bo); + ExcelUtil.exportExcel(list, "主数据维护明细", SysMasterDataDetailVo.class, response); + } + + /** + * 获取主数据维护明细详细信息 + * + * @param masterDataDetailId 主键 + */ + @SaCheckPermission("system:masterDataDetail:query") + @GetMapping("/{masterDataDetailId}") + public R 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 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 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 remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] masterDataDetailIds) { + return toAjax(sysMasterDataDetailService.deleteWithValidByIds(List.of(masterDataDetailIds), true)); + } + + + /** + * 下拉框查询主数据维护明细列表 + */ + + @GetMapping("getSysMasterDataDetailList") + public R> getSysMasterDataDetaillist(SysMasterDataDetailBo bo) { + List list = sysMasterDataDetailService.queryList(bo); + return R.ok(list); + } +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysMasterData.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysMasterData.java new file mode 100644 index 00000000..c03a44c0 --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysMasterData.java @@ -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; +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysMasterDataDetail.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysMasterDataDetail.java new file mode 100644 index 00000000..2a64173a --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysMasterDataDetail.java @@ -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; + + + +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/bo/SysMasterDataBo.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/bo/SysMasterDataBo.java new file mode 100644 index 00000000..0dc5e4d7 --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/bo/SysMasterDataBo.java @@ -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; + + +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/bo/SysMasterDataDetailBo.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/bo/SysMasterDataDetailBo.java new file mode 100644 index 00000000..797b535e --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/bo/SysMasterDataDetailBo.java @@ -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; + + +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/vo/SysMasterDataDetailVo.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/vo/SysMasterDataDetailVo.java new file mode 100644 index 00000000..084328de --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/vo/SysMasterDataDetailVo.java @@ -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; + + +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/vo/SysMasterDataVo.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/vo/SysMasterDataVo.java new file mode 100644 index 00000000..94dd8c1b --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/vo/SysMasterDataVo.java @@ -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; + + +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/mapper/SysMasterDataDetailMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/mapper/SysMasterDataDetailMapper.java new file mode 100644 index 00000000..f506fa52 --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/mapper/SysMasterDataDetailMapper.java @@ -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 { + +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/mapper/SysMasterDataMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/mapper/SysMasterDataMapper.java new file mode 100644 index 00000000..48033dce --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/mapper/SysMasterDataMapper.java @@ -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 { + +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISysMasterDataDetailService.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISysMasterDataDetailService.java new file mode 100644 index 00000000..2908f917 --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISysMasterDataDetailService.java @@ -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 queryPageList(SysMasterDataDetailBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的主数据维护明细列表 + * + * @param bo 查询条件 + * @return 主数据维护明细列表 + */ + List 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 ids, Boolean isValid); +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISysMasterDataService.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISysMasterDataService.java new file mode 100644 index 00000000..eb0b1b26 --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISysMasterDataService.java @@ -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 queryPageList(SysMasterDataBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的主数据维护列表 + * + * @param bo 查询条件 + * @return 主数据维护列表 + */ + List 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 ids, Boolean isValid); +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysMasterDataDetailServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysMasterDataDetailServiceImpl.java new file mode 100644 index 00000000..17b21247 --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysMasterDataDetailServiceImpl.java @@ -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 queryPageList(SysMasterDataDetailBo bo, PageQuery pageQuery) { + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的主数据维护明细列表 + * + * @param bo 查询条件 + * @return 主数据维护明细列表 + */ + @Override + public List queryList(SysMasterDataDetailBo bo) { + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private MPJLambdaWrapper buildQueryWrapper(SysMasterDataDetailBo bo) { + Map params = bo.getParams(); + MPJLambdaWrapper 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 ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteByIds(ids) > 0; + } +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysMasterDataServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysMasterDataServiceImpl.java new file mode 100644 index 00000000..365643f1 --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysMasterDataServiceImpl.java @@ -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 queryPageList(SysMasterDataBo bo, PageQuery pageQuery) { + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的主数据维护列表 + * + * @param bo 查询条件 + * @return 主数据维护列表 + */ + @Override + public List queryList(SysMasterDataBo bo) { + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private MPJLambdaWrapper buildQueryWrapper(SysMasterDataBo bo) { + Map params = bo.getParams(); + MPJLambdaWrapper 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 ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteByIds(ids) > 0; + } +} diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysMasterDataDetailMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysMasterDataDetailMapper.xml new file mode 100644 index 00000000..c5a736cd --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysMasterDataDetailMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysMasterDataMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysMasterDataMapper.xml new file mode 100644 index 00000000..9b2b1dcd --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysMasterDataMapper.xml @@ -0,0 +1,7 @@ + + + + +