部件管理-新增

This commit is contained in:
luolm 2025-03-02 17:08:26 +08:00
parent fdd46a5f04
commit e495710f2a
6 changed files with 24 additions and 2 deletions

View File

@ -68,7 +68,7 @@ public class DeviceComponentController extends ControllerBase {
public ApiResult<PageData<DeviceComponentVO>> getList(@RequestBody DeviceComponentQuery query){ public ApiResult<PageData<DeviceComponentVO>> getList(@RequestBody DeviceComponentQuery query){
Page<DeviceComponentVO> result = deviceComponentService.selectListByPage(query); Page<DeviceComponentVO> result = deviceComponentService.selectListByPage(query);
result.getRecords().forEach(u->{ result.getRecords().forEach(u->{
List<DeviceComponentDetail> detail = deviceComponentDetailService.lambdaQuery().eq(DeviceComponentDetail::getDeviceComponentId, u.getId()).list(); List<DeviceComponentDetailVO> detail = deviceComponentDetailService.getDevicePartDetail(u.getId());
u.setPartList(Convert.toList(DeviceComponentDetailVO.class,detail)); u.setPartList(Convert.toList(DeviceComponentDetailVO.class,detail));
}); });
return ApiResult.success(result.getRecords(),query,result.getTotal()); return ApiResult.success(result.getRecords(),query,result.getTotal());
@ -80,7 +80,7 @@ public class DeviceComponentController extends ControllerBase {
* @return * @return
*/ */
@GetMapping("getModelPartList") @GetMapping("getModelPartList")
@ApiMark(moduleName = "机型部件管理", apiName = "获取机型部件列表") @ApiMark(moduleName = "机型部件管理", apiName = "获取机型已设置部件列表")
public ApiResult<List<DeviceComponentDetailDTO>> getModelPartList(@RequestParam("deviceComponentId") Integer deviceComponentId){ public ApiResult<List<DeviceComponentDetailDTO>> getModelPartList(@RequestParam("deviceComponentId") Integer deviceComponentId){
if (deviceComponentId == null) { if (deviceComponentId == null) {
throw new NflgException(STATE.ParamErr, "设备ID不能为空"); throw new NflgException(STATE.ParamErr, "设备ID不能为空");

View File

@ -56,4 +56,9 @@ public class DeviceComponentDetailVO implements Serializable {
* 创建时间 * 创建时间
*/ */
private LocalDateTime createTime; private LocalDateTime createTime;
/**
* 部件编码
*/
private String partNo;
} }

View File

@ -1,5 +1,6 @@
package com.nflg.mobilebroken.repository.mapper; package com.nflg.mobilebroken.repository.mapper;
import com.nflg.mobilebroken.common.pojo.vo.DeviceComponentDetailVO;
import com.nflg.mobilebroken.repository.entity.DeviceComponentDetail; import com.nflg.mobilebroken.repository.entity.DeviceComponentDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -19,4 +20,6 @@ public interface DeviceComponentDetailMapper extends BaseMapper<DeviceComponentD
void delByComponentId(@Param("componentId") Integer componentId); void delByComponentId(@Param("componentId") Integer componentId);
void batchDelByComponentId(@Param("componentIds") List<Integer> componentIds); void batchDelByComponentId(@Param("componentIds") List<Integer> componentIds);
List<DeviceComponentDetailVO> getDevicePartDetail(@Param("deviceComponentId") Integer deviceComponentId);
} }

View File

@ -1,5 +1,6 @@
package com.nflg.mobilebroken.repository.service; package com.nflg.mobilebroken.repository.service;
import com.nflg.mobilebroken.common.pojo.vo.DeviceComponentDetailVO;
import com.nflg.mobilebroken.repository.entity.DeviceComponentDetail; import com.nflg.mobilebroken.repository.entity.DeviceComponentDetail;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -20,4 +21,6 @@ public interface IDeviceComponentDetailService extends IService<DeviceComponentD
void delByComponentId(@Param("componentId") Integer componentId); void delByComponentId(@Param("componentId") Integer componentId);
void batchDelByComponentId(@Param("componentIds") List<Integer> componentIds); void batchDelByComponentId(@Param("componentIds") List<Integer> componentIds);
List<DeviceComponentDetailVO> getDevicePartDetail(@Param("deviceComponentId") Integer deviceComponentId);
} }

View File

@ -1,5 +1,6 @@
package com.nflg.mobilebroken.repository.service.impl; package com.nflg.mobilebroken.repository.service.impl;
import com.nflg.mobilebroken.common.pojo.vo.DeviceComponentDetailVO;
import com.nflg.mobilebroken.repository.entity.DeviceComponentDetail; import com.nflg.mobilebroken.repository.entity.DeviceComponentDetail;
import com.nflg.mobilebroken.repository.mapper.DeviceComponentDetailMapper; import com.nflg.mobilebroken.repository.mapper.DeviceComponentDetailMapper;
import com.nflg.mobilebroken.repository.service.IDeviceComponentDetailService; import com.nflg.mobilebroken.repository.service.IDeviceComponentDetailService;
@ -27,4 +28,8 @@ public class DeviceComponentDetailServiceImpl extends ServiceImpl<DeviceComponen
public void batchDelByComponentId(@Param("componentIds") List<Integer> componentIds){ public void batchDelByComponentId(@Param("componentIds") List<Integer> componentIds){
this.getBaseMapper().batchDelByComponentId(componentIds); this.getBaseMapper().batchDelByComponentId(componentIds);
} }
public List<DeviceComponentDetailVO> getDevicePartDetail(@Param("deviceComponentId") Integer deviceComponentId){
return this.getBaseMapper().getDevicePartDetail(deviceComponentId);
}
} }

View File

@ -13,4 +13,10 @@
#{item} #{item}
</foreach> </foreach>
</delete> </delete>
<select id="getDevicePartDetail" resultType="com.nflg.mobilebroken.common.pojo.vo.DeviceComponentDetailVO">
select a.* ,b.part_no from device_component_detail a
join t_base_part b on a.model_part_id=b.id
where a.device_component_id=#{deviceComponentId}
</select>
</mapper> </mapper>