# 20201014 琛ヨ创璧勯噾鍙戞斁
ALTER TABLE `grade_subsidy_roster`
ADD COLUMN `platSerFee`  varchar(50) NULL COMMENT '骞冲彴鏈嶅姟璐�';

ALTER TABLE `sb_grade_subsidy_batch`
ADD COLUMN `platSerFee`  varchar(50) NULL COMMENT '骞冲彴鏈嶅姟璐�',
ADD COLUMN `orderNo`  varchar(50) NULL COMMENT '浜ゆ槗娴佹按鍙�',
ADD COLUMN `grantState`  char(5) NULL COMMENT '琛ヨ创鍙戞斁鐘舵€�',
ADD COLUMN `reason`  varchar(500) NULL COMMENT '鍏ず涓嶉€氳繃鍘熷洜';


#鑱斿悕鍗� 鏂板areacode

drop view if EXISTS v_person_bank;
CREATE
VIEW `v_person_bank` AS
select  t1.id, t1.xm as `name`,
t1.idnum,
IFNULL(tt.phone,t1.phone) as phone,
tt.`name` as 'companyName',
t1.zsbh as 'cerNo',
t1.fzrq as 'cerDate',
t1.havephoto as 'havePhoto',
t1.isDraw as 'isDraw',
t1.areaCode as'areaCode',
IFNULL(tt.incumbencyStatus,0) as 'incumbencyStatus',
if(t3.create_time is null,0,1) as 'bankState',
t3.activeDate,
t3.create_time as 'bankDate'
from security_certificate t1
LEFT JOIN (
select t5.`name`,t2.id_number,t2.phone,t2.incumbencyStatus from security_person t2
INNER JOIN security_company_person t4 on t2.id= t4.person_id and t4.active=true
INNER JOIN security_company t5 on t4.company_id = t5.id and t5.active=true
where t2.active=true and t2.incumbencyStatus=1
)tt on t1.idnum = tt.id_number
LEFT JOIN bank_account t3 on t1.idnum = t3.idNum and t3.active=TRUE
where t1.active=true and ifnull(t1.state,1)=1;