<?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.manager.mapper.WbsInfoMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="wbsInfoResultMap" type="org.springblade.manager.entity.WbsInfo">
        <result column="id" property="id"/>
        <result column="create_time" property="createTime"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
        <result column="wbs_name" property="wbsName"/>
        <result column="wbs_type" property="wbsType"/>
    </resultMap>
    <resultMap id="resultMap2" type="org.springblade.manager.vo.WbsInfoVO">
        <result column="id" property="id"/>
        <result column="wbs_name" property="wbsName"/>
        <result column="wbs_type" property="wbsType"/>
        <result column="status" property="status"/>
    </resultMap>

    <select id="selectWbsInfoPage" resultMap="wbsInfoResultMap">
        select * from m_wbs_info where is_deleted = 0
    </select>
    <select id="selectAll" resultMap="resultMap2">
        SELECT
        id,
        wbs_name,
        wbs_type,
        `STATUS`
        FROM
        m_wbs_info
        WHERE
        is_deleted = 0
        AND `STATUS` = 1
        <if test="type != null and type != ''">
            AND wbs_type = #{type}
        </if>
        GROUP BY
        wbs_name
        ORDER BY
        create_time
    </select>

    <select id="selectById2" resultMap="wbsInfoResultMap">
        SELECT * FROM m_wbs_info
        WHERE id = #{id}
    </select>

</mapper>
