<?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.fuxi.ws.data.dao.WAutorunsetMapper" >
  <resultMap id="BaseResultMap" type="com.fuxi.ws.data.entity.WAutorunset" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Sep 08 17:45:08 CST 2016.
    -->
    <id column="AutoRunID" property="autorunid" jdbcType="INTEGER" />
    <result column="MethodName" property="methodname" jdbcType="VARCHAR" />
    <result column="RunType" property="runtype" jdbcType="TINYINT" />
    <result column="IntervalTimes" property="intervaltimes" jdbcType="INTEGER" />
    <result column="EveryDayTime" property="everydaytime" jdbcType="VARCHAR" />
    <result column="WeekAt" property="weekat" jdbcType="TINYINT" />
    <result column="LastStartTime" property="laststarttime" jdbcType="TIMESTAMP" />
    <result column="Runing" property="runing" jdbcType="TINYINT" />
    <result column="Active" property="active" jdbcType="TINYINT" />
  </resultMap>
  <sql id="Example_Where_Clause" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Sep 08 17:45:08 CST 2016.
    -->
    <where >
      <foreach collection="oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <foreach collection="criteria.criteria" item="criterion" >
              <choose >
                <when test="criterion.noValue" >
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue" >
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue" >
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue" >
                  and ${criterion.condition}
                  <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Sep 08 17:45:08 CST 2016.
    -->
    AutoRunID, MethodName, RunType, IntervalTimes, EveryDayTime, WeekAt, LastStartTime, 
    Runing, Active
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.fuxi.ws.data.entity.WAutorunsetExample" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Sep 08 17:45:08 CST 2016.
    -->
    select
    <if test="distinct" >
      distinct
    </if>
    'false' as QUERYID,
    <include refid="Base_Column_List" />
    from W_AutoRunSet
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Sep 08 17:45:08 CST 2016.
    -->
    select 
    <include refid="Base_Column_List" />
    from W_AutoRunSet
    where AutoRunID = #{autorunid,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Sep 08 17:45:08 CST 2016.
    -->
    delete from W_AutoRunSet
    where AutoRunID = #{autorunid,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.fuxi.ws.data.entity.WAutorunset" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Sep 08 17:45:08 CST 2016.
    -->
    insert into W_AutoRunSet (AutoRunID, MethodName, RunType, 
      IntervalTimes, EveryDayTime, WeekAt, 
      LastStartTime, Runing, Active
      )
    values (#{autorunid,jdbcType=INTEGER}, #{methodname,jdbcType=VARCHAR}, #{runtype,jdbcType=TINYINT}, 
      #{intervaltimes,jdbcType=INTEGER}, #{everydaytime,jdbcType=VARCHAR}, #{weekat,jdbcType=TINYINT}, 
      #{laststarttime,jdbcType=TIMESTAMP}, #{runing,jdbcType=TINYINT}, #{active,jdbcType=TINYINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.fuxi.ws.data.entity.WAutorunset" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Sep 08 17:45:08 CST 2016.
    -->
    insert into W_AutoRunSet
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="autorunid != null" >
        AutoRunID,
      </if>
      <if test="methodname != null" >
        MethodName,
      </if>
      <if test="runtype != null" >
        RunType,
      </if>
      <if test="intervaltimes != null" >
        IntervalTimes,
      </if>
      <if test="everydaytime != null" >
        EveryDayTime,
      </if>
      <if test="weekat != null" >
        WeekAt,
      </if>
      <if test="laststarttime != null" >
        LastStartTime,
      </if>
      <if test="runing != null" >
        Runing,
      </if>
      <if test="active != null" >
        Active,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="autorunid != null" >
        #{autorunid,jdbcType=INTEGER},
      </if>
      <if test="methodname != null" >
        #{methodname,jdbcType=VARCHAR},
      </if>
      <if test="runtype != null" >
        #{runtype,jdbcType=TINYINT},
      </if>
      <if test="intervaltimes != null" >
        #{intervaltimes,jdbcType=INTEGER},
      </if>
      <if test="everydaytime != null" >
        #{everydaytime,jdbcType=VARCHAR},
      </if>
      <if test="weekat != null" >
        #{weekat,jdbcType=TINYINT},
      </if>
      <if test="laststarttime != null" >
        #{laststarttime,jdbcType=TIMESTAMP},
      </if>
      <if test="runing != null" >
        #{runing,jdbcType=TINYINT},
      </if>
      <if test="active != null" >
        #{active,jdbcType=TINYINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.fuxi.ws.data.entity.WAutorunsetExample" resultType="java.lang.Integer" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Sep 08 17:45:08 CST 2016.
    -->
    select count(*) from W_AutoRunSet
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByPrimaryKeySelective" parameterType="com.fuxi.ws.data.entity.WAutorunset" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Sep 08 17:45:08 CST 2016.
    -->
    update W_AutoRunSet
    <set >
      <if test="methodname != null" >
        MethodName = #{methodname,jdbcType=VARCHAR},
      </if>
      <if test="runtype != null" >
        RunType = #{runtype,jdbcType=TINYINT},
      </if>
      <if test="intervaltimes != null" >
        IntervalTimes = #{intervaltimes,jdbcType=INTEGER},
      </if>
      <if test="everydaytime != null" >
        EveryDayTime = #{everydaytime,jdbcType=VARCHAR},
      </if>
      <if test="weekat != null" >
        WeekAt = #{weekat,jdbcType=TINYINT},
      </if>
      <if test="laststarttime != null" >
        LastStartTime = #{laststarttime,jdbcType=TIMESTAMP},
      </if>
      <if test="runing != null" >
        Runing = #{runing,jdbcType=TINYINT},
      </if>
      <if test="active != null" >
        Active = #{active,jdbcType=TINYINT},
      </if>
    </set>
    where AutoRunID = #{autorunid,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.fuxi.ws.data.entity.WAutorunset" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Sep 08 17:45:08 CST 2016.
    -->
    update W_AutoRunSet
    set MethodName = #{methodname,jdbcType=VARCHAR},
      RunType = #{runtype,jdbcType=TINYINT},
      IntervalTimes = #{intervaltimes,jdbcType=INTEGER},
      EveryDayTime = #{everydaytime,jdbcType=VARCHAR},
      WeekAt = #{weekat,jdbcType=TINYINT},
      LastStartTime = #{laststarttime,jdbcType=TIMESTAMP},
      Runing = #{runing,jdbcType=TINYINT},
      Active = #{active,jdbcType=TINYINT}
    where AutoRunID = #{autorunid,jdbcType=INTEGER}
  </update>
  
  <!-- 读取商品列表信息 -->
	<select id="autorunsetList" resultType="java.util.LinkedHashMap">
		SELECT  AutoRunID, MethodName,case RunType when 1 then '间隔固定时间' when 2 then '每天定时' when 3 then '每周定时' when 4 then '每月定时' end as RunType, 
		IntervalTimes, EveryDayTime, WeekAt, CONVERT(varchar(10),LastStartTime, 121) + '<![CDATA[<br/>]]>'	+ CONVERT(varchar(10), LastStartTime, 108) AS LastStartTime, 
		case Runing when 0 then '否' when 1 then '是' end as Runing, case Active when 0 then '否' when 1 then '是' end as Active  
		FROM W_AutoRunSet AS a with(nolock)	
	</select>
</mapper>