Files
ks/ruoyi-bussiness/src/main/resources/mapper/app/CompanyMapper.xml

92 lines
5.4 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.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" />
<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" />
</resultMap>
<sql id="selectCompanyVo">
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
</sql>
<insert id="batchInsert" parameterType="java.util.List">
INSERT INTO company (
name, location, industry, scale, code, description, nature,
create_by, create_time, del_flag
) VALUES
<foreach collection="list" item="company" separator=",">
(
#{company.name}, #{company.location}, #{company.industry}, #{company.scale},
#{company.code}, #{company.description}, #{company.nature},
#{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>
<select id="selectCompanyList" 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>
<if test="industry != null and industry != ''"> and industry = #{industry}</if>
<if test="scale != null and scale != ''"> and scale = #{scale}</if>
<if test="nature != null and nature != ''"> and nature = #{nature}</if>
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="label" resultMap="CompanyResult">
SELECT * FROM COMPANY WHERE COMPANY_ID IN (select -1
<if test="companyNature!=null and companyNature!=''">
UNION
SELECT COMPANY_ID FROM COMPANY WHERE nature = #{companyNature}
</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>
</mapper>