Commit 131b816c authored by 332784038@qq.com's avatar 332784038@qq.com

订单业绩客户新老状态更新冗余业务补充完善

parent d6876ce0
...@@ -53,9 +53,19 @@ CREATE TABLE `ecw_vz` ( ...@@ -53,9 +53,19 @@ CREATE TABLE `ecw_vz` (
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC COMMENT='计量单位表'; ) ENGINE=InnoDB ROW_FORMAT=DYNAMIC COMMENT='计量单位表';
alter table `ecw_target_log`
add column `loglev` int DEFAULT NULL COMMENT '逻辑计算来源';
alter table `ecw_target_log`
add column `gsf` varchar(800) COLLATE utf8mb4_general_ci DEFAULT NULL;
alter table `ecw_target_log`
add column `gstype` int DEFAULT NULL;
-- 新增订单产生业绩时归属客户状态 -- 新增订单产生业绩时归属客户状态
alter table `ecw_order` alter table `ecw_order`
add column `is_in_open_sea` tinyint DEFAULT '0' COMMENT '是否公海客户', add column `is_in_open_sea` tinyint DEFAULT '0' COMMENT '是否公海客户',
-- 2024-07-25 刷新订单业绩客户新老客户状态冗余参数
update ecw_order o left join ecw_customer c on c.id = o.customer_id set o.yeji_type = IFNULL(c.is_new, 1);
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
select * from ( select * from (
SELECT SELECT
IFNULL(t6.resource_type,1) as customer_type, IFNULL(t6.resource_type,1) as customer_type,
( CASE WHEN t6.is_new = 1 THEN '新客户' ELSE '旧客户' END ) AS achieveType, ( CASE WHEN t1.yeji_type = 1 THEN '新客户' ELSE '旧客户' END ) AS achieveType,
t2.number, t2.number,
t1.order_no, t1.order_no,
(CASE WHEN t9.customer_id=t.customer_id THEN t9.name ELSE tx.name END) as name, (CASE WHEN t9.customer_id=t.customer_id THEN t9.name ELSE tx.name END) as name,
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
and t7.departure_warehouse_id = #{query.startWarehouseId} and t7.departure_warehouse_id = #{query.startWarehouseId}
</if> </if>
<if test="query.achieveType != null"> <if test="query.achieveType != null">
and t6.is_new = #{query.achieveType} and t1.yeji_type = #{query.achieveType}
</if> </if>
<if test="query.destWarehouseIdList != null"> <if test="query.destWarehouseIdList != null">
and t8.objective_warehouse_id in and t8.objective_warehouse_id in
...@@ -132,7 +132,7 @@ ...@@ -132,7 +132,7 @@
select * from ( select * from (
SELECT SELECT
IFNULL(t6.resource_type,1) as customer_type, IFNULL(t6.resource_type,1) as customer_type,
( CASE WHEN t6.is_new = 1 THEN '新客户' ELSE '旧客户' END ) AS achieveType, ( CASE WHEN t1.yeji_type = 1 THEN '新客户' ELSE '旧客户' END ) AS achieveType,
t2.number, t2.number,
t1.order_no, t1.order_no,
(CASE WHEN t9.customer_id=t.customer_id THEN t9.name ELSE tx.name END) as name, (CASE WHEN t9.customer_id=t.customer_id THEN t9.name ELSE tx.name END) as name,
...@@ -206,7 +206,7 @@ ...@@ -206,7 +206,7 @@
and t7.departure_warehouse_id = #{query.startWarehouseId} and t7.departure_warehouse_id = #{query.startWarehouseId}
</if> </if>
<if test="query.achieveType != null"> <if test="query.achieveType != null">
and t6.is_new = #{query.achieveType} and t1.yeji_type = #{query.achieveType}
</if> </if>
<if test="query.destWarehouseIdList != null"> <if test="query.destWarehouseIdList != null">
and t8.objective_warehouse_id in and t8.objective_warehouse_id in
...@@ -224,7 +224,7 @@ ...@@ -224,7 +224,7 @@
select * from ( select * from (
SELECT SELECT
IFNULL(t6.resource_type,1) as customer_type, IFNULL(t6.resource_type,1) as customer_type,
( CASE WHEN t6.is_new = 1 THEN '新客户' ELSE '旧客户' END ) AS achieveType, ( CASE WHEN t1.yeji_type = 1 THEN '新客户' ELSE '旧客户' END ) AS achieveType,
t2.number, t2.number,
t1.order_no, t1.order_no,
(CASE WHEN t9.customer_id=t.customer_id THEN t9.name ELSE tx.name END) as name, (CASE WHEN t9.customer_id=t.customer_id THEN t9.name ELSE tx.name END) as name,
...@@ -294,7 +294,7 @@ ...@@ -294,7 +294,7 @@
and t7.departure_warehouse_id = #{query.startWarehouseId} and t7.departure_warehouse_id = #{query.startWarehouseId}
</if> </if>
<if test="query.achieveType != null"> <if test="query.achieveType != null">
and t6.is_new = #{query.achieveType} and t1.yeji_type = #{query.achieveType}
</if> </if>
<if test="query.destWarehouseIdList != null"> <if test="query.destWarehouseIdList != null">
and t8.objective_warehouse_id in and t8.objective_warehouse_id in
...@@ -312,7 +312,7 @@ ...@@ -312,7 +312,7 @@
select * from ( select * from (
SELECT SELECT
IFNULL(t6.resource_type,1) as customer_type, IFNULL(t6.resource_type,1) as customer_type,
( CASE WHEN t6.is_new = 1 THEN '新客户' ELSE '旧客户' END ) AS achieveType, ( CASE WHEN t1.yeji_type = 1 THEN '新客户' ELSE '旧客户' END ) AS achieveType,
t2.number, t2.number,
t1.order_no, t1.order_no,
(CASE WHEN t9.customer_id=t.customer_id THEN t9.name ELSE tx.name END) as name, (CASE WHEN t9.customer_id=t.customer_id THEN t9.name ELSE tx.name END) as name,
...@@ -382,7 +382,7 @@ ...@@ -382,7 +382,7 @@
and t7.departure_warehouse_id = #{query.startWarehouseId} and t7.departure_warehouse_id = #{query.startWarehouseId}
</if> </if>
<if test="query.achieveType != null"> <if test="query.achieveType != null">
and t6.is_new = #{query.achieveType} and t1.yeji_type = #{query.achieveType}
</if> </if>
<if test="query.destWarehouseIdList != null"> <if test="query.destWarehouseIdList != null">
and t8.objective_warehouse_id in and t8.objective_warehouse_id in
...@@ -406,7 +406,7 @@ ...@@ -406,7 +406,7 @@
FROM FROM
( (
SELECT SELECT
( CASE WHEN t6.is_new = 1 THEN '新客户' ELSE '旧客户' END ) AS cusType, ( CASE WHEN t1.yeji_type = 1 THEN '新客户' ELSE '旧客户' END ) AS cusType,
( (
SELECT SELECT
CASE CASE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment