|
|
@@ -320,4 +320,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<select id="selectOutTimeOrderList" resultType="com.fs.his.domain.FsPackageOrder">
|
|
|
select * from fs_package_order where status = 1 AND NOW() > DATE_ADD(create_time, INTERVAL ${unPayTime} MINUTE)
|
|
|
</select>
|
|
|
+ <select id="selectFsPackageOrderReportVO" resultType="com.fs.his.vo.FsPackageOrderReportVO">
|
|
|
+ SELECT
|
|
|
+ c.company_name companyName,
|
|
|
+ <if test="deptId != null and deptId != ''">
|
|
|
+ cd.dept_name AS deptName,
|
|
|
+ </if>
|
|
|
+ COUNT(po.order_id) AS orderNum,
|
|
|
+ COALESCE(SUM(po.pay_money), 0) AS money,
|
|
|
+ COUNT(CASE WHEN so.status = 3 THEN po.order_id END) AS receiptOrder,
|
|
|
+ COALESCE(SUM(CASE WHEN so.status = 3 THEN po.pay_money ELSE 0 END), 0) AS receiptMoney
|
|
|
+ FROM
|
|
|
+ fs_package_order po
|
|
|
+ inner join company c ON po.company_id = c.company_id
|
|
|
+ <if test="deptId != null and deptId != ''">
|
|
|
+ inner join company_dept cd ON c.dept_id = cd.dept_id
|
|
|
+ </if>
|
|
|
+ inner join fs_store_order so ON po.order_id = so.order_id
|
|
|
+ <where>
|
|
|
+ <if test="companyId != null and companyId != ''">
|
|
|
+ AND po.company_id = #{companyId}
|
|
|
+ </if>
|
|
|
+ <if test="deptId != null and deptId != ''">
|
|
|
+ AND c.dept_id = #{deptId}
|
|
|
+ </if>
|
|
|
+ <!-- 添加时间段查询条件 -->
|
|
|
+ <if test="stTime != null">
|
|
|
+ AND DATE(po.start_time) >= DATE(#{stTime})
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null">
|
|
|
+ AND DATE(po.finish_time) <= DATE(#{endEndTime})
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY
|
|
|
+ po.company_id,
|
|
|
+ c.company_name
|
|
|
+ <if test="deptId != null and deptId != ''">
|
|
|
+ , cd.dept_name
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
</mapper>
|