<?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.ruoyi.storageLocation.mapper.StorageLocationMapper">

    <resultMap type="StorageLocation" id="StorageLocationResult">
        <result property="materialBh"    column="materialBh"    />
        <result property="materialXingh"    column="materialXingh"    />
        <result property="materialGuig"    column="materialGuig"    />
        <result property="materialDiany"    column="materialDiany"    />
        <result property="materialMs"    column="materialMs"    />
        <result property="materialState"    column="materialState"    />
    </resultMap>

    <select id="selectStorageLocationAList" parameterType="StorageLocation" resultMap="StorageLocationResult">
        select materialBh, materialXingh, materialGuig, materialDiany, materialMs, materialState
        from storageLocation where materialBh like 'A%'
    </select>
    <select id="selectStorageLocationBList" parameterType="StorageLocation" resultMap="StorageLocationResult">
        select materialBh, materialXingh, materialGuig, materialDiany, materialMs, materialState
        from storageLocation where materialBh like 'B%'
    </select>
    <select id="selectStorageLocationCList" parameterType="StorageLocation" resultMap="StorageLocationResult">
        select materialBh, materialXingh, materialGuig, materialDiany, materialMs, materialState
        from storageLocation where materialBh like 'C%'
    </select>

    <update id="addStorageLocation" parameterType="StorageLocation">
        update storageLocation
        <trim prefix="SET" suffixOverrides=",">
            <if test="materialXingh != null and materialXingh != ''">materialXingh = #{materialXingh},</if>
            <if test="materialGuig != null and materialGuig != ''">materialGuig = #{materialGuig},</if>
            <if test="materialDiany != null and materialDiany != ''">materialDiany = #{materialDiany},</if>
            <if test="materialMs != null and materialMs != ''">materialMs = #{materialMs},</if>
            materialState = '1'
        </trim>
        where materialBh = #{materialBh}
    </update>

</mapper>
