<?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.rongwei.bscommon.sys.dao.ApsCraftRouteStepEquDao">

    <resultMap id="BaseResultMap" type="com.rongwei.bsentity.domain.ApsCraftRouteStepEquDo">
            <id property="id" column="ID" jdbcType="VARCHAR"/>
            <result property="tenantid" column="TENANTID" jdbcType="VARCHAR"/>
            <result property="roption" column="ROPTION" jdbcType="VARCHAR"/>
            <result property="deleted" column="DELETED" jdbcType="VARCHAR"/>
            <result property="remark" column="REMARK" jdbcType="VARCHAR"/>
            <result property="createdate" column="CREATEDATE" jdbcType="TIMESTAMP"/>
            <result property="createuserid" column="CREATEUSERID" jdbcType="VARCHAR"/>
            <result property="modifydate" column="MODIFYDATE" jdbcType="TIMESTAMP"/>
            <result property="modifyuserid" column="MODIFYUSERID" jdbcType="VARCHAR"/>
            <result property="createusername" column="CREATEUSERNAME" jdbcType="VARCHAR"/>
            <result property="modifyusername" column="MODIFYUSERNAME" jdbcType="VARCHAR"/>
            <result property="craftrouteid" column="CRAFTROUTEID" jdbcType="VARCHAR"/>
            <result property="craftstepid" column="CRAFTSTEPID" jdbcType="VARCHAR"/>
            <result property="resourceid" column="RESOURCEID" jdbcType="VARCHAR"/>
            <result property="resourcetype" column="RESOURCETYPE" jdbcType="VARCHAR"/>
            <result property="equparames" column="EQUPARAMES" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        ID,TENANTID,ROPTION,
        DELETED,REMARK,CREATEDATE,
        CREATEUSERID,MODIFYDATE,MODIFYUSERID,
        CREATEUSERNAME,MODIFYUSERNAME,CRAFTROUTEID,
        CRAFTSTEPID,RESOURCEID,RESOURCETYPE,
        EQUPARAMES
    </sql>
    <delete id="removeByIdList">
        DELETE FROM aps_craft_route_step_equ
        <where>
            CRAFTROUTEID = #{routeId} AND CRAFTSTEPID IN
            <foreach collection="ids" item="id" open="(" close=")" separator=",">
                #{id}
            </foreach>
        </where>
    </delete>
    <insert id="copyDataById">
        <foreach collection="datas" item="data" open="" close="" separator=";">
            INSERT INTO aps_craft_route_step_equ (ID, TENANTID, ROPTION, DELETED, REMARK, CREATEDATE, CREATEUSERID,
            MODIFYDATE, MODIFYUSERID, CREATEUSERNAME, MODIFYUSERNAME, CRAFTROUTEID, CRAFTSTEPID, RESOURCEID, RESOURCETYPE,
            EQUPARAMES)
            SELECT UUID()  , TENANTID, ROPTION, DELETED, REMARK, NOW(), CREATEUSERID, NOW(), MODIFYUSERID, CREATEUSERNAME,
            MODIFYUSERNAME, #{routeId},#{data.id} ,RESOURCEID , RESOURCETYPE, EQUPARAMES
            FROM aps_craft_equ  WHERE MAINID = #{data.craftstepid}
        </foreach>
    </insert>
</mapper>
