<?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.nantian.cloud.jly.mapper.TMeasuringInstrumentsMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.nantian.cloud.jly.entity.TMeasuringInstruments">
        <id column="id" property="id" />
        <result column="code" property="code" />
        <result column="name" property="name" />
        <result column="pcode" property="pcode" />
        <result column="userid" property="userid" />
        <result column="update_time" property="updateTime" />
        <result column="del_flag" property="delFlag" />
        <result column="dept_id" property="deptId" />
        <result column="ischild" property="ischild" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, code, name, pcode, userid, update_time, del_flag, dept_id, ischild
    </sql>

    <select id="getTree" resultType="com.nantian.cloud.jly.vo.TreeVo">
        SELECT t1.code as value, t1.name as label, t2.code as pvalue, t2.name as plabel
        FROM t_measuring_instruments t1
        left join t_measuring_instruments t2 on t1.pcode = t2.code
    </select>

</mapper>
