<?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.goafanti.common.dao.UserServiceFollowMapper">
  <resultMap id="BaseResultMap" type="com.goafanti.common.model.UserServiceFollow">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri May 28 13:37:12 CST 2021.
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="uid" jdbcType="VARCHAR" property="uid" />
    <result column="aid" jdbcType="VARCHAR" property="aid" />
    <result column="add_wechat" jdbcType="INTEGER" property="addWechat" />
    <result column="wechat" jdbcType="VARCHAR" property="wechat" />
    <result column="renewal" jdbcType="INTEGER" property="renewal" />
    <result column="renewal_time" jdbcType="TIMESTAMP" property="renewalTime" />
    <result column="sign_project_id" jdbcType="VARCHAR" property="signProjectId" />
    <result column="sign_project" jdbcType="VARCHAR" property="signProject" />
    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="tech_satisfaction" jdbcType="INTEGER" property="techSatisfaction" />
    <result column="business_satisfaction" jdbcType="INTEGER" property="businessSatisfaction" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri May 28 13:37:12 CST 2021.
    -->
    id, `uid`, aid, add_wechat, wechat, renewal, renewal_time, sign_project_id, sign_project, 
    remarks, create_time, tech_satisfaction, business_satisfaction
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri May 28 13:37:12 CST 2021.
    -->
    select 
    <include refid="Base_Column_List" />
    from user_service_follow
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri May 28 13:37:12 CST 2021.
    -->
    delete from user_service_follow
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.goafanti.common.model.UserServiceFollow">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri May 28 13:37:12 CST 2021.
    -->
    insert into user_service_follow (id, `uid`, aid, 
      add_wechat, wechat, renewal, 
      renewal_time, sign_project_id, sign_project, 
      remarks, create_time, tech_satisfaction, 
      business_satisfaction)
    values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR}, 
      #{addWechat,jdbcType=INTEGER}, #{wechat,jdbcType=VARCHAR}, #{renewal,jdbcType=INTEGER}, 
      #{renewalTime,jdbcType=TIMESTAMP}, #{signProjectId,jdbcType=VARCHAR}, #{signProject,jdbcType=VARCHAR}, 
      #{remarks,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{techSatisfaction,jdbcType=INTEGER}, 
      #{businessSatisfaction,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.goafanti.common.model.UserServiceFollow">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri May 28 13:37:12 CST 2021.
    -->
    insert into user_service_follow
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="uid != null">
        `uid`,
      </if>
      <if test="aid != null">
        aid,
      </if>
      <if test="addWechat != null">
        add_wechat,
      </if>
      <if test="wechat != null">
        wechat,
      </if>
      <if test="renewal != null">
        renewal,
      </if>
      <if test="renewalTime != null">
        renewal_time,
      </if>
      <if test="signProjectId != null">
        sign_project_id,
      </if>
      <if test="signProject != null">
        sign_project,
      </if>
      <if test="remarks != null">
        remarks,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="techSatisfaction != null">
        tech_satisfaction,
      </if>
      <if test="businessSatisfaction != null">
        business_satisfaction,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="uid != null">
        #{uid,jdbcType=VARCHAR},
      </if>
      <if test="aid != null">
        #{aid,jdbcType=VARCHAR},
      </if>
      <if test="addWechat != null">
        #{addWechat,jdbcType=INTEGER},
      </if>
      <if test="wechat != null">
        #{wechat,jdbcType=VARCHAR},
      </if>
      <if test="renewal != null">
        #{renewal,jdbcType=INTEGER},
      </if>
      <if test="renewalTime != null">
        #{renewalTime,jdbcType=TIMESTAMP},
      </if>
      <if test="signProjectId != null">
        #{signProjectId,jdbcType=VARCHAR},
      </if>
      <if test="signProject != null">
        #{signProject,jdbcType=VARCHAR},
      </if>
      <if test="remarks != null">
        #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="techSatisfaction != null">
        #{techSatisfaction,jdbcType=INTEGER},
      </if>
      <if test="businessSatisfaction != null">
        #{businessSatisfaction,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.UserServiceFollow">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri May 28 13:37:12 CST 2021.
    -->
    update user_service_follow
    <set>
      <if test="uid != null">
        `uid` = #{uid,jdbcType=VARCHAR},
      </if>
      <if test="aid != null">
        aid = #{aid,jdbcType=VARCHAR},
      </if>
      <if test="addWechat != null">
        add_wechat = #{addWechat,jdbcType=INTEGER},
      </if>
      <if test="wechat != null">
        wechat = #{wechat,jdbcType=VARCHAR},
      </if>
      <if test="renewal != null">
        renewal = #{renewal,jdbcType=INTEGER},
      </if>
      <if test="renewalTime != null">
        renewal_time = #{renewalTime,jdbcType=TIMESTAMP},
      </if>
      <if test="signProjectId != null">
        sign_project_id = #{signProjectId,jdbcType=VARCHAR},
      </if>
      <if test="signProject != null">
        sign_project = #{signProject,jdbcType=VARCHAR},
      </if>
      <if test="remarks != null">
        remarks = #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="techSatisfaction != null">
        tech_satisfaction = #{techSatisfaction,jdbcType=INTEGER},
      </if>
      <if test="businessSatisfaction != null">
        business_satisfaction = #{businessSatisfaction,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.UserServiceFollow">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri May 28 13:37:12 CST 2021.
    -->
    update user_service_follow
    set `uid` = #{uid,jdbcType=VARCHAR},
      aid = #{aid,jdbcType=VARCHAR},
      add_wechat = #{addWechat,jdbcType=INTEGER},
      wechat = #{wechat,jdbcType=VARCHAR},
      renewal = #{renewal,jdbcType=INTEGER},
      renewal_time = #{renewalTime,jdbcType=TIMESTAMP},
      sign_project_id = #{signProjectId,jdbcType=VARCHAR},
      sign_project = #{signProject,jdbcType=VARCHAR},
      remarks = #{remarks,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      tech_satisfaction = #{techSatisfaction,jdbcType=INTEGER},
      business_satisfaction = #{businessSatisfaction,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <select id="listUseServiceFollow" resultType="com.goafanti.user.bo.OutUserServiceFollow">
	select a.id, a.`uid`, a.aid, a.add_wechat addWechat, a.wechat, renewal, a.renewal_time renewalTime, a.sign_project_id signProjectId,
 a.sign_project signProject,  a.create_time createTime ,date_format(a.renewal_time,'%Y-%m-%d') as renewalTimes,
 date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as createTimes,a.remarks,b.name adminName,a.tech_satisfaction techSatisfaction,
 a.business_satisfaction businessSatisfaction
  from user_service_follow a left join admin b on a.aid =b.id
    where uid = #{uid}
    order by a.create_time desc
  </select>
</mapper>