<?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.project.asset.mapper.TSpecdevTypemgrMapper">

    <resultMap type="TSpecdevTypemgr" id="TSpecdevTypemgrResult">
        <result property="id"    column="id"    />
        <result property="devType"    column="dev_type"    />
        <result property="pid"    column="pid"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="status"    column="status"    />
        <result property="createrCode"    column="creater_code"    />
        <result property="createdate"    column="createdate"    />
        <result property="updaterCode"    column="updater_code"    />
        <result property="updatedate"    column="updatedate"    />
        <result property="deptId"    column="dept_id"    />
        <result property="remarks"    column="remarks"    />
    </resultMap>

    <sql id="selectTSpecdevTypemgrVo">
        select id, dev_type, pid, del_flag, status, creater_code, createdate, updater_code, updatedate, dept_id, remarks from t_specdev_typemgr
    </sql>

    <select id="selectTSpecdevTypemgrList" parameterType="TSpecdevTypemgr" resultMap="TSpecdevTypemgrResult">
        <include refid="selectTSpecdevTypemgrVo"/>
        <where>
            <if test="devType != null  and devType != ''"> and dev_type = #{devType}</if>
            <if test="pid != null "> and pid = #{pid}</if>
            <if test="status != null "> and status = #{status}</if>
            <if test="createrCode != null  and createrCode != ''"> and creater_code = #{createrCode}</if>
            <if test="createdate != null "> and createdate = #{createdate}</if>
            <if test="updaterCode != null  and updaterCode != ''"> and updater_code = #{updaterCode}</if>
            <if test="updatedate != null "> and updatedate = #{updatedate}</if>
            <if test="deptId != null "> and dept_id = #{deptId}</if>
            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
        and del_flag = 0
        </where>
        order by pid
    </select>

    <select id="selectTSpecdevTypemgrById" parameterType="Long" resultMap="TSpecdevTypemgrResult">
        <include refid="selectTSpecdevTypemgrVo"/>
        where id = #{id}
    </select>

    <insert id="insertTSpecdevTypemgr" parameterType="TSpecdevTypemgr" useGeneratedKeys="true" keyProperty="id">
        insert into t_specdev_typemgr
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="devType != null and devType != ''">dev_type,</if>
            <if test="pid != null">pid,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="status != null">status,</if>
            <if test="createrCode != null">creater_code,</if>
            <if test="createdate != null">createdate,</if>
            <if test="updaterCode != null">updater_code,</if>
            <if test="updatedate != null">updatedate,</if>
            <if test="deptId != null">dept_id,</if>
            <if test="remarks != null">remarks,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="devType != null and devType != ''">#{devType},</if>
            <if test="pid != null">#{pid},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="status != null">#{status},</if>
            <if test="createrCode != null">#{createrCode},</if>
            <if test="createdate != null">#{createdate},</if>
            <if test="updaterCode != null">#{updaterCode},</if>
            <if test="updatedate != null">#{updatedate},</if>
            <if test="deptId != null">#{deptId},</if>
            <if test="remarks != null">#{remarks},</if>
         </trim>
    </insert>

    <update id="updateTSpecdevTypemgr" parameterType="TSpecdevTypemgr">
        update t_specdev_typemgr
        <trim prefix="SET" suffixOverrides=",">
            <if test="devType != null and devType != ''">dev_type = #{devType},</if>
            <if test="pid != null">pid = #{pid},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="status != null">status = #{status},</if>
            <if test="createrCode != null">creater_code = #{createrCode},</if>
            <if test="createdate != null">createdate = #{createdate},</if>
            <if test="updaterCode != null">updater_code = #{updaterCode},</if>
            <if test="updatedate != null">updatedate = #{updatedate},</if>
            <if test="deptId != null">dept_id = #{deptId},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTSpecdevTypemgrById" parameterType="Long">
        update t_specdev_typemgr set del_flag=1 where id = #{id}
    </delete>

    <delete id="deleteTSpecdevTypemgrByIds" parameterType="String">
        update t_specdev_typemgr set del_flag=1 where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
