update add工位关联物料类型
parent
f53e48c04d
commit
e420eea507
@ -0,0 +1,46 @@
|
||||
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;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 工位关联物料类型对象 prod_base_station_materialtype
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-05-13
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("prod_base_station_materialtype")
|
||||
public class ProdBaseStationMaterialtype extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 工位ID
|
||||
*/
|
||||
private Long stationId;
|
||||
|
||||
/**
|
||||
* 物料类型ID
|
||||
*/
|
||||
private Long materialTypeId;
|
||||
|
||||
/**
|
||||
* 激活标识(1是 0否)
|
||||
*/
|
||||
private String activeFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Long updateBy;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Date updateTime;
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package org.dromara.mes.domain.bo;
|
||||
|
||||
import org.dromara.mes.domain.ProdBaseStationMaterialtype;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* 工位关联物料类型业务对象 prod_base_station_materialtype
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-05-13
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = ProdBaseStationMaterialtype.class, reverseConvertGenerate = false)
|
||||
public class ProdBaseStationMaterialtypeBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 工位ID
|
||||
*/
|
||||
@NotNull(message = "工位ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long stationId;
|
||||
|
||||
/**
|
||||
* 物料类型ID
|
||||
*/
|
||||
@NotNull(message = "物料类型ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long materialTypeId;
|
||||
|
||||
/**
|
||||
* 激活标识(1是 0否)
|
||||
*/
|
||||
@NotBlank(message = "激活标识(1是 0否)不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String activeFlag;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package org.dromara.mes.domain.vo;
|
||||
|
||||
import org.dromara.mes.domain.ProdBaseStationMaterialtype;
|
||||
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_station_materialtype
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-05-13
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = ProdBaseStationMaterialtype.class)
|
||||
public class ProdBaseStationMaterialtypeVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 工位ID
|
||||
*/
|
||||
@ExcelProperty(value = "工位ID")
|
||||
private Long stationId;
|
||||
|
||||
/**
|
||||
* 物料类型ID
|
||||
*/
|
||||
@ExcelProperty(value = "物料类型ID")
|
||||
private Long materialTypeId;
|
||||
|
||||
/**
|
||||
* 激活标识(1是 0否)
|
||||
*/
|
||||
@ExcelProperty(value = "激活标识(1是 0否)", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "active_flag")
|
||||
private String activeFlag;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.mes.mapper;
|
||||
|
||||
import org.dromara.mes.domain.ProdBaseStationMaterialtype;
|
||||
import org.dromara.mes.domain.vo.ProdBaseStationMaterialtypeVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 工位关联物料类型Mapper接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-05-13
|
||||
*/
|
||||
public interface ProdBaseStationMaterialtypeMapper extends BaseMapperPlus<ProdBaseStationMaterialtype, ProdBaseStationMaterialtypeVo> {
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package org.dromara.mes.service;
|
||||
|
||||
import org.dromara.mes.domain.ProdBaseStationMaterialtype;
|
||||
import org.dromara.mes.domain.vo.ProdBaseStationMaterialtypeVo;
|
||||
import org.dromara.mes.domain.bo.ProdBaseStationMaterialtypeBo;
|
||||
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-05-13
|
||||
*/
|
||||
public interface IProdBaseStationMaterialtypeService {
|
||||
|
||||
/**
|
||||
* 查询工位关联物料类型
|
||||
*
|
||||
* @param stationId 主键
|
||||
* @return 工位关联物料类型
|
||||
*/
|
||||
ProdBaseStationMaterialtypeVo queryById(Long stationId);
|
||||
|
||||
/**
|
||||
* 分页查询工位关联物料类型列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 工位关联物料类型分页列表
|
||||
*/
|
||||
TableDataInfo<ProdBaseStationMaterialtypeVo> queryPageList(ProdBaseStationMaterialtypeBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的工位关联物料类型列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 工位关联物料类型列表
|
||||
*/
|
||||
List<ProdBaseStationMaterialtypeVo> queryList(ProdBaseStationMaterialtypeBo bo);
|
||||
|
||||
/**
|
||||
* 新增工位关联物料类型
|
||||
*
|
||||
* @param bo 工位关联物料类型
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(ProdBaseStationMaterialtypeBo bo);
|
||||
|
||||
/**
|
||||
* 修改工位关联物料类型
|
||||
*
|
||||
* @param bo 工位关联物料类型
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(ProdBaseStationMaterialtypeBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除工位关联物料类型信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@ -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.ProdBaseStationMaterialtypeBo;
|
||||
import org.dromara.mes.domain.vo.ProdBaseStationMaterialtypeVo;
|
||||
import org.dromara.mes.domain.ProdBaseStationMaterialtype;
|
||||
import org.dromara.mes.mapper.ProdBaseStationMaterialtypeMapper;
|
||||
import org.dromara.mes.service.IProdBaseStationMaterialtypeService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 工位关联物料类型Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-05-13
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class ProdBaseStationMaterialtypeServiceImpl implements IProdBaseStationMaterialtypeService {
|
||||
|
||||
private final ProdBaseStationMaterialtypeMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询工位关联物料类型
|
||||
*
|
||||
* @param stationId 主键
|
||||
* @return 工位关联物料类型
|
||||
*/
|
||||
@Override
|
||||
public ProdBaseStationMaterialtypeVo queryById(Long stationId){
|
||||
return baseMapper.selectVoById(stationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询工位关联物料类型列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 工位关联物料类型分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<ProdBaseStationMaterialtypeVo> queryPageList(ProdBaseStationMaterialtypeBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<ProdBaseStationMaterialtype> lqw = buildQueryWrapper(bo);
|
||||
Page<ProdBaseStationMaterialtypeVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的工位关联物料类型列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 工位关联物料类型列表
|
||||
*/
|
||||
@Override
|
||||
public List<ProdBaseStationMaterialtypeVo> queryList(ProdBaseStationMaterialtypeBo bo) {
|
||||
MPJLambdaWrapper<ProdBaseStationMaterialtype> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<ProdBaseStationMaterialtype> buildQueryWrapper(ProdBaseStationMaterialtypeBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<ProdBaseStationMaterialtype> lqw = JoinWrappers.lambda(ProdBaseStationMaterialtype.class)
|
||||
.selectAll(ProdBaseStationMaterialtype.class)
|
||||
.eq(bo.getStationId() != null, ProdBaseStationMaterialtype::getStationId, bo.getStationId())
|
||||
.eq(bo.getMaterialTypeId() != null, ProdBaseStationMaterialtype::getMaterialTypeId, bo.getMaterialTypeId())
|
||||
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), ProdBaseStationMaterialtype::getActiveFlag, bo.getActiveFlag())
|
||||
.orderByDesc(ProdBaseStationMaterialtype::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工位关联物料类型
|
||||
*
|
||||
* @param bo 工位关联物料类型
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(ProdBaseStationMaterialtypeBo bo) {
|
||||
ProdBaseStationMaterialtype add = MapstructUtils.convert(bo, ProdBaseStationMaterialtype.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setStationId(add.getStationId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工位关联物料类型
|
||||
*
|
||||
* @param bo 工位关联物料类型
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(ProdBaseStationMaterialtypeBo bo) {
|
||||
ProdBaseStationMaterialtype update = MapstructUtils.convert(bo, ProdBaseStationMaterialtype.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(ProdBaseStationMaterialtype 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.ProdBaseStationMaterialtypeMapper">
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue