<?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.miaxis.question.mapper.QuestionColumnMapper">

    <resultMap type="QuestionColumn" id="QuestionColumnResult">
        <result property="id"    column="id"    />
        <result property="columnId"    column="column_id"    />
        <result property="sort"    column="sort"    />
        <result property="model"    column="model"    />
        <result property="subject"    column="subject"    />
        <result property="title"    column="title"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectQuestionColumnVo">
        select * from question_column
    </sql>

    <select id="selectQuestionColumnList" parameterType="QuestionColumn" resultMap="QuestionColumnResult">
        <include refid="selectQuestionColumnVo"/>
        <where>
            <if test="sort != null "> and sort = #{sort}</if>
            <if test="columnId != null "> and column_id = #{columnId}</if>
            <if test="model != null  and model != ''"> and model like concat('%', #{model}, '%')</if>
            <if test="subject != null  and subject != ''"> and subject = #{subject}</if>
            <if test="title != null  and title != ''"> and title = #{title}</if>
        </where>
        order by sort
    </select>

</mapper>
