diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/BaseToolingInfoController.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/BaseToolingInfoController.java new file mode 100644 index 00000000..304233e6 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/BaseToolingInfoController.java @@ -0,0 +1,117 @@ +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.BaseToolingInfoVo; +import org.dromara.mes.domain.bo.BaseToolingInfoBo; +import org.dromara.mes.service.IBaseToolingInfoService; +import org.dromara.common.mybatis.core.page.TableDataInfo; + +/** + * 载具工装信息 + * 前端访问路由地址为:/mes/baseToolingInfo + * + * @author zangch + * @date 2025-01-08 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/baseToolingInfo") +public class BaseToolingInfoController extends BaseController { + + private final IBaseToolingInfoService baseToolingInfoService; + + /** + * 查询载具工装信息列表 + */ + @SaCheckPermission("mes:baseToolingInfo:list") + @GetMapping("/list") + public TableDataInfo list(BaseToolingInfoBo bo, PageQuery pageQuery) { + return baseToolingInfoService.queryPageList(bo, pageQuery); + } + + /** + * 导出载具工装信息列表 + */ + @SaCheckPermission("mes:baseToolingInfo:export") + @Log(title = "载具工装信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(BaseToolingInfoBo bo, HttpServletResponse response) { + List list = baseToolingInfoService.queryList(bo); + ExcelUtil.exportExcel(list, "载具工装信息", BaseToolingInfoVo.class, response); + } + + /** + * 获取载具工装信息详细信息 + * + * @param toolingId 主键 + */ + @SaCheckPermission("mes:baseToolingInfo:query") + @GetMapping("/{toolingId}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long toolingId) { + return R.ok(baseToolingInfoService.queryById(toolingId)); + } + + /** + * 新增载具工装信息 + */ + @SaCheckPermission("mes:baseToolingInfo:add") + @Log(title = "载具工装信息", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody BaseToolingInfoBo bo) { + return toAjax(baseToolingInfoService.insertByBo(bo)); + } + + /** + * 修改载具工装信息 + */ + @SaCheckPermission("mes:baseToolingInfo:edit") + @Log(title = "载具工装信息", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody BaseToolingInfoBo bo) { + return toAjax(baseToolingInfoService.updateByBo(bo)); + } + + /** + * 删除载具工装信息 + * + * @param toolingIds 主键串 + */ + @SaCheckPermission("mes:baseToolingInfo:remove") + @Log(title = "载具工装信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{toolingIds}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] toolingIds) { + return toAjax(baseToolingInfoService.deleteWithValidByIds(List.of(toolingIds), true)); + } + + + /** + * 下拉框查询载具工装信息列表 + */ + + @GetMapping("getBaseToolingInfoList") + public R> getBaseToolingInfolist(BaseToolingInfoBo bo) { + List list = baseToolingInfoService.queryList(bo); + return R.ok(list); + } +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/BaseToolingInfo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/BaseToolingInfo.java new file mode 100644 index 00000000..ead00ff2 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/BaseToolingInfo.java @@ -0,0 +1,81 @@ +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; + +/** + * 载具工装信息对象 base_tooling_info + * + * @author zangch + * @date 2025-01-08 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("base_tooling_info") +public class BaseToolingInfo extends TenantEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + @TableId(value = "tooling_id", type = IdType.AUTO) + private Long toolingId; + + /** + * 工装编号 + */ + private String toolingCode; + + /** + * 工装名称 + */ + private String toolingName; + + /** + * 工装类型(用字典) + */ + private String toolingTypeCode; + + /** + * 工装规格(用字典) + */ + private String toolingSpecCode; + + /** + * 工装条码 + */ + private String toolingBarcode; + + /** + * 工装RFID条码 + */ + private String toolingRfidBarcode; + + /** + * 物料编号 + */ + private String materialCode; + + /** + * 重量 + */ + private Long weight; + + /** + * 备注 + */ + private String remark; + + /** + * 激活标识(1是 0否) + */ + private String activeFlag; + + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/BaseToolingInfoBo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/BaseToolingInfoBo.java new file mode 100644 index 00000000..eb055fb6 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/BaseToolingInfoBo.java @@ -0,0 +1,79 @@ +package org.dromara.mes.domain.bo; + +import org.dromara.mes.domain.BaseToolingInfo; +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.*; + +/** + * 载具工装信息业务对象 base_tooling_info + * + * @author zangch + * @date 2025-01-08 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = BaseToolingInfo.class, reverseConvertGenerate = false) +public class BaseToolingInfoBo extends BaseEntity { + + /** + * 主键标识 + */ + private Long toolingId; + + /** + * 工装编号 + */ + private String toolingCode; + + /** + * 工装名称 + */ + private String toolingName; + + /** + * 工装类型(用字典) + */ + private String toolingTypeCode; + + /** + * 工装规格(用字典) + */ + private String toolingSpecCode; + + /** + * 工装条码 + */ + private String toolingBarcode; + + /** + * 工装RFID条码 + */ + private String toolingRfidBarcode; + + /** + * 物料编号 + */ + private String materialCode; + + /** + * 重量 + */ + private Long weight; + + /** + * 备注 + */ + private String remark; + + /** + * 激活标识(1是 0否) + */ + private String activeFlag; + + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/BaseToolingInfoVo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/BaseToolingInfoVo.java new file mode 100644 index 00000000..a152827d --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/BaseToolingInfoVo.java @@ -0,0 +1,136 @@ +package org.dromara.mes.domain.vo; + +import org.dromara.mes.domain.BaseToolingInfo; +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; + + + +/** + * 载具工装信息视图对象 base_tooling_info + * + * @author zangch + * @date 2025-01-08 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = BaseToolingInfo.class) +public class BaseToolingInfoVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键标识 + */ + @ExcelProperty(value = "主键标识") + private Long toolingId; + + /** + * 租户编号 + */ + @ExcelProperty(value = "租户编号") + private String tenantId; + + /** + * 工装编号 + */ + @ExcelProperty(value = "工装编号") + private String toolingCode; + + /** + * 工装名称 + */ + @ExcelProperty(value = "工装名称") + private String toolingName; + + /** + * 工装类型(用字典) + */ + @ExcelProperty(value = "工装类型", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "tooling_type_code") + private String toolingTypeCode; + + /** + * 工装规格(用字典) + */ + @ExcelProperty(value = "工装规格", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "tooling_spec_code") + private String toolingSpecCode; + + /** + * 工装条码 + */ + @ExcelProperty(value = "工装条码") + private String toolingBarcode; + + /** + * 工装RFID条码 + */ + @ExcelProperty(value = "工装RFID条码") + private String toolingRfidBarcode; + + /** + * 物料编号 + */ + @ExcelProperty(value = "物料编号") + private String materialCode; + + /** + * 重量 + */ + @ExcelProperty(value = "重量") + private Long weight; + + /** + * 备注 + */ + @ExcelProperty(value = "备注") + private String remark; + + /** + * 激活标识(1是 0否) + */ + @ExcelProperty(value = "激活标识(1是 0否)") + private String activeFlag; + + /** + * 创建部门 + */ + @ExcelProperty(value = "创建部门") + private Long createDept; + + /** + * 创建人 + */ + @ExcelProperty(value = "创建人") + private Long createBy; + + /** + * 创建时间 + */ + @ExcelProperty(value = "创建时间") + private Date createTime; + + /** + * 更新人 + */ + @ExcelProperty(value = "更新人") + private Long updateBy; + + /** + * 更新时间 + */ + @ExcelProperty(value = "更新时间") + private Date updateTime; + + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/BaseToolingInfoMapper.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/BaseToolingInfoMapper.java new file mode 100644 index 00000000..903767fc --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/BaseToolingInfoMapper.java @@ -0,0 +1,15 @@ +package org.dromara.mes.mapper; + +import org.dromara.mes.domain.BaseToolingInfo; +import org.dromara.mes.domain.vo.BaseToolingInfoVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 载具工装信息Mapper接口 + * + * @author zangch + * @date 2025-01-08 + */ +public interface BaseToolingInfoMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IBaseToolingInfoService.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IBaseToolingInfoService.java new file mode 100644 index 00000000..32318e3a --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IBaseToolingInfoService.java @@ -0,0 +1,69 @@ +package org.dromara.mes.service; + +import org.dromara.mes.domain.BaseToolingInfo; +import org.dromara.mes.domain.vo.BaseToolingInfoVo; +import org.dromara.mes.domain.bo.BaseToolingInfoBo; +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 zangch + * @date 2025-01-08 + */ +public interface IBaseToolingInfoService { + + /** + * 查询载具工装信息 + * + * @param toolingId 主键 + * @return 载具工装信息 + */ + BaseToolingInfoVo queryById(Long toolingId); + + /** + * 分页查询载具工装信息列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 载具工装信息分页列表 + */ + TableDataInfo queryPageList(BaseToolingInfoBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的载具工装信息列表 + * + * @param bo 查询条件 + * @return 载具工装信息列表 + */ + List queryList(BaseToolingInfoBo bo); + + /** + * 新增载具工装信息 + * + * @param bo 载具工装信息 + * @return 是否新增成功 + */ + Boolean insertByBo(BaseToolingInfoBo bo); + + /** + * 修改载具工装信息 + * + * @param bo 载具工装信息 + * @return 是否修改成功 + */ + Boolean updateByBo(BaseToolingInfoBo 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/BaseToolingInfoServiceImpl.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/BaseToolingInfoServiceImpl.java new file mode 100644 index 00000000..687e5380 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/BaseToolingInfoServiceImpl.java @@ -0,0 +1,141 @@ +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.BaseToolingInfoBo; +import org.dromara.mes.domain.vo.BaseToolingInfoVo; +import org.dromara.mes.domain.BaseToolingInfo; +import org.dromara.mes.mapper.BaseToolingInfoMapper; +import org.dromara.mes.service.IBaseToolingInfoService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 载具工装信息Service业务层处理 + * + * @author zangch + * @date 2025-01-08 + */ +@RequiredArgsConstructor +@Service +public class BaseToolingInfoServiceImpl implements IBaseToolingInfoService { + + private final BaseToolingInfoMapper baseMapper; + + /** + * 查询载具工装信息 + * + * @param toolingId 主键 + * @return 载具工装信息 + */ + @Override + public BaseToolingInfoVo queryById(Long toolingId){ + return baseMapper.selectVoById(toolingId); + } + + /** + * 分页查询载具工装信息列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 载具工装信息分页列表 + */ + @Override + public TableDataInfo queryPageList(BaseToolingInfoBo 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(BaseToolingInfoBo bo) { + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private MPJLambdaWrapper buildQueryWrapper(BaseToolingInfoBo bo) { + Map params = bo.getParams(); + MPJLambdaWrapper lqw = JoinWrappers.lambda(BaseToolingInfo.class) + .selectAll(BaseToolingInfo.class) + .eq(bo.getToolingId() != null, BaseToolingInfo::getToolingId, bo.getToolingId()) + .eq(StringUtils.isNotBlank(bo.getToolingCode()), BaseToolingInfo::getToolingCode, bo.getToolingCode()) + .like(StringUtils.isNotBlank(bo.getToolingName()), BaseToolingInfo::getToolingName, bo.getToolingName()) + .eq(StringUtils.isNotBlank(bo.getToolingTypeCode()), BaseToolingInfo::getToolingTypeCode, bo.getToolingTypeCode()) + .eq(StringUtils.isNotBlank(bo.getToolingSpecCode()), BaseToolingInfo::getToolingSpecCode, bo.getToolingSpecCode()) + .eq(StringUtils.isNotBlank(bo.getToolingBarcode()), BaseToolingInfo::getToolingBarcode, bo.getToolingBarcode()) + .eq(StringUtils.isNotBlank(bo.getToolingRfidBarcode()), BaseToolingInfo::getToolingRfidBarcode, bo.getToolingRfidBarcode()) + .eq(StringUtils.isNotBlank(bo.getMaterialCode()), BaseToolingInfo::getMaterialCode, bo.getMaterialCode()) + .eq(bo.getWeight() != null, BaseToolingInfo::getWeight, bo.getWeight()) + .eq(StringUtils.isNotBlank(bo.getActiveFlag()), BaseToolingInfo::getActiveFlag, bo.getActiveFlag()) + .orderByDesc(BaseToolingInfo::getCreateTime); + return lqw; + } + + /** + * 新增载具工装信息 + * + * @param bo 载具工装信息 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(BaseToolingInfoBo bo) { + BaseToolingInfo add = MapstructUtils.convert(bo, BaseToolingInfo.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setToolingId(add.getToolingId()); + } + return flag; + } + + /** + * 修改载具工装信息 + * + * @param bo 载具工装信息 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(BaseToolingInfoBo bo) { + BaseToolingInfo update = MapstructUtils.convert(bo, BaseToolingInfo.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(BaseToolingInfo 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/BaseToolingInfoMapper.xml b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/BaseToolingInfoMapper.xml new file mode 100644 index 00000000..6e63cdec --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/BaseToolingInfoMapper.xml @@ -0,0 +1,7 @@ + + + + +