<?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.ruoyi.system.mapper.task.TkRoundTaskMapper">
  <resultMap id="BaseResultMap" type="com.ruoyi.system.domain.task.TkRoundTask">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="round_plan_id" jdbcType="VARCHAR" property="roundPlanId" />
    <result column="time" jdbcType="DATE" property="time" />
    <result column="end_time" jdbcType="DATE" property="endTime" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="origin" jdbcType="VARCHAR" property="origin" />
    <result column="status" jdbcType="VARCHAR" property="status" />
    <result column="is_show" jdbcType="VARCHAR" property="isShow" />
    <result column="percent" jdbcType="INTEGER" property="percent" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.ruoyi.system.domain.task.TkRoundTask">
    <result column="user_ids" jdbcType="LONGVARCHAR" property="userIds" />
    <result column="user_names" jdbcType="LONGVARCHAR" property="userNames" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <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 close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <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 close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    id, round_plan_id, time, end_time, name, origin, status, is_show, percent
  </sql>
  <sql id="Blob_Column_List">
    user_ids, user_names
  </sql>
  <select id="selectByExampleWithBLOBs" parameterType="com.ruoyi.system.domain.task.TkRoundTaskExample" resultMap="ResultMapWithBLOBs">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from tk_round_task
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByExample" parameterType="com.ruoyi.system.domain.task.TkRoundTaskExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from tk_round_task
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from tk_round_task
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from tk_round_task
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.ruoyi.system.domain.task.TkRoundTaskExample">
    delete from tk_round_task
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.ruoyi.system.domain.task.TkRoundTask">
    insert into tk_round_task (id, round_plan_id,
      time, end_time, name, origin, 
      status, is_show, percent, 
      user_ids, user_names)
    values (#{id,jdbcType=VARCHAR},  #{roundPlanId,jdbcType=VARCHAR},
      #{time,jdbcType=DATE}, #{endTime,jdbcType=DATE}, #{name,jdbcType=VARCHAR}, #{origin,jdbcType=VARCHAR}, 
      #{status,jdbcType=VARCHAR}, #{isShow,jdbcType=VARCHAR}, #{percent,jdbcType=INTEGER}, 
      #{userIds,jdbcType=LONGVARCHAR}, #{userNames,jdbcType=LONGVARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.ruoyi.system.domain.task.TkRoundTask">
    insert into tk_round_task
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="roundPlanId != null">
        round_plan_id,
      </if>
      <if test="time != null">
        time,
      </if>
      <if test="endTime != null">
        end_time,
      </if>
      <if test="name != null">
        name,
      </if>
      <if test="origin != null">
        origin,
      </if>
      <if test="status != null">
        status,
      </if>
      <if test="isShow != null">
        is_show,
      </if>
      <if test="percent != null">
        percent,
      </if>
      <if test="userIds != null">
        user_ids,
      </if>
      <if test="userNames != null">
        user_names,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="roundPlanId != null">
        #{roundPlanId,jdbcType=VARCHAR},
      </if>
      <if test="time != null">
        #{time,jdbcType=DATE},
      </if>
      <if test="endTime != null">
        #{endTime,jdbcType=DATE},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="origin != null">
        #{origin,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        #{status,jdbcType=VARCHAR},
      </if>
      <if test="isShow != null">
        #{isShow,jdbcType=VARCHAR},
      </if>
      <if test="percent != null">
        #{percent,jdbcType=INTEGER},
      </if>
      <if test="userIds != null">
        #{userIds,jdbcType=LONGVARCHAR},
      </if>
      <if test="userNames != null">
        #{userNames,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.ruoyi.system.domain.task.TkRoundTaskExample" resultType="java.lang.Long">
    select count(*) from tk_round_task
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update tk_round_task
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.roundPlanId != null">
        round_plan_id = #{record.roundPlanId,jdbcType=VARCHAR},
      </if>
      <if test="record.time != null">
        time = #{record.time,jdbcType=DATE},
      </if>
      <if test="record.endTime != null">
        end_time = #{record.endTime,jdbcType=DATE},
      </if>
      <if test="record.name != null">
        name = #{record.name,jdbcType=VARCHAR},
      </if>
      <if test="record.origin != null">
        origin = #{record.origin,jdbcType=VARCHAR},
      </if>
      <if test="record.status != null">
        status = #{record.status,jdbcType=VARCHAR},
      </if>
      <if test="record.isShow != null">
        is_show = #{record.isShow,jdbcType=VARCHAR},
      </if>
      <if test="record.percent != null">
        percent = #{record.percent,jdbcType=INTEGER},
      </if>
      <if test="record.userIds != null">
        user_ids = #{record.userIds,jdbcType=LONGVARCHAR},
      </if>
      <if test="record.userNames != null">
        user_names = #{record.userNames,jdbcType=LONGVARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExampleWithBLOBs" parameterType="map">
    update tk_round_task
    set id = #{record.id,jdbcType=VARCHAR},
      round_plan_id = #{record.roundPlanId,jdbcType=VARCHAR},
      time = #{record.time,jdbcType=DATE},
      end_time = #{record.endTime,jdbcType=DATE},
      name = #{record.name,jdbcType=VARCHAR},
      origin = #{record.origin,jdbcType=VARCHAR},
      status = #{record.status,jdbcType=VARCHAR},
      is_show = #{record.isShow,jdbcType=VARCHAR},
      percent = #{record.percent,jdbcType=INTEGER},
      user_ids = #{record.userIds,jdbcType=LONGVARCHAR},
      user_names = #{record.userNames,jdbcType=LONGVARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update tk_round_task
    set id = #{record.id,jdbcType=VARCHAR},
      round_plan_id = #{record.roundPlanId,jdbcType=VARCHAR},
      time = #{record.time,jdbcType=DATE},
      end_time = #{record.endTime,jdbcType=DATE},
      name = #{record.name,jdbcType=VARCHAR},
      origin = #{record.origin,jdbcType=VARCHAR},
      status = #{record.status,jdbcType=VARCHAR},
      is_show = #{record.isShow,jdbcType=VARCHAR},
      percent = #{record.percent,jdbcType=INTEGER}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.ruoyi.system.domain.task.TkRoundTask">
    update tk_round_task
    <set>
      <if test="roundPlanId != null">
        round_plan_id = #{roundPlanId,jdbcType=VARCHAR},
      </if>
      <if test="time != null">
        time = #{time,jdbcType=DATE},
      </if>
      <if test="endTime != null">
        end_time = #{endTime,jdbcType=DATE},
      </if>
      <if test="name != null">
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="origin != null">
        origin = #{origin,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        status = #{status,jdbcType=VARCHAR},
      </if>
      <if test="isShow != null">
        is_show = #{isShow,jdbcType=VARCHAR},
      </if>
      <if test="percent != null">
        percent = #{percent,jdbcType=INTEGER},
      </if>
      <if test="userIds != null">
        user_ids = #{userIds,jdbcType=LONGVARCHAR},
      </if>
      <if test="userNames != null">
        user_names = #{userNames,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.ruoyi.system.domain.task.TkRoundTask">
    update tk_round_task
    set
      round_plan_id = #{roundPlanId,jdbcType=VARCHAR},
      time = #{time,jdbcType=DATE},
      end_time = #{endTime,jdbcType=DATE},
      name = #{name,jdbcType=VARCHAR},
      origin = #{origin,jdbcType=VARCHAR},
      status = #{status,jdbcType=VARCHAR},
      is_show = #{isShow,jdbcType=VARCHAR},
      percent = #{percent,jdbcType=INTEGER},
      user_ids = #{userIds,jdbcType=LONGVARCHAR},
      user_names = #{userNames,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ruoyi.system.domain.task.TkRoundTask">
    update tk_round_task
    set
      round_plan_id = #{roundPlanId,jdbcType=VARCHAR},
      time = #{time,jdbcType=DATE},
      end_time = #{endTime,jdbcType=DATE},
      name = #{name,jdbcType=VARCHAR},
      origin = #{origin,jdbcType=VARCHAR},
      status = #{status,jdbcType=VARCHAR},
      is_show = #{isShow,jdbcType=VARCHAR},
      percent = #{percent,jdbcType=INTEGER}
    where id = #{id,jdbcType=VARCHAR}
  </update>
</mapper>