<?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="cn.iocoder.yudao.module.knowledge.mapper.TExpertZoneMapper">

    <resultMap type="cn.iocoder.yudao.module.knowledge.entity.TExpertZone" id="tExpertZoneMap">
            <result property="id" column="id"/>
            <result property="title" column="title"/>
            <result property="content" column="content"/>
            <result property="specialistId" column="specialist_id"/>
            <result property="createTime" column="create_time"/>
            <result property="updateTime" column="update_time"/>
            <result property="deptId" column="dept_id"/>
            <result property="identityId" column="identity_id"/>
            <result property="deleted" column="deleted"/>
    </resultMap>

    <!-- 用于select查询公用抽取的列 -->
    <sql id="columns">
        id,title,content,specialist_id,create_time,update_time,dept_id,identity_id,deleted
    </sql>
    <update id="deleteByid">
        update t_expert_zone set deleted = 1 where id = #{id}
    </update>
    <select id="findList" resultMap="tExpertZoneMap">
        select
        <include refid="columns"/>
        from t_expert_zone
        <where>
            deleted = 0
                    <if test="params.title != null and params.title != ''">
                         and   title LIKE CONCAT( '%', #{params.title}, '%')
                    </if>
                    <if test="params.content != null and params.content != ''">
                        and  content LIKE CONCAT( '%', #{params.content}, '%')
                    </if>
                    <if test="params.specialistId != null">
                        and specialist_id = #{params.specialistId}
                    </if>
                    <if test="params.createTime != null">
                        and create_time = #{params.createTime}
                    </if>
        </where>
    </select>
    <select id="queryAll" resultType="cn.iocoder.yudao.module.knowledge.entity.TExpertZone">
        select
        <include refid="columns"/>
        from t_expert_zone
        <where>
            deleted = 0
            <if test="params.title != null and params.title != ''">
                and   title LIKE CONCAT( '%', #{params.title}, '%')
            </if>
            <if test="params.content != null and params.content != ''">
                and  content LIKE CONCAT( '%', #{params.content}, '%')
            </if>
            <if test="params.specialistId != null">
                and specialist_id = #{params.specialistId}
            </if>
            <if test="params.createTime != null">
                and create_time = #{params.createTime}
            </if>
        </where>
    </select>

</mapper>