This commit is contained in:
Vinjor 2024-10-25 18:12:17 +08:00
parent 3319ac9b6f
commit 2372219243
3 changed files with 25 additions and 8 deletions

View File

@ -1,15 +1,13 @@
package cn.iocoder.yudao.module.supplier.controller.admin; package cn.iocoder.yudao.module.supplier.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.label.vo.LabelPageReqVO;
import cn.iocoder.yudao.module.label.vo.LabelRespVO;
import cn.iocoder.yudao.module.supplier.entity.BaseSupplier; import cn.iocoder.yudao.module.supplier.entity.BaseSupplier;
import cn.iocoder.yudao.module.supplier.service.BaseSupplierService; import cn.iocoder.yudao.module.supplier.service.BaseSupplierService;
import cn.iocoder.yudao.module.supplier.vo.BaseSupplierPageReqVO; import cn.iocoder.yudao.module.supplier.vo.BaseSupplierPageReqVO;
import cn.iocoder.yudao.module.supplier.vo.BaseSupplierRespVO; import cn.iocoder.yudao.module.supplier.vo.BaseSupplierRespVO;
import cn.iocoder.yudao.module.supplier.vo.BaseSupplierSaveReqVO; import cn.iocoder.yudao.module.supplier.vo.BaseSupplierSaveReqVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
@ -123,8 +121,20 @@ public class BaseSupplierController {
**/ **/
@GetMapping("/list") @GetMapping("/list")
@Operation(summary = "获得所有供应商") @Operation(summary = "获得所有供应商")
// @PreAuthorize("@ss.hasPermission('supplier:base-supplier:query')")
public CommonResult<?> getBaseSupplierList(){ public CommonResult<?> getBaseSupplierList(){
return success(baseSupplierService.list()); return success(baseSupplierService.list());
} }
/**
* 根据输入名称模糊查询供应商
* @author 小李
* @date 9:23 2024/9/13
**/
@GetMapping("/searchList")
@Operation(summary = "根据输入名称模糊查询供应商")
public CommonResult<?> searchList(String name){
LambdaQueryWrapper<BaseSupplier> queryWrapper = new LambdaQueryWrapper<BaseSupplier>()
.like(BaseSupplier::getName,name);
return success(baseSupplierService.list(queryWrapper));
}
} }

View File

@ -16,4 +16,6 @@ public class RepairCons {
public static final String DICT_REPAIR_RECORDS_TYPE = "repair_records_type"; public static final String DICT_REPAIR_RECORDS_TYPE = "repair_records_type";
/**数据字典常量-repair_type-*/ /**数据字典常量-repair_type-*/
public static final String DICT_REPAIR_TYPE = "repair_type"; public static final String DICT_REPAIR_TYPE = "repair_type";
/**数据字典常量-repair_unit-*/
public static final String DICT_REPAIR_UNIT = "repair_unit";
} }

View File

@ -4,9 +4,10 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.module.project.entity.RepairWares; import cn.iocoder.yudao.module.project.entity.RepairWares;
import cn.iocoder.yudao.module.project.service.RepairWaresService; import cn.iocoder.yudao.module.project.service.RepairWaresService;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
import cn.iocoder.yudao.module.tickets.entity.DlTwItem; import cn.iocoder.yudao.module.tickets.entity.DlTwItem;
import cn.iocoder.yudao.module.tickets.mapper.DlTwItemMapper; import cn.iocoder.yudao.module.tickets.mapper.DlTwItemMapper;
import cn.iocoder.yudao.module.tickets.service.DlTicketWaresService;
import cn.iocoder.yudao.module.tickets.service.DlTwItemService; import cn.iocoder.yudao.module.tickets.service.DlTwItemService;
import cn.iocoder.yudao.module.tickets.vo.DlTwItemReqVO; import cn.iocoder.yudao.module.tickets.vo.DlTwItemReqVO;
import cn.iocoder.yudao.module.tickets.vo.DlTwItemRespVO; import cn.iocoder.yudao.module.tickets.vo.DlTwItemRespVO;
@ -20,6 +21,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static cn.iocoder.yudao.common.RepairCons.DICT_REPAIR_UNIT;
/** /**
* 针对表dl_tw_item(工单配件申请/退回子表)的数据库操作Service实现 * 针对表dl_tw_item(工单配件申请/退回子表)的数据库操作Service实现
* *
@ -32,10 +35,8 @@ public class DlTwItemServiceImpl extends ServiceImpl<DlTwItemMapper, DlTwItem>
@Resource @Resource
private RepairWaresService repairWaresService; private RepairWaresService repairWaresService;
@Resource @Resource
@Lazy private DictDataApi dictDataApi;
private DlTicketWaresService ticketWaresService;
@Resource @Resource
@Lazy @Lazy
private RepairWaresService waresService; private RepairWaresService waresService;
@ -57,6 +58,9 @@ public class DlTwItemServiceImpl extends ServiceImpl<DlTwItemMapper, DlTwItem>
for(Map<String,String> map:typeMapList){ for(Map<String,String> map:typeMapList){
typeMap.put(map.get("id"),map.get("name")); typeMap.put(map.get("id"),map.get("name"));
} }
// 单位字典
List<DictDataRespDTO> recordTypeList = dictDataApi.getDictDataList(DICT_REPAIR_UNIT);
Map<String,String> unitMap = recordTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel));
// 查配件详情 // 查配件详情
List<String> ids = dlTwItems.stream().map(DlTwItem::getWaresId).collect(Collectors.toList()); List<String> ids = dlTwItems.stream().map(DlTwItem::getWaresId).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(ids)){ if (CollectionUtil.isNotEmpty(ids)){
@ -68,6 +72,7 @@ public class DlTwItemServiceImpl extends ServiceImpl<DlTwItemMapper, DlTwItem>
.findFirst() .findFirst()
.ifPresent(bean::setWares); .ifPresent(bean::setWares);
bean.setTypeName(typeMap.get(bean.getWares().getType())); bean.setTypeName(typeMap.get(bean.getWares().getType()));
bean.getWares().setUnit(unitMap.get(bean.getWares().getUnit()));
return bean; return bean;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }