add(hwmom-mes): 添加载具工装信息管理功能

master
zch 2 weeks ago
parent f7e072e180
commit 5379f1daea

@ -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<BaseToolingInfoVo> 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<BaseToolingInfoVo> list = baseToolingInfoService.queryList(bo);
ExcelUtil.exportExcel(list, "载具工装信息", BaseToolingInfoVo.class, response);
}
/**
*
*
* @param toolingId
*/
@SaCheckPermission("mes:baseToolingInfo:query")
@GetMapping("/{toolingId}")
public R<BaseToolingInfoVo> 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<Void> 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<Void> 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<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] toolingIds) {
return toAjax(baseToolingInfoService.deleteWithValidByIds(List.of(toolingIds), true));
}
/**
*
*/
@GetMapping("getBaseToolingInfoList")
public R<List<BaseToolingInfoVo>> getBaseToolingInfolist(BaseToolingInfoBo bo) {
List<BaseToolingInfoVo> list = baseToolingInfoService.queryList(bo);
return R.ok(list);
}
}

@ -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;
}

@ -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;
}

@ -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;
}

@ -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<BaseToolingInfo, BaseToolingInfoVo> {
}

@ -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<BaseToolingInfoVo> queryPageList(BaseToolingInfoBo bo, PageQuery pageQuery);
/**
*
*
* @param bo
* @return
*/
List<BaseToolingInfoVo> 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<Long> ids, Boolean isValid);
}

@ -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<BaseToolingInfoVo> queryPageList(BaseToolingInfoBo bo, PageQuery pageQuery) {
MPJLambdaWrapper<BaseToolingInfo> lqw = buildQueryWrapper(bo);
Page<BaseToolingInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
return TableDataInfo.build(result);
}
/**
*
*
* @param bo
* @return
*/
@Override
public List<BaseToolingInfoVo> queryList(BaseToolingInfoBo bo) {
MPJLambdaWrapper<BaseToolingInfo> lqw = buildQueryWrapper(bo);
return baseMapper.selectVoList(lqw);
}
private MPJLambdaWrapper<BaseToolingInfo> buildQueryWrapper(BaseToolingInfoBo bo) {
Map<String, Object> params = bo.getParams();
MPJLambdaWrapper<BaseToolingInfo> 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<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.mes.mapper.BaseToolingInfoMapper">
</mapper>
Loading…
Cancel
Save