<?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="me.zhengjie.modules.system.mapper.JobMapper">
    <resultMap id="BaseResultMap" type="me.zhengjie.modules.system.domain.Job">
        <id column="job_id" property="id"/>
        <result column="name" property="name"/>
        <result column="job_sort" property="jobSort"/>
        <result column="enabled" property="enabled"/>
        <result column="create_by" property="createBy"/>
        <result column="update_by" property="updateBy"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
    </resultMap>
    
    <sql id="Base_Column_List">
        job_id, name, job_sort, enabled, create_by, update_by, create_time, update_time
    </sql>

    <select id="findAll" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from sys_job
        <where>
            <if test="criteria.name != null and criteria.name != ''">
                and name like concat('%', #{criteria.name}, '%')
            </if>
            <if test="criteria.enabled != null">
                and enabled = #{criteria.enabled}
            </if>
            <if test="criteria.createTime != null and criteria.createTime.size() != 0">
                and create_time between #{criteria.createTime[0]} and #{criteria.createTime[1]}
            </if>
        </where>
        order by job_sort, job_id desc
    </select>
</mapper>