部件管理-新增
This commit is contained in:
parent
e495710f2a
commit
b4ebdd7073
|
|
@ -187,9 +187,9 @@ public class BasePartController extends ControllerBase{
|
|||
*/
|
||||
@PostMapping("enable")
|
||||
@MethodInfoMark(value = "启用",menuName = "部件管理")
|
||||
public ApiResult<Boolean> enable(@RequestBody List<Long> ids ){
|
||||
public ApiResult<Boolean> enable(@RequestBody List<Integer> ids ){
|
||||
VUtils.trueThrowBusinessError(CollUtil.isEmpty(ids)).throwMessage("请选择要启用的数据");
|
||||
partService.lambdaUpdate().in(TBasePart::getId,ids).set(TBasePart::getEnable,1);
|
||||
partService.lambdaUpdate().in(TBasePart::getId,ids).set(TBasePart::getEnable,1).update();
|
||||
return ApiResult.success(true);
|
||||
}
|
||||
|
||||
|
|
@ -201,15 +201,20 @@ public class BasePartController extends ControllerBase{
|
|||
*/
|
||||
@PostMapping("disable")
|
||||
@MethodInfoMark(value = "禁用",menuName = "部件管理")
|
||||
public ApiResult<Boolean> disable(@RequestBody List<Long> ids ){
|
||||
public ApiResult<Boolean> disable(@RequestBody List<Integer> ids ){
|
||||
VUtils.trueThrowBusinessError(CollUtil.isEmpty(ids)).throwMessage("请选择要禁用的数据");
|
||||
partService.lambdaUpdate().in(TBasePart::getId,ids).set(TBasePart::getEnable,0);
|
||||
partService.lambdaUpdate().in(TBasePart::getId,ids).set(TBasePart::getEnable,0).update();
|
||||
|
||||
|
||||
return ApiResult.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入部件
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("importData")
|
||||
@ApiMark(moduleName = "部件管理", apiName = "导入")
|
||||
public ApiResult<Boolean> importData( @RequestParam(value = "file") MultipartFile file){
|
||||
List<Map<String,Object>> result=new ArrayList<>();
|
||||
try (ExcelReader reader = ExcelReader.read(file.getInputStream())) {
|
||||
|
|
|
|||
|
|
@ -176,7 +176,6 @@ public class DeviceComponentController extends ControllerBase {
|
|||
* @return
|
||||
*/
|
||||
@PostMapping("importData")
|
||||
@ApiMark(moduleName = "机型部件管理", apiName = "导入部件")
|
||||
public ApiResult<Boolean> importData( @RequestParam(value = "file") MultipartFile file){
|
||||
|
||||
try {
|
||||
|
|
@ -213,7 +212,7 @@ public class DeviceComponentController extends ControllerBase {
|
|||
ent.setDeviceComponentId(extstsModeMap.get(key).getId());
|
||||
ent.setModelPartId(exitsPartMap.get(componment.getModelPartName()).getId());
|
||||
ent.setModelPartName(componment.getModelPartName());
|
||||
ent.setCreateBy(AdminUserUtil.getUserName());
|
||||
ent.setCreateBy("fdf");
|
||||
ent.setCreateTime(LocalDateTime.now());
|
||||
result.add(ent);
|
||||
}
|
||||
|
|
@ -227,8 +226,6 @@ public class DeviceComponentController extends ControllerBase {
|
|||
deviceComponentDetailService.saveOrUpdateBatch(result);
|
||||
}
|
||||
|
||||
deviceComponentService.saveOrUpdateBatchComponent(Convert.toList(DeviceComponent.class, data));
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new NflgException(STATE.BusinessError, "导入失败:"+e.getMessage());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,5 +19,6 @@
|
|||
select a.model_no,b.model_part_name,b.create_by,b.create_time
|
||||
from device_component a
|
||||
join device_component_detail b on a.id=b.device_component_id
|
||||
join t_base_part c on b.model_part_id=c.id
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue