接口优化

This commit is contained in:
2026-07-29 09:00:41 +08:00
parent 4fd371b8eb
commit dc68cda5d5
8 changed files with 72 additions and 26 deletions

View File

@@ -24,4 +24,7 @@
</foreach>
</insert>
<delete id="deleteByFoodProductId" parameterType="Long">
delete from food_product_material where food_product_id = #{foodProductId}
</delete>
</mapper>

View File

@@ -17,18 +17,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result column="msg" property="msg"/>
<result column="dept_id" property="deptId"/>
<result column="oper_id" property="operId"/>
<result column="order_no" property="orderNo"/>
</resultMap>
<select id="selectRepoRecordByRepoRecordId" resultType="com.zf.foodpurchase.fdsafe.vo.RepoRecordVO">
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,re.oper_id operId,su.user_name operName from repo_record re
sd.dept_name merchantName, rep.repo_name repoName,re.total_cost totalCost,
re.oper_id operId,su.user_name operName,fu.unit_label unitName,re.order_no orderNo 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 sys_user su on re.oper_id=su.user_id
left join food_product p on re.product_id=p.food_product_id WHERE re.id = #{repoRecordId}
left join food_product p on re.product_id=p.food_product_id
left join food_unit fu on p.unit_id=fu.unit_id
WHERE re.id = #{repoRecordId}
</select>
<insert id="insertRepoRecord" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
@@ -45,6 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="msg != null and msg != ''">msg,</if>
<if test="deptId != null">dept_id,</if>
<if test="operId != null">oper_id,</if>
<if test="orderNo != null">order_no,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="applyDate != null">#{applyDate},</if>
@@ -58,18 +63,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="msg != null and msg != ''">#{msg,jdbcType=VARCHAR},</if>
<if test="deptId != null">#{deptId,jdbcType=BIGINT},</if>
<if test="operId != null">#{operId,jdbcType=BIGINT},</if>
<if test="orderNo != null and orderNo != ''">#{orderNo,jdbcType=VARCHAR},</if>
</trim>
</insert>
<select id="selectRepoRecordList" resultType="com.zf.foodpurchase.fdsafe.vo.RepoRecordVO">
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,re.oper_id operId,su.user_name operName from repo_record re
sd.dept_name merchantName, rep.repo_name repoName,re.total_cost totalCost,
re.oper_id operId,su.user_name operName,fu.unit_label unitName,re.order_no orderNo 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
left join sys_user su on re.oper_id=su.user_id
left join food_unit fu on p.unit_id=fu.unit_id
<where>
<if test="repoId != null">
AND re.repo_id = #{repoId,jdbcType=INTEGER}
@@ -98,12 +106,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectRepoRecordListByProductId" resultType="com.zf.foodpurchase.fdsafe.vo.RepoRecordVO">
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,re.oper_id operId,su.user_name operName from repo_record re
sd.dept_name merchantName, rep.repo_name repoName,re.total_cost totalCost,re.oper_id operId,
su.user_name operName,fu.unit_label unitName,re.order_no orderNo 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
left join sys_user su on re.oper_id=su.user_id
left join food_unit fu on p.unit_id=fu.unit_id
where re.product_id = #{productId}
</select>

View File

@@ -9,13 +9,14 @@
<select id="querySchoolOrderItemVO" resultType="com.zf.foodpurchase.fdsafe.vo.SchoolOrderItemVO"
parameterType="com.zf.foodpurchase.fdsafe.vo.SchoolOrderItemVO">
select soi.order_item_no, soi.order_no,soi.food_id, soi.school_id, soi.edu_id, soi.supplier_id, soi.food_product_id, soi.food_name, soi.price, soi.product_num, soi.type_id, soi.unit_id, soi.order_item_status, soi.create_time, soi.update_time, soi.order_item_remark,soi.refund_num,
ft.type_label,fu.unit_label,fp.remark as food_product_remark,sup.supplier_name supplierName,fu.unit_label modelName,fp.num
ft.type_label,fu.unit_label,fp.remark as food_product_remark,sup.supplier_name supplierName,fs.spec_label modelName,fp.num
from school_order_item soi
left join supplier sup on soi.supplier_id=sup.supplier_id
left join school_order so on soi.order_no = so.order_no
left join food_product fp on soi.food_product_id = fp.food_product_id
left join food_type ft on ft.type_id = fp.type_id
left join food_unit fu on fu.unit_id = fp.unit_id
left join food_spec fs on fp.spec_id = fs.spec_id
<where>
<if test="orderItemNo != null and orderItemNo != ''">
and soi.order_item_no = #{orderItemNo}