<?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.huimv.getdata.mapper.ErpBdDepartmentMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.huimv.getdata.entity.ErpBdDepartment">
        <id column="id" property="id" />
        <result column="fcreateorgid" property="fcreateorgid" />
        <result column="fcreatedate" property="fcreatedate" />
        <result column="fdeptid" property="fdeptid" />
        <result column="flocaleid" property="flocaleid" />
        <result column="fname" property="fname" />
        <result column="fdescription" property="fdescription" />
        <result column="ffullname" property="ffullname" />
        <result column="ffullnamehr" property="ffullnamehr" />
    </resultMap>
    <select id="getDep" resultType="com.huimv.getdata.entity.ErpBdDepartment">
        SELECT A.fcreateorgid , A.fcreatedate , A.fdeptid ,B.flocaleid
     ,B.flocaleid ,B.fname ,B.fdescription  ,B.ffullname,B.ffullnamehr
     FROM T_BD_DEPARTMENT  A
     INNER JOIN  T_BD_DEPARTMENT_L B ON A.FDEPTID = B.FDEPTID
    </select>
    <select id="getMaterial" resultType="com.huimv.getdata.entity.ErpBdMaterial">

        SELECT
    SUBSTRING(a.fnumber, 1, 6) AS fnumber
FROM
    [dbo].[T_BD_MATERIAL] a
WHERE
    a.fnumber LIKE '01%'
    AND a.FFORBIDSTATUS = 'A'
GROUP BY
    SUBSTRING(a.fnumber, 1, 6);
    </select>
    <select id="getMaterialDetail" resultType="com.huimv.getdata.entity.ErpMaterial"
            parameterType="java.lang.String">

        SELECT a.fnumber  , b.fuseorgid  facctorgid, b.FNAME fname ,b.FSPECIFICATION fspecification   FROM [dbo].[T_BD_MATERIAL]  a
inner join   T_BD_MATERIAL_L b on a.fmaterialid = b.fmaterialid
 where a.FFORBIDSTATUS = 'A'
 and  a.fnumber like #{fnumber}
    </select>

</mapper>
