<?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.interfaces.mapper.MdModelCatetoryMapper">

    <resultMap type="com.ruoyi.interfaces.domain.MdModelCatetory" id="MdModelCatetoryResult">
        <result property="cateid"    column="cateid"    />
        <result property="name"    column="name"    />
        <result property="intro"    column="intro"    />
        <result property="userId"    column="userId"    />
        <result property="createBy"    column="createBy"    />
        <result property="modifyBy"    column="modifyBy"    />
    </resultMap>

    <sql id="selectMdModelCatetoryVo">
        select cateid, name, intro, userId, createBy, modifyBy from md_model_catetory
    </sql>

    <select id="selectMdModelCatetoryList" parameterType="com.ruoyi.interfaces.domain.MdModelCatetory" resultMap="MdModelCatetoryResult">
        <include refid="selectMdModelCatetoryVo"/>
        <where>
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="intro != null  and intro != ''"> and intro = #{intro}</if>
            <if test="userId != null "> and userId = #{userId}</if>
            <if test="createBy != null "> and createBy = #{createBy}</if>
            <if test="modifyBy != null "> and modifyBy = #{modifyBy}</if>
        </where>
    </select>

    <select id="selectMdModelCatetoryByCateid" parameterType="String" resultMap="MdModelCatetoryResult">
        <include refid="selectMdModelCatetoryVo"/>
        where cateid = #{cateid}
    </select>

    <insert id="insertMdModelCatetory" parameterType="com.ruoyi.interfaces.domain.MdModelCatetory">
        insert into md_model_catetory
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="cateid != null">cateid,</if>
            <if test="name != null">name,</if>
            <if test="intro != null">intro,</if>
            <if test="userId != null">userId,</if>
            <if test="createBy != null">createBy,</if>
            <if test="modifyBy != null">modifyBy,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="cateid != null">#{cateid},</if>
            <if test="name != null">#{name},</if>
            <if test="intro != null">#{intro},</if>
            <if test="userId != null">#{userId},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="modifyBy != null">#{modifyBy},</if>
        </trim>
    </insert>

    <update id="updateMdModelCatetory" parameterType="com.ruoyi.interfaces.domain.MdModelCatetory">
        update md_model_catetory
        <trim prefix="SET" suffixOverrides=",">
            <if test="name != null">name = #{name},</if>
            <if test="intro != null">intro = #{intro},</if>
            <if test="userId != null">userId = #{userId},</if>
            <if test="createBy != null">createBy = #{createBy},</if>
            <if test="modifyBy != null">modifyBy = #{modifyBy},</if>
        </trim>
        where cateid = #{cateid}
    </update>

    <delete id="deleteMdModelCatetoryByCateid" parameterType="String">
        delete from md_model_catetory where cateid = #{cateid}
    </delete>

    <delete id="deleteMdModelCatetoryByCateids" parameterType="String">
        delete from md_model_catetory where cateid in
        <foreach item="cateid" collection="array" open="(" separator="," close=")">
            #{cateid}
        </foreach>
    </delete>
</mapper>