<?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="org.springblade.responsible.mapper.BladeResponsibleMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="org.springblade.responsible.entity.BladeResponsible">
        <id column="id" property="id" />
        <result column="name" property="name" />
        <result column="phone" property="phone" />
        <result column="email" property="email" />
        <result column="department" property="department" />
        <result column="position" property="position" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, name, phone, email, department, position, create_time, update_time
    </sql>

    <select id="getPageByQuery" resultType="org.springblade.responsible.dto.vo.BladeResponsibleVo">
        SELECT
        *
        FROM
        blade_responsible
        where 1 = 1
        <if test="query.responsibleName != null and query.responsibleName != ''">
            and name LIKE CONCAT('%',#{query.responsibleName},'%')
        </if>
        <if test="query.responsibleDepartment != null and query.responsibleDepartment != ''">
            and department LIKE CONCAT('%',#{query.responsibleDepartment},'%')
        </if>
        ORDER BY
        create_time DESC
    </select>
</mapper>
