<?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.vetti.hotake.mapper.HotakeRolesInfoMapper">
    
    <resultMap type="HotakeRolesInfo" id="HotakeRolesInfoResult">
        <result property="id"    column="id"    />
        <result property="uuid" column="uuid" />
        <result property="recruiterId"    column="recruiter_id"    />
        <result property="roleName"    column="role_name"    />
        <result property="companyName" column="company_name" />
        <result property="roleType" column="role_type" />
        <result property="locationType"    column="location_type"    />
        <result property="locations"    column="locations"    />
        <result property="applied"    column="applied"    />
        <result property="jobLevel"    column="job_Level"    />
        <result property="jobType"    column="job_type"    />
        <result property="jobExperience"    column="job_experience"    />
        <result property="salaryStart"    column="salary_start"    />
        <result property="salaryEnd"    column="salary_end"    />
        <result property="requiredSkillsJson"    column="required_skills_json"    />
        <result property="niceToHaveSkillsJson"    column="nice_to_have_skills_json"    />
        <result property="educationRequirementsJson"    column="education_requirements_json"    />
        <result property="acceptEquivalentWorkFlag"    column="accept_equivalent_work_flag"    />
        <result property="certificationsLicensesJson"    column="certifications_licenses_json"    />
        <result property="descriptionTone"    column="description_tone"    />
        <result property="aboutRole"    column="about_role"    />
        <result property="responsibilities"    column="responsibilities"    />
        <result property="roleBenefitsJson"    column="role_benefits_json"    />
        <result property="publishingChannelsJson"    column="publishing_channels_json"    />
        <result property="publishingScheduleDate"    column="publishing_schedule_date"    />
        <result property="publishingScheduleTime"    column="publishing_schedule_time"    />
        <result property="applicationDeadline"    column="application_deadline"    />
        <result property="posted"    column="posted"    />
        <result property="languages" column="languages" />

        <result property="aiScreeningVideoFlag" column="ai_screening_video_flag" />
        <result property="videoId" column="video_id" />
        <result property="speechSpeed" column="speech_speed" />

        <result property="dataType"    column="data_type"    />
        <result property="operStep"    column="oper_step"    />
        <result property="status" column="status" />
        <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"    />
    </resultMap>

    <sql id="selectHotakeRolesInfoVo">
        select id, uuid,recruiter_id, role_name,company_name,role_type, location_type, locations, applied, job_Level, job_type, job_experience, salary_start, salary_end, required_skills_json,
               nice_to_have_skills_json, education_requirements_json, accept_equivalent_work_flag,
               certifications_licenses_json, description_tone, about_role, responsibilities, role_benefits_json,
               publishing_channels_json, publishing_schedule_date, publishing_schedule_time, application_deadline,
               posted, languages,ai_screening_video_flag,video_id,speech_speed,data_type,
               oper_step, status,del_flag, create_by, create_time, update_by, update_time, remark from hotake_roles_info
    </sql>

    <select id="selectHotakeRolesInfoList" parameterType="HotakeRolesInfo" resultMap="HotakeRolesInfoResult">
        <include refid="selectHotakeRolesInfoVo"/>
        <where>
            <if test="uuid != null "> and uuid = #{uuid}</if>
            <if test="recruiterId != null "> and recruiter_id = #{recruiterId}</if>
            <if test="roleName != null  and roleName != ''"> and role_name like concat('%', #{roleName}, '%')</if>
            <if test="locationType != null  and locationType != ''"> and location_type = #{locationType}</if>
            <if test="locations != null  and locations != ''"> and locations = #{locations}</if>
            <if test="applied != null  and applied != ''"> and applied = #{applied}</if>
            <if test="jobLevel != null  and jobLevel != ''"> and job_Level = #{jobLevel}</if>
            <if test="jobType != null  and jobType != ''"> and job_type = #{jobType}</if>
            <if test="jobExperience != null  and jobExperience != ''"> and job_experience = #{jobExperience}</if>
            <if test="salaryStart != null "> and salary_start = #{salaryStart}</if>
            <if test="salaryEnd != null "> and salary_end = #{salaryEnd}</if>
            <if test="requiredSkillsJson != null  and requiredSkillsJson != ''"> and required_skills_json = #{requiredSkillsJson}</if>
            <if test="niceToHaveSkillsJson != null  and niceToHaveSkillsJson != ''"> and nice_to_have_skills_json = #{niceToHaveSkillsJson}</if>
            <if test="educationRequirementsJson != null  and educationRequirementsJson != ''"> and education_requirements_json = #{educationRequirementsJson}</if>
            <if test="acceptEquivalentWorkFlag != null  and acceptEquivalentWorkFlag != ''"> and accept_equivalent_work_flag = #{acceptEquivalentWorkFlag}</if>
            <if test="certificationsLicensesJson != null  and certificationsLicensesJson != ''"> and certifications_licenses_json = #{certificationsLicensesJson}</if>
            <if test="descriptionTone != null  and descriptionTone != ''"> and description_tone = #{descriptionTone}</if>
            <if test="aboutRole != null  and aboutRole != ''"> and about_role = #{aboutRole}</if>
            <if test="responsibilities != null  and responsibilities != ''"> and responsibilities = #{responsibilities}</if>
            <if test="roleBenefitsJson != null  and roleBenefitsJson != ''"> and role_benefits_json = #{roleBenefitsJson}</if>
            <if test="publishingChannelsJson != null  and publishingChannelsJson != ''"> and publishing_channels_json = #{publishingChannelsJson}</if>
            <if test="publishingScheduleDate != null  and publishingScheduleDate != ''"> and publishing_schedule_date = #{publishingScheduleDate}</if>
            <if test="publishingScheduleTime != null  and publishingScheduleTime != ''"> and publishing_schedule_time = #{publishingScheduleTime}</if>
            <if test="applicationDeadline != null  and applicationDeadline != ''"> and application_deadline = #{applicationDeadline}</if>
            <if test="posted != null  and posted != ''"> and posted = #{posted}</if>
            <if test="dataType != null  and dataType != ''"> and data_type = #{dataType}</if>
            <if test="operStep != null  and operStep != ''"> and oper_step = #{operStep}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
        </where>
            order by create_time desc
    </select>
    
    <select id="selectHotakeRolesInfoById" parameterType="Long" resultMap="HotakeRolesInfoResult">
        <include refid="selectHotakeRolesInfoVo"/>
        where id = #{id}
    </select>

    <select id="selectHotakeRolesInfoByUuid" parameterType="String" resultMap="HotakeRolesInfoResult">
        <include refid="selectHotakeRolesInfoVo"/>
        where uuid = #{uuid}
    </select>
        
    <insert id="insertHotakeRolesInfo" parameterType="HotakeRolesInfo" useGeneratedKeys="true" keyProperty="id">
        insert into hotake_roles_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="uuid != null">uuid,</if>
            <if test="recruiterId != null">recruiter_id,</if>
            <if test="roleName != null">role_name,</if>
            <if test="companyName != null">company_name,</if>
            <if test="roleType != null">role_type,</if>
            <if test="locationType != null">location_type,</if>
            <if test="locations != null">locations,</if>
            <if test="applied != null">applied,</if>
            <if test="jobLevel != null">job_Level,</if>
            <if test="jobType != null">job_type,</if>
            <if test="jobExperience != null">job_experience,</if>
            <if test="salaryStart != null">salary_start,</if>
            <if test="salaryEnd != null">salary_end,</if>
            <if test="requiredSkillsJson != null">required_skills_json,</if>
            <if test="niceToHaveSkillsJson != null">nice_to_have_skills_json,</if>
            <if test="educationRequirementsJson != null">education_requirements_json,</if>
            <if test="acceptEquivalentWorkFlag != null">accept_equivalent_work_flag,</if>
            <if test="certificationsLicensesJson != null">certifications_licenses_json,</if>
            <if test="descriptionTone != null">description_tone,</if>
            <if test="aboutRole != null">about_role,</if>
            <if test="responsibilities != null">responsibilities,</if>
            <if test="roleBenefitsJson != null">role_benefits_json,</if>
            <if test="publishingChannelsJson != null">publishing_channels_json,</if>
            <if test="publishingScheduleDate != null">publishing_schedule_date,</if>
            <if test="publishingScheduleTime != null">publishing_schedule_time,</if>
            <if test="applicationDeadline != null">application_deadline,</if>
            <if test="posted != null">posted,</if>

            <if test="aiScreeningVideoFlag != null">ai_screening_video_flag,</if>
            <if test="videoId != null">video_id,</if>
            <if test="speechSpeed != null">speech_speed,</if>

            <if test="languages != null">languages,</if>
            <if test="dataType != null">data_type,</if>
            <if test="operStep != null">oper_step,</if>
            <if test="status != null">status,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="uuid != null">#{uuid},</if>
            <if test="recruiterId != null">#{recruiterId},</if>
            <if test="roleName != null">#{roleName},</if>
            <if test="companyName != null">#{companyName},</if>
            <if test="roleType != null">#{roleType},</if>
            <if test="locationType != null">#{locationType},</if>
            <if test="locations != null">#{locations},</if>
            <if test="applied != null">#{applied},</if>
            <if test="jobLevel != null">#{jobLevel},</if>
            <if test="jobType != null">#{jobType},</if>
            <if test="jobExperience != null">#{jobExperience},</if>
            <if test="salaryStart != null">#{salaryStart},</if>
            <if test="salaryEnd != null">#{salaryEnd},</if>
            <if test="requiredSkillsJson != null">#{requiredSkillsJson},</if>
            <if test="niceToHaveSkillsJson != null">#{niceToHaveSkillsJson},</if>
            <if test="educationRequirementsJson != null">#{educationRequirementsJson},</if>
            <if test="acceptEquivalentWorkFlag != null">#{acceptEquivalentWorkFlag},</if>
            <if test="certificationsLicensesJson != null">#{certificationsLicensesJson},</if>
            <if test="descriptionTone != null">#{descriptionTone},</if>
            <if test="aboutRole != null">#{aboutRole},</if>
            <if test="responsibilities != null">#{responsibilities},</if>
            <if test="roleBenefitsJson != null">#{roleBenefitsJson},</if>
            <if test="publishingChannelsJson != null">#{publishingChannelsJson},</if>
            <if test="publishingScheduleDate != null">#{publishingScheduleDate},</if>
            <if test="publishingScheduleTime != null">#{publishingScheduleTime},</if>
            <if test="applicationDeadline != null">#{applicationDeadline},</if>
            <if test="posted != null">#{posted},</if>

            <if test="aiScreeningVideoFlag != null">#{aiScreeningVideoFlag},</if>
            <if test="videoId != null">#{videoId},</if>
            <if test="speechSpeed != null">#{speechSpeed},</if>

            <if test="languages != null">#{languages},</if>
            <if test="dataType != null">#{dataType},</if>
            <if test="operStep != null">#{operStep},</if>
            <if test="status != null">#{status},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateHotakeRolesInfo" parameterType="HotakeRolesInfo">
        update hotake_roles_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="recruiterId != null">recruiter_id = #{recruiterId},</if>
            <if test="roleName != null">role_name = #{roleName},</if>
            <if test="companyName != null">company_name = #{companyName},</if>
            <if test="roleType != null">role_type = #{roleType},</if>
            <if test="locationType != null">location_type = #{locationType},</if>
            <if test="locations != null">locations = #{locations},</if>
            <if test="applied != null">applied = #{applied},</if>
            <if test="jobLevel != null">job_Level = #{jobLevel},</if>
            <if test="jobType != null">job_type = #{jobType},</if>
            <if test="jobExperience != null">job_experience = #{jobExperience},</if>
            <if test="salaryStart != null">salary_start = #{salaryStart},</if>
            <if test="salaryEnd != null">salary_end = #{salaryEnd},</if>
            <if test="requiredSkillsJson != null">required_skills_json = #{requiredSkillsJson},</if>
            <if test="niceToHaveSkillsJson != null">nice_to_have_skills_json = #{niceToHaveSkillsJson},</if>
            <if test="educationRequirementsJson != null">education_requirements_json = #{educationRequirementsJson},</if>
            <if test="acceptEquivalentWorkFlag != null">accept_equivalent_work_flag = #{acceptEquivalentWorkFlag},</if>
            <if test="certificationsLicensesJson != null">certifications_licenses_json = #{certificationsLicensesJson},</if>
            <if test="descriptionTone != null">description_tone = #{descriptionTone},</if>
            <if test="aboutRole != null">about_role = #{aboutRole},</if>
            <if test="responsibilities != null">responsibilities = #{responsibilities},</if>
            <if test="roleBenefitsJson != null">role_benefits_json = #{roleBenefitsJson},</if>
            <if test="publishingChannelsJson != null">publishing_channels_json = #{publishingChannelsJson},</if>
            <if test="publishingScheduleDate != null">publishing_schedule_date = #{publishingScheduleDate},</if>
            <if test="publishingScheduleTime != null">publishing_schedule_time = #{publishingScheduleTime},</if>
            <if test="applicationDeadline != null">application_deadline = #{applicationDeadline},</if>
            <if test="posted != null">posted = #{posted},</if>

            <if test="aiScreeningVideoFlag != null">ai_screening_video_flag = #{aiScreeningVideoFlag},</if>
            <if test="videoId != null">video_id = #{videoId},</if>
            <if test="speechSpeed != null">speech_speed = #{speechSpeed},</if>

            <if test="languages != null">languages = #{languages},</if>
            <if test="dataType != null">data_type = #{dataType},</if>
            <if test="operStep != null">oper_step = #{operStep},</if>
            <if test="status != null">status = #{status},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>

    <update id="updateAllHotakeRolesInfo" parameterType="HotakeRolesInfo">
        update hotake_roles_info
        <trim prefix="SET" suffixOverrides=",">
            recruiter_id = #{recruiterId},
            role_name = #{roleName},
            company_name = #{companyName},
            role_type = #{roleType},
            location_type = #{locationType},
            locations = #{locations},
            applied = #{applied},
            job_Level = #{jobLevel},
            job_type = #{jobType},
            job_experience = #{jobExperience},
            salary_start = #{salaryStart},
            salary_end = #{salaryEnd},
            required_skills_json = #{requiredSkillsJson},
            nice_to_have_skills_json = #{niceToHaveSkillsJson},
            education_requirements_json = #{educationRequirementsJson},
            accept_equivalent_work_flag = #{acceptEquivalentWorkFlag},
            certifications_licenses_json = #{certificationsLicensesJson},
            description_tone = #{descriptionTone},
            about_role = #{aboutRole},
            responsibilities = #{responsibilities},
            role_benefits_json = #{roleBenefitsJson},
            publishing_channels_json = #{publishingChannelsJson},
            publishing_schedule_date = #{publishingScheduleDate},
            publishing_schedule_time = #{publishingScheduleTime},
            application_deadline = #{applicationDeadline},
            posted = #{posted},

            ai_screening_video_flag = #{aiScreeningVideoFlag},
            video_id = #{videoId},
            speech_speed = #{speechSpeed},

            languages = #{languages},
            data_type = #{dataType},
            oper_step = #{operStep},
            status = #{status},
            update_by = #{updateBy},
            update_time = #{updateTime},
            remark = #{remark},
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteHotakeRolesInfoById" parameterType="Long">
        delete from hotake_roles_info where id = #{id}
    </delete>

    <delete id="deleteHotakeRolesInfoByIds" parameterType="String">
        delete from hotake_roles_info where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

    <insert id="batchInsertHotakeRolesInfo">
        insert into hotake_roles_info( id, recruiter_id, role_name, location_type, locations, applied, job_Level, job_type, job_experience, salary_start, salary_end, required_skills_json, nice_to_have_skills_json, education_requirements_json, accept_equivalent_work_flag, certifications_licenses_json, description_tone, about_role, responsibilities, role_benefits_json, publishing_channels_json, publishing_schedule_date, publishing_schedule_time, application_deadline, posted, data_type, oper_step, del_flag, create_by, create_time, update_by, update_time, remark) values
        <foreach item="item" index="index" collection="list" separator=",">
            ( #{item.id}, #{item.recruiterId}, #{item.roleName}, #{item.locationType}, #{item.locations}, #{item.applied}, #{item.jobLevel}, #{item.jobType}, #{item.jobExperience}, #{item.salaryStart}, #{item.salaryEnd}, #{item.requiredSkillsJson}, #{item.niceToHaveSkillsJson}, #{item.educationRequirementsJson}, #{item.acceptEquivalentWorkFlag}, #{item.certificationsLicensesJson}, #{item.descriptionTone}, #{item.aboutRole}, #{item.responsibilities}, #{item.roleBenefitsJson}, #{item.publishingChannelsJson}, #{item.publishingScheduleDate}, #{item.publishingScheduleTime}, #{item.applicationDeadline}, #{item.posted}, #{item.dataType}, #{item.operStep}, #{item.delFlag}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.remark})
        </foreach>
    </insert>
</mapper>