SupplychainOpenRoomMapperAuto.xml 5.13 KB
<?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.lecuntao.ordering.customization.dal.SupplychainOpenRoomMapper">

    <resultMap  id="supplychainOpenRoomPO" type="com.lecuntao.ordering.customization.po.SupplychainOpenRoomPO">
        <id column="ID" jdbcType="NUMERIC" property="id" />
        <result column="TENANT_ID"  jdbcType="NUMERIC" property="tenantId"></result>
        <result column="STORE_ROOM_ID"  jdbcType="NUMERIC" property="storeRoomId"></result>
        <result column="STORE_ROOM_NAME"  jdbcType="VARCHAR" property="storeRoomName"></result>
        <result column="STORE_HOUSE_ID"  jdbcType="NUMERIC" property="storeHouseId"></result>
        <result column="STORE_HOUSE_NAME"  jdbcType="VARCHAR" property="storeHouseName"></result>
        <result column="IS_ACTIVE"  jdbcType="TINYINT" property="isActive"></result>
        <result column="ROW_VERSION"  jdbcType="NUMERIC" property="rowVersion"></result>
        <result column="IS_DELETED"  jdbcType="TINYINT" property="isDeleted"></result>
        <result column="CREATED_BY"  jdbcType="NUMERIC" property="createdBy"></result>
        <result column="CREATION_TIME"  jdbcType="TIMESTAMP" property="creationTime"></result>
        <result column="LAST_UPDATED_BY"  jdbcType="NUMERIC" property="lastUpdatedBy"></result>
        <result column="LAST_UPDATE_TIME"  jdbcType="TIMESTAMP" property="lastUpdateTime"></result>
    </resultMap>

    <sql id="entityColumnList">
    `ID`,`TENANT_ID`,`STORE_ROOM_ID`,`STORE_ROOM_NAME`,`STORE_HOUSE_ID`,`STORE_HOUSE_NAME`,`IS_ACTIVE`,`ROW_VERSION`,`IS_DELETED`,`CREATED_BY`,`CREATION_TIME`,`LAST_UPDATED_BY`,`LAST_UPDATE_TIME`
    </sql>

    <insert id="insert">
        INSERT INTO
            `ZH_SUPPLYCHAIN_OPEN_ROOM`
            (
            <include refid="entityColumnList" />
            )
        VALUES
        (
        #{ supplychainOpenRoom.id },
         #{ passport.tenantId },
        
        #{ supplychainOpenRoom.storeRoomId },
        #{ supplychainOpenRoom.storeRoomName },
        #{ supplychainOpenRoom.storeHouseId },
        #{ supplychainOpenRoom.storeHouseName },
        #{ supplychainOpenRoom.isActive },
        0,0,#{ passport.userId },sysdate(),null,null
        )
    </insert>

    <insert id="insertBatch">
        INSERT INTO
            `ZH_SUPPLYCHAIN_OPEN_ROOM`
            (
            <include refid="entityColumnList" />
            )
        VALUES
        <foreach collection="list" item= "supplychainOpenRoom" index ="index" separator=",">
            (
            #{ supplychainOpenRoom.id },
            #{ passport.tenantId },
            
            #{ supplychainOpenRoom.storeRoomId },
            #{ supplychainOpenRoom.storeRoomName },
            #{ supplychainOpenRoom.storeHouseId },
            #{ supplychainOpenRoom.storeHouseName },
            #{ supplychainOpenRoom.isActive },
            0,0,#{ passport.userId },sysdate(),null,null
            )
        </foreach >
    </insert>


    <update id="delete">
        UPDATE
            `ZH_SUPPLYCHAIN_OPEN_ROOM`
        SET
            `IS_DELETED` = 1
            ,`LAST_UPDATED_BY`=#{ passport.userId }
            ,`LAST_UPDATE_TIME`=SYSDATE()
        WHERE
            `IS_DELETED`=0
            AND `TENANT_ID`=#{ passport.tenantId }
            AND `ID` = #{id}
    </update>

    <update id= "deleteBatch">
        UPDATE
            `ZH_SUPPLYCHAIN_OPEN_ROOM`
        SET
            `IS_DELETED` = 1
            ,`LAST_UPDATED_BY`=#{ passport.userId }
            ,`LAST_UPDATE_TIME`=SYSDATE()
        WHERE
            `IS_DELETED`=0
            AND `TENANT_ID`=#{ passport.tenantId }
            AND `ID` in
        <foreach collection="list" item= "id" index ="index" open= "(" close =")" separator=",">
            #{id}
        </foreach >
    </update >


    <select id="getById" resultMap="supplychainOpenRoomPO">
        SELECT
        <include refid="entityColumnList" />
        FROM
            `ZH_SUPPLYCHAIN_OPEN_ROOM`
        WHERE
            `IS_DELETED` = 0
            AND `ID` = #{id}
            AND `TENANT_ID`=#{ passport.tenantId }
    </select>

    <select id="getListByIds" resultMap="supplychainOpenRoomPO">
        SELECT
            <include refid="entityColumnList" />
        FROM
            `ZH_SUPPLYCHAIN_OPEN_ROOM`
        WHERE
        `IS_DELETED` = 0
        AND `ID` in
        <foreach collection="list" item= "id" index ="index" open= "(" close =")" separator=",">
            #{id}
        </foreach >
        
            AND `TENANT_ID`=#{ passport.tenantId }
    </select>

    <select id="getAllList" resultMap="supplychainOpenRoomPO">
        SELECT
        <include refid="entityColumnList" />
        FROM
            `ZH_SUPPLYCHAIN_OPEN_ROOM`
        WHERE
            `IS_DELETED`=0
            AND `TENANT_ID`=#{ passport.tenantId }
    </select>

    <select id="existById"  resultType="java.lang.Long">
        SELECT
            COUNT(*)
        FROM
            `ZH_SUPPLYCHAIN_OPEN_ROOM`
        WHERE
            `IS_DELETED`=0
            AND `ID`=#{id}
            AND `TENANT_ID`=#{ passport.tenantId }
    </select>
</mapper>