2026-01-09 20:13:01 +08:00
<?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.ruoyi.cms.mapper.CompanyMapper" >
<resultMap type= "Company" id= "CompanyResult" >
<result property= "companyId" column= "company_id" />
<result property= "name" column= "name" />
<result property= "location" column= "location" />
<result property= "industry" column= "industry" />
<result property= "scale" column= "scale" />
<result property= "code" column= "code" />
<result property= "delFlag" column= "del_flag" />
<result property= "createBy" column= "create_by" />
<result property= "createTime" column= "create_time" />
<result property= "updateBy" column= "update_by" />
<result property= "updateTime" column= "update_time" />
<result property= "remark" column= "remark" />
<result property= "description" column= "description" />
<result property= "nature" column= "nature" />
2026-07-16 15:05:53 +08:00
<result property= "companyNature" column= "company_nature" />
2026-01-09 20:13:01 +08:00
<result property= "totalRecruitment" column= "total_recruitment" />
<result property= "userId" column= "user_id" />
<result property= "businessLicenseUrl" column= "business_license_url" />
<result property= "idCardPictureUrl" column= "id_card_picture_url" />
<result property= "idCardPictureBackUrl" column= "id_card_picture_back_url" />
<result property= "powerOfAttorneyUrl" column= "power_of_attorneyUrl" />
<result property= "contactPerson" column= "contact_person" />
<result property= "contactPersonPhone" column= "contact_person_phone" />
<result property= "status" column= "status" />
<result property= "notPassReason" column= "not_pass_reason" />
<result property= "registeredAddress" column= "registered_address" />
<result property= "isAbnormal" column= "is_abnormal" />
<result property= "enterpriseType" column= "enterprise_type" />
<result property= "isImpCompany" column= "is_imp_company" />
<result property= "impCompanyType" column= "imp_company_type" />
<result property= "legalPerson" column= "legal_person" />
<result property= "legalIdCard" column= "legal_id_card" />
<result property= "legalPhone" column= "legal_phone" />
2026-07-09 18:32:38 +08:00
<result property= "companyStatus" column= "company_status" />
2026-07-11 21:04:36 +08:00
<result property= "isHrs" column= "is_hrs" />
2026-07-11 22:27:14 +08:00
<result property= "lcUserid" column= "lc_userid" />
2026-07-24 12:35:25 +08:00
<result property= "missedOutdoorFairCount" column= "missed_outdoor_fair_count" />
2026-01-09 20:13:01 +08:00
2026-07-22 11:36:58 +08:00
<collection property= "companyContactList" ofType= "com.ruoyi.common.core.domain.entity.CompanyContact"
2026-07-29 19:35:53 +08:00
select="selectCompanyContactsById"
column="company_id"/>
2026-07-22 11:36:58 +08:00
</resultMap>
<resultMap type= "com.ruoyi.common.core.domain.entity.CompanyContact" id= "CompanyContactResult" >
2026-07-29 19:35:53 +08:00
<result property= "id" column= "id" />
<result property= "companyId" column= "company_id" />
<result property= "contactPerson" column= "contact_person" />
<result property= "contactPersonPhone" column= "contact_person_phone" />
2026-01-09 20:13:01 +08:00
</resultMap>
2026-07-29 19:35:53 +08:00
<select id= "selectCompanyContactsById" resultMap= "CompanyContactResult" >
select id, company_id, contact_person, contact_person_phone
from company_contact
where company_id = #{companyId}
and del_flag = '0'
</select>
2026-01-09 20:13:01 +08:00
<sql id= "selectCompanyVo" >
2026-07-24 12:35:25 +08:00
select company_id, name, location, industry, scale, del_flag, create_by, create_time, update_by, update_time, remark,code,description,nature,company_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,is_hrs,
(select count(1)
from shz.fair_company fc
join shz.cms_outdoor_fair f on f.id = fc.job_fair_id and f.del_flag = '0'
left join shz.cms_outdoor_fair_company_attendance a
on a.fair_id = fc.job_fair_id and a.company_id = fc.company_id and a.del_flag = '0'
2026-07-24 12:48:00 +08:00
where fc.company_id = cp.company_id
2026-07-24 12:35:25 +08:00
and fc.del_flag = '0'
and fc.review_status = '1'
and f.end_time < CURRENT_TIMESTAMP
and coalesce(a.attendance_status, '0') < > '1') as missed_outdoor_fair_count
2026-07-24 12:48:00 +08:00
from company cp
2026-01-09 20:13:01 +08:00
</sql>
2026-07-03 13:19:47 +08:00
<sql id= "companyIndustryFilter" >
<if test= "industry != null and industry != ''" >
<choose >
<when test= "industry == '食品产业' or industry == '食品加工'" >
and (
industry in ('食品加工', '食品产业', '绿色有机食品', '食品/饮料/酒水')
or industry like '%食品%'
or industry like '%饮料%'
or industry like '%酒%'
)
</when>
<when test= "industry == '纺织服装'" >
and (
industry = '纺织服装'
or industry like '%纺织%'
or industry like '%服装%'
)
</when>
<when test= "industry == '装备制造'" >
and (
industry = '装备制造'
or industry like '%装备%'
or industry like '%制造%'
or industry like '%机械%'
or industry like '%设备%'
)
</when>
<when test= "industry == '其他'" >
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 '%设备%'
)
)
</when>
<otherwise >
and industry = #{industry}
</otherwise>
</choose>
</if>
</sql>
2026-01-09 20:13:01 +08:00
<insert id= "batchInsert" parameterType= "java.util.List" >
INSERT INTO company (
2026-07-16 15:05:53 +08:00
name, location, industry, scale, code, description, nature, company_nature,
2026-01-09 20:13:01 +08:00
create_by, create_time, del_flag
) VALUES
<foreach collection= "list" item= "company" separator= "," >
(
#{company.name}, #{company.location}, #{company.industry}, #{company.scale},
2026-07-16 15:05:53 +08:00
#{company.code}, #{company.description}, #{company.nature}, #{company.companyNature},
2026-01-09 20:13:01 +08:00
#{company.createBy}, #{company.createTime}, #{company.delFlag}
)
</foreach>
</insert>
<update id= "updateJobCountOfCompany" >
UPDATE company c
SET TOTAL_RECRUITMENT = (
SELECT COUNT(*)
FROM job j
WHERE j.company_id = c.company_id
)
</update>
2026-06-03 15:16:41 +08:00
<select id= "selectCompanyList" parameterType= "CompanySearch" resultMap= "CompanyResult" >
2026-07-24 12:39:30 +08:00
select cp.company_id, cp.name, cp.location, cp.industry, cp.scale, cp.del_flag, cp.create_by, cp.create_time, cp.update_by, cp.update_time, cp.remark,
cp.code,cp.description,cp.nature,cp.company_nature,cp.total_recruitment,cp.registered_address,cp.contact_person,cp.contact_person_phone,cp.is_abnormal,
cp.not_pass_reason,cp.status,case when cp.status='2' then cp.update_time else null end reject_time,cp.is_imp_company,cp.imp_company_type,cp.enterprise_type,
2026-07-24 12:51:19 +08:00
cp.legal_person,cp.legal_id_card,cp.legal_phone,cp.is_hrs,
(select count(1)
from shz.fair_company fc
join shz.cms_outdoor_fair f on f.id = fc.job_fair_id and f.del_flag = '0'
left join shz.cms_outdoor_fair_company_attendance a
on a.fair_id = fc.job_fair_id and a.company_id = fc.company_id and a.del_flag = '0'
where fc.company_id = cp.company_id
and fc.del_flag = '0'
and fc.review_status = '1'
and f.end_time < CURRENT_TIMESTAMP
2026-07-29 19:35:53 +08:00
and coalesce(a.attendance_status, '0') < > '1') as missed_outdoor_fair_count
from company cp
2026-07-24 12:39:30 +08:00
<where > cp.del_flag = '0'
<if test= "name != null and name != ''" > and cp.name like concat('%', cast(#{name, jdbcType=VARCHAR} as varchar), '%')</if>
<if test= "location != null and location != ''" > and cp.location = #{location}</if>
2026-07-03 13:19:47 +08:00
<include refid= "companyIndustryFilter" />
2026-07-24 12:39:30 +08:00
<if test= "scale != null and scale != ''" > and cp.scale = #{scale}</if>
<if test= "nature != null and nature != ''" > and cp.nature = #{nature}</if>
<if test= "companyNature != null and companyNature != ''" > and cp.company_nature = #{companyNature}</if>
<if test= "code != null and code != ''" > and cp.code = #{code}</if>
<if test= "status != null and status != ''" > and cp.status = #{status}</if>
<if test= "companyId != null and companyId != ''" > and cp.company_id = #{companyId}</if>
<if test= "userId != null" > and cp.user_id = #{userId}</if>
<if test= "isHrs != null and isHrs != ''" > and cp.is_hrs = #{isHrs}</if>
2026-06-03 15:16:41 +08:00
<if test= "startDate != null and startDate != ''" >
2026-07-24 12:39:30 +08:00
and cp.create_time >= #{startDate}
2026-06-03 15:16:41 +08:00
</if>
<if test= "endDate != null and endDate != ''" >
2026-07-24 12:39:30 +08:00
and cp.create_time < = #{endDate}
2026-06-03 15:16:41 +08:00
</if>
2026-07-24 12:35:25 +08:00
<if test= "missedOutdoorFairOnly == true" >
and exists (
select 1
from shz.fair_company fc
join shz.cms_outdoor_fair f on f.id = fc.job_fair_id and f.del_flag = '0'
left join shz.cms_outdoor_fair_company_attendance a
on a.fair_id = fc.job_fair_id and a.company_id = fc.company_id and a.del_flag = '0'
2026-07-24 12:48:00 +08:00
where fc.company_id = cp.company_id
2026-07-24 12:35:25 +08:00
and fc.del_flag = '0'
and fc.review_status = '1'
and f.end_time < CURRENT_TIMESTAMP
and coalesce(a.attendance_status, '0') < > '1'
)
</if>
2026-01-09 20:13:01 +08:00
</where>
</select>
<select id= "label" resultMap= "CompanyResult" >
SELECT * FROM COMPANY WHERE COMPANY_ID IN (select -1
<if test= "companyNature!=null and companyNature!=''" >
UNION
2026-07-16 15:05:53 +08:00
SELECT COMPANY_ID FROM COMPANY WHERE company_nature = #{companyNature}
2026-01-09 20:13:01 +08:00
</if>
<if test= "targ!=null and targ!=''" >
UNION
SELECT company_id FROM COMPANY_LABEL WHERE dict_value = #{targ}
</if> )
<if test= "companyName != null and companyName != ''" > and name like concat('%',#{companyName},'%')</if>
</select>
<select id= "selectLikeCompanyList" parameterType= "Company" resultMap= "CompanyResult" >
<include refid= "selectCompanyVo" />
<where > del_flag = '0'
<if test= "name != null and name != ''" > and name like concat('%', cast(#{name, jdbcType=VARCHAR} as varchar), '%')</if>
<if test= "location != null and location != ''" > and location = #{location}</if>
2026-07-03 13:19:47 +08:00
<include refid= "companyIndustryFilter" />
2026-01-09 20:13:01 +08:00
<if test= "scale != null and scale != ''" > and scale = #{scale}</if>
<if test= "nature != null and nature != ''" > and nature = #{nature}</if>
2026-07-16 15:05:53 +08:00
<if test= "companyNature != null and companyNature != ''" > and company_nature = #{companyNature}</if>
2026-01-09 20:13:01 +08:00
<if test= "code != null and code != ''" > and code = #{code}</if>
<if test= "status != null and status != ''" > and status = #{status}</if>
</where>
LIMIT 50
</select>
<select id= "selectCompanyByJobId" resultType= "com.ruoyi.common.core.domain.entity.Company" >
select a.* from COMPANY a inner join job b on a.company_id=b.company_id and b.job_id=#{jobId} limit 1
</select>
2026-07-09 18:32:38 +08:00
<update id= "updateStatus" parameterType= "Company" >
update COMPANY set company_status=#{companyStatus},update_time=#{updateTime},update_by=#{updateBy} where company_id=#{companyId} and del_flag='0'
</update>
2026-07-23 18:59:18 +08:00
<update id= "updateLcToLocalStatus" parameterType= "Company" >
UPDATE company cn
SET cn.status = #{status},cn.update_time = #{updateTime},cn.update_by = #{updateBy}
WHERE cn.code IN ( SELECT su.id_card FROM sys_user su WHERE su.user_id = #{userId})
AND cn.del_flag = '0'
</update>
2026-07-11 22:27:14 +08:00
<select id= "selectAdminCompanyList" parameterType= "CompanySearch" resultMap= "CompanyResult" >
select t.company_id, t.name, t.location, t.industry, t.scale, t.del_flag, t.create_by, t.create_time, t.update_by, t.update_time, t.remark,t.code,t.description,
2026-07-16 15:05:53 +08:00
t.nature,t.company_nature,t.total_recruitment,t.registered_address,t.contact_person,t.contact_person_phone,t.is_abnormal,t.not_pass_reason,t.status,case when t.status='2'
2026-07-11 22:27:14 +08:00
then t.update_time else null end reject_time,t.is_imp_company,t.imp_company_type,t.enterprise_type,t.legal_person,t.legal_id_card,t.legal_phone,t.is_hrs,
2026-07-24 12:35:25 +08:00
(select count(1)
from shz.fair_company fc
join shz.cms_outdoor_fair f on f.id = fc.job_fair_id and f.del_flag = '0'
left join shz.cms_outdoor_fair_company_attendance a
on a.fair_id = fc.job_fair_id and a.company_id = fc.company_id and a.del_flag = '0'
where fc.company_id = t.company_id
and fc.del_flag = '0'
and fc.review_status = '1'
and f.end_time < CURRENT_TIMESTAMP
and coalesce(a.attendance_status, '0') < > '1') as missed_outdoor_fair_count,
2026-07-29 19:35:53 +08:00
su.lc_userid,su.user_id from company t
2026-07-22 11:36:58 +08:00
left join sys_user su on t.code=su.id_card and su.del_flag='0'
2026-07-12 13:13:07 +08:00
<where > t.del_flag = '0' and su.lc_userid is not null
2026-07-11 22:27:14 +08:00
<if test= "name != null and name != ''" > and t.name like concat('%', cast(#{name, jdbcType=VARCHAR} as varchar), '%')</if>
<if test= "scale != null and scale != ''" > and t.scale = #{scale}</if>
<if test= "nature != null and nature != ''" > and t.nature = #{nature}</if>
2026-07-16 15:05:53 +08:00
<if test= "companyNature != null and companyNature != ''" > and t.company_nature = #{companyNature}</if>
2026-07-11 22:27:14 +08:00
<if test= "code != null and code != ''" > and t.code = #{code}</if>
<if test= "status != null and status != ''" > and t.status = #{status}</if>
<if test= "companyId != null and companyId != ''" > and t.company_id = #{companyId}</if>
<if test= "isHrs != null and isHrs != ''" > and t.is_hrs = #{isHrs}</if>
2026-07-22 11:36:58 +08:00
<if test= "legalPerson != null and legalPerson != ''" > and t.legal_person like concat('%', cast(#{legalPerson, jdbcType=VARCHAR} as varchar), '%')</if>
<if test= "contactPerson != null and contactPerson != ''" >
AND EXISTS (
SELECT 1 FROM company_contact cc
WHERE cc.company_id = t.company_id
AND cc.del_flag = '0'
AND cc.contact_person LIKE concat('%', cast(#{contactPerson, jdbcType=VARCHAR} as varchar), '%')
)
</if>
<if test= "contactPersonPhone != null and contactPersonPhone != ''" >
AND EXISTS (
SELECT 1 FROM company_contact cc
WHERE cc.company_id = t.company_id
AND cc.del_flag = '0'
AND cc.contact_person_phone LIKE concat('%', cast(#{contactPersonPhone, jdbcType=VARCHAR} as varchar), '%')
)
</if>
2026-07-11 22:27:14 +08:00
<if test= "startDate != null and startDate != ''" >
and t.create_time >= #{startDate}
</if>
<if test= "endDate != null and endDate != ''" >
and t.create_time < = #{endDate}
</if>
2026-07-24 12:35:25 +08:00
<if test= "missedOutdoorFairOnly == true" >
and exists (
select 1
from shz.fair_company fc
join shz.cms_outdoor_fair f on f.id = fc.job_fair_id and f.del_flag = '0'
left join shz.cms_outdoor_fair_company_attendance a
on a.fair_id = fc.job_fair_id and a.company_id = fc.company_id and a.del_flag = '0'
where fc.company_id = t.company_id
and fc.del_flag = '0'
and fc.review_status = '1'
and f.end_time < CURRENT_TIMESTAMP
and coalesce(a.attendance_status, '0') < > '1'
)
</if>
2026-07-11 22:27:14 +08:00
</where>
</select>
2026-07-24 12:35:25 +08:00
<select id= "selectMissedOutdoorFairList"
parameterType="long"
resultType="com.ruoyi.cms.domain.vo.CompanyMissedOutdoorFairVO">
SELECT f.id AS fair_id,
f.title,
f.host_unit,
f.address,
f.hold_time,
f.end_time,
fc.create_time AS registration_time
FROM shz.fair_company fc
JOIN shz.cms_outdoor_fair f
ON f.id = fc.job_fair_id
AND f.del_flag = '0'
LEFT JOIN shz.cms_outdoor_fair_company_attendance a
ON a.fair_id = fc.job_fair_id
AND a.company_id = fc.company_id
AND a.del_flag = '0'
WHERE fc.company_id = #{companyId}
AND fc.del_flag = '0'
AND fc.review_status = '1'
AND f.end_time < CURRENT_TIMESTAMP
AND COALESCE(a.attendance_status, '0') < > '1'
ORDER BY f.end_time DESC, f.id DESC
</select>
2026-07-03 13:19:47 +08:00
</mapper>