diff --git a/.github/workflows/pr-agent.yml b/.github/workflows/pr-agent.yml
new file mode 100644
index 0000000..f500888
--- /dev/null
+++ b/.github/workflows/pr-agent.yml
@@ -0,0 +1,20 @@
+on:
+ pull_request:
+ types: [opened, reopened, ready_for_review]
+ issue_comment:
+jobs:
+ pr_agent_job:
+ if: ${{ github.event.sender.type != 'Bot' }}
+ runs-on: ubuntu-latest
+ permissions:
+ issues: write
+ pull-requests: write
+ contents: write
+ name: Run pr agent on every pull request, respond to user comments
+ steps:
+ - name: PR Agent action step
+ id: pragent
+ uses: qodo-ai/pr-agent@main
+ env:
+ OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/test-ee.go b/test-ee.go
index fea6532..68d2d6e 100644
--- a/test-ee.go
+++ b/test-ee.go
@@ -4,4 +4,6 @@ import "fmt"
func test() {
fmt.Println("testfffaa")
+ var sp *string
+ fmt.Println(*sp)
}
diff --git a/xml-test/DIR1/sqlmap-common.xml b/xml-test/DIR1/sqlmap-common.xml
new file mode 100644
index 0000000..f3b07fa
--- /dev/null
+++ b/xml-test/DIR1/sqlmap-common.xml
@@ -0,0 +1,1668 @@
+
+
+
+
+
+
+
+
+
+ SELECT * FROM(SELECT T.*,ROWNUM RN FROM (
+
+
+
+ ) T WHERE ROWNUM<=(#{startIndex} + #{endIndex}) ) where RN>#{startIndex}
+
+
+
+ ) T WHERE ROWNUM<=#{endIndex}) WHERE RN>#{startIndex}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ and exists(
+ select 1 from or_os_cust ooc where ooc.cust_id=bc.cust_id and ooc.is_deleted=0 and ooc.status=1
+ )
+
+
+
+ and bc.is_deleted=0
+ and
+ instr(cust_name,#{custName}) > 0
+
+ and cust_id=#{custId}
+
+ and
+ cust_code=#{custCode}
+
+ and
+ IS_DELETED=#{isDeleted}
+
+
+ union
+ SELECT
+ bc.cust_id custId,
+ bc.cust_name
+ custName,
+ bc.cust_code
+ custCode,
+ bc.cust_english_name custEnglishName,
+ bc.cust_short_name
+ custShortName,
+ bc.hr_contract,
+ bc.contact_tel,
+ bc.email,
+ bc.is_deleted isDeleted
+ FROM
+ bd_customer bc,
+ hs_subcontract sl, ef_receivable_template et
+ where
+ bc.cust_id =
+ sl.cust_id
+ and sl.cust_bill_templt_id =
+ et.receivable_templt_id
+ and
+ bc.is_deleted=0
+ and et.payee_id=#{providerId}
+ and exists (select 'x'
+ from sys_user_role_relation r, sys_role rl
+ where r.role_id = rl.role_id
+ and rl.status = 1
+ and rl.role_grade <= 3
+ and rl.is_deleted = 0
+ and rl.biz_category in (50, 10)
+ and r.user_id = #{createBy}
+ and r.status = 1
+ and r.is_deleted = 0)
+ and
+ instr(bc.cust_name,#{custName}) > 0
+
+ and cust_id=#{custId}
+
+ and
+ bc.cust_code=#{custCode}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ and sui.user_id in(select distinct cpm.productline_saler_id from crm_productline_mapping cpm where cpm.productline_company_id=#{custId})
+
+
+
+ AND EXISTS
+ (SELECT 'x'
+ FROM sys_user_manage_user umu
+ WHERE umu.user_id = #{manageId}
+ AND umu.is_deleted = 0
+ AND umu.managed_user_id = sui.user_id)
+
+
+ and ur.role_name_group like '%${roleName}%'
+
+
+ and sui.user_id=#{userId}
+
+
+ and sui.user_name like '%${userName}%'
+
+
+ and sui.real_name like '%${realName}%'
+
+
+ and sdi.department_name like '%${deptName}%'
+
+
+ and sdi.department_id=#{deptId}
+
+
+ and sdi.governing_branch=#{branchId}
+
+
+ and sdi2.department_name like
+ '%${branchName}%'
+
+
+ and sdi.governing_area=#{areaId}
+
+
+ and (sdi.governing_branch in (select hs.assignee_provider_id from hs_subcontract hs where hs.subcontract_id = #{subContractId}) or sdi.governing_branch in (select hss.svc_provider_id from hs_subcontract_service hss where hss.subcontract_id = #{subContractId}))
+
+
+
+
+
+
+
+
+
+ select
+ sg.ss_group_id ssGroupId,
+ sg.insurance_name insuranceName,
+ sg.ss_group_type ssGroupType,
+ (select bc.city_name from bd_city bc where bc.city_id = sg.city_id )
+ as
+ cityName,
+ sg.city_id cityId,
+ sg.is_prc_need_apply ISPRCNEEDAPPLY
+ from
+ ss_group sg where sg.is_deleted=0
+ and
+ sg.ss_group_type=#{ssGroupType}
+
+ and
+ sg.insurance_name like '%${socialName}%'
+
+ and
+ sg.city_id=#{cityId}
+ union
+ select
+ sg2.ss_group_id ssGroupId,
+ sg2.insurance_name insuranceName,
+ sg2.ss_group_type ssGroupType,
+ (select bc.city_name from bd_city bc
+ where bc.city_id = sg2.city_id ) as
+ cityName,
+ sg2.city_id cityId,
+ sg2.is_prc_need_apply ISPRCNEEDAPPLY
+ from
+ ss_city_includ sci,ss_group
+ sg2
+ where
+ sg2.city_id=sci.city_id
+ and sci.p_city_id=#{cityId} and
+ sg2.is_deleted=0 and sci.is_deleted=0
+ and
+ sg2.ss_group_type=#{ssGroupType}
+
+ and
+ sg2.insurance_name like '%${socialName}%'
+
+
+
+
+
+
+
+
+
+ select a.department_id departmentId,
+ a.department_name departmentName,
+ (select b.department_id from sys_department_info b where
+ a.governing_area =
+ b.department_id(+) AND b.status = 1) as
+ governingAreaId,
+ (select b.department_name from sys_department_info b
+ where a.governing_area =
+ b.department_id(+) AND b.status = 1) as
+ governingArea,
+ (select c.department_id from sys_department_info c where
+ a.governing_branch =
+ c.department_id(+) AND c.status = 1) as
+ governingBranchId,
+ (select c.department_name from sys_department_info c
+ where a.governing_branch
+ = c.department_id(+) AND c.status = 1) as
+ governingBranch,
+ bc.city_id AS cityId,
+ bc.city_name AS cityName
+ from
+ sys_department_info a, bd_city bc
+ where a.status = 1
+ and bc.city_id(+) =
+ a.city_id
+ and
+ a.department_id =
+ #{departmentId}
+
+ and
+ a.governing_area =
+ #{governingAreaId}
+
+ and
+ a.department_grade =
+ #{departmentGrade}
+
+ and
+ a.provider_type =
+ #{providerType}
+
+ and
+ a.department_name like
+ '%${departmentName}%'
+
+ and
+ a.department_internal_code = #{departmentInternalCode}
+
+
+ and a.department_id in(
+ select pca.provider_id from pd_provider_cs_auth pca
+ where pca.is_deleted = 0
+ and pca.start_dt <= sysdate
+ and (pca.end_dt is null or pca.end_dt >= trunc(sysdate))
+ and pca.cs_id=#{filterByCSId}
+ )
+
+
+
+
+
+ and
+ exists(
+ select 1
+ from
+ pd_prvd_group_relation gpgr
+ where gpgr.is_deleted = 0
+ and gpgr.prvd_group_id = #{prvdGroupId}
+ and gpgr.provider_id = a.department_id
+ )
+
+
+
+
+
+
+
+
+
+ SELECT a.department_id departmentid,
+ a.department_name departmentname,
+ (SELECT b.department_id
+ FROM sys_department_info b
+ WHERE a.governing_area = b.department_id(+)
+ AND b.status = 1) AS governingareaid,
+ (SELECT b.department_name
+ FROM sys_department_info b
+ WHERE a.governing_area = b.department_id(+)
+ AND b.status = 1) AS governingarea,
+ (SELECT c.department_id
+ FROM sys_department_info c
+ WHERE a.governing_branch = c.department_id(+)
+ AND c.status = 1) AS governingbranchid,
+ (SELECT c.department_name
+ FROM sys_department_info c
+ WHERE a.governing_branch = c.department_id(+)
+ AND c.status = 1) AS governingbranch,
+ nvl((SELECT greatest(to_char(add_months(to_date(MAX(bill.pd_ef_bill_month),
+ 'yyyymm'),
+ 1),
+ 'yyyymm'),
+ to_char(SYSDATE, 'yyyymm'))
+ FROM pd_ef_bill bill
+ WHERE bill.is_deleted = 0
+ AND bill.is_locked = 1
+ AND bill.pd_provider_id = a.department_id),
+ to_char(SYSDATE, 'yyyymm')) billym,
+ bc.city_id AS cityid,
+ bc.city_name AS cityname,
+ et.pd_ef_template_id templtid,
+ et.agreed_bill_gen_dt billgendt,
+ et.agreed_bill_lock_dt billlockdt
+ FROM sys_department_info a,
+ bd_city bc,
+ pd_ef_template et
+ WHERE a.status = 1
+ AND bc.city_id(+) = a.city_id
+ AND a.department_id = et.provider_id
+ AND et.is_valid = 1
+ AND et.is_deleted = 0
+
+ and
+ a.department_id =
+ #{departmentId}
+
+ and
+ a.governing_area =
+ #{governingAreaId}
+
+ and
+ a.department_grade =
+ #{departmentGrade}
+
+ and
+ a.provider_type =
+ #{providerType}
+
+ and
+ a.department_name like
+ '%${departmentName}%'
+
+ and
+ a.department_internal_code = #{departmentInternalCode}
+
+
+
+
+
+ and
+ exists(
+ select 1
+ from
+ pd_prvd_group_relation gpgr
+ where gpgr.is_deleted = 0
+ and gpgr.prvd_group_id = #{prvdGroupId}
+ and gpgr.provider_id = a.department_id
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {call ${prcName} (?,?)}
+
+
+
+
+
+
+
+
+
+ select distinct bc. cust_id,
+ bc.cust_name,
+ bc.cust_code,
+ bc.cust_english_name,
+ bc.cust_short_name,
+ bc.IS_DELETED ,
+ bc.hr_contract,
+ bc.contact_tel,
+ bc.email
+ from bd_customer bc, sl_contract sc, sys_user_manage_user mu
+ where sc.cust_id = bc.cust_id
+ and sc.liability_cs = mu.managed_user_id
+ and mu.is_deleted = 0
+ and sc.contract_status = 2
+ and sc.contract_svc_state in (0, 1)
+ and sc.is_deleted = 0
+ and mu.user_id =#{userId}
+ and bc.is_deleted=0
+ and
+ instr(cust_name,#{custName}) > 0
+
+ and cust_id=#{custId}
+
+ and
+ cust_code=#{custCode}
+
+ and
+ IS_DELETED=#{isDeleted}
+
+
+
+
+
+
+
+
+ insert into pd_dyn_data (data_id, item_id, type_id, data_Value)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ and ${subcontractAlias}.subcontract_id in(
+ select distinct hs.subcontract_id from hs_subcontract hs, hs_subcontract_biz_auth cbm
+ where hs.subcontract_id = cbm.subcontract_id
+ and cbm.bizman_id = #{userId}
+ and cbm.bizman_type = #{bizmanType}
+ = trunc(sysdate))
+ ]]>
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ and ${subcontractAlias}.subcontract_id in (
+ select distinct cbm.subcontract_id from hs_subcontract_biz_auth cbm,sys_user_manage_user umu
+ where cbm.bizman_id = umu.managed_user_id
+ and umu.user_id = #{userId}
+ and cbm.is_deleted=0
+ and umu.is_deleted=0
+ and cbm.start_dt <= sysdate
+ and (cbm.end_dt is null or cbm.end_dt >= trunc(sysdate))
+ and
+ cbm.bizman_type = #{bizmanType}
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ and ${contractAlias}.contract_id in(
+ select distinct cbm.contract_id from hs_subcontract_biz_auth cbm,sys_user_manage_user umu
+ where cbm.bizman_id = umu.managed_user_id
+ and umu.user_id = #{userId}
+ and cbm.is_deleted=0
+ and umu.is_deleted=0
+ and cbm.start_dt <= sysdate
+ and (cbm.end_dt is null or cbm.end_dt >= trunc(sysdate))
+ and
+ cbm.bizman_type = #{bizmanType}
+
+ )
+
+
+
+
+ and exists (select 1
+ from sys_role r,
+ sys_user_role_relation ur,
+ sys_user_department_relation dr,
+ sys_department_info di
+ where ur.role_id = r.role_id
+ and ur.user_id = dr.user_id
+ and dr.department_id = di.department_id
+ and di.governing_branch = ${branchTitleAlias}.branch_id
+ and r.is_deleted = 0
+ and r.status = 1
+ and ur.is_deleted = 0
+ and ur.status = 1
+ and dr.is_deleted = 0
+ and dr.status = 1
+ and di.is_deleted = 0
+ and di.status = 1
+ and r.biz_category = #{bizCategory}
+ and ur.user_id = #{userId})
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ and ${customerAlias}.cust_id in(
+ select distinct cbm.cust_id from hs_subcontract hs, hs_subcontract_biz_auth cbm,sys_user_manage_user umu
+ where hs.subcontract_id = cbm.subcontract_id
+ and umu.managed_user_id=cbm.bizman_id
+ and umu.user_id = #{userId}
+ and cbm.is_deleted=0
+ and umu.is_deleted=0
+ and (cbm.bizman_type = 4 or (hs.assignment_type=3 and cbm.bizman_type=5))
+ and cbm.start_dt <= sysdate
+ and (cbm.end_dt is null or cbm.end_dt >= trunc(sysdate))
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ and (
+
+
+ ${customerAlias}.cust_id in(
+ select distinct cbm.cust_id from hs_subcontract_biz_auth cbm,sys_user_manage_user umu
+ where cbm.bizman_id = umu.managed_user_id
+ and umu.user_id = #{userId}
+ and cbm.is_deleted=0
+ and umu.is_deleted=0
+ and cbm.start_dt <= sysdate
+ and (cbm.end_dt is null or cbm.end_dt >= trunc(sysdate))
+ and
+ cbm.bizman_type = #{bizmanType}
+
+ )
+
+
+ OR
+
+
+ EXISTS (
+ SELECT 'X'
+ FROM EF_RECEIVABLE_TEMPLATE ET
+ WHERE EXISTS (SELECT 'X'
+ FROM SYS_USER_ROLE_RELATION R, SYS_ROLE RL
+ WHERE R.ROLE_ID = RL.ROLE_ID
+ AND RL.STATUS = 1
+ AND RL.ROLE_GRADE <= 3
+ AND RL.IS_DELETED = 0
+ AND RL.BIZ_CATEGORY IN (50, 10)
+ AND R.USER_ID = #{userId}
+ AND R.STATUS = 1
+ AND R.IS_DELETED = 0)
+ and
+ ET.RECEIVABLE_TEMPLT_ID = ${billAlias}.RECEIVABLE_TEMPLT_ID
+
+ and
+ ET.PAYEE_ID = #{governingBranch}
+
+ )
+
+
+ )
+
+
+
+
+
+ AND ${billAlias}.receivable_templt_id IN
+ (SELECT et.receivable_templt_id
+ FROM ef_receivable_template et
+ WHERE EXISTS (SELECT 'X'
+ FROM sys_user_role_relation r, sys_role rl
+ WHERE r.role_id = rl.role_id
+ AND rl.status = 1
+ AND rl.role_grade <= 3
+ AND rl.is_deleted = 0
+ AND rl.biz_category IN (50, 10)
+ AND r.user_id = #{userId}
+ AND r.status = 1
+ AND r.is_deleted = 0)
+ and
+ et.payee_id = #{governingBranch}
+
+ UNION ALL
+ SELECT et.receivable_templt_id
+ FROM ef_receivable_template et
+ WHERE EXISTS
+ (SELECT 1
+ FROM hs_subcontract_biz_auth cbm, sys_user_manage_user umu
+ WHERE cbm.bizman_id = umu.managed_user_id
+ AND umu.user_id = #{userId}
+ AND cbm.is_deleted = 0
+ AND umu.is_deleted = 0
+ AND cbm.start_dt <= SYSDATE
+ AND (cbm.end_dt IS NULL OR cbm.end_dt >= trunc(SYSDATE))
+ AND cbm.cust_id = et.cust_id)
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ and (
+
+
+ ${customerAlias}.cust_id in(
+ select distinct cpm.productline_company_id from crm_productline_mapping cpm,sys_user_manage_user umu
+ where cpm.productline_saler_id = umu.managed_user_id
+ and umu.user_id = #{userId}
+ and cpm.is_deleted = 0
+ and cpm.is_valid=1
+ and cpm.productline_type=1
+ and umu.is_deleted=0
+ )
+
+
+ OR
+
+
+ EXISTS (
+ SELECT 'X'
+ FROM EF_RECEIVABLE_TEMPLATE ET
+ WHERE EXISTS (SELECT 'X'
+ FROM SYS_USER_ROLE_RELATION R, SYS_ROLE RL
+ WHERE R.ROLE_ID = RL.ROLE_ID
+ AND RL.STATUS = 1
+ AND RL.ROLE_GRADE <= 3
+ AND RL.IS_DELETED = 0
+ AND RL.BIZ_CATEGORY IN (50, 10)
+ AND R.USER_ID = #{userId}
+ AND R.STATUS = 1
+ AND R.IS_DELETED = 0)
+ and
+ ET.RECEIVABLE_TEMPLT_ID = ${billAlias}.RECEIVABLE_TEMPLT_ID
+
+ and
+ ET.PAYEE_ID = #{governingBranch}
+
+ )
+
+
+ )
+
+
+
+
+
+ and exists
+ (select 'x'
+ from pd_provider_cs_auth pca
+ where pca.is_deleted = 0
+ and pca.start_dt <= sysdate
+ and (pca.end_dt is null or pca.end_dt >= trunc(sysdate))
+ and
+ pca.provider_id = ${subcontractAlias}.assignee_provider_id
+
+ and
+ pca.cs_id = #{userId}
+
+ )
+
+
+
+
+ and exists(
+ select 'x'
+ from sys_user_manage_user umu
+ where umu.user_id = #{userId}
+ and umu.is_deleted=0
+
+ and umu.managed_user_id = ${userManageUserAlias}.create_by
+
+ )
+
+
+
+
+ and exists
+ (select 'x'
+ from pd_provider_cs_auth pca
+ where pca.is_deleted = 0
+ and pca.start_dt <= sysdate
+ and (pca.end_dt is null or pca.end_dt >= trunc(sysdate))
+ and
+ pca.provider_id = ${subcontractAlias}.provider_id
+
+ and
+ pca.provider_id = ${providerIdAlias}
+
+ and
+ pca.provider_id in (select ppgr.provider_id from pd_prvd_group_relation ppgr where ppgr.is_deleted=0 and ppgr.prvd_group_id=${prvdGroupIdAlias} )
+
+ and
+ pca.cs_id = #{userId}
+
+ )
+
+
+
+
+
+ and exists
+ (select 'x'
+ from pd_provider_cs_auth pca, sys_user_manage_user umu
+ where pca.cs_id = umu.managed_user_id
+ and umu.is_deleted = 0
+ and pca.is_deleted = 0
+ and pca.start_dt <= sysdate
+ and (pca.end_dt is null or pca.end_dt >= trunc(sysdate))
+ and
+ pca.provider_id = ${providerIdAlias}
+
+ and
+ pca.provider_id in (select ppgr.provider_id from pd_prvd_group_relation ppgr where ppgr.is_deleted=0 and ppgr.prvd_group_id=${prvdGroupIdAlias} )
+
+ and
+ umu.user_id = #{userId}
+
+ )
+
+
+
+
+
+ and ( exists (
+ select 'x'
+ from hs_subcontract_biz_auth cbm,sys_user_manage_user umu
+ where cbm.bizman_id = umu.managed_user_id
+ and umu.user_id = #{userId}
+ and cbm.is_deleted=0
+ and umu.is_deleted=0
+ and cbm.start_dt <= sysdate
+ and (cbm.end_dt is null or cbm.end_dt >= trunc(sysdate))
+ and
+ cbm.bizman_type = #{bizmanType}
+
+
+ and cbm.subcontract_id = ${subcontractAlias}.subcontract_id
+
+ )
+ or exists
+ (select 'x'
+ from pd_provider_cs_auth pca
+ where pca.is_deleted = 0
+ and pca.start_dt <= sysdate
+ and (pca.end_dt is null or pca.end_dt >= trunc(sysdate))
+ and
+ pca.provider_id = ${subcontractAlias}.assignee_provider_id
+
+ and
+ pca.cs_id = #{userId}
+
+ ))
+
+
+
+
\ No newline at end of file
diff --git a/xml-test/mybatis.xml b/xml-test/mybatis.xml
new file mode 100644
index 0000000..da63c12
--- /dev/null
+++ b/xml-test/mybatis.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+ ${alias}.id, ${alias}.name as ${alias}_name
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/xml-test/select.sql b/xml-test/select.sql
new file mode 100644
index 0000000..2f181a1
--- /dev/null
+++ b/xml-test/select.sql
@@ -0,0 +1 @@
+select * from tb1;
\ No newline at end of file
diff --git a/xml-test/sqlmap-emphiresep.xml b/xml-test/sqlmap-emphiresep.xml
new file mode 100644
index 0000000..6793eda
--- /dev/null
+++ b/xml-test/sqlmap-emphiresep.xml
@@ -0,0 +1,4075 @@
+
+
+
+
+
+ and
+ hehs.status = #{status}
+
+ and
+ hehs.cust_internal_num = #{custInternalNum}
+
+ and
+ bc.cust_code = #{custCode}
+
+ and
+ instr(bc.cust_name,#{custName}) > 0
+
+ and
+ be.emp_code = #{employeeCode}
+
+ and
+ be.emp_name = #{employeeName}
+
+ and
+ hs.assigner_provider_id = #{assignerProviderId}
+
+ and
+ hs.assignee_provider_id = #{assigneeProviderId}
+
+ and
+ hs.assigner_cs_id = #{assignerCsId}
+
+ and
+ hs.assignee_cs_id = #{assigneeCsId}
+
+ and
+ hs.subcontract_name like '%${subcontractName}%'
+
+ and
+ bg.customer_size = #{customerSize}
+
+
+
+
+
+
+
+
+
+ and
+ hehs.add_confirm_status = 1 and hehs.sep_confirm_status = 1 and hs.assigner_cs_id = #{userId}
+ and exists
+ (select 1
+ from sys_user_department_relation dr, sys_department_info di
+ where dr.department_id = di.department_id
+ and dr.is_deleted = 0
+ and dr.status = 1
+ and dr.user_id = hs.assigner_cs_id
+ and di.governing_branch = hs.assigner_provider_id
+ )
+
+ and
+
+ ((hehs.add_confirm_status = 40 and (hehs.comm_insur_status = 40 or hehs.comm_insur_status is null) or hehs.add_confirm_status = 2 and hehs.comm_insur_status = 40) and hehs.sep_confirm_status = 1 or hehs.sep_confirm_status = 40) and hehs.alter_status in (1,40) and hs.assigner_cs_id = #{userId}
+ and exists
+ (select 1
+ from sys_user_department_relation dr, sys_department_info di
+ where dr.department_id = di.department_id
+ and dr.is_deleted = 0
+ and dr.status = 1
+ and dr.user_id = hs.assigner_cs_id
+ and di.governing_branch = hs.assigner_provider_id
+ )
+
+
+ and
+
+ (hehs.add_confirm_status = 40 and hehs.sep_confirm_status = 1 or hehs.sep_confirm_status = 40) and hehs.alter_status in (1,40) and sdi.provider_type = 1 and hs.assignee_cs_id = #{userId}
+ and exists
+ (select 1
+ from sys_user_department_relation dr, sys_department_info di
+ where dr.department_id = di.department_id
+ and dr.is_deleted = 0
+ and dr.status = 1
+ and dr.user_id = hs.assignee_cs_id
+ and di.governing_branch = hs.assignee_provider_id
+ )
+
+
+ and
+
+ (hehs.add_confirm_status = 40 and hehs.sep_confirm_status = 1 or hehs.sep_confirm_status = 40) and hehs.alter_status in (1,40) and hs.assigner_cs_id = #{userId}
+ and exists
+ (select 1
+ from sys_user_department_relation dr, sys_department_info di
+ where dr.department_id = di.department_id
+ and dr.is_deleted = 0
+ and dr.status = 1
+ and dr.user_id = hs.assigner_cs_id
+ and di.governing_branch = hs.assigner_provider_id
+ )
+
+
+
+ and
+ hehs.status = #{status}
+
+ and
+ hehs.cust_internal_num = #{custInternalNum}
+
+ and
+ bc.cust_code = #{custCode}
+
+ and
+ instr(bc.cust_name,#{custName}) > 0
+
+ and
+ be.emp_code = #{employeeCode}
+
+ and
+ be.emp_name = #{employeeName}
+
+ and
+ hs.assigner_provider_id = #{assignerProviderId}
+
+ and
+ hs.assignee_provider_id = #{assigneeProviderId}
+
+ and
+ hs.assigner_cs_id = #{assignerCsId}
+
+ and
+ hs.assignee_cs_id = #{assigneeCsId}
+
+ and
+ hs.subcontract_name like '%${subcontractName}%'
+
+ and
+ be.idc18 = FNC_15TO18(#{idCardNum})
+
+ and
+
+ hehs.hire_dt >= to_date(#{hireStartDt},'yyyy-MM-dd')
+
+
+ and
+
+ hehs.hire_dt < to_date(#{hireEndDt},'yyyy-MM-dd') + 1
+
+
+ and
+
+ hehs.sep_dt >= to_date(#{sepStartDt},'yyyy-MM-dd')
+
+
+ and
+
+ hehs.sep_dt < to_date(#{sepEndDt},'yyyy-MM-dd') + 1
+
+
+ and
+ bg.customer_size = #{customerSize}
+
+
+
+
+
+
+
+
+
+ and exists
+ (select 1
+ from sys_user_department_relation dr, sys_department_info di
+ where dr.department_id = di.department_id
+ and dr.is_deleted = 0
+ and dr.status = 1
+ and dr.user_id = hs.assignee_cs_id
+ and di.governing_branch = hs.assignee_provider_id
+ )
+
+ and
+ hehs.add_confirm_status = #{addConfirmStatus}
+
+ and
+ be.id_card_type = #{idCardType}
+
+ and
+ be.idc18 = FNC_15TO18(#{idCardNum})
+
+ and
+ bc.cust_code = #{custCode}
+
+ and
+ instr(bc.cust_name,#{custName}) > 0
+
+ and
+ be.emp_code = #{employeeCode}
+
+ and
+ be.emp_name = #{employeeName}
+
+ and
+ hs.assigner_provider_id = #{assignerProviderId}
+
+ and
+ hs.assignee_provider_id = #{assigneeProviderId}
+
+ and
+ hs.assigner_cs_id = #{assignerCsId}
+
+ and
+ hs.assignee_cs_id = #{assigneeCsId}
+
+ and
+ hs.subcontract_name like '%${subcontractName}%'
+
+ and
+
+ hehs.rpt_hire_dt >= to_date(#{rptHireStartDt},'yyyy-mm-dd')
+
+
+ and
+
+ hehs.rpt_hire_dt < to_date(#{rptHireEndDt},'yyyy-mm-dd') + 1
+
+
+ and
+ sc.area_type = #{areaType}
+
+ and
+ hehs.is_hire_call = #{isHireCall}
+
+ and
+ hehs.emp_hiresep_main_id is not null
+
+ and
+ hehs.emp_hiresep_main_id is null
+
+ and
+ bg.customer_size = #{customerSize}
+
+ and
+ hehs.sms_send_status = #{smsSendStatus}
+
+ and
+ hehs.sms_send_dt >= to_date(#{smsSendStartDt},'yyyy-mm-dd')
+
+ and
+ hehs.sms_send_dt < to_date(#{smsSendEndDt},'yyyy-mm-dd') + 1
+
+
+
+
+
+
+
+
+ and exists
+ (select 1
+ from sys_user_department_relation dr, sys_department_info di
+ where dr.department_id = di.department_id
+ and dr.is_deleted = 0
+ and dr.status = 1
+ and dr.user_id = hs.assigner_cs_id
+ and di.governing_branch = hs.assigner_provider_id
+ )
+ and
+ hehs.add_confirm_status = 30 and hehs.sep_confirm_status = 1
+
+ and
+ (hehs.add_confirm_status = 40 and hehs.sep_confirm_status = 1 or hehs.sep_confirm_status = 40) and hehs.alter_status = 30
+
+
+ and
+ be.id_card_type = #{idCardType}
+
+ and
+ be.idc18 = FNC_15TO18(#{idCardNum})
+
+ and
+ bc.cust_code = #{custCode}
+
+ and
+ instr(bc.cust_name,#{custName}) > 0
+
+ and
+ be.emp_code = #{employeeCode}
+
+ and
+ be.emp_name = #{employeeName}
+
+ and
+ hs.assigner_provider_id = #{assignerProviderId}
+
+ and
+ hs.assignee_provider_id = #{assigneeProviderId}
+
+ and
+ hs.assigner_cs_id = #{assignerCsId}
+
+ and
+ hs.assignee_cs_id = #{assigneeCsId}
+
+ and
+ hs.subcontract_name like '%${subcontractName}%'
+
+ and
+
+ hehs.rpt_hire_dt >= to_date(#{rptHireStartDt},'yyyy-mm-dd')
+
+
+ and
+
+ hehs.rpt_hire_dt < to_date(#{rptHireEndDt},'yyyy-mm-dd') + 1
+
+
+ and
+ sc.area_type = #{areaType}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SELECT SEQ_HS_EMP_HIRE_SEP.nextval FROM dual
+
+ insert into HS_EMP_HIRE_SEP (EMP_HIRE_SEP_ID,CREATE_DT,RPT_HIRE_DT
+ ,
+ CONTRACT_ID
+
+ ,
+ SUBCONTRACT_ID
+
+ ,
+ DEC_SALARY
+
+ ,
+ EMP_ID
+
+ ,
+ CUST_ID
+
+ ,
+ CUST_INTERNAL_NUM
+
+ ,
+ HIRE_QUOTATION_ID
+
+ ,
+ SEP_QUOTATION_ID
+
+ ,
+ EMP_TYPE
+
+ ,
+ STATUS
+
+ ,
+ HIRE_DT
+
+ ,
+ RPT_HIRE_BY
+
+ ,
+ ADD_REASON
+
+ ,
+ HIRE_COMPETITOR
+
+ ,
+ HIRE_REMARK
+
+ ,
+ IS_HIRE_CALL
+
+ ,
+ ACTUAL_WORK_LOC
+
+ ,
+ FILE_CAB_CODE
+
+ ,
+ FOLDER_CODE
+
+ ,
+ POSITION_ID
+
+ ,
+ ADD_PERFECT_BY
+
+ ,
+ ADD_PERFECT_DT
+
+ ,
+ ADD_CONFIRM_STATUS
+
+ ,
+ ADD_CONFIRM_PRO
+
+ ,
+ ADD_REMARK
+
+ ,
+ ADD_CONFIRM_BY
+
+ ,
+ ADD_CONFIRM_DT
+
+ ,
+ ALTER_PERFECT_BY
+
+ ,
+ ALTER_PERFECT_DT
+
+ ,
+ ALTER_STATUS
+
+ ,
+ ALTER_REMARK
+
+ ,
+ ALTER_CONFIRM_PRO
+
+ ,
+ ALTER_CONFIRM_BY
+
+ ,
+ ALTER_CONFIRM_DT
+
+ ,
+ SEP_DT
+
+ ,
+ RPT_SEP_DT
+
+ ,
+ REDUCE_REASON
+
+ ,
+ reduce_detail_reason
+
+ ,
+ SEP_PERFECT_BY
+
+ ,
+ SEP_PERFECT_DT
+
+ ,
+ SEP_CONFIRM_HIS
+
+ ,
+ RPT_SEP_BY
+
+ ,
+ SEP_REASON
+
+ ,
+ SEP_REMARK
+
+ ,
+ SEP_PROCESS_STATUS
+
+ ,
+ SEP_CONFIRM_DT
+
+ ,
+ SEP_CONFIRM_STATUS
+
+ ,
+ SEP_CONFIRM_PRO
+
+ ,
+ SEP_CONFIRM_BY
+
+ ,
+ IS_SEP_CALL
+
+ ,
+ IS_REFUND
+
+ ,
+ IS_NEED_SIGN
+
+ ,
+ IS_ARCHIVE
+
+ ,
+ IS_SAME_INSUR
+
+ ,
+ PREV_POINTER
+
+ ,
+ NEXT_POINTER
+
+ ,
+ TYPE1
+
+ ,
+ TYPE2
+
+ ,
+ TYPE3
+
+ ,
+ TYPE4
+
+ ,
+ TYPE5
+
+ ,
+ BATCH_ID
+
+ ,
+ EMP_HIRESEP_MAIN_ID
+
+ ,
+ COMM_INSUR_STATUS
+
+ ,
+ SS_PARTICIPATE_LOCATION
+
+ ,
+ LABOR_RELATION_UNIT
+
+ ,
+ IS_THERE_SS_CARD
+
+ ,
+ IS_THERE_A_COORDINATE_HEALTH
+
+ ,
+ EMP_ADD_ID
+
+ ,
+ EMP_ALTER_ID
+
+ ,
+ REDUCE_ID
+
+ ,
+ PENDING_REASON
+
+ ,
+ EMP_STOP_ID
+
+ ,
+ PROCESS_INS_ID
+
+ ,
+ EMP_STOP_PROCESS_STATE
+
+ ,
+ CITY_ID
+
+ ,
+ PERSON_CATEGORY_ID
+
+ ,
+ CREATE_BY
+
+ ,
+ MIMIC_BY
+
+ ,
+ PROXY_BY
+
+ )
+ values (#{empHireSepId,jdbcType=DECIMAL},sysdate,sysdate
+ ,
+ #{contractId,jdbcType=DECIMAL}
+
+ ,
+ #{subcontractId,jdbcType=DECIMAL}
+
+ ,
+ #{decSalary,jdbcType=DECIMAL}
+
+ ,
+ #{empId,jdbcType=DECIMAL}
+
+ ,
+ #{custId,jdbcType=DECIMAL}
+
+ ,
+ #{custInternalNum,jdbcType=DECIMAL}
+
+ ,
+ #{hireQuotationId,jdbcType=DECIMAL}
+
+ ,
+ #{sepQuotationId,jdbcType=DECIMAL}
+
+ ,
+ #{empType,jdbcType=DECIMAL}
+
+ ,
+ #{status,jdbcType=DECIMAL}
+
+ ,
+ to_date(#{hireDt},'yyyy-mm-dd')
+
+ ,
+ #{rptHireBy,jdbcType=DECIMAL}
+
+ ,
+ #{addReason,jdbcType=DECIMAL}
+
+ ,
+ #{hireCompetitor,jdbcType=DECIMAL}
+
+ ,
+ #{hireRemark,jdbcType=VARCHAR}
+
+ ,
+ #{isHireCall,jdbcType=DECIMAL}
+
+ ,
+ #{actualWorkLoc,jdbcType=VARCHAR}
+
+ ,
+ #{fileCabCode,jdbcType=VARCHAR}
+
+ ,
+ #{folderCode,jdbcType=VARCHAR}
+
+ ,
+ #{positionId,jdbcType=DECIMAL}
+
+ ,
+ #{addPerfectBy,jdbcType=DECIMAL}
+
+ ,
+ to_date(#{addPerfectDate},'yyyy-mm-dd hh24:mi:ss')
+
+ ,
+ #{addConfirmStatus,jdbcType=DECIMAL}
+
+ ,
+ #{addConfirmPro,jdbcType=VARCHAR}
+
+ ,
+ #{addRemark,jdbcType=DECIMAL}
+
+ ,
+ #{addConfirmBy,jdbcType=DECIMAL}
+
+ ,
+ to_date(#{addConfirmDate},'yyyy-mm-dd hh24:mi:ss')
+
+ ,
+ #{alterPerfectBy,jdbcType=DECIMAL}
+
+ ,
+ to_date(#{alterPerfectDate},'yyyy-mm-dd hh24:mi:ss')
+
+ ,
+ #{alterStatus,jdbcType=DECIMAL}
+
+ ,
+ #{alterRemark,jdbcType=VARCHAR}
+
+ ,
+ #{alterConfirmPro,jdbcType=VARCHAR}
+
+ ,
+ #{alterConfirmBy,jdbcType=DECIMAL}
+
+ ,
+ to_date(#{alterConfirmDate},'yyyy-mm-dd hh24:mi:ss')
+
+ ,
+ to_date(#{sepDt},'yyyy-mm-dd')
+
+ ,
+ to_date(#{rptSepDt},'yyyy-mm-dd hh24:mi:ss')
+
+ ,
+ #{reduceReason,jdbcType=DECIMAL}
+
+ ,
+ #{reduceDetailReason,jdbcType=VARCHAR}
+
+ ,
+ #{sepPerfectBy,jdbcType=DECIMAL}
+
+ ,
+ to_date(#{sepPerfectDate},'yyyy-mm-dd hh24:mi:ss')
+
+ ,
+ #{sepConfirmHis,jdbcType=VARCHAR}
+
+ ,
+ #{rptSepBy,jdbcType=DECIMAL}
+
+ ,
+ #{sepReason,jdbcType=DECIMAL}
+
+ ,
+ #{sepRemark,jdbcType=VARCHAR}
+
+ ,
+ #{sepProcessStatus,jdbcType=DECIMAL}
+
+ ,
+ to_date(#{sepConfirmDate},'yyyy-mm-dd hh24:mi:ss')
+
+ ,
+ #{sepConfirmStatus,jdbcType=DECIMAL}
+
+ ,
+ #{sepConfirmPro,jdbcType=VARCHAR}
+
+ ,
+ #{sepConfirmBy,jdbcType=DECIMAL}
+
+ ,
+ #{isSepCall,jdbcType=DECIMAL}
+
+ ,
+ #{isRefund,jdbcType=DECIMAL}
+
+ ,
+ #{isNeedSign,jdbcType=DECIMAL}
+
+ ,
+ #{isArchive,jdbcType=DECIMAL}
+
+ ,
+ #{isSameInsur,jdbcType=DECIMAL}
+
+ ,
+ #{prevPointer,jdbcType=DECIMAL}
+
+ ,
+ #{nextPointer,jdbcType=DECIMAL}
+
+ ,
+ #{type1,jdbcType=VARCHAR}
+
+ ,
+ #{type2,jdbcType=VARCHAR}
+
+ ,
+ #{type3,jdbcType=VARCHAR}
+
+ ,
+ #{type4,jdbcType=VARCHAR}
+
+ ,
+ #{type5,jdbcType=VARCHAR}
+
+ ,
+ #{batchId,jdbcType=DECIMAL}
+
+ ,
+ #{empHiresepMainId,jdbcType=DECIMAL}
+
+ ,
+ #{commInsurStatus,jdbcType=DECIMAL}
+
+ ,
+ #{ssParticipateLocation,jdbcType=VARCHAR}
+
+ ,
+ #{laborRelationUnit,jdbcType=VARCHAR}
+
+ ,
+ #{isThereSsCard,jdbcType=DECIMAL}
+
+ ,
+ #{isThereACoordinateHealth,jdbcType=DECIMAL}
+
+ ,
+ #{empAddId,jdbcType=DECIMAL}
+
+ ,
+ #{empAlterId,jdbcType=DECIMAL}
+
+ ,
+ #{reduceId,jdbcType=DECIMAL}
+
+ ,
+ #{pendingReason,jdbcType=DECIMAL}
+
+ ,
+ #{empStopId,jdbcType=DECIMAL}
+
+ ,
+ #{processInsId,jdbcType=DECIMAL}
+
+ ,
+ #{empStopProcessState,jdbcType=DECIMAL}
+
+ ,
+ #{cityId,jdbcType=DECIMAL}
+
+ ,
+ #{personCategoryId,jdbcType=DECIMAL}
+
+ ,
+ #{createBy,jdbcType=DECIMAL}
+
+ ,
+ #{mimicBy,jdbcType=DECIMAL}
+
+ ,
+ #{proxyBy,jdbcType=DECIMAL}
+
+ )
+
+
+
+
+ update HS_EMP_HIRE_SEP set UPDATE_DT = sysdate
+ ,
+ CONTRACT_ID = #{contractId,jdbcType=DECIMAL}
+
+ ,
+ DEC_SALARY = #{decSalary,jdbcType=DECIMAL}
+
+ ,
+ SUBCONTRACT_ID = #{subcontractId,jdbcType=DECIMAL}
+
+ ,
+ EMP_ID = #{empId,jdbcType=DECIMAL}
+
+ ,
+ CUST_ID = #{custId,jdbcType=DECIMAL}
+
+ ,
+ CUST_INTERNAL_NUM = #{custInternalNum,jdbcType=DECIMAL}
+
+ ,
+ HIRE_QUOTATION_ID = #{hireQuotationId,jdbcType=DECIMAL}
+
+ ,
+ SEP_QUOTATION_ID = #{sepQuotationId,jdbcType=DECIMAL}
+
+ ,
+ EMP_TYPE = #{empType,jdbcType=DECIMAL}
+
+ ,
+ STATUS = #{status,jdbcType=DECIMAL}
+
+ ,
+ HIRE_DT = to_date(#{hireDt},'yyyy-mm-dd')
+
+ ,
+ ADD_REASON = #{addReason,jdbcType=DECIMAL}
+
+ ,
+ HIRE_COMPETITOR = #{hireCompetitor,jdbcType=DECIMAL}
+
+ ,
+ HIRE_REMARK = #{hireRemark,jdbcType=VARCHAR}
+
+ ,
+ IS_HIRE_CALL = #{isHireCall,jdbcType=DECIMAL}
+
+ ,
+ ACTUAL_WORK_LOC = #{actualWorkLoc,jdbcType=VARCHAR}
+
+ ,
+ FILE_CAB_CODE = #{fileCabCode,jdbcType=VARCHAR}
+
+ ,
+ FOLDER_CODE = #{folderCode,jdbcType=VARCHAR}
+
+ ,
+ POSITION_ID = #{positionId,jdbcType=DECIMAL}
+
+ ,
+ ADD_PERFECT_BY = #{addPerfectBy,jdbcType=DECIMAL}
+
+ ,
+ ADD_PERFECT_DT = to_date(#{addPerfectDate},'yyyy-mm-dd hh24:mi:ss')
+
+ ,
+ ADD_CONFIRM_STATUS = #{addConfirmStatus,jdbcType=DECIMAL}
+
+ ,
+ ADD_CONFIRM_PRO = #{addConfirmPro,jdbcType=VARCHAR}
+
+ ,
+ ADD_REMARK = #{addRemark,jdbcType=DECIMAL}
+
+ ,
+ ADD_CONFIRM_BY = #{addConfirmBy,jdbcType=DECIMAL}
+
+ ,
+ ADD_CONFIRM_DT = to_date(#{addConfirmDate},'yyyy-mm-dd hh24:mi:ss')
+
+ ,
+ ALTER_PERFECT_BY = #{alterPerfectBy,jdbcType=DECIMAL}
+
+ ,
+ ALTER_PERFECT_DT = to_date(#{alterPerfectDate},'yyyy-mm-dd hh24:mi:ss')
+
+ ,
+ ALTER_STATUS = #{alterStatus,jdbcType=DECIMAL}
+
+ ,
+ ALTER_REMARK = #{alterRemark,jdbcType=VARCHAR}
+
+ ,
+ ALTER_CONFIRM_PRO = #{alterConfirmPro,jdbcType=VARCHAR}
+
+ ,
+ ALTER_CONFIRM_BY = #{alterConfirmBy,jdbcType=DECIMAL}
+
+ ,
+ ALTER_CONFIRM_DT = to_date(#{alterConfirmDate},'yyyy-mm-dd hh24:mi:ss')
+
+ ,
+ SEP_DT = to_date(#{sepDt},'yyyy-mm-dd')
+
+ ,
+ RPT_SEP_DT = to_date(#{rptSepDt},'yyyy-mm-dd hh24:mi:ss')
+
+ ,
+ REDUCE_REASON = #{reduceReason,jdbcType=DECIMAL}
+
+ ,
+ reduce_detail_reason = #{reduceDetailReason,jdbcType=VARCHAR}
+
+ ,
+ SEP_PERFECT_BY = #{sepPerfectBy,jdbcType=DECIMAL}
+
+ ,
+ SEP_PERFECT_DT = to_date(#{sepPerfectDate},'yyyy-mm-dd hh24:mi:ss')
+
+ ,
+ SEP_CONFIRM_HIS = #{sepConfirmHis,jdbcType=VARCHAR}
+
+ ,
+ RPT_SEP_BY = #{rptSepBy,jdbcType=DECIMAL}
+
+ ,
+ SEP_REASON = #{sepReason,jdbcType=DECIMAL}
+
+ ,
+ SEP_REMARK = #{sepRemark,jdbcType=VARCHAR}
+
+ ,
+ SEP_PROCESS_STATUS = #{sepProcessStatus,jdbcType=DECIMAL}
+
+ ,
+ SEP_CONFIRM_DT = to_date(#{sepConfirmDate},'yyyy-mm-dd hh24:mi:ss')
+
+ ,
+ SEP_CONFIRM_STATUS = #{sepConfirmStatus,jdbcType=DECIMAL}
+
+ ,
+ SEP_CONFIRM_PRO = #{sepConfirmPro,jdbcType=VARCHAR}
+
+ ,
+ SEP_CONFIRM_BY = #{sepConfirmBy,jdbcType=VARCHAR}
+
+ ,
+ IS_SEP_CALL = #{isSepCall,jdbcType=DECIMAL}
+
+ ,
+ IS_REFUND = #{isRefund,jdbcType=DECIMAL}
+
+ ,
+ IS_NEED_SIGN = #{isNeedSign,jdbcType=DECIMAL}
+
+ ,
+ IS_ARCHIVE = #{isArchive,jdbcType=DECIMAL}
+
+ ,
+ IS_SAME_INSUR = #{isSameInsur,jdbcType=DECIMAL}
+
+ ,
+ PREV_POINTER = #{prevPointer,jdbcType=DECIMAL}
+
+ ,
+ NEXT_POINTER = #{nextPointer,jdbcType=DECIMAL}
+
+ ,
+ TYPE1 = #{type1,jdbcType=VARCHAR}
+
+ ,
+ TYPE2 = #{type2,jdbcType=VARCHAR}
+
+ ,
+ TYPE3 = #{type3,jdbcType=VARCHAR}
+
+ ,
+ TYPE4 = #{type4,jdbcType=VARCHAR}
+
+ ,
+ TYPE5 = #{type5,jdbcType=VARCHAR}
+
+ ,
+ BATCH_ID = #{batchId,jdbcType=DECIMAL}
+
+ ,
+ EMP_HIRESEP_MAIN_ID = #{empHiresepMainId,jdbcType=DECIMAL}
+
+ ,
+ COMM_INSUR_STATUS = #{commInsurStatus,jdbcType=DECIMAL}
+
+ ,
+ SS_PARTICIPATE_LOCATION = #{ssParticipateLocation,jdbcType=VARCHAR}
+
+ ,
+ LABOR_RELATION_UNIT = #{laborRelationUnit,jdbcType=VARCHAR}
+
+ ,
+ IS_THERE_SS_CARD = #{isThereSsCard,jdbcType=DECIMAL}
+
+ ,
+ IS_THERE_A_COORDINATE_HEALTH = #{isThereACoordinateHealth,jdbcType=DECIMAL}
+
+ ,
+ EMP_ADD_ID = #{empAddId,jdbcType=DECIMAL}
+
+ ,
+ EMP_ALTER_ID = #{empAlterId,jdbcType=DECIMAL}
+
+ ,
+ REDUCE_ID = #{reduceId,jdbcType=DECIMAL}
+
+ ,
+ PENDING_REASON = #{pendingReason,jdbcType=DECIMAL}
+
+ ,
+ EMP_STOP_ID = #{empStopId,jdbcType=DECIMAL}
+
+ ,
+ PROCESS_INS_ID = #{processInsId,jdbcType=DECIMAL}
+
+ ,
+ EMP_STOP_PROCESS_STATE = #{empStopProcessState,jdbcType=DECIMAL}
+
+ ,
+ CITY_ID = #{cityId,jdbcType=DECIMAL}
+
+ ,
+ PERSON_CATEGORY_ID = #{personCategoryId,jdbcType=DECIMAL}
+
+ ,
+ SMS_SEND_STATUS = #{smsSendStatus,jdbcType=DECIMAL}
+
+ ,
+ SMS_SEND_DT = #{smsSendDt,jdbcType=TIMESTAMP}
+
+ ,
+ IS_DELETED = #{isDeleted,jdbcType=DECIMAL}
+
+ ,
+ UPDATE_BY = #{updateBy,jdbcType=DECIMAL}
+
+ ,
+ MIMIC_BY = #{mimicBy,jdbcType=DECIMAL}
+
+ ,
+ PROXY_BY = #{proxyBy,jdbcType=DECIMAL}
+
+ where EMP_HIRE_SEP_ID = #{empHireSepId,jdbcType=DECIMAL}
+
+
+
+ insert into hs_emp_hire_sep_his
+ (emp_hire_sep_his_id,
+ emp_hire_sep_id,
+ contract_id,
+ subcontract_id,
+ emp_id,
+ cust_id,
+ cust_internal_num,
+ hire_quotation_id,
+ sep_quotation_id,
+ emp_type,
+ status,
+ rpt_hire_dt,
+ hire_dt,
+ rpt_hire_by,
+ add_reason,
+ hire_competitor,
+ hire_remark,
+ is_hire_call,
+ actual_work_loc,
+ file_cab_code,
+ folder_code,
+ position_id,
+ add_perfect_by,
+ add_perfect_dt,
+ add_confirm_status,
+ add_confirm_pro,
+ add_remark,
+ add_confirm_by,
+ add_confirm_dt,
+ alter_perfect_by,
+ alter_perfect_dt,
+ alter_status,
+ alter_remark,
+ alter_confirm_pro,
+ alter_confirm_by,
+ alter_confirm_dt,
+ sep_dt,
+ rpt_sep_dt,
+ reduce_reason,
+ reduce_detail_reason,
+ sep_perfect_by,
+ sep_perfect_dt,
+ sep_confirm_his,
+ rpt_sep_by,
+ sep_reason,
+ sep_remark,
+ sep_process_status,
+ sep_confirm_dt,
+ sep_confirm_status,
+ sep_confirm_pro,
+ sep_confirm_by,
+ is_sep_call,
+ is_refund,
+ is_need_sign,
+ is_archive,
+ is_same_insur,
+ prev_pointer,
+ next_pointer,
+ type1,
+ type2,
+ type3,
+ type4,
+ type5,
+ batch_id,
+ comm_insur_status,
+ ss_participate_location,
+ labor_relation_unit,
+ is_there_ss_card,
+ is_there_a_coordinate_health,
+ emp_add_id,
+ emp_alter_id,
+ reduce_id,
+ pending_reason,
+ emp_stop_id,
+ process_ins_id,
+ emp_stop_process_state,
+ type,
+ create_by,
+ create_dt,
+ mimic_by,
+ proxy_by)
+ select seq_hs_emp_hire_sep_his.nextval,
+ emp_hire_sep_id,
+ contract_id,
+ subcontract_id,
+ emp_id,
+ cust_id,
+ cust_internal_num,
+ hire_quotation_id,
+ sep_quotation_id,
+ emp_type,
+ status,
+ rpt_hire_dt,
+ hire_dt,
+ rpt_hire_by,
+ add_reason,
+ hire_competitor,
+ hire_remark,
+ is_hire_call,
+ actual_work_loc,
+ file_cab_code,
+ folder_code,
+ position_id,
+ add_perfect_by,
+ add_perfect_dt,
+ add_confirm_status,
+ add_confirm_pro,
+ add_remark,
+ add_confirm_by,
+ add_confirm_dt,
+ alter_perfect_by,
+ alter_perfect_dt,
+ alter_status,
+ alter_remark,
+ alter_confirm_pro,
+ alter_confirm_by,
+ alter_confirm_dt,
+ sep_dt,
+ rpt_sep_dt,
+ reduce_reason,
+ reduce_detail_reason,
+ sep_perfect_by,
+ sep_perfect_dt,
+ sep_confirm_his,
+ rpt_sep_by,
+ sep_reason,
+ sep_remark,
+ sep_process_status,
+ sep_confirm_dt,
+ sep_confirm_status,
+ sep_confirm_pro,
+ sep_confirm_by,
+ is_sep_call,
+ is_refund,
+ is_need_sign,
+ is_archive,
+ is_same_insur,
+ prev_pointer,
+ next_pointer,
+ type1,
+ type2,
+ type3,
+ type4,
+ type5,
+ batch_id,
+ comm_insur_status,
+ ss_participate_location,
+ labor_relation_unit,
+ is_there_ss_card,
+ is_there_a_coordinate_health,
+ emp_add_id,
+ emp_alter_id,
+ reduce_id,
+ pending_reason,
+ emp_stop_id,
+ process_ins_id,
+ emp_stop_process_state,
+ #{type},
+ create_by,
+ create_dt,
+ mimic_by,
+ proxy_by
+ from hs_emp_hire_sep
+ where emp_hire_sep_id = #{empHireSepId}
+ and is_deleted = 0
+
+
+
+ AND exists (select 1
+ from sl_contract sc
+ where sc.CONTRACT_ID = hs.CONTRACT_ID
+ and sc.is_deleted = 0
+
+ AND sc.contract_type = #{empType}
+
+ )
+
+ and hs.CONTRACT_ID = #{contractId}
+ AND be.emp_name = #{employeeName}
+ AND bc.cust_id = #{custId}
+ AND be.emp_code = #{employeeCode}
+ AND be.idc18 = FNC_15TO18(#{idCardNum})
+ AND hehs.cust_internal_num = #{custInternalNum}
+ AND hs.assigner_provider_id = #{assignerProviderId}
+ AND hs.assignee_provider_id = #{assigneeProviderId}
+ AND hs.subcontract_name LIKE '%${subcontractName}%'
+ AND hehs.rpt_hire_dt >= to_date('${rptHireDt}','yyyy-MM-dd')
+ AND to_date('${rptHireEndDt}','yyyy-MM-dd')+1 > hehs.rpt_hire_dt
+ AND hehs.hire_dt >= to_date('${hireDt}','yyyy-MM-dd')
+ AND to_date('${hireEndDt}','yyyy-MM-dd')+1 > hehs.hire_dt
+ AND hehs.rpt_sep_dt >= to_date('${rptSepDt}','yyyy-MM-dd')
+ AND to_date('${rptSepEndDt}','yyyy-MM-dd') + 1> hehs.rpt_sep_dt
+ AND hehs.sep_dt>= to_date('${sepDt}','yyyy-MM-dd')
+ AND to_date('${sepEndDt}','yyyy-MM-dd')+1 > hehs.sep_dt
+ AND hehs.status = #{status}
+ AND hehs.add_confirm_status = #{addConfirmStatus}
+ AND hehs.alter_status = #{alterStatus}
+ AND hehs.sep_confirm_status = #{sepConfirmStatus}
+ AND sc.ENHANCED_AGENT = #{enhancedAgent}
+ and
+ hs.assigner_cs_id = #{assignerCsId}
+
+ and
+ hs.assignee_cs_id = #{assigneeCsId}
+
+ and
+ sc.area_type = #{areaType}
+
+ and
+ hs.assignment_type = #{assignmentType}
+
+ AND hehs.COMM_INSUR_STATUS = #{commInsurStatus}
+ and
+ exists( select 1 from hs_subcontract_service hss
+ where hss.subcontract_id = hs.subcontract_id
+ and hss.is_deleted = 0
+ and
+ hss.svc_provider_id = #{svcProviderId}
+
+ and
+ hss.cs_id = #{csId}
+
+ )
+
+ and
+ bg.customer_size = #{customerSize}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ and
+ hehs.add_confirm_status = #{addConfirmStatus}
+
+ and
+ hehs.cust_internal_num = #{custInternalNum}
+
+ and
+ bc.cust_code = #{custCode}
+
+ and
+ instr(bc.cust_name,#{custName}) > 0
+
+ and
+ be.emp_code = #{employeeCode}
+
+ and
+ be.emp_name = #{employeeName}
+
+ and
+ be.idc18 = FNC_15TO18(#{idCardNum})
+
+ and
+ hs.assigner_provider_id = #{assignerProviderId}
+
+ and
+ hs.assignee_provider_id = #{assigneeProviderId}
+
+ and
+ hs.assigner_cs_id = #{assignerCsId}
+
+ and
+ hs.assignee_cs_id = #{assigneeCsId}
+
+ and
+ hs.subcontract_name like '%${subcontractName}%'
+
+ and
+ sc.area_type = #{areaType}
+
+
+
+
+
+
+
+
+
+
+ and
+ hehs.sep_confirm_status = 20 and sdi.provider_type=1
+ and hs.assignee_cs_id = #{userId}
+ and exists
+ (select 1
+ from sys_user_department_relation dr, sys_department_info di
+ where dr.department_id = di.department_id
+ and dr.is_deleted = 0
+ and dr.status = 1
+ and dr.user_id = hs.assignee_cs_id
+ and di.governing_branch = hs.assignee_provider_id
+ )
+
+ and
+ hehs.sep_confirm_status = 30
+ and hs.assigner_cs_id = #{userId}
+ and exists
+ (select 1
+ from sys_user_department_relation dr, sys_department_info di
+ where dr.department_id = di.department_id
+ and dr.is_deleted = 0
+ and dr.status = 1
+ and dr.user_id = hs.assigner_cs_id
+ and di.governing_branch = hs.assigner_provider_id
+ )
+
+ and
+ hehs.add_confirm_status = #{addConfirmStatus}
+
+ and
+ hehs.sep_confirm_status = #{sepConfirmStatus}
+
+ and
+ hehs.cust_internal_num = #{custInternalNum}
+
+ and
+ bc.cust_code = #{custCode}
+
+ and
+ instr(bc.cust_name,#{custName}) > 0
+
+ and
+ be.emp_code = #{employeeCode}
+
+ and
+ be.emp_name = #{employeeName}
+
+ and
+ be.idc18 = FNC_15TO18(#{idCardNum})
+
+ and
+ hs.assigner_provider_id = #{assignerProviderId}
+
+ and
+ hs.assignee_provider_id = #{assigneeProviderId}
+
+ and
+ hs.assigner_cs_id = #{assignerCsId}
+
+ and
+ hs.assignee_cs_id = #{assigneeCsId}
+
+ and
+ hs.subcontract_id = #{subcontractId}
+
+ and
+ hs.subcontract_name like '%${subcontractName}%'
+
+ and
+
+ hehs.rpt_sep_dt >= to_date(#{rptSepStartDt},'yyyy-mm-dd')
+
+
+ and
+
+ hehs.rpt_sep_dt < to_date(#{rptSepEndDt},'yyyy-mm-dd') + 1
+
+
+ and
+ sc.area_type = #{areaType}
+
+ and
+ hehs.emp_type = #{empType}
+
+ and
+ bg.customer_size = #{customerSize}
+
+ and
+ hehs.sep_reason = #{sepReason}
+
+ and
+ hehs.reduce_reason = #{reduceReason}
+
+ and
+ qt.material_sign_status = #{materialSignStatus}
+
+
+
+
+
+
+
+
+ update hs_emp_hire_sep hehs
+ set (hehs.contract_id,
+ hehs.subcontract_id,
+ hehs.DEC_SALARY,
+ hehs.emp_id,
+ hehs.cust_id,
+ hehs.cust_internal_num,
+ hehs.hire_quotation_id,
+ hehs.sep_quotation_id,
+ hehs.emp_type,
+ hehs.status,
+ hehs.rpt_hire_dt,
+ hehs.hire_dt,
+ hehs.rpt_hire_by,
+ hehs.add_reason,
+ hehs.hire_competitor,
+ hehs.hire_remark,
+ hehs.is_hire_call,
+ hehs.actual_work_loc,
+ hehs.file_cab_code,
+ hehs.folder_code,
+ hehs.position_id,
+ hehs.add_perfect_dt,
+ hehs.add_confirm_status,
+ hehs.add_confirm_pro,
+ hehs.add_remark,
+ hehs.add_confirm_by,
+ hehs.add_confirm_dt,
+ hehs.alter_perfect_dt,
+ hehs.alter_status,
+ hehs.alter_remark,
+ hehs.alter_confirm_pro,
+ hehs.alter_confirm_by,
+ hehs.alter_confirm_dt,
+ hehs.sep_dt,
+ hehs.rpt_sep_dt,
+ hehs.reduce_reason,
+ hehs.reduce_detail_reason,
+ hehs.sep_perfect_dt,
+ hehs.sep_confirm_his,
+ hehs.rpt_sep_by,
+ hehs.sep_reason,
+ hehs.sep_remark,
+ hehs.sep_process_status,
+ hehs.sep_confirm_dt,
+ hehs.sep_confirm_status,
+ hehs.sep_confirm_pro,
+ hehs.sep_confirm_by,
+ hehs.is_sep_call,
+ hehs.is_refund,
+ hehs.is_need_sign,
+ hehs.is_archive,
+ hehs.prev_pointer,
+ hehs.next_pointer,
+ hehs.type1,
+ hehs.type2,
+ hehs.type3,
+ hehs.type4,
+ hehs.type5,
+ hehs.batch_id,
+ hehs.create_by,
+ hehs.create_dt,
+ hehs.update_by,
+ hehs.update_dt,
+ hehs.mimic_by,
+ hehs.proxy_by) =
+ (select hehsh.contract_id,
+ hehsh.subcontract_id,
+ hehsh.DEC_SALARY,
+ hehsh.emp_id,
+ hehsh.cust_id,
+ hehsh.cust_internal_num,
+ hehsh.hire_quotation_id,
+ hehsh.sep_quotation_id,
+ hehsh.emp_type,
+ hehsh.status,
+ hehsh.rpt_hire_dt,
+ hehsh.hire_dt,
+ hehsh.rpt_hire_by,
+ hehsh.add_reason,
+ hehsh.hire_competitor,
+ hehsh.hire_remark,
+ hehsh.is_hire_call,
+ hehsh.actual_work_loc,
+ hehsh.file_cab_code,
+ hehsh.folder_code,
+ hehsh.position_id,
+ hehsh.add_perfect_dt,
+ hehsh.add_confirm_status,
+ hehsh.add_confirm_pro,
+ hehsh.add_remark,
+ hehsh.add_confirm_by,
+ hehsh.add_confirm_dt,
+ hehsh.alter_perfect_dt,
+ hehsh.alter_status,
+ hehsh.alter_remark,
+ hehsh.alter_confirm_pro,
+ hehsh.alter_confirm_by,
+ hehsh.alter_confirm_dt,
+ hehsh.sep_dt,
+ hehsh.rpt_sep_dt,
+ hehsh.reduce_reason,
+ hehsh.reduce_detail_reason,
+ hehsh.sep_perfect_dt,
+ hehsh.sep_confirm_his,
+ hehsh.rpt_sep_by,
+ hehsh.sep_reason,
+ hehsh.sep_remark,
+ hehsh.sep_process_status,
+ hehsh.sep_confirm_dt,
+ hehsh.sep_confirm_status,
+ hehsh.sep_confirm_pro,
+ hehsh.sep_confirm_by,
+ hehsh.is_sep_call,
+ hehsh.is_refund,
+ hehsh.is_need_sign,
+ hehsh.is_archive,
+ hehsh.prev_pointer,
+ hehsh.next_pointer,
+ hehsh.type1,
+ hehsh.type2,
+ hehsh.type3,
+ hehsh.type4,
+ hehsh.type5,
+ hehsh.batch_id,
+ hehsh.create_by,
+ hehsh.create_dt,
+ hehsh.update_by,
+ hehsh.update_dt,
+ hehsh.mimic_by,
+ hehsh.proxy_by
+ from hs_emp_hire_sep_his hehsh
+ where hehsh.emp_hire_sep_id = hehs.emp_hire_sep_id
+ and is_deleted = 0)
+ where hehs.emp_hire_sep_id = #{empHireSepId}
+ and exists (select 'x'
+ from hs_emp_hire_sep_his hehsha
+ where hehsha.emp_hire_sep_id = hehs.emp_hire_sep_id
+ and hehsha.type = #{type})
+
+
+
+ update hs_emp_hire_sep_his set is_deleted = 1,update_dt = sysdate where emp_hire_sep_id = #{empHireSepId}
+
+
+
+
+ and
+ hehs.status = #{status}
+
+ and
+ hehs.cust_internal_num = #{custInternalNum}
+
+ and
+ bc.cust_code = #{custCode}
+
+ and
+ instr(bc.cust_name,#{custName}) > 0
+
+ and
+ be.emp_code = #{employeeCode}
+
+ and
+ be.idc18 = FNC_15TO18(#{idCardNum})
+
+ and
+ be.emp_name = #{employeeName}
+
+ and
+ hs.assigner_provider_id = #{assignerProviderId}
+
+ and
+ hs.assignee_provider_id = #{assigneeProviderId}
+
+ and
+ hs.assigner_cs_id = #{assignerCsId}
+
+ and
+ hs.assignee_cs_id = #{assigneeCsId}
+
+ and
+ hs.subcontract_name like '%${subcontractName}%'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ and
+ hbao.batch_alter_name like '%${batchAlterName}%'
+
+ and
+ bc.cust_id = #{custId}
+
+ and
+ hbao.create_dt >= to_date(#{createDt},'yyyy-mm-dd')
+
+ and
+
+ hbao.create_dt < to_date(#{createDtTo},'yyyy-mm-dd') + 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ insert into hs_batch_alter_order
+ IS_DELETED,CREATE_DT
+ ,
+ BATCH_ALTER_ID
+
+ ,
+ CUST_ID
+
+ ,
+ BATCH_ALTER_NAME
+
+ ,
+ OLD_BILL_TEMPLT_ID
+
+ ,
+ OLD_FEE_TEMPLT_ID
+
+ ,
+ NEW_BILL_TEMPLT_ID
+
+ ,
+ NEW_FEE_TEMPLT_ID
+
+ ,
+ BILL_START_MONTH
+
+ ,
+ FEE_START_MONTH
+
+ ,
+ STATUS
+
+ ,
+ REMARK
+
+ ,
+ CREATE_BY
+
+ ,
+ UPDATE_BY
+
+ ,
+ UPDATE_DT
+
+ ,
+ MIMIC_BY
+
+ ,
+ PROXY_BY
+
+ )
+
+ values
+ 0,sysdate
+ ,
+ #{batchAlterId,jdbcType=DECIMAL}
+
+ ,
+ #{custId,jdbcType=DECIMAL}
+
+ ,
+ #{batchAlterName,jdbcType=VARCHAR}
+
+ ,
+ #{oldBillTempltId,jdbcType=DECIMAL}
+
+ ,
+ #{oldFeeTempltId,jdbcType=DECIMAL}
+
+ ,
+ #{newBillTempltId,jdbcType=DECIMAL}
+
+ ,
+ #{newFeeTempltId,jdbcType=DECIMAL}
+
+ ,
+ #{billStartMonth,jdbcType=VARCHAR}
+
+ ,
+ #{feeStartMonth,jdbcType=VARCHAR}
+
+ ,
+ #{status,jdbcType=DECIMAL}
+
+ ,
+ #{remark,jdbcType=VARCHAR}
+
+ ,
+ #{createBy,jdbcType=DECIMAL}
+
+ ,
+ #{updateBy,jdbcType=DECIMAL}
+
+ ,
+ #{updateDt,jdbcType=DATE}
+
+ ,
+ #{mimicBy,jdbcType=DECIMAL}
+
+ ,
+ #{proxyBy,jdbcType=DECIMAL}
+
+ )
+
+
+
+
+
+ insert into hs_batch_alter_emp
+ (alter_emp_item_id,
+ emp_hire_sep_id,
+ emp_id,
+ emp_code,
+ emp_name,
+ id_card_type,
+ id_card_num,
+ subcontract_code,
+ subcontract_name,
+ batch_alter_id,
+ is_deleted,
+ create_dt)
+ select seq_hs_batch_alter_emp.nextval,
+ hehs.emp_hire_sep_id,
+ be.emp_id,
+ be.emp_code,
+ be.emp_name,
+ be.id_card_type,
+ be.id_card_num,
+ hs.subcontract_id,
+ hs.subcontract_name,
+ #{batchAlterId},
+ 0,
+ sysdate
+ from hs_emp_hire_sep hehs, bd_employee be, hs_subcontract hs
+ where hehs.subcontract_id = hs.subcontract_id
+ AND hehs.emp_id = be.emp_id
+ AND hehs.emp_hire_sep_id in (${empHireSepIds})
+
+
+
+
+ insert into hs_batch_alter_subcontract
+ (alter_subcontract_item_id,
+ subcontract_id,
+ subcontract_name,
+ assigner_provider_id,
+ assignee_provider_id,
+ batch_alter_id,
+ is_deleted,
+ create_dt)
+ select seq_hs_batch_alter_subcontract.nextval,
+ hs.subcontract_id,
+ hs.subcontract_name,
+ hs.assigner_provider_id,
+ hs.assignee_provider_id,
+ #{batchAlterId},
+ 0,
+ sysdate
+ from hs_subcontract hs
+ where hs.subcontract_id in (${subContractIds})
+
+
+
+
+ insert into hs_batch_alter_product
+ (alter_product_item_id,
+ product_id,
+ product_name,
+ product_category,
+ batch_alter_id,
+ is_deleted,
+ create_dt)
+ select seq_hs_batch_alter_product.nextval,
+ bp.product_id,
+ bp.product_name,
+ bp.category,
+ #{batchAlterId},
+ 0,
+ sysdate
+ from bd_product bp
+ where bp.product_id in (${productIds})
+
+
+
+
+ insert into hs_batch_alter_prod_category
+ (alter_category_item_id,
+ product_category_id,
+ product_category,
+ batch_alter_id,
+ is_deleted,
+ create_dt)
+ select seq_hs_batch_alter_prod_cate.nextval,
+ bbd.base_data_code,
+ bbd.base_data_name,
+ #{batchAlterId},
+ 0,
+ sysdate
+ from bd_base_data bbd
+ where bbd.base_data_code in (${productCategoryIds})
+ and bbd.type = 98
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SELECT efm.emp_id || ef.EMP_HIRE_SEP_ID || efm.service_month as empfeemonthNo,
+ ef.product_id productId,
+ ehs.cust_id cusId,
+ row_number() over(PARTITION BY efm.emp_id || ef.EMP_HIRE_SEP_ID || efm.service_month,ef.product_id ORDER BY ef.product_id) ifrow,
+ dense_rank() over (order by ef.emp_id || ef.emp_hire_sep_id || efm.service_month) rankNum,
+ efm.emp_id empId,
+ emp.emp_name empName,
+ emp.emp_code empCode,
+ (select bbd.base_data_name from bd_base_data bbd where bbd.base_data_code = emp.id_card_type and bbd.type = 45) AS idcardtype,
+ emp.id_card_num idcnum,
+ cus.cust_name cusName,
+ cus.cust_code cusCode,
+ subcontract.subcontract_code subcontractCode,
+ subcontract.subcontract_name subcontractName,
+ q.quotation_name quotationName,
+ dep1.department_name assignerProvider,
+ user1.real_name assignerCsid,
+ dep2.department_name assigneeProvider,
+ user2.real_name assigneeCsid,
+ case ehs.status when 1 then '入职未生效' when 2 then '在职' when 3 then '离职' end status,
+ case ehs.add_confirm_status when 1 then '增员未提交' when 20 then '等待接单方确认' when 22 then '接单方挂起'
+ when 30 then '等待派单方确认' when 40 then '增员完成' end addConfirmStatus,
+ case ehs.sep_confirm_status when 1 then '离职未提交' when 20 then '等待接单方确认' when 23 then '接单方驳回'
+ when 30 then '等待派单方确认' when 40 then '离职完成' end sepConfirmStatus,
+ case ehs.alter_status when 1 then '变更未提交' when 20 then '等待接单方确认' when 30 then '等待派单方确认'
+ when 40 then '变更最终确认' end alterStatus,
+ ef.ss_group_id groupId,
+ ssgroup.insurance_name groupName,
+ efm.service_month serviceMonth,
+ efm.bill_month billMonth,
+ efm.e_base eBase,
+ efm.e_ratio e_Ratio,
+ efm.e_amt e_Amt,
+ efm.p_base p_Base,
+ efm.p_ratio p_Ratio,
+ efm.p_amt p_Amt,
+ efm.amount amount,
+ ert.RECEIVABLE_TEMPLT_NAME eBillTemplt,
+ erf.FREQUENCY_NAME eFeeTemplt,
+ pb.category category,
+ ehs.dec_salary decSalary --gang.wen
+ FROM hs_emp_hire_sep ehs,
+ bd_employee emp,
+ bd_customer cus,
+ hs_subcontract subcontract,
+ sl_quotation q,
+ sys_department_info dep1,
+ sys_user_info user1,
+ sys_department_info dep2,
+ sys_user_info user2,
+ hs_emp_fee ef,
+ hs_emp_fee_month efm,
+ ss_group ssgroup,
+ bd_product pb,
+ EF_RECEIVABLE_TEMPLATE ert,
+ ef_receivable_frequency erf
+ WHERE ehs.emp_id = emp.emp_id
+ AND ehs.cust_id = cus.cust_id
+ AND subcontract.assigner_provider_id = dep1.department_id
+ AND subcontract.assigner_cs_id = user1.user_id(+)
+ AND subcontract.assignee_provider_id = dep2.department_id
+ AND subcontract.assignee_cs_id = user2.user_id
+ AND ehs.subcontract_id = subcontract.subcontract_id
+ AND ef.quotation_id=q.quotation_id(+)
+ AND ehs.emp_hire_sep_id = ef.emp_hire_sep_id
+ AND ef.emp_fee_id = efm.emp_fee_id
+ AND efm.ss_group_id=ssgroup.ss_group_id(+)
+ AND efm.product_id=pb.product_id
+ AND efm.E_BILL_TEMPLT_ID=ert.RECEIVABLE_TEMPLT_ID
+ AND efm.E_FEE_TEMPLT_ID=erf.FREQUENCY_ID(+)
+ AND ehs.is_deleted = 0
+ AND ef.is_deleted = 0
+ AND subcontract.is_deleted = 0
+ AND efm.is_valid = 1
+ AND efm.is_deleted = 0
+
+ and
+ ehs.cust_id=#{custId}
+
+ and
+ ert.receivable_templt_id=#{receivableTempltId}
+
+ and
+ emp.EMP_CODE=#{empCode}
+
+ and
+ emp.EMP_NAME = #{empName}
+
+ and
+ emp.ID_CARD_TYPE=#{idcType}
+
+ and
+ emp.ID_CARD_NUM=#{idcNum}
+
+ and
+ ehs.SUBCONTRACT_ID=#{subcontractId}
+
+ and
+ subcontract.assigner_provider_id=#{assignerProviderId}
+
+ and
+ subcontract.assignee_provider_id=#{assigneeProviderId}
+
+ and
+ user1.user_id=#{assignerCsId}
+
+ and
+ user2.user_id=#{assigneeCsId}
+
+ and
+ ehs.ADD_CONFIRM_STATUS=#{Addconfirmstatus}
+
+ and
+ ehs.SEP_CONFIRM_STATUS=#{Sepconfirmstatus}
+
+ and
+ ehs.add_confirm_status in (${addconfirmstatusFW})
+
+ and
+ ehs.SEP_CONFIRM_STATUS in (${sepconfirmstatusFW})
+
+ and
+ ehs.ALTER_STATUS=#{AlterStatus}
+
+ and
+ ehs.ALTER_STATUS in (${AlterstatusFW})
+
+ and
+
+ efm.SERVICE_MONTH >=#{serviceMonthStart}
+
+
+
+ and
+
+ efm.SERVICE_MONTH <=#{serviceMonthEnd}
+
+
+ and
+
+ efm.BILL_MONTH >=#{billMonthStart}
+
+
+ and
+
+ efm.BILL_MONTH <=#{billMonthEnd}
+
+
+
+ order by efm.emp_id || ef.EMP_HIRE_SEP_ID || efm.service_month,ifrow,ef.product_id
+
+
+
+ update HS_EMP_HIRE_SEP set UPDATE_DT = sysdate
+ ,
+ CUST_INTERNAL_NUM = #{custInternalNum,jdbcType=DECIMAL}
+
+ ,
+ DEC_SALARY = #{decSalary,jdbcType=DECIMAL}
+
+ ,
+ HIRE_DT = to_date(#{hireDt},'yyyy-mm-dd')
+
+ ,
+ SEP_DT = to_date(#{sepDt},'yyyy-mm-dd')
+
+ ,
+ TYPE1 = #{type1,jdbcType=VARCHAR}
+
+ ,
+ TYPE2 = #{type2,jdbcType=VARCHAR}
+
+ ,
+ TYPE3 = #{type3,jdbcType=VARCHAR}
+
+ ,
+ TYPE4 = #{type4,jdbcType=VARCHAR}
+
+ ,
+ TYPE5 = #{type5,jdbcType=VARCHAR}
+
+ ,
+ SEP_REASON = #{sepReason,jdbcType=VARCHAR}
+
+ ,
+ SEP_REMARK = '${sepRemark}'
+
+ ,
+ SEP_CONFIRM_PRO = '${sepConfirmPro}'
+
+ ,
+ UPDATE_BY = #{updateBy,jdbcType=DECIMAL}
+
+ ,
+ IS_ARCHIVE = '${isArchive}'
+
+ ,
+ ACTUAL_WORK_LOC = '${actualWorkLoc}'
+
+ ,
+ SS_PARTICIPATE_LOCATION = '${ssParticipateLocation}'
+
+ ,
+ LABOR_RELATION_UNIT = '${laborRelationUnit}'
+
+ ,
+ IS_THERE_SS_CARD = '${isThereSsCard}'
+
+ ,
+ IS_THERE_A_COORDINATE_HEALTH = '${isThereACoordinateHealth}'
+
+ ,
+ HIRE_REMARK = '${hireRemark}'
+
+ where EMP_HIRE_SEP_ID = #{empHireSepId,jdbcType=DECIMAL}
+
+
+
+ insert into HS_EMP_HIRE_SEP_EDIT_LOG (CREATE_DT
+ ,
+ EDIT_LOG_ID
+
+ ,
+ EMP_HIRE_SEP_ID
+
+ ,
+ CUST_INTERNAL_NUM
+
+ ,
+ HIRE_DT
+
+ ,
+ SEP_DT
+
+ ,
+ TYPE1
+
+ ,
+ TYPE2
+
+ ,
+ TYPE3
+
+ ,
+ TYPE4
+
+ ,
+ TYPE5
+
+ ,
+ CREATE_BY
+
+ ,
+ MIMIC_BY
+
+ ,
+ PROXY_BY
+
+ ,
+ IS_ARCHIVE
+
+ )
+ values (sysdate
+ ,
+ #{editLogId,jdbcType=DECIMAL}
+
+ ,
+ #{empHireSepId,jdbcType=DECIMAL}
+
+ ,
+ #{custInternalNum,jdbcType=DECIMAL}
+
+ ,
+ to_date(#{hireDt},'yyyy-mm-dd')
+
+ ,
+ to_date(#{sepDt},'yyyy-mm-dd')
+
+ ,
+ #{type1,jdbcType=VARCHAR}
+
+ ,
+ #{type2,jdbcType=VARCHAR}
+
+ ,
+ #{type3,jdbcType=VARCHAR}
+
+ ,
+ #{type4,jdbcType=VARCHAR}
+
+ ,
+ #{type5,jdbcType=VARCHAR}
+
+ ,
+ #{createBy,jdbcType=DECIMAL}
+
+ ,
+ #{mimicBy,jdbcType=DECIMAL}
+
+ ,
+ #{proxyBy,jdbcType=DECIMAL}
+
+ ,
+ #{isArchive}
+
+ )
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {call PRC_IMP_INTERNAL_TYPE (?,?)}
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file