<?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.bonus.sgzb.base.mapper.ExcelMapper">
    <insert id="insertPaName" parameterType="com.bonus.sgzb.base.domain.MaPartType" keyProperty="paId" useGeneratedKeys="true">
        insert into ma_part_type
            (pa_name, parent_id, status,level,del_flag,unit_id,buy_price,create_by,create_time,year)
        VALUES
            (#{paName}, #{parentId},0 , #{level}, 0, #{unitId}, #{buyPrice}, #{createBy}, now(),year(now()))
    </insert>


        <!--    <insert id="insertPaName"  keyProperty="paId" useGeneratedKeys="true">-->
<!--        insert into ma_part_type-->
<!--            (pa_name, status,level,del_flag,create_by,create_time,year)-->
<!--        VALUES-->
<!--            (#{paName}, 0 , 1, 0, #{createBy}, now(),year(now()))-->
<!--    </insert>-->
<!--    <insert id="insertPaTwoName" keyProperty="paId" useGeneratedKeys="true">-->
<!--        insert into ma_part_type-->
<!--        (pa_name, parent_id, status,level,del_flag,unit_id,buy_price,create_by,create_time,year)-->
<!--        VALUES-->
<!--            (#{paName}, #{parentId},0 , 2, 0, #{unitId}, #{buyPrice}, #{createBy}, now(),year(now()))-->
<!--    </insert>-->
<!--    <insert id="insertPaThreeName">-->
<!--        insert into ma_part_type-->
<!--        (pa_name, parent_id, status,level,del_flag,unit_id,buy_price,create_by,create_time,year)-->
<!--        VALUES-->
<!--            (#{paName}, #{parentId},0 , 3, 0, #{unitId}, #{buyPrice}, #{createBy}, now(),year(now()))-->
<!--    </insert>-->
<!--    <update id="updateLevelStatus" parameterType="java.lang.String">-->
<!--        update ma_part_type set level_status = 1 where pa_id = #{parentId}-->
<!--    </update>-->

<!--    <select id="selectPaName" resultType="java.lang.String">-->
<!--        SELECT pa_id FROM ma_part_type WHERE pa_name = #{firstLevel}-->
<!--    </select>-->

<!--    <select id="selectThreeName" resultType="java.lang.Integer" parameterType="java.lang.String">-->
<!--        SELECT count(*) FROM ma_part_type WHERE pa_name = #{firstLevel} and level = 3-->
<!--    </select>-->
<!--    <select id="selectTwoName" resultType="java.lang.Integer"  parameterType="java.lang.String">-->
<!--        SELECT count(*) FROM ma_part_type WHERE pa_name = #{secondLevel} and level = 2-->
<!--    </select>-->
<!--    <select id="selectPaNameAndpaId" resultType="java.lang.String" parameterType="java.lang.String">-->
<!--        SELECT parent_id FROM ma_part_type WHERE pa_name = #{value} and pa_id = #{o}-->
<!--    </select>-->
<!--    <select id="selectListParentid" resultType="java.util.List" parameterType="java.lang.String">-->
<!--        SELECT parent_id FROM ma_part_type WHERE pa_name = #{firstLevel} and level = 2-->
<!--    </select>-->
<!--    <select id="selectName" resultType="java.lang.String" parameterType="java.lang.String">-->
<!--        SELECT pa_name FROM ma_part_type WHERE pa_name = #{parentId2}-->
<!--    </select>-->
<!--    <select id="selectStatus" resultType="java.lang.String">-->
<!--        select level_status from ma_part_type where pa_id = #{pId}-->
<!--    </select>-->
<!--    <select id="selectTwoPaName" resultType="com.bonus.sgzb.base.domain.MaPartType">-->
<!--        select * from ma_part_type where pa_name = #{secondLevel} and parent_id = #{id}-->
<!--    </select>-->
        <select id="selectMa" resultType="com.bonus.sgzb.base.domain.MaPartType">
            select * from ma_part_type where pa_name = #{name} and parent_id = #{id}
        </select>


</mapper>
