Browse Source

修改部分SQL报错问题

master
张献维 2 weeks ago
parent
commit
b736fa91c7
  1. 12
      golang_learn/data_office/get_hy_jctj/main.go
  2. 12
      golang_learn/data_office/get_hy_jctj/脚本.sql

12
golang_learn/data_office/get_hy_jctj/main.go

@ -23,17 +23,17 @@ select ifnull(A0184,'')IDNumber,
ifnull((select min(code_name) from code_value where A0117=code_value and code_type='GB3304'),'') Ethnicity,
ifnull(substr(a0134, 1, 6),'') WorkStartDate,
ifnull((select min(code_name) from code_value where A0141=code_value and code_type='GB4762'),'') PoliticalStatus,
ifnull((select case when A0831 like '1%' then '研究生' when A0831 like '1%' then '大学本科' when A0831 like '3%' then '大学专科' else '中专及以下' end
ifnull((select case when A0801B like '1%' then '研究生' when A0801B like '2%' then '大学本科' when A0801B like '3%' then '大学专科' else '中专及以下' end
from A08 where A0831=1 and A01.A0000=A08.A0000), '') FullTimeEducation,
ifnull((select case when A0831 like '1%' then '研究生' when A0831 like '1%' then '大学本科' when A0831 like '3%' then '大学专科' else '中专及以下' end
ifnull((select case when A0801B like '1%' then '研究生' when A0801B like '2%' then '大学本科' when A0801B like '3%' then '大学专科' else '中专及以下' end
from A08 where A0834=1 and A01.A0000=A08.A0000), '') HighestEducation,
ifnull((select case when A0831 like '3%' then '硕士' when A0831 like '4%' then '学士' else '博士' end from A08 where A0835=1 and A01.A0000=A08.A0000), '') HighestDegree,
ifnull((select min(code_name) from code_value where A0123=code_value and code_type='XZ93'),'') JobCategory,
ifnull((select min(code_name) from A05, code_value where A0501B=code_value and code_type='ZB09' and A0531=0 and A0524=1 and A01.A0000=A05.A0000), '') CurrentPositionLevel,
ifnull((select substr(A0504, 1, 6) from A05 where A0531=0 and A0524=1 and A01.A0000=A05.A0000), '') CurrentPositionStartDate,
ifnull((select min(code_name) from A05, code_value where A0501B=code_value and code_type='ZB148' and A0531=1 and A0524=1 and A01.A0000=A05.A0000), '') CurrentRankLevel,
(select ifnull(DATE_FORMAT(DATE_SUB(STR_TO_DATE(substr(A0530, 1, 6), '%Y%m'), INTERVAL ifnull(A0532, 0) MONTH), '%Y%m'), A0504)
from A05 where A0531=1 and A0524=1 and A01.A0000=A05.A0000) CurrentRankStartDate,
(select ifnull(DATE_FORMAT(DATE_ADD(concat(substr(A0530, 1, 4),'-',substr(A0530, 5, 2),'-01'), INTERVAL ifnull(A0532, 0) MONTH), '%Y%m'),
substr(A0504, 1, 6)) from A05 where A0531=1 and A0524=1 and A01.A0000=A05.A0000) CurrentRankStartDate,
IF(A0197 = 1, '是', '否') Has2YearsGrassrootsExp,
ifnull((select min(code_name) from A15, code_value where A1517=code_value and code_type='ZB18' and A1521='2023' and A01.A0000=A15.A0000), '') AnnualAssessment2023,
ifnull((select min(code_name) from code_value where A0160=code_value and code_type='ZB125'),'') PersonCategory,
@ -59,8 +59,8 @@ select ifnull(M0203,'') IDNumber,
ifnull(substr(M0244, 1, 6),'') CurrentRankStartDate,
IF(M0215 = 1, '是', '否') Has2YearsGrassrootsExp,
ifnull((select min(code_name) from M_M09, code_value where M0905=code_value and code_type='M_D_CM16' and M0902=M0203),'') AnnualAssessment2023,
ifnull((select case M0104 when 2 then '参照管理机关工作人员' when 3 then '参照管理事业单位人员' else '公务员' end from M_M01 where M_M01.UNID=M_M02.UNID),'') PersonCategory,
ifnull((select '是' from M_M05 where M0503=M0203 and rpt='2024'),'否') SelectedFor2024
ifnull((select case M0104 when 2 then '参照管理机关工作人员' when 3 then '参照管理事业单位人员' else '公务员' end from M_M01 where M_M01.UNID=M_M02.UNID and rpt='2024' limit 1),'') PersonCategory,
ifnull((select '是' from M_M05 where M0503=M0203 and rpt='2024' limit 1),'否') SelectedFor2024
from M_M02
where rpt = '2024'
`

12
golang_learn/data_office/get_hy_jctj/脚本.sql

@ -62,8 +62,8 @@ select
ifnull(substr(M0244, 1, 6) ,'') ,
IF(M0215 = 1, '', '') 2,
ifnull((select min(code_name) from M_M09, code_value where M0905=code_value and code_type='M_D_CM16' and M0902=M0203),'') 2023,
ifnull((select case M0104 when 2 then '参照管理机关工作人员' when 3 then '参照管理事业单位人员' else '公务员' end from M_M01 where M_M01.UNID=M_M02.UNID),'') ,
ifnull((select '' from M_M05 where M0503=M0203 and rpt='2024'),'') 2024
ifnull((select case M0104 when 2 then '参照管理机关工作人员' when 3 then '参照管理事业单位人员' else '公务员' end from M_M01 where M_M01.UNID=M_M02.UNID and rpt='2024' limit 1),'') ,
ifnull((select '' from M_M05 where M0503=M0203 and rpt='2024' limit 1),'') 2024
from M_M02 where rpt='2024';
@ -78,17 +78,17 @@ select
ifnull((select min(code_name) from code_value where A0117=code_value and code_type='GB3304'),'') ,
ifnull(substr(a0134, 1, 6),'') ,
ifnull((select min(code_name) from code_value where A0141=code_value and code_type='GB4762'),'') ,
ifnull((select case when A0831 like '1%' then '研究生' when A0831 like '1%' then '大学本科' when A0831 like '3%' then '大学专科' else '中专及以下' end
ifnull((select case when A0801B like '1%' then '研究生' when A0801B like '2%' then '大学本科' when A0801B like '3%' then '大学专科' else '中专及以下' end
from A08 where A0831=1 and A01.A0000=A08.A0000), '') ,
ifnull((select case when A0831 like '1%' then '研究生' when A0831 like '1%' then '大学本科' when A0831 like '3%' then '大学专科' else '中专及以下' end
ifnull((select case when A0801B like '1%' then '研究生' when A0801B like '2%' then '大学本科' when A0801B like '3%' then '大学专科' else '中专及以下' end
from A08 where A0834=1 and A01.A0000=A08.A0000), '') ,
ifnull((select case when A0831 like '3%' then '硕士' when A0831 like '4%' then '学士' else '博士' end from A08 where A0835=1 and A01.A0000=A08.A0000), '') ,
ifnull((select min(code_name) from code_value where A0123=code_value and code_type='XZ93'),'') ,
ifnull((select min(code_name) from A05, code_value where A0501B=code_value and code_type='ZB09' and A0531=0 and A0524=1 and A01.A0000=A05.A0000), '') ,
ifnull((select substr(A0504, 1, 6) from A05 where A0531=0 and A0524=1 and A01.A0000=A05.A0000), '') ,
ifnull((select min(code_name) from A05, code_value where A0501B=code_value and code_type='ZB148' and A0531=1 and A0524=1 and A01.A0000=A05.A0000), '') ,
(select ifnull(DATE_FORMAT(DATE_SUB(STR_TO_DATE(substr(A0530, 1, 6), '%Y%m'), INTERVAL ifnull(A0532, 0) MONTH), '%Y%m'), A0504)
from A05 where A0531=1 and A0524=1 and A01.A0000=A05.A0000) ,
(select ifnull(DATE_FORMAT(DATE_ADD(concat(substr(A0530, 1, 4),'-',substr(A0530, 5, 2),'-01'), INTERVAL ifnull(A0532, 0) MONTH), '%Y%m'),
substr(A0504, 1, 6)) from A05 where A0531=1 and A0524=1 and A01.A0000=A05.A0000) ,
IF(A0197 = 1, '', '') 2,
ifnull((select min(code_name) from A15, code_value where A1517=code_value and code_type='ZB18' and A1521='2023' and A01.A0000=A15.A0000), '') 2023,
ifnull((select min(code_name) from code_value where A0160=code_value and code_type='ZB125'),'') ,

Loading…
Cancel
Save