<?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.visit.VisitFreeInterviewMapper">
  <resultMap id="BaseResultMap" type="com.ruoyi.system.domain.visit.VisitFreeInterview">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="plan_id" jdbcType="VARCHAR" property="planId" />
    <result column="model_id" jdbcType="VARCHAR" property="modelId" />
    <result column="wg_code" jdbcType="VARCHAR" property="wgCode" />
    <result column="wg_value" jdbcType="VARCHAR" property="wgValue" />
    <result column="wgy_name" jdbcType="VARCHAR" property="wgyName" />
    <result column="wgy_code" jdbcType="VARCHAR" property="wgyCode" />
    <result column="interview_time" jdbcType="VARCHAR" property="interviewTime" />
    <result column="type" jdbcType="VARCHAR" property="type" />
    <result column="obj_id" jdbcType="VARCHAR" property="objId" />
    <result column="obj_name" jdbcType="VARCHAR" property="objName" />
    <result column="obj_type" jdbcType="VARCHAR" property="objType" />
    <result column="obj_type_name" jdbcType="VARCHAR" property="objTypeName" />
    <result column="obj_user_name" jdbcType="VARCHAR" property="objUserName" />
    <result column="obj_number" jdbcType="VARCHAR" property="objNumber" />
    <result column="create_id" jdbcType="VARCHAR" property="createId" />
    <result column="create_name" jdbcType="VARCHAR" property="createName" />
    <result column="create_time" jdbcType="VARCHAR" property="createTime" />
    <result column="status" jdbcType="VARCHAR" property="status" />
    <result column="task_id" jdbcType="VARCHAR" property="taskId" />
    <result column="is_valid" jdbcType="VARCHAR" property="isValid" />
    <result column="longitude" jdbcType="VARCHAR" property="longitude" />
    <result column="latitude" jdbcType="VARCHAR" property="latitude" />
    <result column="address" jdbcType="VARCHAR" property="address" />
    <result column="actual_time" jdbcType="VARCHAR" property="actualTime" />
    <result column="visit_type" jdbcType="VARCHAR" property="visitType" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.ruoyi.system.domain.visit.VisitFreeInterview">
    <result column="content" jdbcType="LONGVARCHAR" property="content" />
  </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, plan_id, model_id, wg_code, wg_value, wgy_name, wgy_code, interview_time, type,
    obj_id, obj_name, obj_type, obj_type_name, obj_user_name, obj_number, create_id,
    create_name, create_time, status, task_id, is_valid, longitude, latitude,
    address, actual_time, visit_type
  </sql>
  <sql id="Blob_Column_List">
    content
  </sql>
  <select id="selectByExampleWithBLOBs" parameterType="com.ruoyi.system.domain.visit.VisitFreeInterviewExample" resultMap="ResultMapWithBLOBs">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from visit_free_interview
    <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.visit.VisitFreeInterviewExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from visit_free_interview
    <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 visit_free_interview
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from visit_free_interview
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.ruoyi.system.domain.visit.VisitFreeInterviewExample">
    delete from visit_free_interview
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.ruoyi.system.domain.visit.VisitFreeInterview">
    insert into visit_free_interview (id, plan_id, model_id,
      wg_code, wg_value, wgy_name,
      wgy_code, interview_time, type,
      obj_id, obj_name, obj_type,
      obj_type_name, obj_user_name, obj_number,
      create_id, create_name, create_time,
      status, task_id,
      is_valid, longitude, latitude,
      address, actual_time, content, visit_type
      )
    values (#{id,jdbcType=VARCHAR}, #{planId,jdbcType=VARCHAR}, #{modelId,jdbcType=VARCHAR},
      #{wgCode,jdbcType=VARCHAR}, #{wgValue,jdbcType=VARCHAR}, #{wgyName,jdbcType=VARCHAR},
      #{wgyCode,jdbcType=VARCHAR}, #{interviewTime,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
      #{objId,jdbcType=VARCHAR}, #{objName,jdbcType=VARCHAR}, #{objType,jdbcType=VARCHAR},
      #{objTypeName,jdbcType=VARCHAR}, #{objUserName,jdbcType=VARCHAR}, #{objNumber,jdbcType=VARCHAR},
      #{createId,jdbcType=VARCHAR}, #{createName,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR},
      #{status,jdbcType=VARCHAR}, #{taskId,jdbcType=VARCHAR},
      #{isValid,jdbcType=VARCHAR}, #{longitude,jdbcType=VARCHAR}, #{latitude,jdbcType=VARCHAR},
      #{address,jdbcType=VARCHAR}, #{actualTime,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR}, #{visitType,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.ruoyi.system.domain.visit.VisitFreeInterview">
    insert into visit_free_interview
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="planId != null">
        plan_id,
      </if>
      <if test="modelId != null">
        model_id,
      </if>
      <if test="wgCode != null">
        wg_code,
      </if>
      <if test="wgValue != null">
        wg_value,
      </if>
      <if test="wgyName != null">
        wgy_name,
      </if>
      <if test="wgyCode != null">
        wgy_code,
      </if>
      <if test="interviewTime != null">
        interview_time,
      </if>
      <if test="type != null">
        type,
      </if>
      <if test="objId != null">
        obj_id,
      </if>
      <if test="objName != null">
        obj_name,
      </if>
      <if test="objType != null">
        obj_type,
      </if>
      <if test="objTypeName != null">
        obj_type_name,
      </if>
      <if test="objUserName != null">
        obj_user_name,
      </if>
      <if test="objNumber != null">
        obj_number,
      </if>
      <if test="createId != null">
        create_id,
      </if>
      <if test="createName != null">
        create_name,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="status != null">
        status,
      </if>
      <if test="taskId != null">
        task_id,
      </if>
      <if test="isValid != null">
        is_valid,
      </if>
      <if test="longitude != null">
        longitude,
      </if>
      <if test="latitude != null">
        latitude,
      </if>
      <if test="address != null">
        address,
      </if>
      <if test="actualTime != null">
        actual_time,
      </if>
      <if test="content != null">
        content,
      </if>
      <if test="visitType != null">
        visit_type,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="planId != null">
        #{planId,jdbcType=VARCHAR},
      </if>
      <if test="modelId != null">
        #{modelId,jdbcType=VARCHAR},
      </if>
      <if test="wgCode != null">
        #{wgCode,jdbcType=VARCHAR},
      </if>
      <if test="wgValue != null">
        #{wgValue,jdbcType=VARCHAR},
      </if>
      <if test="wgyName != null">
        #{wgyName,jdbcType=VARCHAR},
      </if>
      <if test="wgyCode != null">
        #{wgyCode,jdbcType=VARCHAR},
      </if>
      <if test="interviewTime != null">
        #{interviewTime,jdbcType=VARCHAR},
      </if>
      <if test="type != null">
        #{type,jdbcType=VARCHAR},
      </if>
      <if test="objId != null">
        #{objId,jdbcType=VARCHAR},
      </if>
      <if test="objName != null">
        #{objName,jdbcType=VARCHAR},
      </if>
      <if test="objType != null">
        #{objType,jdbcType=VARCHAR},
      </if>
      <if test="objTypeName != null">
        #{objTypeName,jdbcType=VARCHAR},
      </if>
      <if test="objUserName != null">
        #{objUserName,jdbcType=VARCHAR},
      </if>
      <if test="objNumber != null">
        #{objNumber,jdbcType=VARCHAR},
      </if>
      <if test="createId != null">
        #{createId,jdbcType=VARCHAR},
      </if>
      <if test="createName != null">
        #{createName,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        #{status,jdbcType=VARCHAR},
      </if>
      <if test="taskId != null">
        #{taskId,jdbcType=VARCHAR},
      </if>
      <if test="isValid != null">
        #{isValid,jdbcType=VARCHAR},
      </if>
      <if test="longitude != null">
        #{longitude,jdbcType=VARCHAR},
      </if>
      <if test="latitude != null">
        #{latitude,jdbcType=VARCHAR},
      </if>
      <if test="address != null">
        #{address,jdbcType=VARCHAR},
      </if>
      <if test="actualTime != null">
        #{actualTime,jdbcType=VARCHAR},
      </if>
      <if test="content != null">
        #{content,jdbcType=LONGVARCHAR},
      </if>
      <if test="visitType != null">
        #{visitType,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.ruoyi.system.domain.visit.VisitFreeInterviewExample" resultType="java.lang.Long">
    select count(*) from visit_free_interview
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update visit_free_interview
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.planId != null">
        plan_id = #{record.planId,jdbcType=VARCHAR},
      </if>
      <if test="record.modelId != null">
        model_id = #{record.modelId,jdbcType=VARCHAR},
      </if>
      <if test="record.wgCode != null">
        wg_code = #{record.wgCode,jdbcType=VARCHAR},
      </if>
      <if test="record.wgValue != null">
        wg_value = #{record.wgValue,jdbcType=VARCHAR},
      </if>
      <if test="record.wgyName != null">
        wgy_name = #{record.wgyName,jdbcType=VARCHAR},
      </if>
      <if test="record.wgyCode != null">
        wgy_code = #{record.wgyCode,jdbcType=VARCHAR},
      </if>
      <if test="record.interviewTime != null">
        interview_time = #{record.interviewTime,jdbcType=VARCHAR},
      </if>
      <if test="record.type != null">
        type = #{record.type,jdbcType=VARCHAR},
      </if>
      <if test="record.objId != null">
        obj_id = #{record.objId,jdbcType=VARCHAR},
      </if>
      <if test="record.objName != null">
        obj_name = #{record.objName,jdbcType=VARCHAR},
      </if>
      <if test="record.objType != null">
        obj_type = #{record.objType,jdbcType=VARCHAR},
      </if>
      <if test="record.objTypeName != null">
        obj_type_name = #{record.objTypeName,jdbcType=VARCHAR},
      </if>
      <if test="record.objUserName != null">
        obj_user_name = #{record.objUserName,jdbcType=VARCHAR},
      </if>
      <if test="record.objNumber != null">
        obj_number = #{record.objNumber,jdbcType=VARCHAR},
      </if>
      <if test="record.createId != null">
        create_id = #{record.createId,jdbcType=VARCHAR},
      </if>
      <if test="record.createName != null">
        create_name = #{record.createName,jdbcType=VARCHAR},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=VARCHAR},
      </if>
      <if test="record.status != null">
        status = #{record.status,jdbcType=VARCHAR},
      </if>
      <if test="record.taskId != null">
        task_id = #{record.taskId,jdbcType=VARCHAR},
      </if>
      <if test="record.isValid != null">
        is_valid = #{record.isValid,jdbcType=VARCHAR},
      </if>
      <if test="record.longitude != null">
        longitude = #{record.longitude,jdbcType=VARCHAR},
      </if>
      <if test="record.latitude != null">
        latitude = #{record.latitude,jdbcType=VARCHAR},
      </if>
      <if test="record.address != null">
        address = #{record.address,jdbcType=VARCHAR},
      </if>
      <if test="record.actualTime != null">
        actual_time = #{record.actualTime,jdbcType=VARCHAR},
      </if>
      <if test="record.content != null">
        content = #{record.content,jdbcType=LONGVARCHAR},
      </if>
      <if test="record.visitType != null">
        visit_Type = #{record.visitType,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExampleWithBLOBs" parameterType="map">
    update visit_free_interview
    set id = #{record.id,jdbcType=VARCHAR},
    plan_id = #{record.planId,jdbcType=VARCHAR},
    model_id = #{record.modelId,jdbcType=VARCHAR},
    wg_code = #{record.wgCode,jdbcType=VARCHAR},
    wg_value = #{record.wgValue,jdbcType=VARCHAR},
    wgy_name = #{record.wgyName,jdbcType=VARCHAR},
    wgy_code = #{record.wgyCode,jdbcType=VARCHAR},
    interview_time = #{record.interviewTime,jdbcType=VARCHAR},
    type = #{record.type,jdbcType=VARCHAR},
    obj_id = #{record.objId,jdbcType=VARCHAR},
    obj_name = #{record.objName,jdbcType=VARCHAR},
    obj_type = #{record.objType,jdbcType=VARCHAR},
    obj_type_name = #{record.objTypeName,jdbcType=VARCHAR},
    obj_user_name = #{record.objUserName,jdbcType=VARCHAR},
    obj_number = #{record.objNumber,jdbcType=VARCHAR},
    create_id = #{record.createId,jdbcType=VARCHAR},
    create_name = #{record.createName,jdbcType=VARCHAR},
    create_time = #{record.createTime,jdbcType=VARCHAR},
    status = #{record.status,jdbcType=VARCHAR},
    task_id = #{record.taskId,jdbcType=VARCHAR},
    is_valid = #{record.isValid,jdbcType=VARCHAR},
    longitude = #{record.longitude,jdbcType=VARCHAR},
    latitude = #{record.latitude,jdbcType=VARCHAR},
    address = #{record.address,jdbcType=VARCHAR},
    actual_time = #{record.actualTime,jdbcType=VARCHAR},
    content = #{record.content,jdbcType=LONGVARCHAR},
    visit_type = #{record.visitType,jdbcType=VARCHAR},
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update visit_free_interview
    set id = #{record.id,jdbcType=VARCHAR},
    plan_id = #{record.planId,jdbcType=VARCHAR},
    model_id = #{record.modelId,jdbcType=VARCHAR},
    wg_code = #{record.wgCode,jdbcType=VARCHAR},
    wg_value = #{record.wgValue,jdbcType=VARCHAR},
    wgy_name = #{record.wgyName,jdbcType=VARCHAR},
    wgy_code = #{record.wgyCode,jdbcType=VARCHAR},
    interview_time = #{record.interviewTime,jdbcType=VARCHAR},
    type = #{record.type,jdbcType=VARCHAR},
    obj_id = #{record.objId,jdbcType=VARCHAR},
    obj_name = #{record.objName,jdbcType=VARCHAR},
    obj_type = #{record.objType,jdbcType=VARCHAR},
    obj_type_name = #{record.objTypeName,jdbcType=VARCHAR},
    obj_user_name = #{record.objUserName,jdbcType=VARCHAR},
    obj_number = #{record.objNumber,jdbcType=VARCHAR},
    create_id = #{record.createId,jdbcType=VARCHAR},
    create_name = #{record.createName,jdbcType=VARCHAR},
    create_time = #{record.createTime,jdbcType=VARCHAR},
    status = #{record.status,jdbcType=VARCHAR},
    task_id = #{record.taskId,jdbcType=VARCHAR},
    is_valid = #{record.isValid,jdbcType=VARCHAR},
    longitude = #{record.longitude,jdbcType=VARCHAR},
    latitude = #{record.latitude,jdbcType=VARCHAR},
    address = #{record.address,jdbcType=VARCHAR},
    actual_time = #{record.actualTime,jdbcType=VARCHAR},
    visit_type = #{record.visitType,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.ruoyi.system.domain.visit.VisitFreeInterview">
    update visit_free_interview
    <set>
      <if test="planId != null">
        plan_id = #{planId,jdbcType=VARCHAR},
      </if>
      <if test="modelId != null">
        model_id = #{modelId,jdbcType=VARCHAR},
      </if>
      <if test="wgCode != null">
        wg_code = #{wgCode,jdbcType=VARCHAR},
      </if>
      <if test="wgValue != null">
        wg_value = #{wgValue,jdbcType=VARCHAR},
      </if>
      <if test="wgyName != null">
        wgy_name = #{wgyName,jdbcType=VARCHAR},
      </if>
      <if test="wgyCode != null">
        wgy_code = #{wgyCode,jdbcType=VARCHAR},
      </if>
      <if test="interviewTime != null">
        interview_time = #{interviewTime,jdbcType=VARCHAR},
      </if>
      <if test="type != null">
        type = #{type,jdbcType=VARCHAR},
      </if>
      <if test="objId != null">
        obj_id = #{objId,jdbcType=VARCHAR},
      </if>
      <if test="objName != null">
        obj_name = #{objName,jdbcType=VARCHAR},
      </if>
      <if test="objType != null">
        obj_type = #{objType,jdbcType=VARCHAR},
      </if>
      <if test="objTypeName != null">
        obj_type_name = #{objTypeName,jdbcType=VARCHAR},
      </if>
      <if test="objUserName != null">
        obj_user_name = #{objUserName,jdbcType=VARCHAR},
      </if>
      <if test="objNumber != null">
        obj_number = #{objNumber,jdbcType=VARCHAR},
      </if>
      <if test="createId != null">
        create_id = #{createId,jdbcType=VARCHAR},
      </if>
      <if test="createName != null">
        create_name = #{createName,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        status = #{status,jdbcType=VARCHAR},
      </if>
      <if test="taskId != null">
        task_id = #{taskId,jdbcType=VARCHAR},
      </if>
      <if test="isValid != null">
        is_valid = #{isValid,jdbcType=VARCHAR},
      </if>
      <if test="longitude != null">
        longitude = #{longitude,jdbcType=VARCHAR},
      </if>
      <if test="latitude != null">
        latitude = #{latitude,jdbcType=VARCHAR},
      </if>
      <if test="address != null">
        address = #{address,jdbcType=VARCHAR},
      </if>
      <if test="actualTime != null">
        actual_time = #{actualTime,jdbcType=VARCHAR},
      </if>
      <if test="content != null">
        content = #{content,jdbcType=LONGVARCHAR},
      </if>
      <if test="visitType != null">
        visit_type = #{visitType,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.ruoyi.system.domain.visit.VisitFreeInterview">
    update visit_free_interview
    set plan_id = #{planId,jdbcType=VARCHAR},
      model_id = #{modelId,jdbcType=VARCHAR},
      wg_code = #{wgCode,jdbcType=VARCHAR},
      wg_value = #{wgValue,jdbcType=VARCHAR},
      wgy_name = #{wgyName,jdbcType=VARCHAR},
      wgy_code = #{wgyCode,jdbcType=VARCHAR},
      interview_time = #{interviewTime,jdbcType=VARCHAR},
      type = #{type,jdbcType=VARCHAR},
      obj_id = #{objId,jdbcType=VARCHAR},
      obj_name = #{objName,jdbcType=VARCHAR},
      obj_type = #{objType,jdbcType=VARCHAR},
      obj_type_name = #{objTypeName,jdbcType=VARCHAR},
      obj_user_name = #{objUserName,jdbcType=VARCHAR},
      obj_number = #{objNumber,jdbcType=VARCHAR},
      create_id = #{createId,jdbcType=VARCHAR},
      create_name = #{createName,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=VARCHAR},
      status = #{status,jdbcType=VARCHAR},
      task_id = #{taskId,jdbcType=VARCHAR},
      is_valid = #{isValid,jdbcType=VARCHAR},
      longitude = #{longitude,jdbcType=VARCHAR},
      latitude = #{latitude,jdbcType=VARCHAR},
      address = #{address,jdbcType=VARCHAR},
      actual_time = #{actualTime,jdbcType=VARCHAR},
      content = #{content,jdbcType=LONGVARCHAR},
    visit_type = #{visitType,jdbcType=VARCHAR}
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ruoyi.system.domain.visit.VisitFreeInterview">
    update visit_free_interview
    set plan_id = #{planId,jdbcType=VARCHAR},
      model_id = #{modelId,jdbcType=VARCHAR},
      wg_code = #{wgCode,jdbcType=VARCHAR},
      wg_value = #{wgValue,jdbcType=VARCHAR},
      wgy_name = #{wgyName,jdbcType=VARCHAR},
      wgy_code = #{wgyCode,jdbcType=VARCHAR},
      interview_time = #{interviewTime,jdbcType=VARCHAR},
      type = #{type,jdbcType=VARCHAR},
      obj_id = #{objId,jdbcType=VARCHAR},
      obj_name = #{objName,jdbcType=VARCHAR},
      obj_type = #{objType,jdbcType=VARCHAR},
      obj_type_name = #{objTypeName,jdbcType=VARCHAR},
      obj_user_name = #{objUserName,jdbcType=VARCHAR},
      obj_number = #{objNumber,jdbcType=VARCHAR},
      create_id = #{createId,jdbcType=VARCHAR},
      create_name = #{createName,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=VARCHAR},
      status = #{status,jdbcType=VARCHAR},
      task_id = #{taskId,jdbcType=VARCHAR},
      is_valid = #{isValid,jdbcType=VARCHAR},
      longitude = #{longitude,jdbcType=VARCHAR},
      latitude = #{latitude,jdbcType=VARCHAR},
      address = #{address,jdbcType=VARCHAR},
      actual_time = #{actualTime,jdbcType=VARCHAR},
    visit_type = #{visitType,jdbcType=VARCHAR}
    where id = #{id,jdbcType=VARCHAR}
  </update>

  <select id="freeVisitStatistics" resultType="java.util.HashMap">
    select
    type as type,
    count(*) as count
    from visit_free_interview
    WHERE is_valid = 1 and visit_type = #{visitType} group by type order by type asc
  </select>
  <select id="listByParams" resultType="com.ruoyi.system.domain.visit.VisitFreeInterview">
    select * from visit_free_interview where is_valid = '1'
    <if test="visitType != null and visitType != ''">
      and visit_type = #{visitType}
    </if>
    <if test="wgCodeLikes != null and wgCodeLikes.size() > 0">
      and (
      <foreach collection="wgCodeLikes" item="wgCode" open="(" close=")" separator="or">
        wgy_code like CONCAT(#{wgCode}, '%')
      </foreach>
      )
    </if>
    <if test="planIds != null and planIds.size() > 0">
      and plan_id in
      <foreach collection="planIds" item="planId" open="(" close=")" separator=",">
        #{planId}
      </foreach>
    </if>
    <if test="startDate != null and startDate != ''">
      and DATE_FORMAT(interview_time,'%Y-%m-%d') &gt;= #{startDate}
    </if>
    <if test="endDate != null and endDate != ''">
      and DATE_FORMAT(interview_time,'%Y-%m-%d') &lt;= #{endDate}
    </if>
  </select>

</mapper>