完成了模具维修

plp
86158 3 weeks ago
parent 025e5e6af0
commit 69a5fc3689

@ -70,7 +70,7 @@ public class MoldBrandRespVO {
@ColumnWidth(20)
private LocalDateTime createTime;
@Schema(description = "工序", example = "你说的对")
@Schema(description = "工序", example = "reya")
@ExcelProperty(value = "工序", converter = DictConvert.class)
@DictFormat("mes_org_type")
private String orgType;

@ -28,7 +28,7 @@ public class MoldBrandSaveReqVO {
private String moldType;
@Schema(description = "产品ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2336")
@NotNull(message = "产品ID不能为空")
// @NotNull(message = "产品ID不能为空")
private Long productId;
@Schema(description = "预期寿命(小时)")
@ -40,8 +40,8 @@ public class MoldBrandSaveReqVO {
@Schema(description = "维保周期")
private BigDecimal maintainTime;
@Schema(description = "模具系数", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "模具系数不能为空")
@Schema(description = "模数", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "模数不能为空")
private Long moldSize;
@Schema(description = "备注", example = "你说的对")

@ -42,16 +42,16 @@ public class MoldRepairRespVO {
private String moldName;
@Schema(description = "品牌")
@ExcelProperty("品牌")
// @ExcelProperty("品牌")
private String moldBrand;
@Schema(description = "规格型号")
@ExcelProperty("规格型号")
// @ExcelProperty("规格型号")
private String moldSpec;
@Schema(description = "模具类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1622")
// @ExcelProperty(value = "模具类型", converter = DictConvert.class)
@DictFormat("mes_machine_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
// @DictFormat("mes_machine_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
private Long moldTypeId;
@Schema(description = "报修日期")

@ -0,0 +1,133 @@
package cn.iocoder.yudao.module.mes.controller.admin.moldrepairtems;
import cn.iocoder.yudao.module.mes.dal.dataobject.criticalcomponent.CriticalComponentDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.mold.MoldDO;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import java.util.stream.Collectors;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.mes.controller.admin.moldrepairtems.vo.*;
import cn.iocoder.yudao.module.mes.dal.dataobject.moldrepairtems.MoldRepairTemsDO;
import cn.iocoder.yudao.module.mes.service.moldrepairtems.MoldRepairTemsService;
@Tag(name = "管理后台 - 维修项目")
@RestController
@RequestMapping("/mes/mold-repair-tems")
@Validated
public class MoldRepairTemsController {
@Resource
private MoldRepairTemsService moldrepairTemsService;
@PostMapping("/create")
@Operation(summary = "创建维修项目")
@PreAuthorize("@ss.hasPermission('mes:mold-repair-tems:create')")
public CommonResult<Long> createMoldRepairTems(@Valid @RequestBody MoldRepairTemsSaveReqVO createReqVO) {
return success(moldrepairTemsService.createMoldRepairTems(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新维修项目")
@PreAuthorize("@ss.hasPermission('mes:mold-repair-tems:update')")
public CommonResult<Boolean> updateMoldRepairTems(@Valid @RequestBody MoldRepairTemsSaveReqVO updateReqVO) {
moldrepairTemsService.updateMoldRepairTems(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除维修项目")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('mes:mold-repair-tems:delete')")
public CommonResult<Boolean> deleteMoldRepairTems(@RequestParam("ids") String ids) {
List<Long> idList = Arrays.stream(ids.split(","))
.map(String::trim) // 去除可能存在的空格
.map(Long::valueOf)
.collect(Collectors.toList());
moldrepairTemsService.deleteMoldRepairTems(idList);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得维修项目")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('mes:mold-repair-tems:query')")
public CommonResult<MoldRepairTemsRespVO> getMoldRepairTems(@RequestParam("id") Long id) {
MoldRepairTemsDO moldrepairTems = moldrepairTemsService.getMoldRepairTems(id);
return success(BeanUtils.toBean(moldrepairTems, MoldRepairTemsRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得维修项目分页")
@PreAuthorize("@ss.hasPermission('mes:mold-repair-tems:query')")
public CommonResult<PageResult<MoldRepairTemsRespVO>> getMoldRepairTemsPage(@Valid MoldRepairTemsPageReqVO pageReqVO) {
PageResult<MoldRepairTemsRespVO> pageResult = moldrepairTemsService.getMoldRepairTemsPage(pageReqVO);
return success(pageResult);
}
@GetMapping("/export-excel")
@Operation(summary = "导出维修项目 Excel")
@PreAuthorize("@ss.hasPermission('mes:mold-repair-tems:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportMoldRepairTemsExcel(@Valid MoldRepairTemsPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<MoldRepairTemsRespVO> list = moldrepairTemsService.getMoldRepairTemsPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "维修项目.xls", "数据", MoldRepairTemsRespVO.class,list);
}
// @GetMapping("/getMoldOrComponent")
// @Operation(summary = "获得设备/关键件")
// @Parameter(name = "moldType", description = "moldType 1-设备 2-关键件", required = true, example = "1024")
// @PreAuthorize("@ss.hasPermission('mes:mold-repair-tems:query')")
// public CommonResult<List<MoldRepairTemsRespVO>> getMoldOrComponent(@RequestParam("moldType") Integer moldType) {
// return success( moldrepairTemsService.getMoldOrComponent(moldType));
// }
//
// @GetMapping("/getMoldOrComponentList")
// @Operation(summary = "获得设备/关键件列表")
//// @Parameter(name = "moldType", description = "moldType 1-设备 2-关键件", required = true, example = "1024")
// @PreAuthorize("@ss.hasPermission('mes:mold-repair-tems:query')")
// public CommonResult<List<MoldRepairTemsRespVO>> getMoldOrComponentList(
// @Parameter(name = "moldId", description = "设备Id", required = true, example = "123")
// @RequestParam("moldId") Long moldId,
// @Parameter(name = "componentId", description = "关键件Id", required = false, example = "123")
// @RequestParam(value = "componentId",required = false) Long componentId) {
// return success(moldrepairTemsService.getMoldOrComponentList(moldId,componentId));
// }
//
//
// @GetMapping("/getComponentList")
// @Operation(summary = "获得设备关键件")
// @Parameter(name = "moldId", description = "moldId设备Id", required = true, example = "1024")
// @PreAuthorize("@ss.hasPermission('mes:mold-repair-tems:query')")
// public CommonResult<List<CriticalComponentDO>> getComponentList(@RequestParam("moldId") Long moldId) {
// return success( moldrepairTemsService.getComponentList(moldId));
// }
}

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.mes.controller.admin.moldrepairtems.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 维修项目分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MoldRepairTemsPageReqVO extends PageParam {
@Schema(description = "项目编码")
private String subjectCode;
@Schema(description = "项目名称", example = "芋艿")
private String subjectName;
@Schema(description = "模具类型", example = "1")
private Integer moldBrand;
@Schema(description = "模具id", example = "11632")
private Long moldId;
@Schema(description = "关键件id", example = "29557")
private Long componentId;
@Schema(description = "检验方式")
private String inspectionMethod;
@Schema(description = "值类型", example = "1")
private String valueType;
@Schema(description = "判定基准")
private String judgmentCriteria;
@Schema(description = "是否启用")
private Boolean isEnable;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "项目内容")
private String projectContent;
@Schema(description = "id集合导出用")
private String ids;
}

@ -0,0 +1,81 @@
package cn.iocoder.yudao.module.mes.controller.admin.moldrepairtems.vo;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 维修项目 Response VO")
@Data
@ExcelIgnoreUnannotated
public class MoldRepairTemsRespVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15428")
// @ExcelProperty("ID")
private Long id;
@Schema(description = "项目编码", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("维修编码")
private String subjectCode;
@Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
@ExcelProperty("维修名称")
private String subjectName;
@Schema(description = "模具类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer moldBrand;
@Schema(description = "模具类型名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
// @ExcelProperty("模具类型名称")
private String moldBrandName;
@Schema(description = "模具id", example = "11632")
// @ExcelProperty("模具id")
private Long moldId;
@Schema(description = "关键件id", example = "29557")
// @ExcelProperty("关键件id")
private Long componentId;
@Schema(description = "检验方式")
// @ExcelProperty("检验方式")
private String inspectionMethod;
@Schema(description = "值类型", example = "1")
// @ExcelProperty("值类型")
private String valueType;
@Schema(description = "判定基准")
// @ExcelProperty("判定基准")
private String judgmentCriteria;
@Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("是否启用")
private Boolean isEnable;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
@ColumnWidth(20)
private LocalDateTime createTime;
@Schema(description = "模具名称")
@ExcelProperty("模具名称")
private String moldName;
@Schema(description = "关键件名称")
// @ExcelProperty("关键件名称")
private String componentName;
@Schema(description = "创建人名称")
@ExcelProperty("创建人名称")
private String creatorName;
@Schema(description = "项目内容")
@ExcelProperty("维修内容")
private String projectContent;
}

@ -0,0 +1,62 @@
package cn.iocoder.yudao.module.mes.controller.admin.moldrepairtems.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 维修项目新增/修改 Request VO")
@Data
public class MoldRepairTemsSaveReqVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15428")
private Long id;
@Schema(description = "项目编码", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "项目编码不能为空")
private String subjectCode;
@Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
@NotEmpty(message = "项目名称不能为空")
private String subjectName;
@Schema(description = "模具类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
// @NotNull(message = "模具类型不能为空")
private Integer moldBrand;
@Schema(description = "模具id", example = "11632")
private Long moldId;
@Schema(description = "关键件id", example = "29557")
private Long componentId;
@Schema(description = "检验方式")
private String inspectionMethod;
@Schema(description = "值类型", example = "1")
private String valueType;
@Schema(description = "判定基准")
private String judgmentCriteria;
@Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "是否启用不能为空")
private Boolean isEnable;
@Schema(description = "模具名称")
@ExcelProperty("模具名称")
private String moldName;
@Schema(description = "关键件名称")
@ExcelProperty("关键件名称")
private String componentName;
@Schema(description = "创建人名称")
@ExcelProperty("创建人名称")
private String creatorName;
@Schema(description = "项目内容")
@ExcelProperty("项目内容")
private String projectContent;
}

@ -0,0 +1,72 @@
package cn.iocoder.yudao.module.mes.dal.dataobject.moldrepairtems;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* DO
*
* @author
*/
@TableName("mes_mold_repair_tems")
@KeySequence("mes_mold_repair_tems_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class MoldRepairTemsDO extends BaseDO {
/**
* ID
*/
@TableId
private Long id;
/**
*
*/
private String subjectCode;
/**
*
*/
private String subjectName;
/**
*
*/
private Integer moldBrand;
/**
* id
*/
private Long moldId;
/**
* id
*/
private Long componentId;
/**
*
*/
private String inspectionMethod;
/**
*
*/
private String valueType;
/**
*
*/
private String judgmentCriteria;
/**
*
*/
private Boolean isEnable;
/**
*
*/
private String projectContent;
}

@ -0,0 +1,42 @@
package cn.iocoder.yudao.module.mes.dal.mysql.moldrepairtems;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mes.dal.dataobject.moldrepairtems.MoldRepairTemsDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mes.controller.admin.moldrepairtems.vo.*;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
*
* @author
*/
@Mapper
public interface MoldRepairTemsMapper extends BaseMapperX<MoldRepairTemsDO> {
default PageResult<MoldRepairTemsDO> selectPage(MoldRepairTemsPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<MoldRepairTemsDO>()
.eqIfPresent(MoldRepairTemsDO::getSubjectCode, reqVO.getSubjectCode())
.likeIfPresent(MoldRepairTemsDO::getSubjectName, reqVO.getSubjectName())
.eqIfPresent(MoldRepairTemsDO::getMoldBrand, reqVO.getMoldBrand())
.eqIfPresent(MoldRepairTemsDO::getMoldId, reqVO.getMoldId())
.eqIfPresent(MoldRepairTemsDO::getComponentId, reqVO.getComponentId())
.eqIfPresent(MoldRepairTemsDO::getInspectionMethod, reqVO.getInspectionMethod())
.eqIfPresent(MoldRepairTemsDO::getValueType, reqVO.getValueType())
.eqIfPresent(MoldRepairTemsDO::getJudgmentCriteria, reqVO.getJudgmentCriteria())
.eqIfPresent(MoldRepairTemsDO::getIsEnable, reqVO.getIsEnable())
.betweenIfPresent(MoldRepairTemsDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(MoldRepairTemsDO::getId));
}
IPage<MoldRepairTemsRespVO> getMoldRepairTemsPage(Page<MoldRepairTemsRespVO> page, @Param("pageReqVO") MoldRepairTemsPageReqVO pageReqVO);
List<MoldRepairTemsRespVO> getMoldRepairTemsList( @Param("pageReqVO") MoldRepairTemsPageReqVO pageReqVO);
}

@ -0,0 +1,62 @@
package cn.iocoder.yudao.module.mes.service.moldrepairtems;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.mes.controller.admin.moldrepairtems.vo.*;
import cn.iocoder.yudao.module.mes.dal.dataobject.criticalcomponent.CriticalComponentDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.mold.MoldDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.moldrepairtems.MoldRepairTemsDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* Service
*
* @author
*/
public interface MoldRepairTemsService {
/**
*
*
* @param createReqVO
* @return
*/
Long createMoldRepairTems(@Valid MoldRepairTemsSaveReqVO createReqVO);
/**
*
*
* @param updateReqVO
*/
void updateMoldRepairTems(@Valid MoldRepairTemsSaveReqVO updateReqVO);
/**
*
*
* @param id
*/
void deleteMoldRepairTems( List<Long> idList);
/**
*
*
* @param id
* @return
*/
MoldRepairTemsDO getMoldRepairTems(Long id);
/**
*
*
* @param pageReqVO
* @return
*/
PageResult<MoldRepairTemsRespVO> getMoldRepairTemsPage(MoldRepairTemsPageReqVO pageReqVO);
// List<MoldRepairTemsRespVO> getMoldOrComponent(Integer moldBrand);
// List<MoldRepairTemsRespVO> getMoldOrComponentList(Long moldId, Long componentId);
// List<CriticalComponentDO> getComponentList(Long moldId);
}

@ -0,0 +1,160 @@
package cn.iocoder.yudao.module.mes.service.moldrepairtems;
//import cn.iocoder.yudao.module.iot.controller.admin.mold.vo.LineMoldRespVO;
//import cn.iocoder.yudao.module.iot.dal.dataobject.moldmodel.MoldModelDO;
import cn.iocoder.yudao.module.mes.dal.dataobject.criticalcomponent.CriticalComponentDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.mold.MoldDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.mold.MoldBrandDO;
import cn.iocoder.yudao.module.mes.dal.mysql.criticalcomponent.CriticalComponentMapper;
import cn.iocoder.yudao.module.erp.dal.mysql.mold.MoldMapper;
import cn.iocoder.yudao.module.mes.service.moldrepairtems.MoldRepairTemsService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.stream.Collectors;
import cn.iocoder.yudao.module.mes.controller.admin.moldrepairtems.vo.*;
import cn.iocoder.yudao.module.mes.dal.dataobject.moldrepairtems.MoldRepairTemsDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.mes.dal.mysql.moldrepairtems.MoldRepairTemsMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.DEVICE_MODEL_CODE_EXISTS;
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*;
/**
* Service
*
* @author
*/
@Service
@Validated
public class MoldRepairTemsServiceImpl implements MoldRepairTemsService {
@Resource
private MoldRepairTemsMapper moldrepairTemsMapper;
@Resource
private MoldMapper moldMapper;
@Resource
private CriticalComponentMapper criticalComponentMapper;
@Override
public Long createMoldRepairTems(MoldRepairTemsSaveReqVO createReqVO) {
//编码重复判断
Long count = moldrepairTemsMapper.selectCount(new LambdaQueryWrapper<MoldRepairTemsDO>()
.eq(MoldRepairTemsDO::getSubjectCode, createReqVO.getSubjectCode())
);
if (count > 0) {
throw exception(REPAIR_TEMS_CODE_EXISTS);
}
// 插入
MoldRepairTemsDO moldrepairTems = BeanUtils.toBean(createReqVO, MoldRepairTemsDO.class);
moldrepairTemsMapper.insert(moldrepairTems);
// 返回
return moldrepairTems.getId();
}
@Override
public void updateMoldRepairTems(MoldRepairTemsSaveReqVO updateReqVO) {
// 校验存在
validateMoldRepairTemsExists(updateReqVO.getId());
//编码重复判断
Long count = moldrepairTemsMapper.selectCount(new LambdaQueryWrapper<MoldRepairTemsDO>()
.eq(MoldRepairTemsDO::getSubjectCode, updateReqVO.getSubjectCode())
.ne(MoldRepairTemsDO::getId, updateReqVO.getId())
);
if (count > 0) {
throw exception(REPAIR_TEMS_CODE_EXISTS);
}
// 更新
MoldRepairTemsDO updateObj = BeanUtils.toBean(updateReqVO, MoldRepairTemsDO.class);
moldrepairTemsMapper.updateById(updateObj);
}
@Override
public void deleteMoldRepairTems( List<Long> idList) {
for (Long id : idList) {
// 校验存在
validateMoldRepairTemsExists(id);
}
// 删除
moldrepairTemsMapper.deleteByIds(idList);
}
private void validateMoldRepairTemsExists(Long id) {
if (moldrepairTemsMapper.selectById(id) == null) {
throw exception(REPAIR_TEMS_NOT_EXISTS);
}
}
@Override
public MoldRepairTemsDO getMoldRepairTems(Long id) {
return moldrepairTemsMapper.selectById(id);
}
@Override
public PageResult<MoldRepairTemsRespVO> getMoldRepairTemsPage(MoldRepairTemsPageReqVO pageReqVO) {
Page<MoldRepairTemsRespVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
IPage<MoldRepairTemsRespVO> moldrepairTemsDOIPage = moldrepairTemsMapper.getMoldRepairTemsPage(page,pageReqVO);
PageResult<MoldRepairTemsRespVO> moldrepairTemsDOPageResult = new PageResult<>(moldrepairTemsDOIPage.getRecords(), moldrepairTemsDOIPage.getTotal());
return moldrepairTemsDOPageResult;
}
// @Override
// public List<MoldRepairTemsRespVO> getMoldOrComponent(Integer moldBrand) {
// return moldrepairTemsMapper.getMoldRepairTemsList(new MoldRepairTemsPageReqVO().setMoldBrand(moldBrand));
// }
// @Override
// public List<MoldRepairTemsRespVO> getMoldOrComponentList(Long moldId, Long componentId) {
// return moldrepairTemsMapper.getMoldRepairTemsList(new MoldRepairTemsPageReqVO().setMoldId(moldId).setComponentId(componentId));
// }
// @Override
// public List<CriticalComponentDO> getComponentList(Long moldId) {
//
// MoldDO moldDO = moldMapper.selectById(moldId);
// if(moldDO == null ){
// throw exception(DEVICE_LEDGER_NOT_EXISTS);
// }
//
// if (StringUtils.isBlank(moldDO.getComponentId())){
// return new ArrayList<>();
// }
//
// List<CriticalComponentDO> criticalComponentDOS= new ArrayList<>();
// List<Long> idList = Arrays.stream(moldDO.getComponentId().split(","))
// .map(String::trim) // 去除可能存在的空格
// .map(Long::valueOf)
// .collect(Collectors.toList());
//
// for (Long id : idList) {
// CriticalComponentDO criticalComponentDO = criticalComponentMapper.selectById(id);
// if (criticalComponentDO !=null){
// criticalComponentDOS.add(criticalComponentDO);
// }
// }
//
// return criticalComponentDOS;
// }
}

@ -0,0 +1,113 @@
<?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="cn.iocoder.yudao.module.mes.dal.mysql.moldrepairtems.MoldRepairTemsMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="getMoldRepairTemsPage"
resultType="cn.iocoder.yudao.module.mes.controller.admin.moldrepairtems.vo.MoldRepairTemsRespVO">
SELECT
mrt.id,
mrt.subject_code,
mrt.subject_name,
mrt.mold_id,
mrt.is_enable,
mrt.creator,
mrt.create_time,
mrt.updater,
mrt.update_time,
mrt.deleted,
mrt.tenant_id,
mrt.project_content,
mml.name as moldName, <!-- device_name 改为 mold_name别名对应修改 -->
CONCAT('(', su.username, ')', su.nickname) as creatorName
FROM besure.mes_mold_repair_tems mrt
left join besure.erp_mold mml on mml.id = mrt.mold_id <!-- device_ledger 改为 mold_ledger关联字段改为 mold_id -->
left join besure.system_users su on su.id = mrt.creator
WHERE 1=1
AND mrt.deleted = 0
<if test="pageReqVO.subjectCode != null and pageReqVO.subjectCode != ''">
AND mrt.subject_code = #{pageReqVO.subjectCode}
</if>
<if test="pageReqVO.subjectName != null and pageReqVO.subjectName != ''">
AND mrt.subject_name LIKE CONCAT('%', #{pageReqVO.subjectName}, '%')
</if>
<if test="pageReqVO.moldId != null"> <!-- deviceId 改为 moldId -->
AND mrt.mold_id = #{pageReqVO.moldId}
</if>
<if test="pageReqVO.inspectionMethod != null and pageReqVO.inspectionMethod != ''">
AND mrt.inspection_method = #{pageReqVO.inspectionMethod}
</if>
<if test="pageReqVO.valueType != null and pageReqVO.valueType != ''">
AND mrt.value_type = #{pageReqVO.valueType}
</if>
<if test="pageReqVO.judgmentCriteria != null and pageReqVO.judgmentCriteria != ''">
AND mrt.judgment_criteria = #{pageReqVO.judgmentCriteria}
</if>
<if test="pageReqVO.isEnable != null">
AND mrt.is_enable = #{pageReqVO.isEnable}
</if>
<if test="pageReqVO.projectContent != null and pageReqVO.projectContent != ''">
AND mrt.project_content LIKE CONCAT('%', #{pageReqVO.projectContent}, '%')
</if>
<!-- 添加 ids 过滤条件 -->
<if test="pageReqVO.ids != null and pageReqVO.ids != ''">
AND FIND_IN_SET(mrt.id, #{pageReqVO.ids})
</if>
</select>
<select id="getMoldRepairTemsList"
resultType="cn.iocoder.yudao.module.mes.controller.admin.moldrepairtems.vo.MoldRepairTemsRespVO">
SELECT
mrt.id,
mrt.subject_code,
mrt.subject_name,
mrt.mold_id,
mrt.is_enable,
mrt.creator,
mrt.create_time,
mrt.updater,
mrt.update_time,
mrt.deleted,
mrt.tenant_id,
mml.name as moldName, <!-- device_name 改为 mold_name别名对应修改 -->
CONCAT('(', su.username, ')', su.nickname) as creatorName
FROM besure.mes_mold_repair_tems mrt
left join besure.erp_mold mml on mml.id = mrt.mold_id <!-- device_ledger 改为 mold_ledger关联字段改为 mold_id -->
left join besure.system_users su on su.id = mrt.creator
WHERE mrt.deleted = 0
<if test="pageReqVO.subjectCode != null and pageReqVO.subjectCode != ''">
AND mrt.subject_code = #{pageReqVO.subjectCode}
</if>
<if test="pageReqVO.subjectName != null and pageReqVO.subjectName != ''">
AND mrt.subject_name LIKE CONCAT('%', #{pageReqVO.subjectName}, '%')
</if>
<if test="pageReqVO.moldId != null"> <!-- deviceId 改为 moldId -->
AND mrt.mold_id = #{pageReqVO.moldId}
</if>
<if test="pageReqVO.inspectionMethod != null and pageReqVO.inspectionMethod != ''">
AND mrt.inspection_method = #{pageReqVO.inspectionMethod}
</if>
<if test="pageReqVO.valueType != null and pageReqVO.valueType != ''">
AND mrt.value_type = #{pageReqVO.valueType}
</if>
<if test="pageReqVO.judgmentCriteria != null and pageReqVO.judgmentCriteria != ''">
AND mrt.judgment_criteria = #{pageReqVO.judgmentCriteria}
</if>
<if test="pageReqVO.isEnable != null">
AND mrt.is_enable = #{pageReqVO.isEnable}
</if>
<if test="pageReqVO.projectContent != null and pageReqVO.projectContent != ''">
AND mrt.project_content LIKE CONCAT('%', #{pageReqVO.projectContent}, '%')
</if>
<!-- 添加 ids 过滤条件 -->
<if test="pageReqVO.ids != null and pageReqVO.ids != ''">
AND FIND_IN_SET(mrt.id, #{pageReqVO.ids})
</if>
</select>
</mapper>
Loading…
Cancel
Save