<resultMap id="SubmitTaskRecordMap" type="com.lanxincn.imes.productionmanage.model.vo.SubmitTaskRecordVo">
<result column="workOrderTaskId" jdbcType="BIGINT" property="workOrderTaskId" />
<result column="processName" jdbcType="VARCHAR" property="processName" />
<result column="beforeRemainNum" jdbcType="INTEGER" property="beforeRemainNum" />
<collection property="submittedTaskRecordBos" ofType="com.lanxincn.imes.productionmanage.model.bo.SubmittedTaskRecordBo">
<id column="id" jdbcType="BIGINT" property="id" />
<!-- <result column="workOrderTaskId" jdbcType="BIGINT" property="workOrderTaskId" />-->
<result column="operatorName" jdbcType="VARCHAR" property="operatorName" />
<result column="submittedNum" jdbcType="INTEGER" property="submittedNum" />
<result column="createTime" jdbcType="TIMESTAMP" property="createTime" />
</collection>
</resultMap>
select语句:
<select id="selectSubmitTaskRecordByTaskId" parameterType="com.lanxincn.dba.filter.FilterExample" resultMap="SubmitTaskRecordMap">
SELECT
t1.id AS workOrderTaskId,
t1.process_name AS processName,
t1.num AS beforeRemainNum,
t2.id,
/*t2.work_order_task_id AS workOrderTaskId,*/
t3.NAME AS operatorName,
t2.submitted_num AS submittedNum,
t2.create_time AS createTime
FROM
work_order_task t1
LEFT JOIN task_submitted_record t2 ON t1.id = t2.work_order_task_id
LEFT JOIN USER t3 ON t2.operatior_id = t3.id
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
实体类:
public class SubmitTaskRecordVo {
/**
* 工单任务id
*/
private Long workOrderTaskId;
/**
* 工序名称
*/
private String processName;
/**
* 该工单任务中的剩余工序报工数
*/
private Integer beforeRemainNum;
/**
* 该工单任务报工记录
*/
private List<SubmittedTaskRecordBo> submittedTaskRecordBos;
}
SubmittedTaskRecordBo实体类:
public class SubmittedTaskRecordBo {
private Long id;
private Long workOrderTaskId;
private String operatorName;
private Integer submittedNum;
private Date createTime;
}