select--部门
dept.name as bm,--年度指标任务-新签(万元)
ndzbwh.nxqndzbrw as nxqndzbrw,--年度指标任务-收入(万元)
ndzbwh.nsrndzbrw as nsrndzbrw,--年度指标任务-回款(万元)
ndzbwh.nhkndzbrw as nhkndzbrw,--指标完成情况-新签(万元)-取部门新签合同维护casewhen isnull(bmxqhtwh.nxqzbwcqk,0)=0then0else isnull(bmxqhtwh.nxqzbwcqk,0)/10000endas nxqzbwcqk,--指标完成情况-收入(万元)-取项目产值及回款填报casewhen isnull(xmczjhktbfzpxend.nsrzbwcqk,0)=0then0else isnull(xmczjhktbfzpxend.nsrzbwcqk,0)/10000endas nsrzbwcqk,--指标完成情况-回款(万元)-取部门收款明细维护casewhen isnull(bmskmxwh.nhkzbwcqk,0)=0then0else isnull(bmskmxwh.nhkzbwcqk,0)/10000endas nhkzbwcqk,--指标完成情况百分比%-新签casewhen isnull(ndzbwh.nxqndzbrw,0)=0then'0%'elseconvert(varchar(200),convert(decimal(18,2),isnull(bmxqhtwh.nxqzbwcqk,0)/isnull(ndzbwh.nxqndzbrw,0)/100))+'%'endas nxqzbwcqkbfb,--指标完成情况百分比%-收入casewhen isnull(ndzbwh.nsrndzbrw,0)=0then'0%'elseconvert(varchar(200),convert(decimal(18,2),isnull(xmczjhktbfzpxend.nsrzbwcqk,0)/isnull(ndzbwh.nsrndzbrw,0)/100))+'%'endas nsrzbwcqkbfb,--指标完成情况百分比%-回款casewhen isnull(ndzbwh.nhkndzbrw,0)=0then'0%'elseconvert(varchar(200),convert(decimal(18,2),isnull(bmskmxwh.nhkzbwcqk,0)/isnull(ndzbwh.nhkndzbrw,0)/100))+'%'endas nhkzbwcqkbfb
from
org_dept dept
--年度指标维护leftjoin(select b.pk_dept as pk_dept, b.nxq as nxqndzbrw, b.nsr as nsrndzbrw, b.nhk as nhkndzbrw
from zkch_ndzbwh h
leftjoin zkch_ndzbwh_b b on h.pk_ndzbwh = b.pk_ndzbwh
leftjoin bd_accperiod acc on acc.pk_accperiod = h.pk_zbnd
where isnull(h.dr,0)=0and isnull(b.dr,0)=0and isnull(acc.dr,0)=0and acc.periodyear ='2023') ndzbwh
on ndzbwh.pk_dept = dept.pk_dept
--部门新签合同维护leftjoin(select
h.tbdept as tbdept,sum(b.je)as nxqzbwcqk
from jygyl_bmxqhtwh h
leftjoin jygyl_bmxqhtwh_b b on b.pk_bmxqhtwh = h.pk_bmxqhtwh
leftjoin bd_accperiodmonth acc on acc.pk_accperiodmonth = h.tbmonth
where isnull(h.dr,0)=0and isnull(b.dr,0)=0and isnull(acc.dr,0)=0and acc.yearmth >='2023-01'and acc.yearmth <='2023-04'groupby tbdept
) bmxqhtwh
on bmxqhtwh.tbdept = dept.pk_dept
--部门收款明细维护leftjoin(select
h.tbbm as tbbm,sum(b.dnxj)as nhkzbwcqk
from jygyl_bmskmxwh h
leftjoin jygyl_bmskmxwh_b b on b.pk_bmskmxwh = h.pk_bmskmxwh
leftjoin bd_accperiodmonth acc on acc.pk_accperiodmonth = h.tbyf
leftjoin(select tbbm,tbyf,max(version) maxversion from jygyl_bmskmxwh where isnull(dr,0)=0groupby tbbm,tbyf )tempon h.tbbm =temp.tbbm and h.tbyf =temp.tbyf
where isnull(h.dr,0)=0and isnull(b.dr,0)=0and isnull(acc.dr,0)=0and version = maxversion
and acc.yearmth ='2023-04'groupby h.tbbm
) bmskmxwh
on bmskmxwh.tbbm = dept.pk_dept
--项目产值及回款填报leftjoin(select
xmczjhktbfzpx.pk_dept as pk_dept,sum(nsrzbwcqk)as nsrzbwcqk
from(select
row_number()over(partitionby xmczjhktb.project_code orderby xmczjhktb.yearmth desc)as rank,
xmczjhktb.*from(select
mon.yearmth,
pro.project_code,
dept.pk_dept,(selectsum(yzbhsdnljwcnum)from jygyl_xmczjhktb_b b where b.pk_xmczjhktb = h.pk_xmczjhktb and isnull(h.dr,0)=0and isnull(b.dr,0)=0and csrcid isnotnullandlen(csrcid)>0)as nsrzbwcqk
from jygyl_xmczjhktb h
innerjoin bd_accperiodmonth mon on h.tbyf = mon.pk_accperiodmonth
innerjoin bd_project pro on h.xmbh = pro.pk_project
innerjoin org_dept dept on dept.pk_dept = pro.def2
where isnull(h.dr,0)=0and isnull(mon.dr,0)=0and isnull(pro.dr,0)=0and isnull(dept.dr,0)=0and mon.yearmth <='2023-04') xmczjhktb
) xmczjhktbfzpx where rank <=1groupby xmczjhktbfzpx.pk_dept
)xmczjhktbfzpxend
on xmczjhktbfzpxend.pk_dept = dept.pk_dept
where ndzbwh.pk_dept in(select h.pk_tbdept from jygyl_bmyhqxb h leftjoin jygyl_bmyhqxb_b b on h.pk_bmyhqx = b.pk_bmyhqx where isnull(h.dr,0)=0and isnull(b.dr,0)=0and b.pk_user ='1001A31000000008WSNH')and ndzbwh.pk_dept in('1001A21000000008128D')
首先我们通过css选择器获取页码信息,这里的css选择器,选择的是含有a标签的所有li标签,代码如下:
li html_web.css(div.pd_c_xslb_left_fenye ul li>a)
for li in li:li_url li.css(a::attr(href)).get()li_num li.css(a::t…