<?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.zcloud.mapper.datasource.corp.CorpInfoMapper">

	<!--表名 -->
	<sql id="tableName">
		BUS_CORP_INFO
	</sql>

	<!--数据字典表名 -->
	<sql id="dicTableName">
		SYS_DICTIONARIES
	</sql>

	<!-- 字段 -->
	<sql id="Field">
		f.CORP_NAME,
		f.CODE,
		f.COMPANY_AREA,
		f.ADDRESS,
		f.CREATE_DATE,
		f.PERSONNEL_POSITION,
		f.SCALE,
		f.LONGITUDE,
		f.LATITUDE,
		f.POSTAL_CODE,
		f.EMPLOYEES,
		f.AREA_COVERED,
		f.TOTALASSETS,
		f.REGCAPITAL,
		f.SALESREVENUE,
		f.ANNUALPROFIT,
		f.ECO_TYPE,
		f.ECO_TYPE2,
		f.ECO_TYPE_NAME,
		f.INDUSTRY,
		f.CORP_TYPE,
		f.CORP_TYPE2,
		f.CORP_TYPE3,
		f.CORP_TYPE4,
		f.CORP_TYPE_NAME,
		f.CORP_TYPE_SMALL,
		f.LR_NAME,
		f.LR_POSITION,
		f.LR_PHONE,
		f.LR_MOBILE,
		f.CONTACTS,
		f.CONTACTS_PHONE,
		f.CHECKPERSON,
		f.CHECKPERSONPHONE,
		f.ISDELETE,
		f.OPERATOR,
		f.OPERATTIME,
		f.CREATTIME,
		f.CREATOR,
		f.CORPINFO_ID,
		f.FOURTYPE,
		f.ISRECEIVE,
		f.PROVINCE,
		f.CITY,
		f.COUNTY,
		f.VILLAGE,
		f.SMS_COUNT,
		f.ISREMIND,
		f.ISUSE,
		f.ISSMALL,
		f.LR_PERSONID,
		f.AUDITSTATUS,
		f.STREET,
		f.SMALL_TYPE,
		f.SMALL_TYPE2,
		f.LOGIN_USER_ID,
		f.ADDRESS_BUSINESS,
		f.ADDRESS_OFFICE,
		f.CORP_STATE,
		f.FIXED_ASSETS,
		f.YEAR_OUTPUT_VALUE,
		f.REG_TYPE,
		f.SUBORDINATION,
		f.CORP_OF_TYPE,
		f.CORP_OF_TYPE2,
		f.INDUSTRY_DEPARTMENT,
		f.SCALE_TYPE,
		f.SAFETY_NAME,
		f.SAFETY_POST,
		f.SAFETY_NUMBER,
		f.SAFETY_PHONE,
		f.CORP_CONFIRM,
		f.CORP_EXAMINE,
		f.REPORT_CYCLE,
		f.REPORT_STATUS,
		f.USE_DATE_START,
		f.USE_DATE_END,
		f.TRAINTYPE,
		f.VIPLEVEL,
		f.USERS_NUM,
		f.REGULARTYPE
	</sql>

	<!-- 字段用于新增 -->
	<sql id="Field2">
		CORP_NAME,
		CODE,
		COMPANY_AREA,
		ADDRESS,
		CREATE_DATE,
		PERSONNEL_POSITION,
		SCALE,
		LONGITUDE,
		LATITUDE,
		POSTAL_CODE,
		EMPLOYEES,
		AREA_COVERED,
		TOTALASSETS,
		REGCAPITAL,
		SALESREVENUE,
		ANNUALPROFIT,
		ECO_TYPE,
		INDUSTRY,
		CORP_TYPE,
		CORP_TYPE_SMALL,
		LR_NAME,
		LR_POSITION,
		LR_PHONE,
		LR_MOBILE,
		CONTACTS,
		CONTACTS_PHONE,
		CHECKPERSON,
		CHECKPERSONPHONE,
		ISDELETE,
		OPERATOR,
		OPERATTIME,
		CREATTIME,
		CREATOR,
		CORPINFO_ID,
		FOURTYPE,
		ISRECEIVE,
		PROVINCE,
		CITY,
		COUNTY,
		VILLAGE,
		STREET,
		SMS_COUNT,
		ISREMIND,
		TRAINTYPE,
		ISUSE,
		ISSMALL,
		LR_PERSONID,
		AUDITSTATUS,
		SMALL_TYPE,
		SMALL_TYPE2,
		USERS_NUM,
		REGULARTYPE
	</sql>

	<!-- 字段值 -->
	<sql id="FieldValue">
		#{CORP_NAME},
		#{CODE},
		#{COMPANY_AREA},
		#{ADDRESS},
		#{CREATE_DATE},
		#{PERSONNEL_POSITION},
		#{SCALE},
		#{LONGITUDE},
		#{LATITUDE},
		#{POSTAL_CODE},
		#{EMPLOYEES},
		#{AREA_COVERED},
		#{TOTALASSETS},
		#{REGCAPITAL},
		#{SALESREVENUE},
		#{ANNUALPROFIT},
		#{ECO_TYPE},
		#{INDUSTRY},
		#{CORP_TYPE},
		#{CORP_TYPE_SMALL},
		#{LR_NAME},
		#{LR_POSITION},
		#{LR_PHONE},
		#{LR_MOBILE},
		#{CONTACTS},
		#{CONTACTS_PHONE},
		#{CHECKPERSON},
		#{CHECKPERSONPHONE},
		#{ISDELETE},
		#{OPERATOR},
		#{OPERATTIME},
		#{CREATTIME},
		#{CREATOR},
		#{CORPINFO_ID},
		#{FOURTYPE},
		#{ISRECEIVE},
		#{PROVINCE},
		#{CITY},
		#{COUNTY},
		#{VILLAGE},
		#{STREET},
		#{SMS_COUNT},
		#{ISREMIND},
		#{TRAINTYPE},
		#{ISUSE},
		#{ISSMALL},
		#{LR_PERSONID},
		#{AUDITSTATUS},
		#{SMALL_TYPE},
		#{SMALL_TYPE2},
		#{USERS_NUM},
		#{REGULARTYPE}
	</sql>

	<!-- 新增-->
	<insert id="save" parameterType="pd">
		insert into
		<include refid="tableName"></include>
		(
		<include refid="Field2"></include>
		) values (
		<include refid="FieldValue"></include>
		)
	</insert>

	<!-- 删除-->
	<delete id="delete" parameterType="pd">
		update
		<include refid="tableName"></include>
		set
			ISDELETE = '1'
		where
			CORPINFO_ID = #{CORPINFO_ID}
	</delete>

	<update id="editSMSCOUNT" parameterType="pd">
		update
		<include refid="tableName"></include>
		set
		SMS_COUNT = #{SMS_COUNT},
		ISRECEIVE ='1'
		where
		CORPINFO_ID = #{CORPINFO_ID}
	</update>



	<!-- 修改 -->
	<update id="edit" parameterType="pd">
		update
		<include refid="tableName"></include>
		set
		CORP_NAME = #{CORP_NAME},
		CODE = #{CODE},
		COMPANY_AREA = #{COMPANY_AREA},
		ADDRESS = #{ADDRESS},
		CREATE_DATE = #{CREATE_DATE},
		SCALE = #{SCALE},
		LONGITUDE = #{LONGITUDE},
		LATITUDE = #{LATITUDE},
		POSTAL_CODE = #{POSTAL_CODE},
		EMPLOYEES = #{EMPLOYEES},
		AREA_COVERED = #{AREA_COVERED},
		TOTALASSETS = #{TOTALASSETS},
		REGCAPITAL = #{REGCAPITAL},
		SALESREVENUE = #{SALESREVENUE},
		ANNUALPROFIT = #{ANNUALPROFIT},
		ECO_TYPE = #{ECO_TYPE},
			ECO_TYPE2 = #{ECO_TYPE2},
			ECO_TYPE_NAME=#{ECO_TYPE_NAME},
		INDUSTRY = #{INDUSTRY},
		CORP_TYPE = #{CORP_TYPE},
			CORP_TYPE2 = #{CORP_TYPE2},
			CORP_TYPE3 = #{CORP_TYPE3},
			CORP_TYPE4 = #{CORP_TYPE4},
			CORP_TYPE_NAME = #{CORP_TYPE_NAME},
		CORP_TYPE_SMALL = #{CORP_TYPE_SMALL},
		LR_NAME = #{LR_NAME},
		LR_POSITION = #{LR_POSITION},
		LR_PHONE = #{LR_PHONE},
		LR_MOBILE = #{LR_MOBILE},
		CONTACTS = #{CONTACTS},
		CONTACTS_PHONE = #{CONTACTS_PHONE},
		CHECKPERSON = #{CHECKPERSON},
		CHECKPERSONPHONE = #{CHECKPERSONPHONE},
		OPERATOR = #{OPERATOR},
		OPERATTIME = #{OPERATTIME},
		CREATOR = #{CREATOR},
		<if test="FOURTYPE != null and FOURTYPE != ''">
			FOURTYPE=#{FOURTYPE},
		</if>
		PROVINCE=#{PROVINCE},
		CITY=#{CITY},
			VILLAGE = #{VILLAGE},
	        LOGIN_USER_ID = #{LOGIN_USER_ID},
	        ADDRESS_BUSINESS = #{ADDRESS_BUSINESS},
	        ADDRESS_OFFICE = #{ADDRESS_OFFICE},
	        CORP_STATE = #{CORP_STATE},
	        FIXED_ASSETS = #{FIXED_ASSETS},
	        YEAR_OUTPUT_VALUE = #{YEAR_OUTPUT_VALUE},
	        REG_TYPE = #{REG_TYPE},
	        SUBORDINATION = #{SUBORDINATION},
	        CORP_OF_TYPE = #{CORP_OF_TYPE},
	        CORP_OF_TYPE2 = #{CORP_OF_TYPE2},
	        INDUSTRY_DEPARTMENT = #{INDUSTRY_DEPARTMENT},
	        SCALE_TYPE = #{SCALE_TYPE},
	        SAFETY_NAME = #{SAFETY_NAME},
	        SAFETY_POST = #{SAFETY_POST},
	        SAFETY_NUMBER = #{SAFETY_NUMBER},
	        SAFETY_PHONE = #{SAFETY_PHONE},
	        CORP_CONFIRM = #{CORP_CONFIRM},
	        CORP_EXAMINE = #{CORP_EXAMINE},
	        REPORT_CYCLE=#{REPORT_CYCLE},
			REPORT_STATUS=#{REPORT_STATUS},
		STREET=#{STREET},
		COUNTY=#{COUNTY},
		ISSMALL=#{ISSMALL},
		TRAINTYPE=#{TRAINTYPE},
		LR_PERSONID=#{LR_PERSONID},
		CORPINFO_ID = CORPINFO_ID,
		USERS_NUM = #{USERS_NUM},
		REGULARTYPE = #{REGULARTYPE}
		where
		CORPINFO_ID = #{CORPINFO_ID}
	</update>
	<update id="editIsReceive" parameterType="pd">
		update
		<include refid="tableName"></include>
		set
		ISRECEIVE = #{ISRECEIVE}
		where
		CORPINFO_ID = #{CORPINFO_ID}
	</update>
	<update id="editISRemind" parameterType="pd">
		update
		<include refid="tableName"></include>
		set
		ISREMIND = #{ISREMIND}
		where
		CORPINFO_ID = #{CORPINFO_ID}
	</update>
    <update id="updateEnterpriseId">
		update
		<include refid="tableName"></include>
		set
		enterpriseId = #{enterpriseId}
		where
		CORPINFO_ID = #{CORPINFO_ID}
	</update>

    <!-- 通过ID获取数据 -->
	<select id="findById" parameterType="pd" resultType="pd">
		select
		t.NAME as REGULARTYPE_NAME,
		f.*,
		s.NAME as SCALE_NAME,
		r.CORPINFO_ID,
		r.AQ_BZ_LEVEL,
		r.AQ_BZ_NO,
		r.AQ_BZ_UNIT,
		r.AQ_BZ_TIME,
		r.WHETHER_HYGIENE,
		r.WHETHER_HAZARDS,
		r.WHETHER_SCARCE,
		r.WHETHER_CHEMICALS,
		r.WHETHER_SPECIALEQUIPMENT,
		r.WHETHER_SPECIALPEOPLE,
		r.WHETHER_COALGAS,
		r.WHETHER_FIRE,
		r.WHETHER_CONFINED,
		r.WHETHER_POWDER,
		r.WHETHER_LIGHTNING,
		r.WHETHER_ACTINOGEN,
		r.WHETHER_LIQUIDAMMONIA,
		r.WHETHER_PIPELINE,
		r.IS_MAJOR_HAZARD,
		r.IS_MAJOR_HAZARD_PUSH,
		r.IS_MAIN_TECHNOLO,
		r.IS_MAIN_TECHNOLO_PUSH,
		cs.NAME CORP_STATE_NAME,
		sub.NAME SUBORDINATIONNAME,
		abl.NAME AQ_BZ_LEVEL_NAME,
		dicT.NAME as TRAINTYPE_NAME,
		b.ISSTOP,
		pls.POST_URL,
		pls.DEPT_ID,
		pls.TILES3D_URL,
		pls.USE_URL,
		(
		SELECT
		DATEDIFF(
		MAX( c.TRIALTIME ),
		CURDATE()) TRIALDAY
		FROM
		bus_corp_trial c
		WHERE
		c.CORPINFO_ID = f.CORPINFO_ID and c.ISDELETE = '0'
		) TRIALDAY,
		(select count(1) from bus_corp_time bct
		where bct.CORPINFO_ID = f.CORPINFO_ID
		and DATE_FORMAT(NOW(),'%Y-%m-%d') between bct.USE_DATE_START and bct.USE_DATE_END) as HAS_LIVE
		from
		<include refid="tableName"></include> f
		left join bus_corp_stop b on b.CORPINFO_ID = f.CORPINFO_ID and b.ISDELETE = '0'
		left join SYS_DICTIONARIES s on s.DICTIONARIES_ID = f.SCALE
        LEFT JOIN bus_corp_info_related r on r.CORPINFO_ID =f.CORPINFO_ID
        LEFT JOIN SYS_DICTIONARIES cs on cs.DICTIONARIES_ID = f.CORP_STATE
        LEFT JOIN SYS_DICTIONARIES sub on sub.DICTIONARIES_ID = f.SUBORDINATION
        LEFT JOIN SYS_DICTIONARIES abl on abl.DICTIONARIES_ID = r.AQ_BZ_LEVEL
		left join SYS_DICTIONARIES dicT on dicT.DICTIONARIES_ID = f.TRAINTYPE
		left join BUS_CORPTYPE t on t.CORPTYPE_ID = f.REGULARTYPE and t.ISDELETE = '0'
		left join bus_corp_pls_info pls on pls.CORPINFO_ID = f.CORPINFO_ID
		where
		f.CORPINFO_ID = #{CORPINFO_ID}
	</select>

	<!-- 通过ID获取数据 -->
	<select id="findNumById" parameterType="pd" resultType="pd">
		select
		USERS_NUM
		from
		<include refid="tableName"></include> f
		where
		f.CORPINFO_ID = #{CORPINFO_ID}
	</select>

	<!-- 通过手机后四位获取数据 -->
	<select id="findByPhone" parameterType="pd" resultType="pd">
		select
		<include refid="Field"></include>
		from
		<include refid="tableName"></include> f
		where f.CORPINFO_ID = #{CORPINFO_ID} and
		(
		f.LR_MOBILE LIKE CONCAT(CONCAT('%', #{LR_MOBILE}),'%')
		)
	</select>

	<!-- 通过企业名获取数据 -->
	<select id="findByName" parameterType="pd" resultType="pd" >
		select
		<include refid="Field"></include>
		from
		<include refid="tableName"></include>f
		where
		f.CORP_NAME = #{CORP_NAME}
		<if test="ISSMALL != null and ISSMALL != ''"><!-- 关键词检索 -->
			and f.ISSMALL=#{ISSMALL}
		</if>
		<if test="CORPINFO_ID != null and CORPINFO_ID != ''"><!-- 关键词检索 -->
			and f.CORPINFO_ID!=#{CORPINFO_ID}
		</if>
	</select>

	<select id="findByCode" parameterType="pd" resultType="pd" >
		select
		<include refid="Field"></include>
		from
		<include refid="tableName"></include>f
		where
		f.CODE = #{CODE}
		<if test="CORPINFO_ID != null and CORPINFO_ID != ''"><!-- 关键词检索 -->
			and f.CORPINFO_ID!=#{CORPINFO_ID}
		</if>
	</select>


	<!-- 列表 -->
	<select id="datalistPage" parameterType="page" resultType="pd">
		select
		d17.DICTIONARIES_ID DICTIONARIES_ID17,
		d17.NAME DNAME17,
		d18.DICTIONARIES_ID DICTIONARIES_ID18,
		d18.NAME DNAME18,
		d19.DICTIONARIES_ID DICTIONARIES_ID19,
		d19.NAME DNAME19,
		<include refid="Field"></include>
		from
		<include refid="tableName"></include> f
		left join
		<include refid="dicTableName"></include> d17
		on f.INDUSTRY = d17.DICTIONARIES_ID
		left join
		<include refid="dicTableName"></include> d18
		on f.CORP_TYPE = d18.DICTIONARIES_ID
		left join
		<include refid="dicTableName"></include> d19
		on f.CORP_TYPE_SMALL = d19.DICTIONARIES_ID
		where f.ISDELETE = '0'
		<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
			and
			(
			f.CORP_NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
			)
		</if>
	</select>

	<!-- 列表(全部) -->
	<select id="listAll" parameterType="pd" resultType="pd">
		select
		<include refid="Field"></include>
		from
		<include refid="tableName"></include> f
		where f.ISDELETE = '0'
		<if test="ISSMALL != null and ISSMALL != ''"><!-- 关键词检索 -->
			and f.ISSMALL=#{ISSMALL}
		</if>
		<if test="ISRECEIVE != null and ISRECEIVE != ''"><!-- 关键词检索 -->
			and f.ISRECEIVE=#{ISRECEIVE}
		</if>
		<if test="CORP_NAME != null and CORP_NAME != ''"><!-- 关键词检索 -->
			and
			(
			f.CORP_NAME LIKE CONCAT(CONCAT('%', #{CORP_NAME}),'%')
			)
		</if>
	</select>

	<!-- 批量删除 -->
	<delete id="deleteAll" parameterType="String">
		update
		<include refid="tableName"></include>
		set
		ISDELETE = '1'
		where
		CORPINFO_ID in
		<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
			#{item}
		</foreach>
	</delete>
	<!-- 列表 -->

	<select id="listByCorpType" parameterType="page" resultType="pd">
		select  f.CORPINFO_ID ,f.CORP_NAME
		from  <include refid="tableName"></include> f
		where f.ISDELETE = '0'
		<if test="INDUSTRY != null and INDUSTRY != ''">
			and f.INDUSTRY =#{INDUSTRY}
		</if>
		<if test="CORP_TYPE != null and CORP_TYPE != ''">
			and f.CORP_TYPE =#{CORP_TYPE}
		</if>
		<if test="CORP_TYPE_SMALL != null and CORP_TYPE_SMALL != ''">
			and f.CORP_TYPE_SMALL =#{CORP_TYPE_SMALL}
		</if>


	</select>

	<!--查询暂无排班规则的公司 -->
	<select id="listAllNoRules" parameterType="pd" resultType="pd">
		select
			*
		FROM
			bus_corp_info c
			LEFT JOIN bus_shiftworkrules s ON s.CORPINFO_ID = c.CORPINFO_ID
		WHERE
			s.SHIFTWORKRULES_ID IS NULL
			OR s.SHIFTWORKRULES_ID = ''
		GROUP BY
			c.CORPINFO_ID
	</select>
	<select id="getInfo" resultType="com.zcloud.entity.PageData">
		select
		f.*,
		s.NAME as SCALE_NAME,
		r.CORPINFO_ID,
		r.AQ_BZ_LEVEL,
		r.AQ_BZ_NO,
		r.AQ_BZ_UNIT,
		r.AQ_BZ_TIME,
		r.WHETHER_HYGIENE,
		r.WHETHER_HAZARDS,
		r.WHETHER_SCARCE,
		r.WHETHER_CHEMICALS,
		r.WHETHER_SPECIALEQUIPMENT,
		r.WHETHER_SPECIALPEOPLE,
		r.WHETHER_COALGAS,
		r.WHETHER_FIRE,
		r.WHETHER_CONFINED,
		r.WHETHER_POWDER,
		r.WHETHER_LIGHTNING,
		r.WHETHER_ACTINOGEN,
		r.WHETHER_LIQUIDAMMONIA,
		r.WHETHER_PIPELINE,
		cs.NAME CORP_STATE_NAME,
		sub.NAME SUBORDINATIONNAME,
		abl.NAME AQ_BZ_LEVEL_NAME,
		dicT.NAME as TRAINTYPE_NAME,
		b.ISSTOP,
		cto.NAME as CORP_TYPE_ONE_NAME,
		ctt.NAME as CORP_TYPE_TWO_NAME,
		ctth.NAME as CORP_TYPE_THREE_NAME,
		ctf.NAME as CORP_TYPE_FOUR_NAME
		from
		<include refid="tableName"></include> f
		left join bus_corp_stop b on b.CORPINFO_ID = f.CORPINFO_ID and b.ISDELETE = '0'
		left join SYS_DICTIONARIES s on s.DICTIONARIES_ID = f.SCALE
		LEFT JOIN bus_corp_info_related r on r.CORPINFO_ID =f.CORPINFO_ID
		LEFT JOIN SYS_DICTIONARIES cs on cs.DICTIONARIES_ID = f.CORP_STATE
		LEFT JOIN SYS_DICTIONARIES sub on sub.DICTIONARIES_ID = f.SUBORDINATION
		LEFT JOIN SYS_DICTIONARIES abl on abl.DICTIONARIES_ID = r.AQ_BZ_LEVEL
		left join SYS_DICTIONARIES dicT on dicT.DICTIONARIES_ID = f.TRAINTYPE
		left join SYS_DICTIONARIES cto on cto.DICTIONARIES_ID = f.CORP_TYPE
		left join SYS_DICTIONARIES ctt on ctt.DICTIONARIES_ID = f.CORP_TYPE2
		left join SYS_DICTIONARIES ctth on ctth.DICTIONARIES_ID = f.CORP_TYPE3
		left join SYS_DICTIONARIES ctf on ctf.DICTIONARIES_ID = f.CORP_TYPE4
		where
		f.CORPINFO_ID = #{CORPINFO_ID}
	</select>

	<!-- 列表 -->
	<select id="eightWorkBI" parameterType="pd" resultType="pd">
		select
			(select count(1) from BUS_BLINDBOARD t where t.CORPINFO_ID = #{CORPINFO_ID} and t.ISDELETE=0 and t.BLINDBOARD_ID in (SELECT
																														  WORK_ID
																													  FROM
																														  vi_eightwork_flow_log f
																													  WHERE
																														  f.STEP_ID != -1)) as blindboard_num,
			(select count(1) from BUS_BREAKGROUND t where t.CORPINFO_ID = #{CORPINFO_ID} and t.ISDELETE=0 and t.BREAKGROUND_ID in (SELECT
			WORK_ID
			FROM
			vi_eightwork_flow_log f
			WHERE
			f.STEP_ID != -1)) as breakground_num,
			(select count(1) from BUS_CONFINEDSPACE t where t.CORPINFO_ID = #{CORPINFO_ID} and t.ISDELETE=0 and t.CONFINEDSPACE_ID in (SELECT
			WORK_ID
			FROM
			vi_eightwork_flow_log f
			WHERE
			f.STEP_ID != -1)) as confinedspace_num,
			(select count(1) from BUS_ELECTRICITY t where t.CORPINFO_ID = #{CORPINFO_ID} and t.ISDELETE=0 and t.ELECTRICITY_ID in (SELECT
			WORK_ID
			FROM
			vi_eightwork_flow_log f
			WHERE
			f.STEP_ID != -1)) as electricity_num,
			(select count(1) from BUS_CUTROAD t where t.CORPINFO_ID = #{CORPINFO_ID} and t.ISDELETE=0 and t.CUTROAD_ID in (SELECT
			WORK_ID
			FROM
			vi_eightwork_flow_log f
			WHERE
			f.STEP_ID != -1)) as cutroad_num,
			(select count(1) from BUS_HIGHWORK t where t.CORPINFO_ID = #{CORPINFO_ID} and t.ISDELETE=0 and t.HIGHWORK_ID in (SELECT
			WORK_ID
			FROM
			vi_eightwork_flow_log f
			WHERE
			f.STEP_ID != -1)) as highwork_num,
			(select count(1) from BUS_HOISTING t where t.CORPINFO_ID = #{CORPINFO_ID} and t.ISDELETE=0 and t.HOISTING_ID in (SELECT
			WORK_ID
			FROM
			vi_eightwork_flow_log f
			WHERE
			f.STEP_ID != -1)) as hoisting_num,
			(select count(1) from BUS_HOTWORK t where t.CORPINFO_ID = #{CORPINFO_ID} and t.ISDELETE=0 and t.HOTWORK_ID in (SELECT
			WORK_ID
			FROM
			vi_eightwork_flow_log f
			WHERE
			f.STEP_ID != -1)) as hotwork_num,
			(select count(1) from bus_personnelmanagement r where r.CORPINFO_ID = #{CORPINFO_ID} and r.ISDELETE = 0) as people_num,
			(select count(1) from bus_units r where r.CORPINFO_ID = #{CORPINFO_ID} and r.ISDELETE = 0) as units_num,
			(select count(1) from BUS_SPECIALEQUIPMENT r where r.CORPINFO_ID = #{CORPINFO_ID} and r.ISDELETE = 0) as equipment_num
	</select>

</mapper>
