Commit 5312666b authored by wdy's avatar wdy

自动获取第一个样品信息

parent a91f3e1c
...@@ -59,6 +59,6 @@ public interface SampleManagementMapper extends BaseMapper<Sample> { ...@@ -59,6 +59,6 @@ public interface SampleManagementMapper extends BaseMapper<Sample> {
* */ * */
public List<Sample> selectSampleList(SampleManagementRequest sampleManagementRequest); public List<Sample> selectSampleList(SampleManagementRequest sampleManagementRequest);
List<Sample> findByIdList(@Param("relationList") List<TaskSampleRelation> relationList); List<Sample> findByIdList(@Param("relationList") List<TaskSampleRelation> relationList,@Param("id") Long id);
} }
...@@ -99,7 +99,7 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init ...@@ -99,7 +99,7 @@ public class StrategyCarReviewTaskPending implements StrategyCarReviewTask, Init
List<ReviewSceneChangeTask> lastChanges = reviewSceneChangeTaskService.findLastChangeByTaskId(carReviewTask.getId()); List<ReviewSceneChangeTask> lastChanges = reviewSceneChangeTaskService.findLastChangeByTaskId(carReviewTask.getId());
List<TaskSampleRelation> sampleRelations = taskSampleRelationMapper.selectByTaskId(taskMapper.findByCarReviewTaskId(carReviewTask.getId()),TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE); List<TaskSampleRelation> sampleRelations = taskSampleRelationMapper.selectByTaskId(taskMapper.findByCarReviewTaskId(carReviewTask.getId()),TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE);
TaskSampleRelation taskSampleRelation = sampleRelations.get(sampleRelations.size() -1); TaskSampleRelation taskSampleRelation = sampleRelations.get(0);
Sample sample = sampleManagementMapper.selectSampleManagementById(taskSampleRelation.getSampleId()); Sample sample = sampleManagementMapper.selectSampleManagementById(taskSampleRelation.getSampleId());
carReviewTask.setEnterpriseName(sample.getManufacturingEnterprise()); carReviewTask.setEnterpriseName(sample.getManufacturingEnterprise());
......
...@@ -143,7 +143,7 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask ...@@ -143,7 +143,7 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
List<TaskSampleRelation> sampleRelations = taskSampleRelationMapper.selectByTaskId(taskMapper.findBySystemReviewTaskId(systemReviewTask.getId()),TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE); List<TaskSampleRelation> sampleRelations = taskSampleRelationMapper.selectByTaskId(taskMapper.findBySystemReviewTaskId(systemReviewTask.getId()),TaskSampleRelation.COMPLETE_VEHICLE_SAMPLE);
TaskSampleRelation taskSampleRelation = sampleRelations.get(sampleRelations.size() -1); TaskSampleRelation taskSampleRelation = sampleRelations.get(0);
Sample sample = sampleManagementMapper.selectSampleManagementById(taskSampleRelation.getSampleId()); Sample sample = sampleManagementMapper.selectSampleManagementById(taskSampleRelation.getSampleId());
systemReviewTask.setEnterpriseName(sample.getManufacturingEnterprise()); systemReviewTask.setEnterpriseName(sample.getManufacturingEnterprise());
......
...@@ -272,7 +272,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -272,7 +272,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
if (sampleRelations.size() != 0 && sampleRelations != null) { if (sampleRelations.size() != 0 && sampleRelations != null) {
// 获取之前的第一个企业名称 // 获取之前的第一个企业名称
TaskSampleRelation taskSampleRelation = sampleRelations.get(sampleRelations.size() - 1); TaskSampleRelation taskSampleRelation = sampleRelations.get(0);
Sample oldSample = sampleManagementMapper.selectSampleManagementById(taskSampleRelation.getSampleId()); Sample oldSample = sampleManagementMapper.selectSampleManagementById(taskSampleRelation.getSampleId());
// 获取编辑任务后的第一个企业名称 // 获取编辑任务后的第一个企业名称
...@@ -692,7 +692,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas ...@@ -692,7 +692,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
// 样品信息 // 样品信息
List<TaskSampleRelation> relationList = taskSampleRelationService.selectByTaskId(id,type); List<TaskSampleRelation> relationList = taskSampleRelationService.selectByTaskId(id,type);
if (relationList.size() != 0 && relationList != null) { if (relationList.size() != 0 && relationList != null) {
List<Sample> SampleList = sampleManagementMapper.findByIdList(relationList); List<Sample> SampleList = sampleManagementMapper.findByIdList(relationList,id);
return SampleList; return SampleList;
} else { } else {
return null; return null;
......
...@@ -173,10 +173,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -173,10 +173,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="enterpriseId" column="enterprise_id" /> <result property="enterpriseId" column="enterprise_id" />
</resultMap> </resultMap>
<select id="findByIdList" resultMap="SampleManagementResult"> <select id="findByIdList" resultMap="SampleManagementResult">
select id,identification_code,sample_number,sample_name,enterprise_id,trademark,sample_photos,number_of_samples,delivery_date,sample_sender,manufacturing_enterprise,manufacture_date from t_sample select t.id,t.identification_code,t.sample_number,t.sample_name,t.enterprise_id,t.trademark,t.sample_photos,t.number_of_samples,t.delivery_date,t.sample_sender,t.manufacturing_enterprise,t.manufacture_date
WHERE id IN from t_sample t
left join t_task_sample_relation ts on ts.sample_id = t.id and ts.task_id = #{id}
WHERE t.id IN
<foreach collection="relationList" item="relation" open="(" separator="," close=")"> <foreach collection="relationList" item="relation" open="(" separator="," close=")">
#{relation.sampleId} #{relation.sampleId}
</foreach> </foreach>
ORDER BY ts.id
</select> </select>
</mapper> </mapper>
\ No newline at end of file
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