diff --git a/doc/sql/用户初始化.sql b/doc/sql/用户初始化.sql index d506c0238..ebf015d73 100644 --- a/doc/sql/用户初始化.sql +++ b/doc/sql/用户初始化.sql @@ -5,7 +5,7 @@ INSERT INTO epmet_gov_org.customer_staff_grid ( ID, CUSTOMER_ID, USER_ID, GRID_ID, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) SELECT t1.id, -'bb19419e365cf97567dc0520cdcfba9e', +'b09527201c4409e19d1dbc5e3c3429a1', t1.id AS USER_ID, t1.dept_id AS GRID_ID, t1.del_flag, @@ -32,7 +32,7 @@ INSERT INTO epmet_gov_org.customer_staff_department ( UPDATED_TIME ) SELECT t1.id , -'bb19419e365cf97567dc0520cdcfba9e', +'b09527201c4409e19d1dbc5e3c3429a1', t1.id as USER_ID, t1.dept_id as DEPARTMENT_ID, t1.del_flag, @@ -60,7 +60,7 @@ INSERT INTO epmet_gov_org.customer_staff_agency ( UPDATED_TIME ) SELECT t1.id , -'bb19419e365cf97567dc0520cdcfba9e', +'b09527201c4409e19d1dbc5e3c3429a1', t1.id as USER_ID, t1.dept_id as AGENCY_ID, t1.del_flag, @@ -73,4 +73,96 @@ left join esua_epdc_admin.sys_dept t2 on t1.dept_id = t2.id WHERE t2.type_key = 'district_party' OR t2.type_key = 'street_party' - OR t2.type_key = 'community_party'; \ No newline at end of file + OR t2.type_key = 'community_party'; + +INSERT INTO epmet_user.customer_staff ( ID, CUSTOMER_ID,USER_ID,REAL_NAME,GENDER,EMAIL,MOBILE,HEAD_PHOTO,PASSWORD,DEL_FLAG,REVISION,CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) SELECT +t1.id as ID, +'b09527201c4409e19d1dbc5e3c3429a1', +t1.id AS USER_ID, +t1.real_name as REAL_NAME, +t1.gender as GENDER, +t1.email as EMAIL, +t1.mobile as MOBILE, +t1.head_url as HEAD_PHOTO, +t1.password as PASSWORD, +t1.del_flag as DEL_FLAG, +'0' as REVISION, +t1.creator AS CREATED_BY, +t1.create_date AS CREATED_TIME, +t1.updater AS UPDATED_BY, +t1.update_date AS UPDATED_TIME +FROM + esua_epdc_admin.sys_user t1 +where t1.user_tag_key ='offers'; + +INSERT INTO epmet_user.USER (ID, CUSTOMER_ID, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) SELECT +t1.id AS ID, +'b09527201c4409e19d1dbc5e3c3429a1' AS CUSTOMER_ID, +t1.del_flag AS DEL_FLAG, +'0' AS REVISION, +t1.creator AS CREATED_BY, +t1.create_date AS CREATED_TIME, +t1.updater AS UPDATED_BY, +t1.update_date AS UPDATED_TIME +FROM + esua_epdc_admin.sys_user t1 +where t1.user_tag_key ='offers'; + + +INSERT INTO epmet_gov_org.staff_org_relation ( ID, CUSTOMER_ID, PIDS, STAFF_ID, ORG_ID, ORG_TYPE, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) SELECT +t1.id AS ID, +'b09527201c4409e19d1dbc5e3c3429a1' AS CUSTOMER_ID, +CASE + t2.type_key + WHEN 'district_party' THEN + t2.pids + WHEN 'street_party' THEN + t2.pids + WHEN 'community_party' THEN + concat( + SUBSTRING_INDEX( t2.pids, ',', 1 ), + ':', + SUBSTRING_INDEX( t2.pids, ',',- 1 )) + WHEN 'district_dept' THEN + t2.pids + WHEN 'street_dept' THEN + concat( + SUBSTRING_INDEX( t2.pids, ',', 1 ), + ':', + SUBSTRING_INDEX( t2.pids, ',',- 1 )) + WHEN 'grid_party' THEN + concat( + SUBSTRING_INDEX( t2.pids, ',', 1 ), + ':', + SUBSTRING_INDEX( SUBSTRING_INDEX( t2.pids, ',', 2 ), ',',- 1 ), + ':', + SUBSTRING_INDEX( t2.pids, ',',- 1 )) + END AS PIDS, + t1.id AS STAFF_ID, + t2.id AS ORG_ID, +CASE + t2.type_key + WHEN 'district_party' THEN + 'agency' + WHEN 'street_party' THEN + 'agency' + WHEN 'community_party' THEN + 'agency' + WHEN 'district_dept' THEN + 'dept' + WHEN 'street_dept' THEN + 'dept' + WHEN 'grid_party' THEN + 'grid' + END AS ORG_TYPE, + t1.del_flag AS DEL_FLAG, + '0' AS REVISION, + t1.creator AS CREATED_BY, + t1.create_date AS CREATED_TIME, + t1.updater AS UPDATED_BY, + t1.update_date AS UPDATED_TIME +FROM + esua_epdc_admin.sys_user t1 + LEFT JOIN esua_epdc_admin.sys_dept t2 ON t1.dept_id = t2.id +WHERE + t1.user_tag_key = 'offers'; \ No newline at end of file diff --git a/doc/sql/部门组织初始化.sql b/doc/sql/部门组织初始化.sql index bbd75b2b8..110564b02 100644 --- a/doc/sql/部门组织初始化.sql +++ b/doc/sql/部门组织初始化.sql @@ -5,7 +5,7 @@ INSERT INTO epmet_gov_org.customer_grid ( ID, CUSTOMER_ID, GRID_NAME, SYNC_FLAG, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, MANAGE_DISTRICT, TOTAL_USER, PID, PIDS ) SELECT t1.id, -'bb19419e365cf97567dc0520cdcfba9e', +'b09527201c4409e19d1dbc5e3c3429a1', t1.NAME AS GRID_NAME, '1', t1.del_flag, @@ -45,7 +45,7 @@ INSERT INTO epmet_gov_org.customer_agency ( TOTAL_USER ) SELECT t1.id, -'bb19419e365cf97567dc0520cdcfba9e', +'b09527201c4409e19d1dbc5e3c3429a1', t1.pid, CASE t1.type_key @@ -112,7 +112,7 @@ INSERT INTO epmet_gov_org.customer_department ( UPDATED_TIME ) SELECT t1.id, -'bb19419e365cf97567dc0520cdcfba9e', +'b09527201c4409e19d1dbc5e3c3429a1', t1.pid as AGENCY_ID, t1.name as DEPARTMENT_NAME, t2.total AS TOTAL_USER, diff --git a/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/StaffOrgRelationDao.java b/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/StaffOrgRelationDao.java new file mode 100644 index 000000000..bc6326729 --- /dev/null +++ b/esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/dao/StaffOrgRelationDao.java @@ -0,0 +1,37 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *
+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *
+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see