Przeglądaj źródła

sql过滤条件更新

fyz 9 miesięcy temu
rodzic
commit
9531187c84

+ 11 - 8
mjava-lanyun/src/main/java/com/malk/lanyun/service/impl/TimerServiceImpl.java

@@ -348,11 +348,11 @@ public class TimerServiceImpl implements TimerService {
                     " SUM( cost_sum ) cost_sum, " +
                     " SUM( taxes ) taxes, " +
                     " SUM( gross_profit ) gross_profit, " +
-                    " SUM( gross_profit )/ SUM( income ) gross_margin, " +
+                    " CONCAT(ROUND(SUM( gross_profit )/ SUM( income )*100,2),'%') gross_margin, " +
                     " SUM( overhead ) overhead, " +
                     " SUM( corporate_income_tax ) corporate_income_tax, " +
                     " SUM( net_profit ) net_profit, " +
-                    " SUM( net_profit )/ SUM( income ) net_margin  " +
+                    " CONCAT(ROUND(SUM( net_profit )/ SUM( income )*100,2),'%') net_margin  " +
                     "FROM " +
                     " lanyun_project_analysis  " +
                     " WHERE 1=1 " ;
@@ -370,11 +370,11 @@ public class TimerServiceImpl implements TimerService {
                     " SUM( cost_sum ) cost_sum, " +
                     " SUM( taxes ) taxes, " +
                     " SUM( gross_profit ) gross_profit, " +
-                    " SUM( gross_profit )/ SUM( income ) gross_margin, " +
+                    " CONCAT(ROUND(SUM( gross_profit )/ SUM( income )*100,2),'%') gross_margin, " +
                     " SUM( overhead ) overhead, " +
                     " SUM( corporate_income_tax ) corporate_income_tax, " +
                     " SUM( net_profit ) net_profit, " +
-                    " SUM( net_profit )/ SUM( income ) net_margin  " +
+                    " CONCAT(ROUND(SUM( net_profit )/ SUM( income )*100,2),'%') net_margin  " +
                     "FROM " +
                     " lanyun_project_analysis  " +
                     "WHERE 1=1 " ;
@@ -415,11 +415,11 @@ public class TimerServiceImpl implements TimerService {
                     "  cost_sum, " +
                     "  taxes, " +
                     "  gross_profit, " +
-                    "  gross_margin, " +
+                    "  CONCAT(ROUND(gross_margin*100,2),'%') gross_margin, " +
                     "  overhead, " +
                     "  corporate_income_tax, " +
                     "  net_profit, " +
-                    "  net_margin  " +
+                    "  CONCAT(ROUND(net_margin*100,2),'%') net_margin  " +
                     "FROM " +
                     " lanyun_project_analysis " +
                     " WHERE 1=1";
@@ -437,11 +437,11 @@ public class TimerServiceImpl implements TimerService {
                     " SUM( cost_sum ) cost_sum, " +
                     " SUM( taxes ) taxes, " +
                     " SUM( gross_profit ) gross_profit, " +
-                    " SUM( gross_profit )/ SUM( income ) gross_margin, " +
+                    " CONCAT(ROUND(SUM( gross_profit )/ SUM( income )*100,2),'%') gross_margin, " +
                     " SUM( overhead ) overhead, " +
                     " SUM( corporate_income_tax ) corporate_income_tax, " +
                     " SUM( net_profit ) net_profit, " +
-                    " SUM( net_profit )/ SUM( income ) net_margin  " +
+                    " CONCAT(ROUND(SUM( net_profit )/ SUM( income )*100,2),'%') net_margin " +
                     " FROM " +
                     " lanyun_project_analysis  " +
                     " WHERE 1=1 ";
@@ -493,6 +493,9 @@ public class TimerServiceImpl implements TimerService {
             totalCount = Integer.parseInt(result.get(0).get("total_count").toString());
         }
         List<Map<String, Object>> projects = jdbcTemplate.queryForList(sql[3]);
+        projects.get(0).forEach((k,v)->{
+
+        });
         List<Map<String, Object>> formats = jdbcTemplate.queryForList(sql[4]);
         List<Map<String, Object>> customers = jdbcTemplate.queryForList(sql[5]);
         analysisList.add(analysisSum.get(0));