select company_id, name, location, industry, scale, del_flag, create_by, create_time, update_by, update_time, remark,code,description,nature,total_recruitment,registered_address,contact_person,contact_person_phone,is_abnormal,not_pass_reason,status,case when status='2' then update_time else null end reject_time,is_imp_company,imp_company_type,enterprise_type,legal_person,legal_id_card,legal_phone from company
and (
industry in ('食品加工', '食品产业', '绿色有机食品', '食品/饮料/酒水')
or industry like '%食品%'
or industry like '%饮料%'
or industry like '%酒%'
)
and (
industry = '纺织服装'
or industry like '%纺织%'
or industry like '%服装%'
)
and (
industry = '装备制造'
or industry like '%装备%'
or industry like '%制造%'
or industry like '%机械%'
or industry like '%设备%'
)
and (
industry is null
or (
coalesce(industry, '') not in ('食品加工', '食品产业', '绿色有机食品', '食品/饮料/酒水', '纺织服装', '装备制造')
and coalesce(industry, '') not like '%食品%'
and coalesce(industry, '') not like '%饮料%'
and coalesce(industry, '') not like '%酒%'
and coalesce(industry, '') not like '%纺织%'
and coalesce(industry, '') not like '%服装%'
and coalesce(industry, '') not like '%装备%'
and coalesce(industry, '') not like '%制造%'
and coalesce(industry, '') not like '%机械%'
and coalesce(industry, '') not like '%设备%'
)
)
and industry = #{industry}
INSERT INTO company (
name, location, industry, scale, code, description, nature,
create_by, create_time, del_flag
) VALUES
(
#{company.name}, #{company.location}, #{company.industry}, #{company.scale},
#{company.code}, #{company.description}, #{company.nature},
#{company.createBy}, #{company.createTime}, #{company.delFlag}
)
UPDATE company c
SET TOTAL_RECRUITMENT = (
SELECT COUNT(*)
FROM job j
WHERE j.company_id = c.company_id
)