<?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.PtAlgorithmMapper">
    <resultMap id="PtAlgorithmMap" type="com.ruoyi.interfaces.domain.PtAlgorithm">
        <id column="ID" property="id"/>
        <result column="CATE_CODE" property="cateCode"/>
        <result column="CODE" property="code"/>
        <result column="NAME" property="name"/>
        <result column="MAINCLASS" property="matnclass"/>
        <result column="INTRO" property="intro"/>
        <result column="NOTE" property="note"/>
        <result column="TM" property="date"/>
    </resultMap>
    <sql id="Base_Column_List">
        ID
        , CATE_CODE, CODE, NAME, MAINCLASS, INTRO, NOTE, TM
    </sql>

    <insert id="insert" parameterType="com.ruoyi.interfaces.domain.PtAlgorithm">
        INSERT INTO PT_ALGORITHM(ID, CATE_CODE, CODE, NAME, MAINCLASS, INTRO, NOTE, TM)
        VALUES (#{id}, #{cateCode}, #{code}, #{name}, #{matnclass}, #{intro}, #{note}, #{date})
    </insert>

    <select id="selectAll" parameterType="com.ruoyi.interfaces.domain.PtAlgorithm" resultMap="PtAlgorithmMap">
        select
        <include refid="Base_Column_List"/>
        from PT_ALGORITHM
        <where>
            <if test="id != null and id != ''">
                and ID = #{id}
            </if>
            <if test="matnclass != null and matnclass != ''">
                and MAINCLASS = #{matnclass}
            </if>
        </where>
    </select>

    <update id="update" parameterType="com.ruoyi.interfaces.domain.PtAlgorithm">
        update PT_ALGORITHM
        set TM        =#{date},
            CATE_CODE = #{cateCode},
            CODE      = #{code},
            NAME      = #{name},
            MAINCLASS = #{matnclass},
            INTRO     = #{intro},
            NOTE      = #{note}
        where ID = #{id}
    </update>

    <delete id="delete" parameterType="java.lang.Integer">
        delete
        from PT_ALGORITHM
        where ID = #{id}
    </delete>

    <select id="selectMaxId" resultType="java.lang.Integer">
        select nullif(max(ID) + 1, 1)
        from PT_ALGORITHM
    </select>
</mapper>
