Merge branch 'main' of ssh://192.168.1.205:9922/cf_devdept2/cf_imes_server

This commit is contained in:
lym
2024-03-07 18:33:08 +08:00
21 changed files with 295 additions and 61 deletions
@@ -0,0 +1,39 @@
package com.cf.imes.module.system.api.machine;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.common.util.object.BeanUtils;
import com.cf.imes.module.system.api.machine.dto.CuttingRespDTO;
import com.cf.imes.module.system.controller.admin.machine.vo.CuttingRespVO;
import com.cf.imes.module.system.service.machine.MachineService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
import static com.cf.imes.framework.common.pojo.CommonResult.success;
@RestController // 提供 RESTful API 接口,给 Feign 调用
@Validated
public class MachineApiImpl implements MachineApi {
@Resource
private MachineService machineService;
@Override
public CommonResult<CuttingRespDTO> getCutting(Long id) {
return success(BeanUtils.toBean(machineService.getCutting(id), CuttingRespDTO.class));
}
@Override
public CommonResult<CuttingRespDTO> getDrill(Long id) {
return success(BeanUtils.toBean(machineService.getDrill(id), CuttingRespDTO.class));
}
@Override
public CommonResult<List<CuttingRespDTO>> list(Collection<Long> ids) {
return success(BeanUtils.toBean(machineService.list(ids), CuttingRespDTO.class));
}
}
@@ -68,4 +68,6 @@ public interface MachineService {
void batchDeleteDrill(List<Long> ids);
DrillRespVO getDrill(Long id);
List<MachineDO> list(Collection<Long> ids);
}
@@ -222,6 +222,11 @@ public class MachineServiceImpl implements MachineService {
return respVO;
}
@Override
public List<MachineDO> list(Collection<Long> ids) {
return machineMapper.selectBatchIds(ids);
}
private void validateExists(Long id) {
if (machineMapper.selectById(id) == null) {
throw exception(MACHINE_NOT_EXISTS);