Commit 363932a7 authored by qinhu's avatar qinhu

设备获取bug修改

parent e9233d0b
...@@ -58,9 +58,7 @@ public class PrecipriceController { ...@@ -58,9 +58,7 @@ public class PrecipriceController {
@ApiOperation("aaa") @ApiOperation("aaa")
public void add(){ public void add(){
iNormProductionService.createPreciprice(1,1,1,1,1); iNormProductionService.createPreciprice(1,1,1,1,1);
iNormProductionService.createPreciprice(1,1,20,0,1);
iNormProductionService.createPreciprice(1,1,1,1,1);
iNormProductionService.createPreciprice(1,1,1,1,1);
} }
@GetMapping("/statistics") @GetMapping("/statistics")
......
...@@ -10,6 +10,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -10,6 +10,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* <p> * <p>
...@@ -32,4 +33,11 @@ public interface EquipmentUseMapper extends BaseMapper<EquipmentUse> { ...@@ -32,4 +33,11 @@ public interface EquipmentUseMapper extends BaseMapper<EquipmentUse> {
* @return list * @return list
*/ */
List<String> getEquipmentNamesByProjectId(@Param("param") Integer entrustId); List<String> getEquipmentNamesByProjectId(@Param("param") Integer entrustId);
/**
* 根据设备ids获取使用到的设备名字
* @param ids 设备id
* @return list
*/
List<String> getEquipmentNamesByEquipmentIds(@Param("params")Set<Integer> ids);
} }
...@@ -52,5 +52,13 @@ ...@@ -52,5 +52,13 @@
WHERE eu.id IS NOT NULL WHERE eu.id IS NOT NULL
</select> </select>
<select id="getEquipmentNamesByEquipmentIds" resultType="java.lang.String">
SELECT CONCAT(`name`,' (',`code`,')') FROM equipment
where id in
<foreach collection="params" open="(" close=")" item="id" separator=",">
#{id}
</foreach>
</select>
</mapper> </mapper>
...@@ -2642,7 +2642,10 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -2642,7 +2642,10 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
rts.setSampleNames(new HashSet<>(source.size())); rts.setSampleNames(new HashSet<>(source.size()));
rts.setMethodNames(new HashSet<>(source.size())); rts.setMethodNames(new HashSet<>(source.size()));
rts.setTeamNames(new HashSet<>(source.size())); rts.setTeamNames(new HashSet<>(source.size()));
Set<Integer> equipmentIds = new HashSet<>(source.size());
source.forEach(arg -> { source.forEach(arg -> {
equipmentIds.add(arg.getEquipmentId());
//获取使用的设备id
//关联检测项目 //关联检测项目
if (StrUtil.isNotBlank(arg.getTeamName())) { if (StrUtil.isNotBlank(arg.getTeamName())) {
String[] teamSplits = arg.getTeamName().split("、"); String[] teamSplits = arg.getTeamName().split("、");
...@@ -2666,7 +2669,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -2666,7 +2669,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
rts.setSampleNum(rts.getSampleNames().size()); rts.setSampleNum(rts.getSampleNames().size());
//关联仪器名字 去重 //关联仪器名字 去重
List<String> equipmentNames = equipmentUseMapper.getEquipmentNamesByProjectId(firstReportDetail.getEntrustId()); List<String> equipmentNames = equipmentUseMapper.getEquipmentNamesByEquipmentIds(equipmentIds);
equipmentNames.forEach(arg -> rts.getEquipmentNames().add(arg)); equipmentNames.forEach(arg -> rts.getEquipmentNames().add(arg));
//关联送样单位名字 //关联送样单位名字
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment