wngur6076 1 month ago
parent
commit
af13973b4b

+ 5 - 0
.idea/.gitignore

@@ -0,0 +1,5 @@
+# 디폴트 무시된 파일
+/shelf/
+/workspace.xml
+# 에디터 기반 HTTP 클라이언트 요청
+/httpRequests/

+ 8 - 0
.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/userful.iml" filepath="$PROJECT_DIR$/.idea/userful.iml" />
+    </modules>
+  </component>
+</project>

+ 12 - 0
.idea/userful.iml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="WEB_MODULE" version="4">
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$">
+      <excludeFolder url="file://$MODULE_DIR$/temp" />
+      <excludeFolder url="file://$MODULE_DIR$/.tmp" />
+      <excludeFolder url="file://$MODULE_DIR$/tmp" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 6 - 0
.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
+  </component>
+</project>

+ 12 - 8
function-in-db/procedures/dash_board/shop_dash/lt1_shop_dash_2_left_top.sql

@@ -2,10 +2,10 @@ drop procedure if exists lt1_shop_dash_2_left_top;
 
 
 DELIMITER //
 DELIMITER //
 CREATE PROCEDURE lt1_shop_dash_2_left_top( _listToken varchar(21), _sdate varchar(8), _edate varchar(8),
 CREATE PROCEDURE lt1_shop_dash_2_left_top( _listToken varchar(21), _sdate varchar(8), _edate varchar(8),
-                                              _s1 varchar(32), _e1 varchar(32), _s2 varchar(32), _e2 varchar(32),
-                                              _s3 varchar(32), _e3 varchar(32), _s4 varchar(32), _e4 varchar(32),
-                                              _where varchar(386), _having varchar(386), _orderby varchar(64),
-                                              _branch int, _storage int)
+_s1 varchar(32), _e1 varchar(32), _s2 varchar(32), _e2 varchar(32),
+_s3 varchar(32), _e3 varchar(32), _s4 varchar(32), _e4 varchar(32),
+_having varchar(386), _orderby varchar(64),
+_branch int, _storage int, _member_company_id int, _lt_filter int)
 BEGIN
 BEGIN
 
 
 -- 로컬 변수 선언
 -- 로컬 변수 선언
@@ -55,6 +55,7 @@ SELECT
         END
         END
     ) AS c2,
     ) AS c2,
     CONCAT(
     CONCAT(
+    IF(COUNT(*) = 0, 0,
         FLOOR(
         FLOOR(
             COUNT(
             COUNT(
                 CASE
                 CASE
@@ -64,9 +65,10 @@ SELECT
                     THEN mx.id
                     THEN mx.id
                 END
                 END
             ) * 100 / COUNT(*)
             ) * 100 / COUNT(*)
-        ),
-        '%'
-    ) AS c3
+        )
+    ),
+    '%'
+) AS c3
 FROM
 FROM
     dbr_sorder AS mx;
     dbr_sorder AS mx;
 
 
@@ -75,4 +77,6 @@ END //
 DELIMITER ;
 DELIMITER ;
 
 
 CALL lt1_shop_dash_2_left_top('', '', '', '', '', '', '', '',
 CALL lt1_shop_dash_2_left_top('', '', '', '', '', '', '', '',
-'', '', '', '', '', '', 1, 1);
+'', '', '', '', '', 1, 1, 1, 1);
+
+

+ 4 - 5
function-in-db/procedures/dash_board/shop_dash/lt1_shop_dash_order_delayed.sql

@@ -2,11 +2,10 @@ drop procedure if exists lt1_shop_dash_order_delayed;
 
 
 DELIMITER //
 DELIMITER //
 CREATE PROCEDURE lt1_shop_dash_order_delayed( _listToken varchar(21), _sdate varchar(8), _edate varchar(8),
 CREATE PROCEDURE lt1_shop_dash_order_delayed( _listToken varchar(21), _sdate varchar(8), _edate varchar(8),
-                                              _s1 varchar(32), _e1 varchar(32), _s2 varchar(32), _e2 varchar(32),
-                                              _s3 varchar(32), _e3 varchar(32), _s4 varchar(32), _e4 varchar(32),
-                                              _where varchar(386), _having varchar(386), _orderby varchar(64),
-                                              _branch int, _storage int)
-SQL SECURITY INVOKER
+_s1 varchar(32), _e1 varchar(32), _s2 varchar(32), _e2 varchar(32),
+_s3 varchar(32), _e3 varchar(32), _s4 varchar(32), _e4 varchar(32),
+_having varchar(386), _orderby varchar(64),
+_branch int, _storage int, _member_company_id int, _lt_filter int)
 BEGIN
 BEGIN
 
 
 -- 로컬 변수 선언
 -- 로컬 변수 선언

+ 4 - 4
function-in-db/procedures/dash_board/shop_dash/lt1_shop_sales_statistics_graph.sql

@@ -2,10 +2,10 @@ drop procedure if exists lt1_shop_sales_statistics_graph;
 
 
 DELIMITER //
 DELIMITER //
 CREATE PROCEDURE lt1_shop_sales_statistics_graph( _listToken varchar(21), _sdate varchar(8), _edate varchar(8),
 CREATE PROCEDURE lt1_shop_sales_statistics_graph( _listToken varchar(21), _sdate varchar(8), _edate varchar(8),
-                                              _s1 varchar(32), _e1 varchar(32), _s2 varchar(32), _e2 varchar(32),
-                                              _s3 varchar(32), _e3 varchar(32), _s4 varchar(32), _e4 varchar(32),
-                                              _where varchar(386), _having varchar(386), _orderby varchar(64),
-                                              _branch int, _storage int)
+_s1 varchar(32), _e1 varchar(32), _s2 varchar(32), _e2 varchar(32),
+_s3 varchar(32), _e3 varchar(32), _s4 varchar(32), _e4 varchar(32),
+_having varchar(386), _orderby varchar(64),
+_branch int, _storage int, _member_company_id int, _lt_filter int)
 BEGIN
 BEGIN
 	  DECLARE start_date varchar(8);
 	  DECLARE start_date varchar(8);
 	  DECLARE end_date varchar(8);
 	  DECLARE end_date varchar(8);

+ 6 - 7
function-in-db/procedures/dash_board/shop_dash/zds_door_sales_cancel_month.sql

@@ -2,11 +2,10 @@ drop procedure if exists zds_door_sales_cancel_month;
 
 
 DELIMITER //
 DELIMITER //
 CREATE PROCEDURE zds_door_sales_cancel_month( _listToken varchar(21), _sdate varchar(8), _edate varchar(8),
 CREATE PROCEDURE zds_door_sales_cancel_month( _listToken varchar(21), _sdate varchar(8), _edate varchar(8),
-                                              _s1 varchar(32), _e1 varchar(32), _s2 varchar(32), _e2 varchar(32),
-                                              _s3 varchar(32), _e3 varchar(32), _s4 varchar(32), _e4 varchar(32),
-                                              _where varchar(386), _having varchar(386), _orderby varchar(64),
-                                              _branch int, _storage int)
-SQL SECURITY INVOKER
+_s1 varchar(32), _e1 varchar(32), _s2 varchar(32), _e2 varchar(32),
+_s3 varchar(32), _e3 varchar(32), _s4 varchar(32), _e4 varchar(32),
+_having varchar(386), _orderby varchar(64),
+_branch int, _storage int, _member_company_id int, _lt_filter int)
 BEGIN
 BEGIN
 	  DECLARE start_date varchar(8);
 	  DECLARE start_date varchar(8);
 	  DECLARE end_date varchar(8);
 	  DECLARE end_date varchar(8);
@@ -53,7 +52,7 @@ FROM (
     SUM(sorder_qty) as sum_sorder_qty
     SUM(sorder_qty) as sum_sorder_qty
     FROM dbr_sorder as mx
     FROM dbr_sorder as mx
     INNER JOIN dbr_sorder_bd as mb ON mx.id = mb.sorder_id
     INNER JOIN dbr_sorder_bd as mb ON mx.id = mb.sorder_id
-       WHERE true and seller_id = 88  and sorder_date between '20240801' and '20240831' 
+       WHERE mx.seller_id = _member_company_id and sorder_date >= previous_month_start_date and sorder_date <= previous_month_end_date
     GROUP BY seller_id, item_id
     GROUP BY seller_id, item_id
     ) as june_data ON mc.id = june_data.seller_id AND md.id = june_data.item_id
     ) as june_data ON mc.id = june_data.seller_id AND md.id = june_data.item_id
     LEFT JOIN (
     LEFT JOIN (
@@ -63,7 +62,7 @@ FROM (
     SUM(CASE WHEN mx.status = 'C' THEN sorder_qty ELSE 0 END) AS sum_sorder_claim_qty
     SUM(CASE WHEN mx.status = 'C' THEN sorder_qty ELSE 0 END) AS sum_sorder_claim_qty
     FROM dbr_sorder as mx
     FROM dbr_sorder as mx
     INNER JOIN dbr_sorder_bd as mb ON mx.id = mb.sorder_id
     INNER JOIN dbr_sorder_bd as mb ON mx.id = mb.sorder_id
-      WHERE true and seller_id = 88  and sorder_date between '20240801' and '20240831' 
+      WHERE mx.seller_id = _member_company_id and sorder_date >= start_date and sorder_date <= end_date
     GROUP BY seller_id, item_id
     GROUP BY seller_id, item_id
     ) as july_data ON mc.id = july_data.seller_id AND md.id = july_data.item_id
     ) as july_data ON mc.id = july_data.seller_id AND md.id = july_data.item_id
     WHERE me.cgroup_code = 'A-0001'
     WHERE me.cgroup_code = 'A-0001'