Commit 5312666b authored by wdy's avatar wdy

自动获取第一个样品信息

parent a91f3e1c
......@@ -59,6 +59,6 @@ public interface SampleManagementMapper extends BaseMapper<Sample> {
* */
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
List<ReviewSceneChangeTask> lastChanges = reviewSceneChangeTaskService.findLastChangeByTaskId(carReviewTask.getId());
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());
carReviewTask.setEnterpriseName(sample.getManufacturingEnterprise());
......
......@@ -143,7 +143,7 @@ public class StrategySystemReviewTaskPending implements StrategySystemReviewTask
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());
systemReviewTask.setEnterpriseName(sample.getManufacturingEnterprise());
......
......@@ -272,7 +272,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
if (sampleRelations.size() != 0 && sampleRelations != null) {
// 获取之前的第一个企业名称
TaskSampleRelation taskSampleRelation = sampleRelations.get(sampleRelations.size() - 1);
TaskSampleRelation taskSampleRelation = sampleRelations.get(0);
Sample oldSample = sampleManagementMapper.selectSampleManagementById(taskSampleRelation.getSampleId());
// 获取编辑任务后的第一个企业名称
......@@ -692,7 +692,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
// 样品信息
List<TaskSampleRelation> relationList = taskSampleRelationService.selectByTaskId(id,type);
if (relationList.size() != 0 && relationList != null) {
List<Sample> SampleList = sampleManagementMapper.findByIdList(relationList);
List<Sample> SampleList = sampleManagementMapper.findByIdList(relationList,id);
return SampleList;
} else {
return null;
......
......@@ -173,10 +173,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="enterpriseId" column="enterprise_id" />
</resultMap>
<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
WHERE id IN
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
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=")">
#{relation.sampleId}
</foreach>
ORDER BY ts.id
</select>
</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