<?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.vctgo.system.mapper.SysPlatformExpertEducationMapper">

    <resultMap type="com.vctgo.system.domain.SysPlatformExpertEducation" id="SysPlatformExpertEducationResult">
        <result property="id"    column="id"    />
        <result property="userId"    column="user_id"    />
        <result property="educationalBackgroundType"    column="educational_background_type"    />
        <result property="educationalBackground"    column="educational_background"    />
        <result property="graduateSchool"    column="graduate_school"    />
        <result property="profession"    column="profession"    />
        <result property="remark"    column="remark"    />
        <result property="isDeleted"    column="is_deleted"    />
        <result property="createById"    column="create_by_id"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateById"    column="update_by_id"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="tenantId"    column="tenant_id"    />
    </resultMap>

    <sql id="selectSysPlatformExpertEducationVo">
        select id, user_id, educational_background_type, educational_background, graduate_school, profession, remark, is_deleted, create_by_id, create_by, create_time, update_by_id, update_by, update_time, tenant_id from sys_platform_expert_education
    </sql>

    <sql id="defaultDeleteCondition">
        is_deleted = 0
    </sql>

    <select id="selectSysPlatformExpertEducationList"   resultMap="SysPlatformExpertEducationResult">
        <include refid="selectSysPlatformExpertEducationVo"/>
        <where>
            <include refid="defaultDeleteCondition"/>
            <if test="query.userId != null "> and user_id = #{query.userId}</if>
            <if test="query.educationalBackgroundType != null  and query.educationalBackgroundType != ''"> and educational_background_type = #{query.educationalBackgroundType}</if>
            <if test="query.educationalBackground != null  and query.educationalBackground != ''"> and educational_background = #{query.educationalBackground}</if>
            <if test="query.graduateSchool != null  and query.graduateSchool != ''"> and graduate_school = #{query.graduateSchool}</if>
            <if test="query.profession != null  and query.profession != ''"> and profession = #{query.profession}</if>
            <if test="query.isDeleted != null  and query.isDeleted != ''"> and is_deleted = #{query.isDeleted}</if>
            <if test="query.createById != null "> and create_by_id = #{query.createById}</if>
            <if test="query.updateById != null "> and update_by_id = #{query.updateById}</if>
            <if test="query.tenantId != null "> and tenant_id = #{query.tenantId}</if>
        </where>
    </select>

    <update id="logicalDeleteSysPlatformExpertEducationByIds" parameterType="String">
        update sys_platform_expert_education set is_deleted = #{query.isDeleted},
        update_by_id = #{query.updateById}, update_by = #{query.updateBy},
        update_time = #{query.updateTime} where id in
        <foreach item="id" collection="ids" open="(" separator="," close=")">
            #{id}
        </foreach>
    </update>

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