|
@@ -51,4 +51,26 @@
|
|
|
DATE_FORMAT(#{endDate},"%Y%m%d"))
|
|
|
</if>
|
|
|
</select>
|
|
|
+ <select id="getExpenseTotal" parameterType="Map" resultType="com.yh.saas.plugin.yiliangyiyun.entity.SpeedExpenseInfo">
|
|
|
+ SELECT
|
|
|
+ IFNULL(SUM(b.amount_money),0) as income,
|
|
|
+ IFNULL(SUM(c.amount_money),0) as pay
|
|
|
+ FROM speed_expense_info a
|
|
|
+ LEFT JOIN speed_expense_info b ON b.id = a.id
|
|
|
+ AND b.delete_flag = 0
|
|
|
+ AND b.expenses_type = '收入'
|
|
|
+ LEFT JOIN speed_expense_info c ON c.id = a.id
|
|
|
+ AND c.delete_flag = 0
|
|
|
+ AND c.expenses_type = '支出'
|
|
|
+ WHERE a.delete_flag = '0'
|
|
|
+ and a.comp_id= #{compId}
|
|
|
+ <if test="startDate != null">
|
|
|
+ AND (DATE_FORMAT(a.create_date ,"%Y%m%d") >=
|
|
|
+ DATE_FORMAT(#{startDate},"%Y%m%d"))
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null">
|
|
|
+ AND (DATE_FORMAT(a.create_date ,"%Y%m%d") <=
|
|
|
+ DATE_FORMAT(#{endDate},"%Y%m%d"))
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
</mapper>
|