From c085e6fa1cb24f0173b500488ecd192dd2ae624f Mon Sep 17 00:00:00 2001 From: 1697371125@qq.com <wei1697371125> Date: 星期五, 25 十二月 2020 15:13:50 +0800 Subject: [PATCH] 增加解释及库表说明 --- platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/mapper/SubsidyLogMapper.java | 121 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 121 insertions(+), 0 deletions(-) diff --git a/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/mapper/SubsidyLogMapper.java b/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/mapper/SubsidyLogMapper.java index 9baa968..3f0a3c9 100644 --- a/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/mapper/SubsidyLogMapper.java +++ b/platform-modules/platform-zhyl/src/main/java/cn/cetc54/platform/zhyl/mapper/SubsidyLogMapper.java @@ -2,13 +2,134 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import cn.cetc54.platform.zhyl.entity.SubsidyLog; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; import java.util.List; +import java.util.Map; + /** * 琛ヨ创鏃ュ織鏁版嵁澶勭悊灞� * @author */ public interface SubsidyLogMapper extends BaseMapper<SubsidyLog> { + //鑾峰彇琛ヨ创鎬讳汉鏁� + @Select("<script>" + + " select SUM(duixiang_id) from t_yl_subsidy_log" + + " <where> " + + " <if test='areaId!= null'>" + + " and area_id = #{areaId}" + + " </if>" + + " <if test='type!= null'>" + + " and type = #{type}" + + " </if>" + + " </where>" + + " GROUP BY duixiang_id"+ + " </script>") + List<Integer> getTotalNum(@Param(value = "areaId")String areaId, @Param(value = "type")Integer type); + + /** + * 鑾峰彇鎬婚噾棰� + * @param areaId + * @param type + * @return + */ + @Select("<script>" + + " select SUM(money) from t_yl_subsidy_log" + + " <where> " + + " <if test='areaId!= null'>" + + " and area_id = #{areaId}" + + " </if>" + + " <if test='type!= null'>" + + " and type = #{type}" + + " </if>" + + " </where>" + + " </script>") + Double getTotalMoney(@Param(value = "areaId")String areaId, @Param(value = "type")Integer type); + + /** + * 鑾峰彇鏈堝害缁熻 + * @param areaId + * @param type + * @return + * SELECT + * CONCAT(YEAR(create_time),'-',MONTH(create_time)) AS releaseYearMonth, + * SUM(money) as sum + * FROM t_yl_subsidy_log + * GROUP BY releaseYearMonth ORDER BY releaseYearMonth desc LIMIT 12 + */ + @Select("<script>" + + " select CONCAT(YEAR(create_time),'-',MONTH(create_time)) AS time," + + "SUM(money) as sum FROM t_yl_subsidy_log" + + " <where> " + + " <if test='areaId!= null'>" + + " and area_id = #{areaId}" + + " </if>" + + " <if test='type!= null'>" + + " and type = #{type}" + + " </if>" + + " </where>" + + " GROUP BY time ORDER BY time desc LIMIT 12"+ + " </script>") + List<Map<String,Object>> getMonthTotal(@Param(value = "areaId")String areaId, @Param(value = "type")Integer type); + + /** + * 鑾峰彇骞村害缁熻 + * @param areaId + * @param type + * @return + */ + @Select("<script>" + + " select CONCAT(YEAR(create_time)) AS time," + + "SUM(money) as sum FROM t_yl_subsidy_log" + + " <where> " + + " <if test='areaId!= null'>" + + " and area_id = #{areaId}" + + " </if>" + + " <if test='type!= null'>" + + " and type = #{type}" + + " </if>" + + " </where>" + + " GROUP BY time ORDER BY time desc LIMIT 12"+ + " </script>") + List<Map<String,Object>> getYearTotal(@Param(value = "areaId")String areaId, @Param(value = "type")Integer type); + + + /** + *缁熻姣忕琛ヨ创鐨勯噾棰濇暟 + * @param areaId + * @return + */ + @Select("<script>" + + " select type," + + "SUM(money) as sum FROM t_yl_subsidy_log" + + " <where> " + + " <if test='areaId!= null'>" + + " and area_id = #{areaId}" + + " </if>" + + " </where>" + + " GROUP BY type ORDER BY sum desc"+ + " </script>") + List<Map<String,Object>> getTypeMoney(@Param(value = "areaId")String areaId); + + /** + * 姣忕琛ヨ创鐨勪汉鏁� + * @param areaId + * @return + */ + @Select("<script>" + + "select type,count(duixiang_id) as num from (" + + " select type,duixiang_id" + + " FROM t_yl_subsidy_log" + + " <where> " + + " <if test='areaId!= null'>" + + " and area_id = #{areaId}" + + " </if>" + + " </where>" + + " GROUP BY type,duixiang_id) t GROUP BY type" + + " ORDER BY num desc"+ + " </script>") + List<Map<String,Object>> getTypeNum(@Param(value = "areaId")String areaId); } \ No newline at end of file -- Gitblit v1.9.1