diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdBaseMouldInfoController.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdBaseMouldInfoController.java new file mode 100644 index 00000000..c37e95a3 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdBaseMouldInfoController.java @@ -0,0 +1,118 @@ +package org.dromara.mes.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.mes.domain.vo.ProdBaseMouldInfoVo; +import org.dromara.mes.domain.bo.ProdBaseMouldInfoBo; +import org.dromara.mes.service.IProdBaseMouldInfoService; +import org.dromara.common.mybatis.core.page.TableDataInfo; + +/** + * 模具信息 + * 前端访问路由地址为:/mes/baseMouldInfo + * + * @author Yinq + * @date 2025-02-19 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/baseMouldInfo") +public class ProdBaseMouldInfoController extends BaseController { + + private final IProdBaseMouldInfoService prodBaseMouldInfoService; + + /** + * 查询模具信息列表 + */ + @SaCheckPermission("mes:baseMouldInfo:list") + @GetMapping("/list") + public TableDataInfo list(ProdBaseMouldInfoBo bo, PageQuery pageQuery) { + return prodBaseMouldInfoService.queryPageList(bo, pageQuery); + } + + /** + * 导出模具信息列表 + */ + @SaCheckPermission("mes:baseMouldInfo:export") + @Log(title = "模具信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(ProdBaseMouldInfoBo bo, HttpServletResponse response) { + List list = prodBaseMouldInfoService.queryList(bo); + ExcelUtil.exportExcel(list, "模具信息", ProdBaseMouldInfoVo.class, response); + } + + /** + * 获取模具信息详细信息 + * + * @param mouldId 主键 + */ + @SaCheckPermission("mes:baseMouldInfo:query") + @GetMapping("/{mouldId}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long mouldId) { + return R.ok(prodBaseMouldInfoService.queryById(mouldId)); + } + + /** + * 新增模具信息 + */ + @SaCheckPermission("mes:baseMouldInfo:add") + @Log(title = "模具信息", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody ProdBaseMouldInfoBo bo) { + return toAjax(prodBaseMouldInfoService.insertByBo(bo)); + } + + /** + * 修改模具信息 + */ + @SaCheckPermission("mes:baseMouldInfo:edit") + @Log(title = "模具信息", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody ProdBaseMouldInfoBo bo) { + return toAjax(prodBaseMouldInfoService.updateByBo(bo)); + } + + /** + * 删除模具信息 + * + * @param mouldIds 主键串 + */ + @SaCheckPermission("mes:baseMouldInfo:remove") + @Log(title = "模具信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{mouldIds}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] mouldIds) { + return toAjax(prodBaseMouldInfoService.deleteWithValidByIds(List.of(mouldIds), true)); + } + + + /** + * 下拉框查询模具信息列表 + */ + @GetMapping("/getProdBaseMouldInfoList") + public R> getProdBaseMouldInfoList(ProdBaseMouldInfoBo bo) { + List list = prodBaseMouldInfoService.queryList(bo); + return R.ok(list); + } + + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdBaseMouldInfo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdBaseMouldInfo.java new file mode 100644 index 00000000..4a9cf069 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdBaseMouldInfo.java @@ -0,0 +1,55 @@ +package org.dromara.mes.domain; + +import org.dromara.common.tenant.core.TenantEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serial; + +/** + * 模具信息对象 prod_base_mould_info + * + * @author Yinq + * @date 2025-02-19 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("prod_base_mould_info") +public class ProdBaseMouldInfo extends TenantEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + @TableId(value = "mould_id", type = IdType.AUTO) + private Long mouldId; + + /** + * 模具名称 + */ + private String mouldName; + + /** + * 所在机台ID + */ + private Long machineId; + + /** + * 使用次数 + */ + private Long usedNum; + + /** + * 备注 + */ + private String remark; + + /** + * 机台名称 + */ + @TableField(exist = false) + private String machineName; +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdBaseMouldRelation.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdBaseMouldRelation.java new file mode 100644 index 00000000..0df7f66a --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdBaseMouldRelation.java @@ -0,0 +1,41 @@ +package org.dromara.mes.domain; + +import org.dromara.common.mybatis.core.domain.BaseEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serial; + +/** + * 模具关联轮胎信息对象 prod_base_mould_relation + * + * @author Yinq + * @date 2025-02-19 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("prod_base_mould_relation") +public class ProdBaseMouldRelation extends BaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + @TableId(value = "mould_relation_id", type = IdType.AUTO) + private Long mouldRelationId; + + /** + * 模具ID + */ + private Long mouldId; + + /** + * 物料规格 + */ + private String materialSpec; + + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdBaseMouldInfoBo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdBaseMouldInfoBo.java new file mode 100644 index 00000000..4b2ef8de --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdBaseMouldInfoBo.java @@ -0,0 +1,60 @@ +package org.dromara.mes.domain.bo; + +import org.dromara.mes.domain.ProdBaseMouldInfo; +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.*; +import org.dromara.mes.domain.ProdBaseMouldRelation; + +import java.util.List; + +/** + * 模具信息业务对象 prod_base_mould_info + * + * @author Yinq + * @date 2025-02-19 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = ProdBaseMouldInfo.class, reverseConvertGenerate = false) +public class ProdBaseMouldInfoBo extends BaseEntity { + + /** + * 主键标识 + */ + private Long mouldId; + + /** + * 模具名称 + */ + @NotBlank(message = "模具名称不能为空", groups = {AddGroup.class, EditGroup.class}) + private String mouldName; + + /** + * 所在机台ID + */ + @NotNull(message = "所在机台ID不能为空", groups = {AddGroup.class, EditGroup.class}) + private Long machineId; + + /** + * 使用次数 + */ + private Long usedNum; + + /** + * 备注 + */ + private String remark; + + /** + * 机台名称 + */ + private String machineName; + + private List baseMouldRelationList; + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdBaseMouldRelationBo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdBaseMouldRelationBo.java new file mode 100644 index 00000000..a24e48ec --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdBaseMouldRelationBo.java @@ -0,0 +1,43 @@ +package org.dromara.mes.domain.bo; + +import org.dromara.mes.domain.ProdBaseMouldRelation; +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.*; + +import java.util.List; + +/** + * 模具关联轮胎信息业务对象 prod_base_mould_relation + * + * @author Yinq + * @date 2025-02-19 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = ProdBaseMouldRelation.class, reverseConvertGenerate = false) +public class ProdBaseMouldRelationBo extends BaseEntity { + + /** + * 主键标识 + */ + private Long mouldRelationId; + + /** + * 模具ID + */ + @NotNull(message = "模具ID不能为空", groups = {AddGroup.class, EditGroup.class}) + private Long mouldId; + + /** + * 物料规格 + */ + @NotBlank(message = "物料规格不能为空", groups = {AddGroup.class, EditGroup.class}) + private String materialSpec; + + private List baseMouldRelationList; +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdBaseMouldInfoVo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdBaseMouldInfoVo.java new file mode 100644 index 00000000..893d3957 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdBaseMouldInfoVo.java @@ -0,0 +1,66 @@ +package org.dromara.mes.domain.vo; + +import org.dromara.mes.domain.ProdBaseMouldInfo; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import org.dromara.mes.domain.ProdBaseMouldRelation; + +import java.io.Serial; +import java.io.Serializable; +import java.util.List; + + +/** + * 模具信息视图对象 prod_base_mould_info + * + * @author Yinq + * @date 2025-02-19 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = ProdBaseMouldInfo.class) +public class ProdBaseMouldInfoVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + @ExcelProperty(value = "主键标识") + private Long mouldId; + + /** + * 模具名称 + */ + @ExcelProperty(value = "模具名称") + private String mouldName; + + /** + * 所在机台ID + */ + @ExcelProperty(value = "所在机台ID") + private Long machineId; + + /** + * 使用次数 + */ + @ExcelProperty(value = "使用次数") + private Long usedNum; + + /** + * 备注 + */ + @ExcelProperty(value = "备注") + private String remark; + + /** + * 机台名称 + */ + @ExcelProperty(value = "机台名称") + private String machineName; + + private List baseMouldRelationList; +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdBaseMouldRelationVo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdBaseMouldRelationVo.java new file mode 100644 index 00000000..4e9fb537 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdBaseMouldRelationVo.java @@ -0,0 +1,50 @@ +package org.dromara.mes.domain.vo; + +import org.dromara.mes.domain.ProdBaseMouldRelation; +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; + + + +/** + * 模具关联轮胎信息视图对象 prod_base_mould_relation + * + * @author Yinq + * @date 2025-02-19 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = ProdBaseMouldRelation.class) +public class ProdBaseMouldRelationVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + @ExcelProperty(value = "主键标识") + private Long mouldRelationId; + + /** + * 模具ID + */ + @ExcelProperty(value = "模具ID") + private Long mouldId; + + /** + * 物料规格 + */ + @ExcelProperty(value = "物料规格") + private String materialSpec; + + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdBaseMouldInfoMapper.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdBaseMouldInfoMapper.java new file mode 100644 index 00000000..120a2ee8 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdBaseMouldInfoMapper.java @@ -0,0 +1,15 @@ +package org.dromara.mes.mapper; + +import org.dromara.mes.domain.ProdBaseMouldInfo; +import org.dromara.mes.domain.vo.ProdBaseMouldInfoVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 模具信息Mapper接口 + * + * @author Yinq + * @date 2025-02-19 + */ +public interface ProdBaseMouldInfoMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdBaseMouldRelationMapper.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdBaseMouldRelationMapper.java new file mode 100644 index 00000000..d9c15690 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdBaseMouldRelationMapper.java @@ -0,0 +1,15 @@ +package org.dromara.mes.mapper; + +import org.dromara.mes.domain.ProdBaseMouldRelation; +import org.dromara.mes.domain.vo.ProdBaseMouldRelationVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 模具关联轮胎信息Mapper接口 + * + * @author Yinq + * @date 2025-02-19 + */ +public interface ProdBaseMouldRelationMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdBaseMouldInfoService.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdBaseMouldInfoService.java new file mode 100644 index 00000000..2237756c --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdBaseMouldInfoService.java @@ -0,0 +1,70 @@ +package org.dromara.mes.service; + +import org.dromara.mes.domain.ProdBaseMouldInfo; +import org.dromara.mes.domain.vo.ProdBaseMouldInfoVo; +import org.dromara.mes.domain.bo.ProdBaseMouldInfoBo; +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-02-19 + */ +public interface IProdBaseMouldInfoService { + + /** + * 查询模具信息 + * + * @param mouldId 主键 + * @return 模具信息 + */ + ProdBaseMouldInfoVo queryById(Long mouldId); + + /** + * 分页查询模具信息列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 模具信息分页列表 + */ + TableDataInfo queryPageList(ProdBaseMouldInfoBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的模具信息列表 + * + * @param bo 查询条件 + * @return 模具信息列表 + */ + List queryList(ProdBaseMouldInfoBo bo); + + /** + * 新增模具信息 + * + * @param bo 模具信息 + * @return 是否新增成功 + */ + Boolean insertByBo(ProdBaseMouldInfoBo bo); + + /** + * 修改模具信息 + * + * @param bo 模具信息 + * @return 是否修改成功 + */ + Boolean updateByBo(ProdBaseMouldInfoBo bo); + + /** + * 校验并批量删除模具信息信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdBaseMouldRelationService.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdBaseMouldRelationService.java new file mode 100644 index 00000000..cf7ac223 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdBaseMouldRelationService.java @@ -0,0 +1,69 @@ +package org.dromara.mes.service; + +import org.dromara.mes.domain.ProdBaseMouldRelation; +import org.dromara.mes.domain.vo.ProdBaseMouldRelationVo; +import org.dromara.mes.domain.bo.ProdBaseMouldRelationBo; +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-02-19 + */ +public interface IProdBaseMouldRelationService { + + /** + * 查询模具关联轮胎信息 + * + * @param mouldRelationId 主键 + * @return 模具关联轮胎信息 + */ + ProdBaseMouldRelationVo queryById(Long mouldRelationId); + + /** + * 分页查询模具关联轮胎信息列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 模具关联轮胎信息分页列表 + */ + TableDataInfo queryPageList(ProdBaseMouldRelationBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的模具关联轮胎信息列表 + * + * @param bo 查询条件 + * @return 模具关联轮胎信息列表 + */ + List queryList(ProdBaseMouldRelationBo bo); + + /** + * 新增模具关联轮胎信息 + * + * @param bo 模具关联轮胎信息 + * @return 是否新增成功 + */ + Boolean insertByBo(ProdBaseMouldRelationBo bo); + + /** + * 修改模具关联轮胎信息 + * + * @param bo 模具关联轮胎信息 + * @return 是否修改成功 + */ + Boolean updateByBo(ProdBaseMouldRelationBo bo); + + /** + * 校验并批量删除模具关联轮胎信息信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdBaseMouldInfoServiceImpl.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdBaseMouldInfoServiceImpl.java new file mode 100644 index 00000000..11bbf9a6 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdBaseMouldInfoServiceImpl.java @@ -0,0 +1,162 @@ +package org.dromara.mes.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.yulichang.toolkit.JoinWrappers; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import lombok.RequiredArgsConstructor; +import org.dromara.mes.domain.*; +import org.dromara.mes.mapper.ProdBaseMouldRelationMapper; +import org.springframework.stereotype.Service; +import org.dromara.mes.domain.bo.ProdBaseMouldInfoBo; +import org.dromara.mes.domain.vo.ProdBaseMouldInfoVo; +import org.dromara.mes.mapper.ProdBaseMouldInfoMapper; +import org.dromara.mes.service.IProdBaseMouldInfoService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 模具信息Service业务层处理 + * + * @author Yinq + * @date 2025-02-19 + */ +@RequiredArgsConstructor +@Service +public class ProdBaseMouldInfoServiceImpl implements IProdBaseMouldInfoService { + + private final ProdBaseMouldInfoMapper baseMapper; + + private final ProdBaseMouldRelationMapper prodBaseMouldRelationMapper; + + /** + * 查询模具信息 + * + * @param mouldId 主键 + * @return 模具信息 + */ + @Override + public ProdBaseMouldInfoVo queryById(Long mouldId) { + ProdBaseMouldInfoBo bo = new ProdBaseMouldInfoBo(); + bo.setMouldId(mouldId); + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + ProdBaseMouldInfoVo prodBaseMouldInfoVo = baseMapper.selectVoOne(lqw); + //模具关联轮胎 + MPJLambdaWrapper lqwRelation = JoinWrappers.lambda(ProdBaseMouldRelation.class) + .selectAll(ProdBaseMouldRelation.class) + .eq(bo.getMouldId() != null, ProdBaseMouldRelation::getMouldId, bo.getMouldId()) + .orderByAsc(ProdBaseMouldRelation::getCreateTime); + List prodBaseMouldRelations = prodBaseMouldRelationMapper.selectList(lqwRelation); + prodBaseMouldInfoVo.setBaseMouldRelationList(prodBaseMouldRelations); + return prodBaseMouldInfoVo; + } + + /** + * 分页查询模具信息列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 模具信息分页列表 + */ + @Override + public TableDataInfo queryPageList(ProdBaseMouldInfoBo 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(ProdBaseMouldInfoBo bo) { + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private MPJLambdaWrapper buildQueryWrapper(ProdBaseMouldInfoBo bo) { + Map params = bo.getParams(); + MPJLambdaWrapper lqw = JoinWrappers.lambda(ProdBaseMouldInfo.class) + .selectAll(ProdBaseMouldInfo.class) + .select(ProdBaseMachineInfo::getMachineName) + .leftJoin(ProdBaseMachineInfo.class, ProdBaseMachineInfo::getMachineId, ProdBaseMouldInfo::getMachineId) + .eq(bo.getMouldId() != null, ProdBaseMouldInfo::getMouldId, bo.getMouldId()) + .like(StringUtils.isNotBlank(bo.getMouldName()), ProdBaseMouldInfo::getMouldName, bo.getMouldName()) + .eq(bo.getMachineId() != null, ProdBaseMouldInfo::getMachineId, bo.getMachineId()) + .eq(bo.getUsedNum() != null, ProdBaseMouldInfo::getUsedNum, bo.getUsedNum()) + .orderByDesc(ProdBaseMouldInfo::getCreateTime); + return lqw; + } + + /** + * 新增模具信息 + * + * @param bo 模具信息 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(ProdBaseMouldInfoBo bo) { + ProdBaseMouldInfo add = MapstructUtils.convert(bo, ProdBaseMouldInfo.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setMouldId(add.getMouldId()); + } + return flag; + } + + /** + * 修改模具信息 + * + * @param bo 模具信息 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(ProdBaseMouldInfoBo bo) { + ProdBaseMouldInfo update = MapstructUtils.convert(bo, ProdBaseMouldInfo.class); + validEntityBeforeSave(update); + List baseMouldRelationList = bo.getBaseMouldRelationList(); + if (baseMouldRelationList.size() > 0) { + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(StringUtils.isNotNull(bo.getMouldId()), ProdBaseMouldRelation::getMouldId, bo.getMouldId()); + prodBaseMouldRelationMapper.delete(lqw); + for (ProdBaseMouldRelation relation : baseMouldRelationList) { + relation.setMouldRelationId(null); + prodBaseMouldRelationMapper.insert(relation); + } + } + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(ProdBaseMouldInfo 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/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdBaseMouldRelationServiceImpl.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdBaseMouldRelationServiceImpl.java new file mode 100644 index 00000000..3e42c024 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdBaseMouldRelationServiceImpl.java @@ -0,0 +1,134 @@ +package org.dromara.mes.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.mes.domain.bo.ProdBaseMouldRelationBo; +import org.dromara.mes.domain.vo.ProdBaseMouldRelationVo; +import org.dromara.mes.domain.ProdBaseMouldRelation; +import org.dromara.mes.mapper.ProdBaseMouldRelationMapper; +import org.dromara.mes.service.IProdBaseMouldRelationService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 模具关联轮胎信息Service业务层处理 + * + * @author Yinq + * @date 2025-02-19 + */ +@RequiredArgsConstructor +@Service +public class ProdBaseMouldRelationServiceImpl implements IProdBaseMouldRelationService { + + private final ProdBaseMouldRelationMapper baseMapper; + + /** + * 查询模具关联轮胎信息 + * + * @param mouldRelationId 主键 + * @return 模具关联轮胎信息 + */ + @Override + public ProdBaseMouldRelationVo queryById(Long mouldRelationId){ + return baseMapper.selectVoById(mouldRelationId); + } + + /** + * 分页查询模具关联轮胎信息列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 模具关联轮胎信息分页列表 + */ + @Override + public TableDataInfo queryPageList(ProdBaseMouldRelationBo 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(ProdBaseMouldRelationBo bo) { + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private MPJLambdaWrapper buildQueryWrapper(ProdBaseMouldRelationBo bo) { + Map params = bo.getParams(); + MPJLambdaWrapper lqw = JoinWrappers.lambda(ProdBaseMouldRelation.class) + .selectAll(ProdBaseMouldRelation.class) + .eq(bo.getMouldRelationId() != null, ProdBaseMouldRelation::getMouldRelationId, bo.getMouldRelationId()) + .eq(bo.getMouldId() != null, ProdBaseMouldRelation::getMouldId, bo.getMouldId()) + .eq(StringUtils.isNotBlank(bo.getMaterialSpec()), ProdBaseMouldRelation::getMaterialSpec, bo.getMaterialSpec()) + .orderByAsc(ProdBaseMouldRelation::getCreateTime); + return lqw; + } + + /** + * 新增模具关联轮胎信息 + * + * @param bo 模具关联轮胎信息 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(ProdBaseMouldRelationBo bo) { + ProdBaseMouldRelation add = MapstructUtils.convert(bo, ProdBaseMouldRelation.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setMouldRelationId(add.getMouldRelationId()); + } + return flag; + } + + /** + * 修改模具关联轮胎信息 + * + * @param bo 模具关联轮胎信息 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(ProdBaseMouldRelationBo bo) { + ProdBaseMouldRelation update = MapstructUtils.convert(bo, ProdBaseMouldRelation.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(ProdBaseMouldRelation 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/hwmom-mes/src/main/resources/mapper/mes/ProdBaseMouldInfoMapper.xml b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdBaseMouldInfoMapper.xml new file mode 100644 index 00000000..b5365ead --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdBaseMouldInfoMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdBaseMouldRelationMapper.xml b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdBaseMouldRelationMapper.xml new file mode 100644 index 00000000..b81bee7c --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdBaseMouldRelationMapper.xml @@ -0,0 +1,7 @@ + + + + +