<?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.engine.organization.mapper.personnelcard.PersonnelCardMapper">
    <resultMap id="UserMap" type="com.engine.organization.entity.personnelcard.UserCard">
        <result column="id" property="id"/>
        <result column="resourceimageid" property="image"/>
        <result column="lastname" property="name"/>
        <result column="sex" property="sex"/>
        <result column="email" property="email"/>
        <result column="mobile" property="phone"/>
        <result column="accounttype" property="accountType"/>
        <result column="status" property="status"/>
    </resultMap>

    <resultMap id="BaseTabMap" type="com.engine.organization.entity.personnelcard.ResourceBaseTab">
        <result column="id" property="id"/>
        <result column="groupname" property="groupName"/>
        <result column="grouplabel" property="groupLabel"/>
        <result column="dsporder" property="dspOrder"/>
        <result column="isopen" property="isOpen"/>
        <result column="ismand" property="isMand"/>
        <result column="isused" property="isUsed"/>
        <result column="issystem" property="isSystem"/>
        <result column="linkurl" property="linkUrl"/>
        <result column="tabnum" property="tabNum"/>
    </resultMap>

    <resultMap id="CusTreeFormMap" type="com.engine.organization.entity.personnelcard.po.CusTreeFormPO">
        <result column="scope" property="scope"/>
        <result column="formLabel" property="formLabel"/>
        <result column="id" property="id"/>
        <result column="parentId" property="parentId"/>
        <result column="viewType" property="viewType"/>
        <result column="scopeOrder" property="scopeOrder"/>
    </resultMap>


    <select id="getUserById" resultMap="UserMap">
        select id,
               resourceimageid,
               lastname,
               sex,
               email,
               mobile,
               accounttype,
               status
        from hrmresource
        where id = #{id}
    </select>

    <select id="getResourceBaseTabList" resultMap="BaseTabMap">
        select *
        from HrmResourceBaseTab
        where isopen = 1
        order by dsporder
    </select>
    <select id="getCusTreeForms" resultMap="CusTreeFormMap">
        select *
        from cus_treeform
        where parentid = #{parentId}
        <if test="null!=parentId and parentId !=0">
            and viewtype = 1
        </if>
    </select>
</mapper>