618 lines
34 KiB
XML
618 lines
34 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
||
<!DOCTYPE mapper
|
||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||
<mapper namespace="com.bonus.gzrn.rnbmw.basic.dao.ProjectDao">
|
||
<!--工程查询页面-->
|
||
<select id="getProList" resultType="com.bonus.gzrn.rnbmw.basic.entity.ProjectBean">
|
||
SELECT bp.id ,pc.`org_name` as orgName,bp.name as name,bp.pro_type as proType,sdd.name as voltageLevel,bp.status
|
||
as status,
|
||
bp.origin AS origin,bp.is_push as isPush, bp.push_time as pushTime
|
||
FROM bm_project bp
|
||
LEFT JOIN pm_company pc on bp.company_id = pc.ID
|
||
LEFT JOIN sys_dic_detail sdd on sdd.id = bp.voltage_level
|
||
where bp.IS_ACTIVE = 1
|
||
<if test="params.companyId!=null and params.companyId!='' ">
|
||
and pc.ID =#{params.companyId}
|
||
</if>
|
||
<if test="params.status!='全部'">
|
||
and bp.`STATUS` =#{params.status}
|
||
</if>
|
||
<if test="params.proId!=null and params.proId!='' ">
|
||
and bp.ID= #{params.proId}
|
||
</if>
|
||
|
||
limit #{offset}, #{limit}
|
||
</select>
|
||
|
||
<!--工程查询页面-->
|
||
<select id="getProById" resultType="com.bonus.gzrn.rnbmw.basic.entity.ProjectBean">
|
||
SELECT bp.id ,pc.`org_name` as orgName,bp.name as name,bp.pro_type as proType,sdd.name as voltageLevel,bp.status
|
||
as status,
|
||
bp.origin AS origin,bp.is_push as isPush, bp.push_time as pushTime, bp.lon, bp.lat
|
||
FROM bm_project bp
|
||
LEFT JOIN pm_company pc on bp.company_id = pc.ID
|
||
LEFT JOIN sys_dic_detail sdd on sdd.id = bp.voltage_level
|
||
where bp.IS_ACTIVE = 1
|
||
<if test="params.proId!=null and params.proId!='' ">
|
||
and bp.ID= #{params.proId}
|
||
</if>
|
||
</select>
|
||
|
||
<!--工程数量-->
|
||
<select id="getProjectCount" resultType="java.lang.Integer">
|
||
SELECT COUNT(1) FROM bm_project bp
|
||
LEFT JOIN pm_company pc on bp.company_id = pc.ID
|
||
where bp.IS_ACTIVE = 1
|
||
<if test="params.companyId!=null and params.companyId!='' ">
|
||
and pc.ID =#{params.companyId}
|
||
</if>
|
||
<if test="params.status!='全部'">
|
||
and bp.`STATUS` =#{params.status}
|
||
</if>
|
||
<if test="params.proId!=null and params.proId!='' ">
|
||
and bp.ID= #{params.proId}
|
||
</if>
|
||
</select>
|
||
|
||
<!--新增工程-->
|
||
<insert id="addProject" parameterType="com.bonus.gzrn.rnbmw.basic.entity.ProjectBean" keyProperty="id"
|
||
keyColumn="ID" useGeneratedKeys="true">
|
||
insert into bm_project(`name`, `org_id`, company_id, `abbreviation`, `pro_type`, `status`,
|
||
`voltage_level`, `power_grid`, `origin`, `lon`, `lat`, `record_id`,
|
||
`start_time`, `end_time`, `contractSigningDate`, `contractPrice`, `isRegistered`,
|
||
`registerAddressCode`, `isInsurance`, `payment_type`, `security_payments`,
|
||
`payment_file`, tripartiteAgreementUrl,
|
||
`payDate`, `labourSpecialName`, `labourSpecialPhone`, `labourSpecialIdCard`,
|
||
`board_file`, `pro_leader`,
|
||
`bank_account`, `special_bank_type`, `open_bank_type`, `account_name`,
|
||
`pro_leader_phone`,
|
||
`open_bank_number`, `bank_name`, `pay_way`, `account_balance`, `update_time`,
|
||
`is_active`, `construction_contract_url`, `set_tlement_date`, `set_tlement_cycle`,
|
||
`set_tlement_amount`)
|
||
values (#{name}, #{orgId}, #{companyId}, #{abbreviation}, #{proType}, #{status},
|
||
#{voltageLevel}, #{powerGrid}, #{origin}, #{lon}, #{lat}, #{recordId},
|
||
#{startTime}, #{endTime}, #{contractSigningDate}, #{contractPrice}, #{isRegistered},
|
||
#{registerAddressCode}, #{isInsurance}, #{paymentType}, #{securityPayments}, #{paymentFile},
|
||
#{tripartiteAgreementUrl},
|
||
#{payDate}, #{labourSpecialName}, #{labourSpecialPhone}, #{labourSpecialIdCard}, #{boardFile},
|
||
#{proLeader}, #{bankAccount}, #{specialBankType}, #{openBankType}, #{accountName}, #{proLeaderPhone},
|
||
#{openBankNumber}, #{bankName}, #{payWay}, #{accountBalance}, now(), '1', #{constructionContractUrl},
|
||
#{setTlementDate}, #{setTlementCycle}, #{setTlementAmount})
|
||
</insert>
|
||
|
||
<!--查询分公司-->
|
||
<select id="getCompanys" parameterType="java.lang.String"
|
||
resultType="com.bonus.gzrn.rnbmw.manager.entity.BaseBean">
|
||
select ID, `org_name` as name
|
||
from pm_company
|
||
where IS_ACTIVE = 1
|
||
<if test="companyId != null and companyId != '' ">
|
||
and id= #{companyId}
|
||
</if>
|
||
</select>
|
||
<!--根据id查找-->
|
||
<select id="getProjectById" resultType="com.bonus.gzrn.rnbmw.basic.entity.ProjectBean">
|
||
select bp.id,
|
||
bp.org_id as orgId,
|
||
bp.company_id as companyId,
|
||
pm.org_name as orgName,
|
||
bp.name as name,
|
||
bp.abbreviation as abbreviation,
|
||
bp.pro_type as proType,
|
||
bp.status as status,
|
||
spo.id as voltageLevelId,
|
||
bp.`power_grid` as powerGrid,
|
||
bp.`origin` as origin,
|
||
bp.`lon` as lon,
|
||
bp.`lat` as lat,
|
||
bp.record_id as recordId,
|
||
bp.`start_time` as startTime,
|
||
bp.`end_time` as endTime,
|
||
bp.`contractSigningDate` as contractSigningDate,
|
||
bp.`contractPrice` as contractPrice,
|
||
bp.`isRegistered` as isRegistered,
|
||
sdd.id as registerAddressCodeId,
|
||
CONCAT(sdd.code, '-', sdd.`name`) as registerAddressCode,
|
||
bp.`isInsurance`,
|
||
bp.`payment_type`,
|
||
bp.`security_payments`,
|
||
bp.`payment_file`,
|
||
bp.`payDate` as payDate,
|
||
bp.`labourSpecialName` as labourSpecialName,
|
||
bp.`labourSpecialPhone` as labourSpecialPhone,
|
||
bp.`labourSpecialIdCard` as labourSpecialIdCard,
|
||
bp.`board_file` as boardFile,
|
||
bp.`project_manager` as projectManager,
|
||
bp.`phone` as phone,
|
||
bp.`manager_number` as managerNumber,
|
||
bp.`approachDate` as approachDate,
|
||
bp.`pro_leader` as proLeader,
|
||
sd.id as bankAccountId,
|
||
bp.`special_bank_type` as specialBankType,
|
||
bp.`open_bank_type` as openBankType,
|
||
bp.`account_name` as accountName,
|
||
bp.`pro_leader_phone` as proLeaderPhone,
|
||
bp.`open_bank_number` as openBankNumber,
|
||
bp.`bank_name` as bankName,
|
||
bp.`pay_way` as payWay,
|
||
bp.`construction_contract_url` as constructionContractUrl,
|
||
bp.`set_tlement_date` as setTlementDate,
|
||
bp.`set_tlement_cycle` as setTlementCycle,
|
||
bp.`set_tlement_amount` as setTlementAmount,
|
||
bp.`account_balance` as accountBalance,
|
||
bp.tripartiteAgreementUrl as tripartiteAgreementUrl,
|
||
a.securityMaymentsNum as securityMaymentsNum,
|
||
a.securityName,
|
||
a.fileType,
|
||
a.securityMaymentsFilePaths,
|
||
a.securityMaymentsFileId,
|
||
b.broadNum,
|
||
b.broadFilePaths,
|
||
b.boardFileId,
|
||
orgGeneralContractor.project_manager as orgProjectManager,
|
||
orgGeneralContractor.project_manager_id_card_num as orgProjectManagerIdCardNum,
|
||
orgGeneralContractor.project_manager_phone as orgProjectManagerPhone,
|
||
orgGeneralContractor.project_manager_approach_date as orgApproachDate,
|
||
orgGeneralContractor.principalName as orgPrincipalName,
|
||
orgGeneralContractor.principalNamePhone as orgPrincipalNamePhone,
|
||
orgGeneralContractor.principalNameIdCardNum as orgPrincipalNameIdCardNum,
|
||
orgGeneralContractor.constructionStatus as orgConstructionStatus,
|
||
orgGeneralContractor.legalPersonName as orgLegalPersonName,
|
||
orgGeneralContractor.legalPersonIdCard as orgLegalPersonIdCard,
|
||
orgGeneralContractor.legalPersonPhone as orgLegalPersonPhone,
|
||
orgGeneralContractor.orgType as orgOrgType,
|
||
orgGeneralContractor.registerCapital as orgRegisterCapital,
|
||
orgGeneralContractor.registerAddressCode as orgRegisterAddressCode,
|
||
orgGeneralContractor.postalCode as orgPostalCode,
|
||
orgGeneralContractor.laborerPersonName as orgLaborerPersonName,
|
||
orgGeneralContractor.laborerPersonIdCard as orgLaborerPersonIdCard,
|
||
orgGeneralContractor.laborerPersonPhone as orgLaborerPersonPhone,
|
||
orgGeneralContractor.contactPerson as orgContactPerson,
|
||
orgGeneralContractor.contactPersonPhone as orgContactPersonPhone,
|
||
orgGeneralContractor.officeAddress as orgOfficeAddress,
|
||
orgGeneralContractor.registDate as orgRegistDate,
|
||
orgGeneralContractor.org_name as orgOrgName,
|
||
orgGeneralContractor.org_credit_code as orgCreditCode,
|
||
orgGeneralContractor.register_address as orgRegisterAddress,
|
||
orgDesign.project_manager as orgDesignProjectManager,
|
||
orgDesign.project_manager_id_card_num as orgDesignProjectManagerIdCardNum,
|
||
orgDesign.project_manager_phone as orgDesignProjectManagerPhone,
|
||
orgDesign.org_name as orgDesignName,
|
||
orgDesign.org_credit_code as orgDesignCreditCode,
|
||
orgDesign.principalName as orgDesignPrincipalName,
|
||
orgDesign.principalNameIdCardNum as orgDesignPrincipalNameIdCardNum,
|
||
orgDesign.principalNamePhone as orgDesignPrincipalNamePhone,
|
||
orgDesign.constructionStatus as orgDesignConstructionStatus,
|
||
orgDesign.project_manager_approach_date as orgDesignApproachDate,
|
||
orgDesign.registerAddressCode as orgDesignRegisterAddressCode,
|
||
orgDesign.legalPersonName as orgDesignLegalPersonName,
|
||
orgDesign.legalPersonIdCard as orgDesignLegalPersonIdCard,
|
||
orgDesign.legalPersonPhone as orgDesignLegalPersonPhone,
|
||
orgDesign.register_address as orgDesignRegisterAddress,
|
||
orgOwner.project_manager as orgOwnerProjectManager,
|
||
orgOwner.project_manager_id_card_num as orgOwnerProjectManagerIdCardNum,
|
||
orgOwner.project_manager_phone as orgOwnerProjectManagerPhone,
|
||
orgOwner.org_name as orgOwnerName,
|
||
orgOwner.org_credit_code as orgOwnerCreditCode,
|
||
orgOwner.legalPersonName as orgOwnerLegalPersonName,
|
||
orgOwner.legalPersonIdCard as orgOwnerLegalPersonIdCard,
|
||
orgOwner.legalPersonPhone as orgOwnerLegalPersonPhone,
|
||
orgOwner.orgType as orgOwnerOrgType,
|
||
orgOwner.registerCapital as orgOwnerRegisterCapital,
|
||
orgOwner.registerAddressCode as orgOwnerRegisterAddressCode,
|
||
orgOwner.postalCode as orgOwnerPostalCode,
|
||
orgOwner.register_address as orgOwnerRegisterAddress,
|
||
orgOwner.laborerPersonName as orgOwnerLaborerPersonName,
|
||
orgOwner.laborerPersonIdCard as orgOwnerLaborerPersonIdCard,
|
||
orgOwner.laborerPersonPhone as orgOwnerLaborerPersonPhone,
|
||
orgOwner.contactPerson as orgOwnerContactPerson,
|
||
orgOwner.contactPersonPhone as orgOwnerContactPersonPhone,
|
||
orgOwner.officeAddress as orgOwnerOfficeAddress,
|
||
orgOwner.registDate as orgOwnerRegistDate,
|
||
orgSupervision.project_manager as orgSupervisionProjectManager,
|
||
orgSupervision.project_manager_id_card_num as orgSupervisionProjectManagerIdCardNum,
|
||
orgSupervision.project_manager_phone as orgSupervisionProjectManagerPhone,
|
||
orgSupervision.org_name as orgSupervisionName,
|
||
orgSupervision.org_credit_code as orgSupervisionCreditCode,
|
||
orgSupervision.principalName as orgSupervisionPrincipalName,
|
||
orgSupervision.principalNameIdCardNum as orgSupervisionPrincipalNameIdCardNum,
|
||
orgSupervision.principalNamePhone as orgSupervisionPrincipalNamePhone,
|
||
orgSupervision.constructionStatus as orgSupervisionConstructionStatus,
|
||
orgSupervision.project_manager_approach_date as orgSupervisionApproachDate,
|
||
orgSupervision.registerAddressCode as orgSupervisionRegisterAddressCode,
|
||
orgSupervision.legalPersonName as orgSupervisionLegalPersonName,
|
||
orgSupervision.legalPersonIdCard as orgSupervisionLegalPersonIdCard,
|
||
orgSupervision.legalPersonPhone as orgSupervisionLegalPersonPhone,
|
||
orgSupervision.register_address as orgSupervisionRegisterAddress,
|
||
orgSurvey.project_manager as orgSurveyProjectManager,
|
||
orgSurvey.project_manager_id_card_num as orgSurveyProjectManagerIdCardNum,
|
||
orgSurvey.project_manager_phone as orgSurveyProjectManagerPhone,
|
||
orgSurvey.org_name as orgSurveyName,
|
||
orgSurvey.org_credit_code as orgSurveyCreditCode,
|
||
orgSurvey.principalName as orgSurveyPrincipalName,
|
||
orgSurvey.principalNameIdCardNum as orgSurveyPrincipalNameIdCardNum,
|
||
orgSurvey.principalNamePhone as orgSurveyPrincipalNamePhone,
|
||
orgSurvey.constructionStatus as orgSurveyConstructionStatus,
|
||
orgSurvey.project_manager_approach_date as orgSurveyApproachDate,
|
||
orgSurvey.registerAddressCode as orgSurveyRegisterAddressCode,
|
||
orgSurvey.legalPersonName as orgSurveyLegalPersonName,
|
||
orgSurvey.legalPersonIdCard as orgSurveyLegalPersonIdCard,
|
||
orgSurvey.legalPersonPhone as orgSurveyLegalPersonPhone,
|
||
orgSurvey.register_address as orgSurveyRegisterAddress
|
||
FROM bm_project bp
|
||
LEFT JOIN bm_project_five_parties orgGeneralContractor
|
||
ON orgGeneralContractor.pro_id = bp.id AND orgGeneralContractor.`type` = '1' AND
|
||
orgGeneralContractor.is_active = '1'
|
||
LEFT JOIN bm_project_five_parties orgDesign
|
||
ON orgDesign.pro_id = bp.id AND orgDesign.`type` = '2' AND orgDesign.is_active = '1'
|
||
LEFT JOIN bm_project_five_parties orgOwner
|
||
ON orgOwner.pro_id = bp.id AND orgOwner.`type` = '3' AND orgOwner.is_active = '1'
|
||
LEFT JOIN bm_project_five_parties orgSupervision
|
||
ON orgSupervision.pro_id = bp.id AND orgSupervision.`type` = '4' AND
|
||
orgSupervision.is_active = '1'
|
||
LEFT JOIN bm_project_five_parties orgSurvey
|
||
ON orgSurvey.pro_id = bp.id AND orgSurvey.`type` = '5' AND orgSurvey.is_active = '1'
|
||
LEFT JOIN pm_company pm on pm.ID = bp.company_id
|
||
LEFT JOIN sys_dic_detail sdd on sdd.id = bp.registerAddressCode
|
||
LEFT JOIN sys_dic_detail sd on sd.id = bp.bank_account
|
||
LEFT JOIN sys_dic_detail spo on spo.id = bp.voltage_level
|
||
left join (select id,
|
||
pro_id,
|
||
GROUP_CONCAT(file_name) as securityName,
|
||
GROUP_CONCAT(file_type) as fileType,
|
||
count(1) as securityMaymentsNum,
|
||
GROUP_CONCAT(file_path) as securityMaymentsFilePaths,
|
||
GROUP_CONCAT(id) AS securityMaymentsFileId
|
||
from bm_project_file
|
||
where pro_id = #{id}
|
||
and is_active = '1'
|
||
and accessory_type = '0'
|
||
group by accessory_type) a on a.pro_id = bp.id
|
||
left join (select id,
|
||
pro_id,
|
||
file_name as boradFileName,
|
||
count(1) as broadNum,
|
||
GROUP_CONCAT(file_path) as broadFilePaths,
|
||
GROUP_CONCAT(id) AS boardFileId
|
||
from bm_project_file
|
||
where pro_id = #{id}
|
||
and is_active = '1'
|
||
and accessory_type = '1'
|
||
group by accessory_type) b on b.pro_id = bp.id
|
||
WHERE bp.IS_ACTIVE = '1'
|
||
AND bp.ID = #{id}
|
||
|
||
</select>
|
||
<!--查询工程id,name-->
|
||
<select id="getProject" resultType="com.bonus.gzrn.rnbmw.basic.entity.ProjectBean">
|
||
select ID,`NAME`
|
||
FROM bm_project
|
||
WHERE IS_ACTIVE = '1'
|
||
<if test="companyId != null and companyId != ''">
|
||
and company_id = #{companyId}
|
||
</if>
|
||
<if test="status != null and status != ''">
|
||
and status = #{status}
|
||
</if>
|
||
ORDER BY `NAME` asc
|
||
</select>
|
||
<!--修改工程-->
|
||
<update id="updateProject">
|
||
update bm_project
|
||
set ID = #{id},
|
||
org_id =#{orgId},
|
||
company_id = #{companyId},
|
||
`name` = #{name},
|
||
abbreviation = #{abbreviation},
|
||
pro_type =#{proType},
|
||
status = #{status},
|
||
voltage_level =#{voltageLevel},
|
||
power_grid =#{powerGrid},
|
||
origin =#{origin},
|
||
lon =#{lon},
|
||
lat =#{lat},
|
||
record_id =#{recordId},
|
||
start_time =#{startTime},
|
||
end_time = #{endTime},
|
||
contractSigningDate =#{contractSigningDate},
|
||
contractPrice =#{contractPrice},
|
||
isRegistered = #{isRegistered},
|
||
registerAddressCode =#{registerAddressCode},
|
||
isInsurance = #{isInsurance},
|
||
payment_type = #{paymentType},
|
||
security_payments = #{securityPayments},
|
||
payment_file = #{paymentFile},
|
||
payDate = #{payDate},
|
||
construction_contract_url = #{constructionContractUrl},
|
||
tripartiteAgreementUrl = #{tripartiteAgreementUrl},
|
||
set_tlement_date = #{setTlementDate},
|
||
set_tlement_cycle = #{setTlementCycle},
|
||
set_tlement_amount = #{setTlementAmount},
|
||
labourSpecialName = #{labourSpecialName},
|
||
labourSpecialPhone = #{labourSpecialPhone},
|
||
labourSpecialIdCard = #{labourSpecialIdCard},
|
||
board_file = #{boardFile},
|
||
project_manager = #{projectManager},
|
||
phone = #{phone},
|
||
manager_number = #{managerNumber},
|
||
approachDate = #{approachDate},
|
||
pro_leader = #{proLeader},
|
||
bank_account = #{bankAccount},
|
||
special_bank_type = #{specialBankType},
|
||
open_bank_type = #{openBankType},
|
||
account_name =#{accountName},
|
||
pro_leader_phone = #{proLeaderPhone},
|
||
open_bank_number =#{openBankNumber},
|
||
bank_name = #{bankName},
|
||
pay_way = #{payWay},
|
||
account_balance =#{accountBalance},
|
||
update_time = now()
|
||
where ID = #{id}
|
||
</update>
|
||
<!--删除工程-->
|
||
<update id="deleteProject">
|
||
update bm_project
|
||
set IS_ACTIVE = 0
|
||
where ID = #{id};
|
||
</update>
|
||
<!--根据名称查询工程-->
|
||
<select id="findByName" resultType="com.bonus.gzrn.rnbmw.basic.entity.ProjectBean">
|
||
select ID, `NAME`
|
||
FROM bm_project
|
||
WHERE IS_ACTIVE = 1
|
||
and `name` = #{name} limit 1
|
||
</select>
|
||
<select id="findProjectRel" resultType="com.bonus.gzrn.rnbmw.basic.entity.ProjectBean">
|
||
select *
|
||
from (select DISTINCT bp.ID, '施工现场' relType
|
||
FROM bm_project bp,
|
||
bm_work_scene scene
|
||
WHERE scene.IS_ACTIVE = 1
|
||
and bp.ID = scene.PRO_ID
|
||
and bp.ID = #{id}
|
||
union
|
||
select DISTINCT pro_id id, '分包商' relType
|
||
from bm_sub_pro_relation
|
||
where pro_id = #{id}
|
||
union
|
||
select DISTINCT pro_id id, '建管单位' relType
|
||
from bm_builder_pro_relation
|
||
where pro_id = #{id}) r
|
||
</select>
|
||
<!-- 查询工程是否存在-->
|
||
<select id="isRepeat" resultType="java.lang.Integer">
|
||
select count(*)
|
||
from bm_project
|
||
where `name` = #{name}
|
||
and is_active = '1'
|
||
</select>
|
||
<!-- 查询在场人数-->
|
||
<select id="getAllWorker" resultType="java.lang.Integer">
|
||
select count(ID_NUMBER)
|
||
from bm_project bp
|
||
left join bm_worker_record bwr on bp.ID = bwr.PROJECT_ID and bwr.IS_ACTIVE = '1'
|
||
where bp.ID = #{id}
|
||
and bp.is_active = '1'
|
||
group by bp.id
|
||
</select>
|
||
<!--插入表格信息到信息表-->
|
||
<insert id="insert" parameterType="com.bonus.gzrn.rnbmw.basic.entity.ProjectBean" useGeneratedKeys="true"
|
||
keyProperty="id">
|
||
insert into bm_project
|
||
(org_id,company_id,name,abbreviation,pro_type,voltage_level,power_grid,isRegistered,registerAddressCode,origin,lon,lat,status,contractSigningDate,
|
||
contractPrice,
|
||
start_time, end_time,pro_leader,pro_leader_phone,isInsurance,security_payments,payment_type,labourSpecialName,
|
||
labourSpecialPhone,
|
||
labourSpecialIdCard,payDate,
|
||
project_manager,phone,manager_number,approachDate,bank_account,account_name,open_bank_type,special_bank_type,
|
||
pay_way,open_bank_number,bank_name,account_balance,update_time,is_active)
|
||
values
|
||
(#{orgId},#{orgId},#{name},#{abbreviation},#{proType},#{voltageLevel},#{powerGrid},#{isRegistered},#{registerAddressCodeId},#{origin},
|
||
#{lon},#{lat},#{status},#{contractSigningDate},#{contractPrice},#{startTime},#{endTime},#{proLeader},
|
||
#{proLeaderPhone},#{isInsurance},#{securityPayments},#{paymentType},#{labourSpecialName},#{labourSpecialPhone},#{labourSpecialIdCard},#{payDate},
|
||
#{projectManager},#{phone},#{managerNumber},#{approachDate},#{bankAccountId},#{accountName},#{openBankType},#{specialBankType},
|
||
#{payWay},#{openBankNumber},#{bankName},#{accountBalance},now(),1)
|
||
<!--<foreach item="params" collection="list" separator=",">
|
||
(#{params.orgId},#{params.orgId},#{params.name},#{params.abbreviation},#{params.proType},#{params.voltageLevel},#{params.powerGrid},#{params.isRegistered},#{params.registerAddressCodeId},#{params.origin},
|
||
#{params.lon},#{params.lat},#{params.status},#{params.contractSigningDate},#{params.contractPrice},#{params.startTime},#{params.endTime},#{params.proLeader},
|
||
#{params.proLeaderPhone},#{params.isInsurance},#{params.securityPayments},#{params.paymentType},#{params.labourSpecialName},#{params.labourSpecialPhone},#{params.labourSpecialIdCard},#{params.payDate},
|
||
#{params.projectManager},#{params.phone},#{params.managerNumber},#{params.approachDate},#{params.bankAccountId},#{params.accountName},#{params.openBankType},#{params.specialBankType},
|
||
#{params.payWay},#{params.openBankNumber},#{params.bankName},#{params.accountBalance},now(),1)
|
||
</foreach>-->
|
||
</insert>
|
||
<!-- 获取公司orgId-->
|
||
<select id="getOrgId" resultType="java.lang.String">
|
||
select ID as orgId
|
||
from pm_company
|
||
where org_name = #{orgName}
|
||
and is_active = 1
|
||
</select>
|
||
<!-- 获取行政区编码-->
|
||
<select id="getRegisterAddressCode" resultType="com.bonus.gzrn.rnbmw.basic.entity.ProjectBean">
|
||
select id, name, code
|
||
from sys_dic_detail
|
||
where dic_type = 2
|
||
</select>
|
||
<!-- 获取银行-->
|
||
<select id="getBankAccount" resultType="com.bonus.gzrn.rnbmw.basic.entity.ProjectBean">
|
||
select id, name
|
||
from sys_dic_detail
|
||
where dic_type = 4
|
||
and is_active = '1'
|
||
</select>
|
||
<!-- 获取行政区编码id-->
|
||
<select id="getRegisterAddressCodeID" resultType="java.lang.String">
|
||
select id
|
||
from sys_dic_detail
|
||
where code = #{registerAddressCode}
|
||
</select>
|
||
<!-- 获取银行id-->
|
||
<select id="getBankAccountId" resultType="java.lang.String">
|
||
select id
|
||
from sys_dic_detail
|
||
where name = #{bankAccount}
|
||
</select>
|
||
<!-- 验证工程名称是否存在-->
|
||
<select id="verifyProjectIsExist" resultType="java.lang.String">
|
||
select name
|
||
from bm_project
|
||
where name = #{name}
|
||
AND is_active = 1
|
||
</select>
|
||
<!-- 获取公司conpanyId-->
|
||
<select id="getCompanyId" resultType="java.lang.String">
|
||
select COMPANY_ID as companyId
|
||
from pm_organization
|
||
where ID = #{orgId}
|
||
and IS_ACTIVE = '1'
|
||
</select>
|
||
<!-- 获取电压等级-->
|
||
<select id="getPowerLevel" resultType="com.bonus.gzrn.rnbmw.basic.entity.ProjectBean">
|
||
select id, name
|
||
from sys_dic_detail
|
||
where dic_type = 5
|
||
and is_active = '1'
|
||
</select>
|
||
<!-- 验证公司是否存在-->
|
||
<select id="verifyOrgNameIsExist" resultType="java.lang.String">
|
||
select org_name as orgName
|
||
from pm_company
|
||
where org_name = #{orgName}
|
||
AND is_active = 1
|
||
</select>
|
||
<!-- 验证电压等级是否存在数据库表-->
|
||
<select id="verifyPowerLevelIsExist" resultType="java.lang.String">
|
||
select name
|
||
from sys_dic_detail
|
||
where name = #{powerLevel}
|
||
and is_active = 1
|
||
</select>
|
||
<!-- 获取电压等级ID-->
|
||
<select id="getPowerLevelID" resultType="java.lang.String">
|
||
select id
|
||
from sys_dic_detail
|
||
where name = #{powerLevel}
|
||
</select>
|
||
<!-- 获取工程ID-->
|
||
<select id="getProjectId" resultType="java.lang.String">
|
||
select ID as id
|
||
from bm_project
|
||
where name = #{name}
|
||
and is_active = '1'
|
||
</select>
|
||
<!-- 新增附件-->
|
||
<insert id="savePaymentType">
|
||
insert into bm_project_file(pro_id, file_name, file_path, file_type, accessory_type, upload_user_id,
|
||
update_time, is_active)
|
||
values (#{proId}, #{fileName}, #{filePath}, #{fileType}, #{accessoryType}, #{uploadUser}, #{updateTime}, '1')
|
||
</insert>
|
||
|
||
|
||
<insert id="addProjectFive">
|
||
insert into bm_project_five_parties(pro_id,org_name,org_credit_code,project_manager,project_manager_id_card_num,
|
||
project_manager_phone,project_manager_approach_date,register_address,`type`, principalName, principalNamePhone,
|
||
principalNameIdCardNum, constructionStatus, legalPersonName, legalPersonIdCard, legalPersonPhone, orgType,
|
||
registerCapital, registerAddressCode, postalCode, laborerPersonName, laborerPersonIdCard, laborerPersonPhone,
|
||
contactPerson, contactPersonPhone, officeAddress, registDate)
|
||
values
|
||
<foreach item="params" collection="list" separator=",">
|
||
(
|
||
#{params.proId},#{params.orgName},#{params.orgCreditCode},#{params.projectManager},#{params.projectManagerIdCardNum},
|
||
#{params.projectManagerPhone},#{params.approachDate},#{params.registerAddress},#{params.type},
|
||
#{params.principalName},
|
||
#{params.principalNamePhone}, #{params.principalNameIdCardNum}, #{params.constructionStatus},
|
||
#{params.legalPersonName},
|
||
#{params.legalPersonIdCard}, #{params.legalPersonPhone}, #{params.orgType}, #{params.registerCapital},
|
||
#{params.registerAddressCode}, #{params.postalCode}, #{params.laborerPersonName},
|
||
#{params.laborerPersonIdCard},
|
||
#{params.laborerPersonPhone}, #{params.contactPerson}, #{params.contactPersonPhone},
|
||
#{params.officeAddress}, #{params.registDate}
|
||
)
|
||
</foreach>
|
||
</insert>
|
||
|
||
|
||
<select id="getEinTime" parameterType="com.bonus.gzrn.rnbmw.basic.entity.ProjectBean" resultType="java.lang.String">
|
||
SELECT EIN_TIME as einTime
|
||
FROM bm_worker_attend_history
|
||
WHERE ID_NUMBER = #{idNumber}
|
||
ORDER BY EIN_TIME desc LIMIT 1
|
||
</select>
|
||
<!-- 修改完工状态为已完工 筹建 在建 完工 停工-->
|
||
<update id="finishProject" parameterType="com.bonus.gzrn.rnbmw.basic.entity.ProjectBean">
|
||
update bm_project
|
||
set status = "完工"
|
||
where ID = #{id}
|
||
and is_active = '1'
|
||
</update>
|
||
<select id="getIdNumber" parameterType="com.bonus.gzrn.rnbmw.basic.entity.ProjectBean"
|
||
resultType="com.bonus.gzrn.rnbmw.basic.entity.ProjectBean">
|
||
select ID_NUMBER
|
||
from bm_project bp
|
||
left join bm_worker_record bwr on bp.ID = bwr.PROJECT_ID and bwr.IS_ACTIVE = '1'
|
||
where bp.ID = #{id}
|
||
and bp.is_active = '1'
|
||
</select>
|
||
|
||
<select id="listParentProRelation" resultType="com.bonus.gzrn.rnbmw.basic.entity.UserRelationBean">
|
||
SELECT * FROM(
|
||
SELECT
|
||
pro.id,
|
||
pro.`NAME` AS NAME,
|
||
pc.ID AS parentId
|
||
FROM
|
||
bm_project pro
|
||
LEFT JOIN pm_company pc ON pro.company_id = pc.ID
|
||
where pro.IS_ACTIVE = '1'
|
||
<if test="companyId!=null and companyId!='' ">
|
||
and pc.ID =#{companyId}
|
||
</if>
|
||
UNION
|
||
SELECT pc.id,pc.org_name AS NAME, 0 AS parentId
|
||
FROM pm_company pc
|
||
where pc.IS_ACTIVE = '1'
|
||
|
||
<if test="companyId!=null and companyId!='' ">
|
||
and pc.ID =#{companyId}
|
||
</if>
|
||
) a
|
||
</select>
|
||
|
||
<update id="updWrkerRecord" parameterType="com.bonus.gzrn.rnbmw.basic.entity.ProjectBean">
|
||
update bm_worker_record
|
||
set EXIT_DATE= #{exitDate},
|
||
EXIT_TIME = #{exitTime},
|
||
ein_status = '0'
|
||
where ID_NUMBER = #{idNumber}
|
||
and is_active = '1'
|
||
</update>
|
||
<update id="workerHistory" parameterType="com.bonus.gzrn.rnbmw.basic.entity.ProjectBean">
|
||
update bm_worker_attend_history
|
||
set EXIT_TIME = #{exitTime}
|
||
where ID_NUMBER = #{idNumber} AND EIN_TIME = #{einTime}
|
||
<if test="id != '' and id != null">
|
||
and project_id = #{id}
|
||
</if>
|
||
and is_active = '1'
|
||
</update>
|
||
|
||
<update id="updatePush" parameterType="com.bonus.gzrn.rnbmw.basic.entity.ProjectBean">
|
||
update bm_project bp
|
||
set bp.is_push = '0',
|
||
bp.push_time = null
|
||
where id = #{id}
|
||
</update>
|
||
|
||
<update id="updateProjectFive">
|
||
update bm_project_five_parties
|
||
set is_active = '0'
|
||
where pro_id = #{id}
|
||
</update>
|
||
|
||
<delete id="delPaymentType">
|
||
delete
|
||
from bm_project_file
|
||
where id = #{string}
|
||
</delete>
|
||
</mapper> |