<?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.SysTeachHonoraryAchievementMapper">

    <resultMap type="com.vctgo.system.domain.SysTeachHonoraryAchievement" id="SysTeachHonoraryAchievementResult">
        <result property="id" column="id"/>
        <result property="staffId" column="staff_id"/>
        <result property="title" column="title"/>
        <result property="commendOrganization" column="commend_organization"/>
        <result property="commendTime" column="commend_time"/>
        <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="selectSysTeachHonoraryAchievementVo">
        select id,
               staff_id,
               title,
               commend_organization,
               commend_time,
               remark,
               is_deleted,
               create_by_id,
               create_by,
               create_time,
               update_by_id,
               update_by,
               update_time,
               tenant_id
        from sys_teach_honorary_achievement
    </sql>

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

    <select id="selectSysTeachHonoraryAchievementList" resultMap="SysTeachHonoraryAchievementResult">
        <include refid="selectSysTeachHonoraryAchievementVo"/>
        <where>
            <include refid="defaultDeleteCondition"/>
            <if test="query.staffId != null ">and staff_id = #{query.staffId}</if>
            <if test="query.title != null  and query.title != ''">and title = #{query.title}</if>
            <if test="query.commendOrganization != null  and query.commendOrganization != ''">and commend_organization =
                #{query.commendOrganization}
            </if>
            <if test="query.commendTime != null  and query.commendTime != ''">and commend_time = #{query.commendTime}
            </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="logicalDeleteSysTeachHonoraryAchievementByIds" parameterType="String">
        update sys_teach_honorary_achievement 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="deleteSysTeachHonoraryAchievementByIds" parameterType="String">
        delete from sys_teach_honorary_achievement where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
