Bonus-Cloud-JYY-Canteen/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/supply.purchase/DrpPurchasePlanMapper.xml

636 lines
27 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.canteen.core.supply.purchase.mapper.DrpPurchasePlanMapper">
<resultMap id="listPurchasePlanImportMapper" type="com.bonus.canteen.core.supply.purchase.domain.vo.DrpPurchasePlanImportPageVO">
<result column="plan_id" property="planId"/>
<result column="pur_date" property="purDate"/>
<result column="canteen_id" property="canteenId"/>
<result column="canteenName" property="canteenName"/>
<result column="warehouse_id" property="warehouseId"/>
<result column="warehouse_name" property="warehouseName"/>
<collection property="detailList" ofType="com.bonus.canteen.core.supply.purchase.domain.vo.DrpPurPlanDetailImportPageVO">
<result column="detail_id" property="detailId"/>
<result column="material_id" property="materialId"/>
<result column="material_name" property="materialName"/>
<result column="category_name" property="categoryName"/>
<result column="unitPrice" property="unitPrice"/>
<result column="planNum" property="planNum"/>
<result column="purNum" property="purNum"/>
<result column="unit_id" property="unitId"/>
<result column="unit_name" property="unitName"/>
<result column="supplier_id" property="supplierId"/>
<result column="supplier_name" property="supplierName"/>
<result column="size" property="size"/>
</collection>
</resultMap>
<select id="selectAllList" resultType="com.bonus.canteen.core.supply.purchase.domain.vo.DrpPurchasePlanPageVO">
SELECT
dup.plan_id,
dup.pur_date,
dup.STATUS,
dup.remark,
dup.approve_status,
dup.create_by,
dup.create_time,
dup.update_by,
dup.update_time,
dup.relate_plan_ids,
dup.if_merge,
( SELECT sum( pur_num ) FROM drp_pur_plan_detail dppd WHERE dppd.plan_id = dup.plan_id ) AS materialTotal,
dup.approve_by,
dup.approve_time,
dup.approve_remark,
dup.canteen_id,
dup.stall_id,
dup.purchasing_budget_total,
( SELECT sum( purchasing_budget_price ) FROM drp_pur_plan_detail dppd2 WHERE dppd2.plan_id = dup.plan_id ) AS purchasingBudgetPrice,
dup.supplier_ids,
ac.canteen_name,
dup.process_instance_id,
ac.area_id,
aa.area_name,
dup.deliver_goods_date
FROM
drp_purchase_plan dup
LEFT JOIN alloc_canteen ac ON dup.canteen_id = ac.canteen_id
left join alloc_area aa on aa.area_id = ac.area_id
where
dup.del_flag = #{delFlag}
<if test="content.orderStatus != null">
and dup.status = #{content.orderStatus}
</if>
<if test="content.planId != null and content.planId != ''">
and dup.plan_id = #{content.planId}
</if>
<if test="content.startTime != null">
and dup.pur_date <![CDATA[ >= ]]> #{content.startTime}
</if>
<if test="content.endTime != null">
and dup.pur_date <![CDATA[ <= ]]> #{content.endTime}
</if>
<if test="content.approveStatus != null">
and dup.approve_status = #{content.approveStatus}
</if>
<if test="content.instanceIds != null and content.instanceIds.size() > 0">
AND dup.process_instance_id IN
<foreach collection="content.instanceIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="content.approveStatusList != null and content.approveStatusList.size() > 0">
AND dup.approve_status IN
<foreach collection="content.approveStatusList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="content.createBy != null and content.createBy != ''">
and dup.create_by = #{content.createBy}
</if>
<if test="content.crtimeStart != null">
and dup.create_time <![CDATA[ >= ]]> #{content.crtimeStart}
</if>
<if test="content.crtimeEnd != null">
and dup.create_time <![CDATA[ <= ]]> #{content.crtimeEnd}
</if>
<if test="content.areaIdList != null and content.areaIdList.size() > 0">
AND ac.area_id in
<foreach collection="content.areaIdList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="content.canteenIdList != null and content.canteenIdList.size() > 0">
AND dup.canteen_id in
<foreach collection="content.canteenIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="content.planIdList != null and content.planIdList.size() > 0">
and dup.plan_id IN
<foreach collection="content.planIdList" item="planId" separator="," open="(" close=")">
#{planId}
</foreach>
</if>
<if test="content.stallIdList != null and content.stallIdList.size() > 0">
and dup.plan_id IN (
select plan_id
from drp_pur_plan_detail dppd3 where dppd3.plan_id = dup.plan_id
and dppd3.stall_id in
<foreach collection="content.stallIdList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
)
</if>
order by dup.create_time desc, dup.plan_id desc
</select>
<!-- <select id="listPurchasePlanImport"-->
<!-- resultMap="listPurchasePlanImportMapper">-->
<!-- SELECT dpp.plan_id,-->
<!-- dpp.pur_date,-->
<!-- dpp.status,-->
<!-- dppd.detail_id,-->
<!-- dppd.material_id,-->
<!-- mm.material_name,-->
<!-- mmc.category_name,-->
<!-- dppd.pro_plan_num as planNum,-->
<!-- dppd.pur_num as purNum,-->
<!-- dppd.unit_id,-->
<!-- du.unit_name,-->
<!-- dppd.size-->
<!-- FROM drp_purchase_plan dpp-->
<!-- JOIN drp_pur_plan_detail dppd ON dppd.plan_id = dpp.plan_id-->
<!-- JOIN menu_material mm ON mm.material_id = dppd.material_id-->
<!-- JOIN menu_material_category mmc ON mmc.category_id = mm.category_id-->
<!-- JOIN drp_unit du ON du.unit_id = dppd.unit_id-->
<!-- WHERE dpp.del_flag = 2-->
<!-- AND dpp.`status` = 2-->
<!-- AND dpp.`approve_status` = 3-->
<!-- and DATE_FORMAT(dpp.pur_date, '%Y-%m-%d') = #{content.purDate}-->
<!-- </select>-->
<!-- &lt;!&ndash;分页获取采购原料&ndash;&gt;-->
<!-- <select id="pageMaterial" resultType="com.bonus.canteen.core.supply.purchase.domain.vo.DrpPurMaterialPageVO">-->
<!-- select mm.material_id,-->
<!-- mm.material_name,-->
<!-- mm.material_code,-->
<!-- mmc.category_id,-->
<!-- mmc.category_name,-->
<!-- ds.supplier_id,-->
<!-- ds.supplier_name,-->
<!-- du.unit_id,-->
<!-- du.unit_name,-->
<!-- did.pur_price,-->
<!-- did.pur_num-->
<!-- from menu_material mm-->
<!-- left join (SELECT a.*-->
<!-- FROM drp_pur_plan_detail AS a,-->
<!-- (SELECT b.material_id,-->
<!-- max(b.id) AS id-->
<!-- FROM drp_pur_plan_detail AS b-->
<!-- LEFT JOIN drp_purchase_plan AS c ON c.plan_id = b.plan_id-->
<!-- WHERE c.warehouse_id = #{warehouseId}-->
<!-- GROUP BY b.material_id) AS c-->
<!-- WHERE a.material_id = c.material_id-->
<!-- AND a.id = c.id) did on mm.material_id = did.material_id-->
<!-- left join menu_material_category mmc on mm.category_id = mmc.category_id-->
<!-- left join drp_supplier ds on did.supplier_id = ds.supplier_id-->
<!-- left join drp_unit du on did.unit_id = du.unit_id-->
<!-- where mm.del_flag = #{delFlag}-->
<!-- <if test="content.materialCode != null and content.materialCode != ''">-->
<!-- and mm.material_code = #{content.materialCode}-->
<!-- </if>-->
<!-- <if test="content.materialName != null and content.materialName != ''">-->
<!-- and (-->
<!-- mm.material_name like concat(concat('%', #{content.materialName}), '%')-->
<!-- or mm.pinyin_initials like concat(concat('%', #{pinyinInitials}), '%')-->
<!-- or mm.pinyin_full like concat(concat('%', #{pinyinFull}), '%')-->
<!-- )-->
<!-- </if>-->
<!-- <if test="content.barCode != null and content.barCode != ''">-->
<!-- and mm.bar_code = #{content.barCode}-->
<!-- </if>-->
<!-- <if test="categoryIdList != null and categoryIdList.size() > 0">-->
<!-- and mm.category_id in-->
<!-- <foreach close=")" collection="categoryIdList" item="categoryId" open="(" separator=",">-->
<!-- #{categoryId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- </select>-->
<select id="pageMaterialInfo" resultType="com.bonus.canteen.core.supply.purchase.domain.vo.DrpPurMaterialPageVO">
SELECT mm.material_id,
mm.material_name,
mm.material_code,
mm.material_type,
mmc.category_id,
mmc.category_name,
du.unit_id,
du.unit_name
FROM menu_material mm
LEFT JOIN menu_material_category mmc ON mm.category_id = mmc.category_id
LEFT JOIN drp_unit du ON mm.unit_id = du.unit_id
WHERE 1 == 1
<if test="content.materialCode != null and content.materialCode != ''">
and mm.material_code = #{content.materialCode}
</if>
<if test="content.materialName != null and content.materialName != ''">
and (
mm.material_name like concat(concat('%', #{content.materialName}), '%')
or mm.pinyin_initials like concat(concat('%', #{pinyinInitials}), '%')
or mm.pinyin_full like concat(concat('%', #{pinyinFull}), '%')
)
</if>
<if test="content.barCode != null and content.barCode != ''">
and mm.bar_code = #{content.barCode}
</if>
<if test="categoryIdList != null and categoryIdList.size() > 0">
and mm.category_id in
<foreach close=")" collection="categoryIdList" item="categoryId" open="(" separator=",">
#{categoryId}
</foreach>
</if>
</select>
<select id="pagePurMaterialInfo" resultType="com.bonus.canteen.core.supply.purchase.domain.vo.DrpPurMaterialInfoPageVO">
SELECT a.material_id,
a.material_name,
a.material_code,
a.material_type,
a.category_id,
b.category_name,
a.unit_id,
c.unit_name,
a.unit_price,
a.image_url,
a.bar_code,
a.sales_mode,
a.area_id,
aa.area_name,
a.shelf_life_type,
a.shelf_life_days,
sum(d.material_num) AS inventoryNum
FROM menu_material a
LEFT JOIN menu_material_category b ON b.category_id = a.category_id
LEFT JOIN drp_unit c ON c.unit_id = a.unit_id
LEFT JOIN drp_inventory d on d.material_id = a.material_id
<if test="content.warehouseId != null">
and d.warehouse_id = #{content.warehouseId}
</if>
left join alloc_area aa on aa.area_id = a.area_id
LEFT JOIN drp_warehouse e ON e.warehouse_id = d.warehouse_id AND e.`status` = #{useStatus}
<if test="content.canteenId != null">
LEFT JOIN drp_menu_material_supplier dmms ON dmms.material_id = a.material_id
AND dmms.canteen_id = #{content.canteenId}
AND dmms.del_flag = 0
AND dmms.if_supply = 1
</if>
<where>
a.disable_status is null
<!-- and a.del_flag = #{delFlag} -->
<if test="content.canteenId != null">
and dmms.material_id is not null
</if>
<if test="content.materialCode != null and content.materialCode != ''">
and a.material_code like #{content.materialCode}
</if>
<if test="content.materialName != null and content.materialName != ''">
and (
a.material_name like concat('%', #{content.materialName}, '%')
or a.pinyin_initials like concat(#{pinyinInitials}, '%')
or a.bar_code like #{content.barCode}
)
</if>
<if test="content.barCode != null and content.barCode != ''">
and a.bar_code like #{content.barCode}
</if>
<if test="content.initial != null and content.initial != ''">
and a.pinyin_initials like CONCAT(#{content.initial}, '%')
</if>
<if test="content.categoryIdList != null and content.categoryIdList.size() > 0">
and a.category_id in
<foreach collection="content.categoryIdList" item="categoryId" separator="," open="(" close=")">
#{categoryId}
</foreach>
</if>
<if test="content.warehouseType != null">
and a.material_type = #{content.warehouseType}
</if>
<if test="content.materialType != null">
and a.material_type = #{content.materialType}
</if>
<if test="content.materialInfo != null and content.materialInfo != ''">
and (
a.material_name like concat('%', #{content.materialInfo}, '%')
or a.pinyin_initials like concat(#{content.materialInfo}, '%')
or a.pinyin_full like concat('%', #{content.materialInfo}, '%')
or a.bar_code like concat('%', #{content.materialInfo}, '%')
or a.material_code like concat('%', #{content.materialInfo}, '%')
)
</if>
<if test="content.areaId != null">
and (a.area_id = #{content.areaId} or a.area_id is null)
</if>
<if test="content.materialId != null">
and a.material_id = #{content.materialId}
</if>
<if test="content.materialIdList != null and content.materialIdList.size() > 0">
and a.material_id in
<foreach collection="content.materialIdList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
GROUP BY
a.material_id,
a.material_name,
a.material_code,
a.material_type,
a.category_id,
b.category_name,
a.unit_id,
c.unit_name,
a.unit_price,
a.image_url,
a.bar_code,
a.sales_mode,
a.area_id,
aa.area_name,
a.shelf_life_type,
a.shelf_life_days
</select>
<!-- <select id="pageRecentPriceMaterialInfo" resultType="net.xnzn.core.drp.vo.DrpPurMaterialInfoPageVO">-->
<!-- SELECT a.material_id,-->
<!-- a.material_name,-->
<!-- a.material_code,-->
<!-- a.material_type,-->
<!-- a.category_id,-->
<!-- b.category_name,-->
<!-- a.unit_id,-->
<!-- c.unit_name,-->
<!-- a.image_url,-->
<!-- a.bar_code,-->
<!-- a.sales_mode,-->
<!-- <if test="content.warehouseId != null">-->
<!-- any_value(d.material_num) as inventoryNum-->
<!-- </if>-->
<!-- <if test="content.warehouseId == null">-->
<!-- sum(d.material_num) as inventoryNum-->
<!-- </if>-->
<!-- FROM-->
<!-- menu_material a-->
<!-- LEFT JOIN menu_material_category b ON b.category_id = a.category_id-->
<!-- LEFT JOIN drp_unit c ON c.unit_id = a.unit_id-->
<!-- LEFT JOIN drp_inventory d ON d.material_id = a.material_id-->
<!-- <if test="content.warehouseId != null">-->
<!-- and d.warehouse_id = #{content.warehouseId}-->
<!-- </if>-->
<!-- <where>-->
<!-- a.del_flag = #{delFlag}-->
<!-- <if test="content.materialCode != null and content.materialCode != ''">-->
<!-- and a.material_code like #{content.materialCode}-->
<!-- </if>-->
<!-- <if test="content.materialName != null and content.materialName != ''">-->
<!-- and (-->
<!-- a.material_name like concat('%', #{content.materialName}, '%')-->
<!-- or a.pinyin_initials like concat(#{pinyinInitials}, '%')-->
<!-- or a.pinyin_full like concat('%', #{pinyinFull}, '%')-->
<!-- )-->
<!-- </if>-->
<!-- <if test="content.barCode != null and content.barCode != ''">-->
<!-- and a.bar_code = #{content.barCode}-->
<!-- </if>-->
<!-- <if test="content.initial != null and content.initial != ''">-->
<!-- and a.pinyin_initials like CONCAT(#{content.initial}, '%')-->
<!-- </if>-->
<!-- <if test="content.categoryIdList != null and content.categoryIdList.size() > 0">-->
<!-- and a.category_id in-->
<!-- <foreach collection="content.categoryIdList" item="categoryId" separator="," open="(" close=")">-->
<!-- #{categoryId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- <if test="content.warehouseType != null">-->
<!-- and a.material_type = #{content.warehouseType}-->
<!-- </if>-->
<!-- <if test="content.materialType != null">-->
<!-- and a.material_type = #{content.materialType}-->
<!-- </if>-->
<!-- <if test="content.materialInfo != null and content.materialInfo != ''">-->
<!-- and (-->
<!-- a.material_name like concat('%', #{content.materialInfo}, '%')-->
<!-- or a.pinyin_initials like concat(#{content.materialInfo}, '%')-->
<!-- or a.pinyin_full like concat('%', #{content.materialInfo}, '%')-->
<!-- or a.bar_code like concat('%', #{content.materialInfo}, '%')-->
<!-- or a.material_code like concat('%', #{content.materialInfo}, '%')-->
<!-- )-->
<!-- </if>-->
<!-- </where>-->
<!-- GROUP BY a.material_id,-->
<!-- a.material_name,-->
<!-- a.material_code,-->
<!-- a.material_type,-->
<!-- a.category_id,-->
<!-- b.category_name,-->
<!-- a.unit_id,-->
<!-- c.unit_name,-->
<!-- a.image_url,-->
<!-- a.bar_code,-->
<!-- a.sales_mode-->
<!-- </select>-->
<select id="materialCount" resultType="com.bonus.canteen.core.supply.purchase.domain.vo.DrpProductionPlanMaterialCountVO">
SELECT mm.material_name,
mmc.category_name,
SUM(dppd.pur_num) AS materialCount,
mmc.category_id
FROM drp_purchase_plan dpp
LEFT JOIN drp_pur_plan_detail dppd ON dpp.plan_id = dppd.plan_id
LEFT JOIN menu_material mm ON dppd.material_id = mm.material_id
LEFT JOIN menu_material_category mmc ON mm.category_id = mmc.category_id
where dpp.plan_id = #{content.planId}
GROUP BY mm.material_id,
mm.material_name,
mmc.category_id,
mmc.category_name
</select>
<select id="selectByPlanId" resultType="com.bonus.canteen.core.supply.purchase.domain.vo.DrpPurchasePlanPageVO">
SELECT dup.plan_id,
dup.pur_date,
dup.STATUS,
dup.remark,
dup.approve_status,
dup.create_by,
dup.create_time,
dup.update_by,
dup.update_time,
dup.relate_plan_ids,
dup.if_merge,
(SELECT sum(dppd.pur_num)
FROM drp_pur_plan_detail dppd
WHERE dppd.plan_id = dup.plan_id) AS materialTotal,
(SELECT sum(dppd.purchasing_budget_price)
FROM drp_pur_plan_detail dppd
WHERE dppd.plan_id = dup.plan_id) AS purchasingBudgetPrice,
(SELECT count(*)
FROM drp_pur_plan_detail dppd
LEFT JOIN menu_material mm ON dppd.material_id = mm.material_id
LEFT JOIN menu_material_category mmc ON mm.category_id = mmc.category_id
WHERE dppd.plan_id = dup.plan_id
GROUP BY mmc.category_id
LIMIT 1) AS categoryTotal,
dup.approve_by,
dup.approve_time,
dup.approve_remark,
dup.canteen_id,
dup.stall_id,
dup.purchasing_budget_total,
dup.supplier_ids,
ac.canteen_name,
dup.process_instance_id,
ac.area_id,
aa.area_name,
dup.deliver_goods_date,
dup.production_plan_id
FROM drp_purchase_plan dup
LEFT JOIN alloc_canteen ac ON dup.canteen_id = ac.canteen_id
left join alloc_area aa on aa.area_id = ac.area_id
where dup.del_flag = #{delFlag}
<if test="planId != null and planId != ''">
and dup.plan_id = #{planId}
</if>
</select>
<!-- <select id="syncPurchasePrice" resultType="net.xnzn.core.supermarket.vo.PriceByMaterialIdVO">-->
<!-- SELECT dogd.material_id,-->
<!-- IFNULL(dogd.single_price, 0) AS unitPrice-->
<!-- FROM drp_order_goods_detail dogd-->
<!-- INNER JOIN (SELECT material_id, MAX(crtime) AS max_crtime-->
<!-- FROM drp_order_goods_detail-->
<!-- GROUP BY material_id) AS subquery ON dogd.material_id = subquery.material_id-->
<!-- AND dogd.crtime = subquery.max_crtime-->
<!-- where 1 = 1-->
<!-- <if test="materialIds != null and materialIds.size() > 0">-->
<!-- and dogd.material_id in-->
<!-- <foreach collection="materialIds" item="materialId" separator="," open="(" close=")">-->
<!-- #{materialId}-->
<!-- </foreach>-->
<!-- </if>-->
<!-- </select>-->
<!-- <select id="queryTotal" resultType="net.xnzn.core.drp.vo.DrpPurchasePlanTotalVO">-->
<!-- SELECT-->
<!-- (SELECT COUNT(*)-->
<!-- FROM drp_purchase_plan WHERE DATE(crtime) = CURDATE()-->
<!-- AND status = 2-->
<!-- <if test="crby != null and crby != ''">-->
<!-- and crby = #{crby}-->
<!-- </if>) AS 'today',-->
<!-- (SELECT COUNT(*)-->
<!-- FROM drp_purchase_plan WHERE status = 2-->
<!-- <if test="crby != null and crby != ''">-->
<!-- and crby = #{crby}-->
<!-- </if>) AS 'total',-->
<!-- (SELECT COUNT(*)-->
<!-- FROM drp_purchase_plan WHERE approve_status = 3-->
<!-- <if test="crby != null and crby != ''">-->
<!-- and crby = #{crby}-->
<!-- </if>) AS 'approve',-->
<!-- (SELECT COUNT(*)-->
<!-- FROM drp_purchase_plan WHERE approve_status = 4-->
<!-- <if test="crby != null and crby != ''">-->
<!-- and crby = #{crby}-->
<!-- </if>) AS 'not_approve';-->
<!-- </select>-->
<!-- <select id="queryTotal" resultType="net.xnzn.core.drp.vo.DrpPurchasePlanTotalVO" databaseId="kb">-->
<!-- SELECT-->
<!-- (SELECT COUNT(*)-->
<!-- FROM drp_purchase_plan WHERE crtime::date = CURRENT_DATE AND status = 2-->
<!-- <if test="crby != null and crby != ''">-->
<!-- and crby = #{crby}-->
<!-- </if>) AS "today",-->
<!-- (SELECT COUNT(*)-->
<!-- FROM drp_purchase_plan WHERE status = 2-->
<!-- <if test="crby != null and crby != ''">-->
<!-- and crby = #{crby}-->
<!-- </if>) AS "total",-->
<!-- (SELECT COUNT(*)-->
<!-- FROM drp_purchase_plan WHERE approve_status = 3-->
<!-- <if test="crby != null and crby != ''">-->
<!-- and crby = #{crby}-->
<!-- </if>) AS "approve",-->
<!-- (SELECT COUNT(*)-->
<!-- FROM drp_purchase_plan WHERE approve_status = 4-->
<!-- <if test="crby != null and crby != ''">-->
<!-- and crby = #{crby}-->
<!-- </if>) AS "not_approve";-->
<!-- </select>-->
<select id="pageFetchMaterialImportPurPlan"
resultType="com.bonus.canteen.core.supply.vo.DrpFetchMaterialImportPurPlanPageVO">
SELECT distinct a.plan_id,
a.pur_date,
a.remark,
a.canteen_id,
ac.canteen_name,
a.stall_id,
a.create_by,
a.create_time,
a.update_by,
a.update_time
FROM
drp_purchase_plan a
left join drp_pur_plan_detail b on a.plan_id = b.plan_id
LEFT JOIN alloc_canteen ac ON ac.canteen_id = a.canteen_id
left join drp_inventory c on c.material_id = b.material_id and b.unit_id = c.unit_id
<if test="content.warehouseId != null">
AND c.warehouse_id = #{content.warehouseId}
</if>
WHERE a.`status` = #{commitStatus}
and c.material_num > 0
AND a.approve_status = #{approveStatus}
<if test="content.planId != null and content.planId != ''">
AND a.plan_id LIKE #{content.planId}
</if>
<if test="content.startTime != null">
AND a.pur_date <![CDATA[ >= ]]> #{content.startTime}
</if>
<if test="content.endTime != null">
AND a.pur_date <![CDATA[ <= ]]> #{content.endTime}
</if>
<if test="content.canteenId != null">
AND a.canteen_id = #{content.canteenId}
</if>
<if test="content.stallId != null and content.stallId.size() > 0">
and b.stall_id IN
<foreach collection="content.stallId" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
order by a.update_time desc
</select>
</mapper>