select re.id,re.apply_date,re.supplier_id,re.category_id,re.repo_id,re.product_id,
re.product_num,p.name,re.total_cost,re.status,re.msg,fd.type_label categoryName,
sd.dept_name merchantName, rep.repo_name repoName,re.total_cost totalCost from repo_record re
left join food_type fd on re.category_id=fd.type_id
left join sys_dept sd on re.supplier_id=sd.dept_id
left join repository rep on re.repo_id = rep.id
left join food_product p on re.product_id=p.food_product_id WHERE re.id = #{repoRecordId}
INSERT INTO repo_record
apply_date,
supplier_id,
category_id,
repo_id,
product_id,
product_num,
total_cost,
status,
msg,
school_id,
#{applyDate},
#{supplierId,jdbcType=INTEGER},
#{categoryId,jdbcType=INTEGER},
#{repoId,jdbcType=INTEGER},
#{productId,jdbcType=INTEGER},
#{productNum,jdbcType=INTEGER},
#{totalCost},
#{status,jdbcType=INTEGER},
#{msg,jdbcType=VARCHAR},
#{schoolId,jdbcType=BIGINT},
select re.id,re.apply_date,re.supplier_id,re.category_id,re.repo_id,re.product_id,
re.product_num,p.name,re.total_cost,re.status,re.msg,fd.type_label categoryName,
sd.dept_name merchantName, rep.repo_name repoName,re.total_cost totalCost from repo_record re
left join food_type fd on re.category_id=fd.type_id
left join sys_dept sd on re.supplier_id=sd.dept_id
left join repository rep on re.repo_id = rep.id
left join food_product p on re.product_id=p.food_product_id
AND re.repo_id = #{repoId,jdbcType=INTEGER}
AND p.name LIKE CONCAT('%', #{productName,jdbcType=VARCHAR}, '%')
AND fd.type_id = #{categoryId,jdbcType=INTEGER}
AND re.apply_date >= #{startTime,jdbcType=DATETIME}
AND re.apply_date <= #{endTime,jdbcType=DATETIME}