DBWorkJobMapper.xml 2.34 KB
<?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.monitor.mysql.mapper.DBWorkJobMapper" >
    <resultMap id="BaseResultMap" type="com.model.DBWorkJob" >
        <id column="id" property="id" jdbcType="VARCHAR" />
        <result column="title" property="title" jdbcType="VARCHAR" />
        <result column="text" property="text" jdbcType="VARCHAR" />
        <result column="develop" property="develop" jdbcType="VARCHAR" />
        <result column="dba" property="dba" jdbcType="VARCHAR" />
        <result column="status" property="status" jdbcType="INTEGER" />
        <result column="createTime" property="createTime" jdbcType="VARCHAR" />
        <result column="updateTime" property="updateTime" jdbcType="VARCHAR" />

    </resultMap>

    <sql id="Base_Column_List" >
        id, title,text,develop,dba,status,DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%S') AS createTime,DATE_FORMAT(update_time,'%Y-%m-%d %H:%i:%S') AS updateTime
    </sql>

    <select id="selectCount"  resultType="java.lang.Integer">
        select
        count(1)
        from db_work_job
        where
    </select>

    <select id="selectByPage"   resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from db_work_job
        order by id desc
        limit #{startIndex},#{pageSize}
    </select>

    <select id="selectById"   resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from db_work_job
        where
        id = #{id}
    </select>

    <insert id="insert" parameterType="com.model.DBWorkJob" >
        insert into db_work_job
        (
        id,
        title,
        text,
        develop,
        status,
        create_time,
        update_time
        )
        values
        (
        #{id,jdbcType=VARCHAR},
        #{title,jdbcType=VARCHAR},
        #{text,jdbcType=VARCHAR},
        #{develop,jdbcType=VARCHAR},
        #{status,jdbcType=INTEGER},
        now(),
        now())
    </insert>

    <update id="update" parameterType="com.model.DBWorkJob">
        UPDATE db_work_job
        set
          status =  #{status,jdbcType=INTEGER},
          dba = #{dba,jdbcType=INTEGER},
          update_time = now()
        where
          id = #{id,jdbcType=VARCHAR}
    </update>

</mapper>