<?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.dlink.mapper.StatementMapper">

    <resultMap id="BaseResultMap" type="com.dlink.model.Statement">
        <id column="id" property="id" />
        <result column="statement" property="statement" />
    </resultMap>

    <sql id="Base_Column_List">
        id,statement
    </sql>

    <insert id="insert">
        insert into dlink_task_statement (id,statement) values (#{id},#{statement})
    </insert>

    <select id="selectForProTable" resultType="com.dlink.model.Task">
        select
        a.*
        from
        dlink_task_statement a
        <where>
            1=1
            <if test='param.id!=null and param.id!=""'>
                and a.id = #{param.id}
            </if>
            <if test='param.statement!=null and param.statement!=""'>
                and a.statement like "%${param.statement}%"
            </if>
            <if test='ew.sqlSegment!=null and ew.sqlSegment!="" and !ew.sqlSegment.startsWith(" ORDER BY")'>
                and
            </if>
            <if test='ew.sqlSegment!=null and ew.sqlSegment!=""'>
                ${ew.sqlSegment}
            </if>
        </where>
    </select>
</mapper>
