<?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.lightinit.hsdataplatform.mapper.OfflineConferenceMapper">
  <resultMap id="BaseResultMap" type="com.lightinit.hsdataplatform.entity.OfflineConference">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="user_id" jdbcType="BIGINT" property="userId" />
    <result column="publish_setting_id" jdbcType="BIGINT" property="publishSettingId" />
    <result column="submit_time" jdbcType="TIMESTAMP" property="submitTime" />
    <result column="order_number" jdbcType="VARCHAR" property="orderNumber" />
    <result column="order_state" jdbcType="VARCHAR" property="orderState" />
    <result column="audited_by" jdbcType="BIGINT" property="auditedBy" />
    <result column="audited_at" jdbcType="TIMESTAMP" property="auditedAt" />
    <result column="audit_result" jdbcType="VARCHAR" property="auditResult" />
    <result column="audit_opinion" jdbcType="VARCHAR" property="auditOpinion" />
    <result column="contact" jdbcType="VARCHAR" property="contact" />
    <result column="phone" jdbcType="VARCHAR" property="phone" />
    <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
    <result column="created_by" jdbcType="BIGINT" property="createdBy" />
    <result column="deleted_at" jdbcType="TIMESTAMP" property="deletedAt" />
    <result column="deleted_by" jdbcType="BIGINT" property="deletedBy" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.lightinit.hsdataplatform.entity.OfflineConferenceWithBLOBs">
    <result column="requirement" jdbcType="LONGVARCHAR" property="requirement" />
    <result column="usages" jdbcType="LONGVARCHAR" property="usages" />
  </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, user_id, publish_setting_id, submit_time, order_number, order_state, audited_by, 
    audited_at, audit_result, audit_opinion, contact, phone, created_at, created_by, 
    deleted_at, deleted_by
  </sql>
  <sql id="Blob_Column_List">
    requirement, usages
  </sql>
  <select id="selectByExampleWithBLOBs" parameterType="com.lightinit.hsdataplatform.entity.OfflineConferenceExample" resultMap="ResultMapWithBLOBs">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from offline_conference
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByExample" parameterType="com.lightinit.hsdataplatform.entity.OfflineConferenceExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from offline_conference
    <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.Long" resultMap="ResultMapWithBLOBs">
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from offline_conference
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from offline_conference
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.lightinit.hsdataplatform.entity.OfflineConferenceExample">
    delete from offline_conference
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.lightinit.hsdataplatform.entity.OfflineConferenceWithBLOBs">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into offline_conference (user_id, publish_setting_id, submit_time, 
      order_number, order_state, audited_by, 
      audited_at, audit_result, audit_opinion, 
      contact, phone, created_at, 
      created_by, deleted_at, deleted_by, 
      requirement, usages)
    values (#{userId,jdbcType=BIGINT}, #{publishSettingId,jdbcType=BIGINT}, #{submitTime,jdbcType=TIMESTAMP}, 
      #{orderNumber,jdbcType=VARCHAR}, #{orderState,jdbcType=VARCHAR}, #{auditedBy,jdbcType=BIGINT}, 
      #{auditedAt,jdbcType=TIMESTAMP}, #{auditResult,jdbcType=VARCHAR}, #{auditOpinion,jdbcType=VARCHAR}, 
      #{contact,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, 
      #{createdBy,jdbcType=BIGINT}, #{deletedAt,jdbcType=TIMESTAMP}, #{deletedBy,jdbcType=BIGINT}, 
      #{requirement,jdbcType=LONGVARCHAR}, #{usages,jdbcType=LONGVARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.lightinit.hsdataplatform.entity.OfflineConferenceWithBLOBs">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into offline_conference
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="userId != null">
        user_id,
      </if>
      <if test="publishSettingId != null">
        publish_setting_id,
      </if>
      <if test="submitTime != null">
        submit_time,
      </if>
      <if test="orderNumber != null">
        order_number,
      </if>
      <if test="orderState != null">
        order_state,
      </if>
      <if test="auditedBy != null">
        audited_by,
      </if>
      <if test="auditedAt != null">
        audited_at,
      </if>
      <if test="auditResult != null">
        audit_result,
      </if>
      <if test="auditOpinion != null">
        audit_opinion,
      </if>
      <if test="contact != null">
        contact,
      </if>
      <if test="phone != null">
        phone,
      </if>
      <if test="createdAt != null">
        created_at,
      </if>
      <if test="createdBy != null">
        created_by,
      </if>
      <if test="deletedAt != null">
        deleted_at,
      </if>
      <if test="deletedBy != null">
        deleted_by,
      </if>
      <if test="requirement != null">
        requirement,
      </if>
      <if test="usages != null">
        usages,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="userId != null">
        #{userId,jdbcType=BIGINT},
      </if>
      <if test="publishSettingId != null">
        #{publishSettingId,jdbcType=BIGINT},
      </if>
      <if test="submitTime != null">
        #{submitTime,jdbcType=TIMESTAMP},
      </if>
      <if test="orderNumber != null">
        #{orderNumber,jdbcType=VARCHAR},
      </if>
      <if test="orderState != null">
        #{orderState,jdbcType=VARCHAR},
      </if>
      <if test="auditedBy != null">
        #{auditedBy,jdbcType=BIGINT},
      </if>
      <if test="auditedAt != null">
        #{auditedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="auditResult != null">
        #{auditResult,jdbcType=VARCHAR},
      </if>
      <if test="auditOpinion != null">
        #{auditOpinion,jdbcType=VARCHAR},
      </if>
      <if test="contact != null">
        #{contact,jdbcType=VARCHAR},
      </if>
      <if test="phone != null">
        #{phone,jdbcType=VARCHAR},
      </if>
      <if test="createdAt != null">
        #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        #{createdBy,jdbcType=BIGINT},
      </if>
      <if test="deletedAt != null">
        #{deletedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="deletedBy != null">
        #{deletedBy,jdbcType=BIGINT},
      </if>
      <if test="requirement != null">
        #{requirement,jdbcType=LONGVARCHAR},
      </if>
      <if test="usages != null">
        #{usages,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.lightinit.hsdataplatform.entity.OfflineConferenceExample" resultType="java.lang.Long">
    select count(*) from offline_conference
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update offline_conference
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.userId != null">
        user_id = #{record.userId,jdbcType=BIGINT},
      </if>
      <if test="record.publishSettingId != null">
        publish_setting_id = #{record.publishSettingId,jdbcType=BIGINT},
      </if>
      <if test="record.submitTime != null">
        submit_time = #{record.submitTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.orderNumber != null">
        order_number = #{record.orderNumber,jdbcType=VARCHAR},
      </if>
      <if test="record.orderState != null">
        order_state = #{record.orderState,jdbcType=VARCHAR},
      </if>
      <if test="record.auditedBy != null">
        audited_by = #{record.auditedBy,jdbcType=BIGINT},
      </if>
      <if test="record.auditedAt != null">
        audited_at = #{record.auditedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="record.auditResult != null">
        audit_result = #{record.auditResult,jdbcType=VARCHAR},
      </if>
      <if test="record.auditOpinion != null">
        audit_opinion = #{record.auditOpinion,jdbcType=VARCHAR},
      </if>
      <if test="record.contact != null">
        contact = #{record.contact,jdbcType=VARCHAR},
      </if>
      <if test="record.phone != null">
        phone = #{record.phone,jdbcType=VARCHAR},
      </if>
      <if test="record.createdAt != null">
        created_at = #{record.createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createdBy != null">
        created_by = #{record.createdBy,jdbcType=BIGINT},
      </if>
      <if test="record.deletedAt != null">
        deleted_at = #{record.deletedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="record.deletedBy != null">
        deleted_by = #{record.deletedBy,jdbcType=BIGINT},
      </if>
      <if test="record.requirement != null">
        requirement = #{record.requirement,jdbcType=LONGVARCHAR},
      </if>
      <if test="record.usages != null">
        usages = #{record.usages,jdbcType=LONGVARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExampleWithBLOBs" parameterType="map">
    update offline_conference
    set id = #{record.id,jdbcType=BIGINT},
      user_id = #{record.userId,jdbcType=BIGINT},
      publish_setting_id = #{record.publishSettingId,jdbcType=BIGINT},
      submit_time = #{record.submitTime,jdbcType=TIMESTAMP},
      order_number = #{record.orderNumber,jdbcType=VARCHAR},
      order_state = #{record.orderState,jdbcType=VARCHAR},
      audited_by = #{record.auditedBy,jdbcType=BIGINT},
      audited_at = #{record.auditedAt,jdbcType=TIMESTAMP},
      audit_result = #{record.auditResult,jdbcType=VARCHAR},
      audit_opinion = #{record.auditOpinion,jdbcType=VARCHAR},
      contact = #{record.contact,jdbcType=VARCHAR},
      phone = #{record.phone,jdbcType=VARCHAR},
      created_at = #{record.createdAt,jdbcType=TIMESTAMP},
      created_by = #{record.createdBy,jdbcType=BIGINT},
      deleted_at = #{record.deletedAt,jdbcType=TIMESTAMP},
      deleted_by = #{record.deletedBy,jdbcType=BIGINT},
      requirement = #{record.requirement,jdbcType=LONGVARCHAR},
      usages = #{record.usages,jdbcType=LONGVARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update offline_conference
    set id = #{record.id,jdbcType=BIGINT},
      user_id = #{record.userId,jdbcType=BIGINT},
      publish_setting_id = #{record.publishSettingId,jdbcType=BIGINT},
      submit_time = #{record.submitTime,jdbcType=TIMESTAMP},
      order_number = #{record.orderNumber,jdbcType=VARCHAR},
      order_state = #{record.orderState,jdbcType=VARCHAR},
      audited_by = #{record.auditedBy,jdbcType=BIGINT},
      audited_at = #{record.auditedAt,jdbcType=TIMESTAMP},
      audit_result = #{record.auditResult,jdbcType=VARCHAR},
      audit_opinion = #{record.auditOpinion,jdbcType=VARCHAR},
      contact = #{record.contact,jdbcType=VARCHAR},
      phone = #{record.phone,jdbcType=VARCHAR},
      created_at = #{record.createdAt,jdbcType=TIMESTAMP},
      created_by = #{record.createdBy,jdbcType=BIGINT},
      deleted_at = #{record.deletedAt,jdbcType=TIMESTAMP},
      deleted_by = #{record.deletedBy,jdbcType=BIGINT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.lightinit.hsdataplatform.entity.OfflineConferenceWithBLOBs">
    update offline_conference
    <set>
      <if test="userId != null">
        user_id = #{userId,jdbcType=BIGINT},
      </if>
      <if test="publishSettingId != null">
        publish_setting_id = #{publishSettingId,jdbcType=BIGINT},
      </if>
      <if test="submitTime != null">
        submit_time = #{submitTime,jdbcType=TIMESTAMP},
      </if>
      <if test="orderNumber != null">
        order_number = #{orderNumber,jdbcType=VARCHAR},
      </if>
      <if test="orderState != null">
        order_state = #{orderState,jdbcType=VARCHAR},
      </if>
      <if test="auditedBy != null">
        audited_by = #{auditedBy,jdbcType=BIGINT},
      </if>
      <if test="auditedAt != null">
        audited_at = #{auditedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="auditResult != null">
        audit_result = #{auditResult,jdbcType=VARCHAR},
      </if>
      <if test="auditOpinion != null">
        audit_opinion = #{auditOpinion,jdbcType=VARCHAR},
      </if>
      <if test="contact != null">
        contact = #{contact,jdbcType=VARCHAR},
      </if>
      <if test="phone != null">
        phone = #{phone,jdbcType=VARCHAR},
      </if>
      <if test="createdAt != null">
        created_at = #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        created_by = #{createdBy,jdbcType=BIGINT},
      </if>
      <if test="deletedAt != null">
        deleted_at = #{deletedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="deletedBy != null">
        deleted_by = #{deletedBy,jdbcType=BIGINT},
      </if>
      <if test="requirement != null">
        requirement = #{requirement,jdbcType=LONGVARCHAR},
      </if>
      <if test="usages != null">
        usages = #{usages,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.lightinit.hsdataplatform.entity.OfflineConferenceWithBLOBs">
    update offline_conference
    set user_id = #{userId,jdbcType=BIGINT},
      publish_setting_id = #{publishSettingId,jdbcType=BIGINT},
      submit_time = #{submitTime,jdbcType=TIMESTAMP},
      order_number = #{orderNumber,jdbcType=VARCHAR},
      order_state = #{orderState,jdbcType=VARCHAR},
      audited_by = #{auditedBy,jdbcType=BIGINT},
      audited_at = #{auditedAt,jdbcType=TIMESTAMP},
      audit_result = #{auditResult,jdbcType=VARCHAR},
      audit_opinion = #{auditOpinion,jdbcType=VARCHAR},
      contact = #{contact,jdbcType=VARCHAR},
      phone = #{phone,jdbcType=VARCHAR},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      created_by = #{createdBy,jdbcType=BIGINT},
      deleted_at = #{deletedAt,jdbcType=TIMESTAMP},
      deleted_by = #{deletedBy,jdbcType=BIGINT},
      requirement = #{requirement,jdbcType=LONGVARCHAR},
      usages = #{usages,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.lightinit.hsdataplatform.entity.OfflineConference">
    update offline_conference
    set user_id = #{userId,jdbcType=BIGINT},
      publish_setting_id = #{publishSettingId,jdbcType=BIGINT},
      submit_time = #{submitTime,jdbcType=TIMESTAMP},
      order_number = #{orderNumber,jdbcType=VARCHAR},
      order_state = #{orderState,jdbcType=VARCHAR},
      audited_by = #{auditedBy,jdbcType=BIGINT},
      audited_at = #{auditedAt,jdbcType=TIMESTAMP},
      audit_result = #{auditResult,jdbcType=VARCHAR},
      audit_opinion = #{auditOpinion,jdbcType=VARCHAR},
      contact = #{contact,jdbcType=VARCHAR},
      phone = #{phone,jdbcType=VARCHAR},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      created_by = #{createdBy,jdbcType=BIGINT},
      deleted_at = #{deletedAt,jdbcType=TIMESTAMP},
      deleted_by = #{deletedBy,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <select id="queryList" parameterType="com.lightinit.hsdataplatform.model.admin.OfflineConferenceSearchModel" resultType="com.lightinit.hsdataplatform.model.admin.OfflineConferenceListModel">
    SELECT a.id,a.submit_time,a.order_number,a.order_state,a.requirement,a.usages,a.audit_result,a.audit_opinion,a.phone,a.contact,a.order_state
    ,b.`username`,c.username auditedByName
    FROM `offline_conference` a
    LEFT JOIN `user` b
    ON a.`user_id` = b.id
    LEFT JOIN `admin` c
    ON a.audited_by = c.id
    <where>
      <if test="username != null and username.length()&gt;0">b.username LIKE '%${username}%'</if>
      <if test="orderState != null and orderState.length()&gt;0">AND a.order_state LIKE '%${orderState}%'</if>
      <if test="auditedByName != null and auditedByName.length()&gt;0">AND c.username LIKE '%${auditedByName}%'</if>
      <if test="orderNumber != null and orderNumber.length()&gt;0">AND a.order_number LIKE '%${orderNumber}%'</if>
      <if test="submitTime != null">
        AND date(a.submit_time) = date(#{submitTime,jdbcType=TIMESTAMP})
      </if>
    </where>
    ORDER  BY a.id DESC
  <if test="page != null">
    limit ${page.beginIndex},${page.pageSize}
  </if>
</select>
  <select id="queryCount" parameterType="com.lightinit.hsdataplatform.model.admin.OfflineConferenceSearchModel" resultType="java.lang.Long">
    SELECT count(*)
    FROM `offline_conference` a
    LEFT JOIN `user` b
    ON a.`user_id` = b.id
    LEFT JOIN `admin` c
    ON a.audited_by = c.id
    <where>
      <if test="username != null and username.length()&gt;0">b.username LIKE '%${username}%'</if>
      <if test="orderState != null and orderState.length()&gt;0">AND a.order_state LIKE '%${orderState}%'</if>
      <if test="auditedByName != null and auditedByName.length()&gt;0">AND c.username LIKE '%${auditedByName}%'</if>
      <if test="orderNumber != null and orderNumber.length()&gt;0">AND a.order_number LIKE '%${orderNumber}%'</if>
      <if test="submitTime != null">
        AND date(a.submit_time) = date(#{submitTime,jdbcType=TIMESTAMP})
      </if>
    </where>
  </select>
    <select id="queryOne" parameterType="java.lang.Long" resultType="com.lightinit.hsdataplatform.model.admin.OfflineConferenceListModel">
        SELECT a.id,a.submit_time,a.order_number,a.order_state,a.requirement,a.usages,a.audit_result,a.audit_opinion,a.phone,a.contact,a.order_state
        ,b.`username`,c.username auditedByName
        FROM `offline_conference` a
        LEFT JOIN `user` b
        ON a.`user_id` = b.id
        LEFT JOIN `admin` c
        ON a.audited_by = c.id
        <where>
            <if test="id != null ">a.id = #{id,jdbcType=BIGINT}</if>
        </where>
    </select>
  <update id="handle" parameterType="com.lightinit.hsdataplatform.model.admin.OfflineConferenceHeableModel">
    update offline_conference
    set
    audited_by = #{inputModel.auditedBy,jdbcType=BIGINT},
    audit_opinion = #{inputModel.auditOpinion,jdbcType=VARCHAR},
    order_state = #{inputModel.orderState,jdbcType=VARCHAR}
    where id = #{inputModel.id,jdbcType=BIGINT}
  </update>
</mapper>