RuoYi-Vue/xkt/src/main/resources/mapper/StoreProductDemandMapper.xml

43 lines
1.5 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.ruoyi.xkt.mapper.StoreProductDemandMapper">
<update id="updateStatusByIds">
UPDATE
store_product_demand SET demand_status = 3, update_time = NOW()
WHERE
del_flag = 0
<if test="demandIdList != null and demandIdList.size > 0">
AND id IN
<foreach collection="demandIdList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</update>
<delete id="deleteDemandList" >
UPDATE store_product_demand SET del_flag = 2 WHERE id in
<foreach item="id" collection="deleteDemandIdList" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="getStatusNum" resultType="com.ruoyi.xkt.dto.storeProductDemand.StoreProdDemandStatusCountResDTO">
SELECT
COALESCE(SUM(CASE WHEN spd.demand_status = 1 THEN 1 ELSE 0 END),0) AS unProductionNum,
COALESCE(SUM(CASE WHEN spd.demand_status = 2 THEN 1 ELSE 0 END),0) AS inProductionNum,
COALESCE(SUM(CASE WHEN spd.demand_status = 3 THEN 1 ELSE 0 END),0) AS productionCompleteNum
FROM
store_product_demand spd
WHERE
spd.del_flag = 0 AND spd.store_id = #{storeId}
AND spd.create_time between #{sixMonthAgo} AND #{now}
</select>
</mapper>