feat(ai): 新增根据ID列表查询公司信息功能
- 在AiCompanyService接口中新增getListById方法
- 在AiCompanyServiceImpl实现类中实现getListById方法,支持批量查询
- 优化AiCompanyWorkflow分页查询逻辑,关联查询公司名称
- 在AiCompanyWorkflow实体类中新增companyName字段,用于展示公司名称
- 更新前端页面列表展示字段,将公司编码替换为公司名称- 调整公司列表页面名称字段的显示标题为"公司"
| | |
| | | package cc.mrbird.febs.ai.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.AiBaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | |
| | | * 代码标识 |
| | | */ |
| | | private String code; |
| | | |
| | | @TableField(exist = false) |
| | | private String companyName; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public interface AiCompanyService extends IService<AiCompany> { |
| | | |
| | | AiCompany getById(String id); |
| | | List<AiCompany> getListById(List<String> ids); |
| | | |
| | | FebsResponse add(AiCompany dto); |
| | | |
| | |
| | | |
| | | import cc.mrbird.febs.ai.entity.AiCompany; |
| | | import cc.mrbird.febs.ai.entity.AiCompanyWorkflow; |
| | | import cc.mrbird.febs.ai.entity.AiMemberRole; |
| | | import cc.mrbird.febs.ai.mapper.AiCompanyMapper; |
| | | import cc.mrbird.febs.ai.mapper.AiCompanyWorkflowMapper; |
| | | import cc.mrbird.febs.ai.service.AiCompanyService; |
| | | import cc.mrbird.febs.ai.util.UUID; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Slf4j |
| | | @Service |
| | |
| | | @Override |
| | | public AiCompany getById(String id) { |
| | | return aiCompanyMapper.selectById( id); |
| | | } |
| | | |
| | | @Override |
| | | public List<AiCompany> getListById(List<String> ids) { |
| | | LambdaQueryWrapper<AiCompany> aiCompanyLambdaQueryWrapper = Wrappers.lambdaQuery(AiCompany.class); |
| | | aiCompanyLambdaQueryWrapper.in(AiCompany::getId, ids); |
| | | return aiCompanyMapper.selectList(aiCompanyLambdaQueryWrapper); |
| | | } |
| | | |
| | | @Override |
| | |
| | | LambdaQueryWrapper<AiCompanyWorkflow> query = Wrappers.lambdaQuery(AiCompanyWorkflow.class); |
| | | query.orderByDesc(AiCompanyWorkflow::getCreatedTime); |
| | | Page<AiCompanyWorkflow> pages = aiCompanyWorkflowMapper.selectPage(page, query); |
| | | |
| | | List<AiCompanyWorkflow> records = pages.getRecords(); |
| | | if (CollUtil.isNotEmpty( records)){ |
| | | Set<String> collect = records.stream().map(AiCompanyWorkflow::getCompanyId).collect(Collectors.toSet()); |
| | | |
| | | |
| | | Map<String, AiCompany> map = new HashMap<>(); |
| | | if (CollUtil.isNotEmpty( collect)){ |
| | | //set转list |
| | | List<String> collect1 = new ArrayList<>(collect); |
| | | List<AiCompany> listById = this.getListById((collect1)); |
| | | map = listById.stream().collect(Collectors.toMap(AiCompany::getId, aiCompany -> aiCompany)); |
| | | } |
| | | |
| | | for (AiCompanyWorkflow aiCompanyWorkflow : records){ |
| | | if (map.containsKey(aiCompanyWorkflow.getCompanyId())){ |
| | | aiCompanyWorkflow.setCompanyName(map.get(aiCompanyWorkflow.getCompanyId()).getName()); |
| | | } |
| | | } |
| | | |
| | | } |
| | | return pages; |
| | | } |
| | | |
| | |
| | | {type: 'numbers', title: '', width: 80}, |
| | | {title: '操作', toolbar: '#aiCompanyOption', minWidth: 200, align: 'center'}, |
| | | {field: 'id', title: '编码', minWidth: 100,align:'center'}, |
| | | {field: 'name', title: '名称', minWidth: 100,align:'center'}, |
| | | {field: 'name', title: '公司', minWidth: 100,align:'center'}, |
| | | ]] |
| | | }); |
| | | } |
| | |
| | | {title: '操作', toolbar: '#workflowOption', minWidth: 200, align: 'center'}, |
| | | {field: 'code', title: '编码', minWidth: 100,align:'center'}, |
| | | {templet:"#workflowTypeFormat", title: '类型', minWidth: 140,align:'center'}, |
| | | {field: 'companyId', title: '公司编码', minWidth: 150,align:'center'}, |
| | | {field: 'companyName', title: '公司', minWidth: 150,align:'center'}, |
| | | ]] |
| | | }); |
| | | } |