<?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.casic.missiles.modular.dept.dao.BusDeptUserMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.casic.missiles.modular.dept.model.BusDeptUser">
        <id column="ID" property="id" />
        <result column="DEPTID" property="deptid" />
        <result column="USER" property="user" />
        <result column="NUM" property="num" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        ID AS id, DEPTID AS deptid, user_id AS userId, NUM AS num
    </sql>

    <select id="selectDeptUserList" resultType="com.casic.missiles.modular.dept.dto.DeptUserView">
        SELECT
            id,
            pid,
            pids,
            simplename,
            fullname,
            version,
            num,
            tips,
            userId,
            userName,
            phone
         FROM dept_user_view
         <where>
             <if test="deptName != null and deptName != ''">
                 AND (fullname LIKE CONCAT('%',#{deptName},'%')
                 OR simplename LIKE CONCAT('%',#{deptName},'%'))
             </if>
             <if test="deptType != null and deptType != -1 ">
                 AND deptType = #{deptType}
             </if>
         </where>
    </select>

</mapper>
