<?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.PublicReleaseLogMapper">
  <resultMap id="BaseResultMap" type="com.goafanti.common.model.PublicReleaseLog">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 24 11:35:04 CST 2021.
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="prid" jdbcType="INTEGER" property="prid" />
    <result column="aid" jdbcType="VARCHAR" property="aid" />
    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
    <result column="status" jdbcType="INTEGER" property="status" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.goafanti.common.model.PublicReleaseLog">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 24 11:35:04 CST 2021.
    -->
    <result column="photo_url" jdbcType="LONGVARCHAR" property="photoUrl" />
  </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 Thu Jun 24 11:35:04 CST 2021.
    -->
    id, prid, aid, remarks, `status`, create_time
  </sql>
  <sql id="Blob_Column_List">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 24 11:35:04 CST 2021.
    -->
    photo_url
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 24 11:35:04 CST 2021.
    -->
    select
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from public_release_log
    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 Thu Jun 24 11:35:04 CST 2021.
    -->
    delete from public_release_log
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.goafanti.common.model.PublicReleaseLog">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 24 11:35:04 CST 2021.
    -->
    insert into public_release_log (id, prid, aid,
      remarks, `status`, create_time,
      photo_url)
    values (#{id,jdbcType=INTEGER}, #{prid,jdbcType=INTEGER}, #{aid,jdbcType=VARCHAR},
      #{remarks,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
      #{photoUrl,jdbcType=LONGVARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.goafanti.common.model.PublicReleaseLog">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 24 11:35:04 CST 2021.
    -->
    insert into public_release_log
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="prid != null">
        prid,
      </if>
      <if test="aid != null">
        aid,
      </if>
      <if test="remarks != null">
        remarks,
      </if>
      <if test="status != null">
        `status`,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="photoUrl != null">
        photo_url,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="prid != null">
        #{prid,jdbcType=INTEGER},
      </if>
      <if test="aid != null">
        #{aid,jdbcType=VARCHAR},
      </if>
      <if test="remarks != null">
        #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        #{status,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="photoUrl != null">
        #{photoUrl,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PublicReleaseLog">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 24 11:35:04 CST 2021.
    -->
    update public_release_log
    <set>
      <if test="prid != null">
        prid = #{prid,jdbcType=INTEGER},
      </if>
      <if test="aid != null">
        aid = #{aid,jdbcType=VARCHAR},
      </if>
      <if test="remarks != null">
        remarks = #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        `status` = #{status,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="photoUrl != null">
        photo_url = #{photoUrl,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.goafanti.common.model.PublicReleaseLog">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 24 11:35:04 CST 2021.
    -->
    update public_release_log
    set prid = #{prid,jdbcType=INTEGER},
      aid = #{aid,jdbcType=VARCHAR},
      remarks = #{remarks,jdbcType=VARCHAR},
      `status` = #{status,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      photo_url = #{photoUrl,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.PublicReleaseLog">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 24 11:35:04 CST 2021.
    -->
    update public_release_log
    set prid = #{prid,jdbcType=INTEGER},
      aid = #{aid,jdbcType=VARCHAR},
      remarks = #{remarks,jdbcType=VARCHAR},
      `status` = #{status,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <select id="listPublicReleaseLog" resultType="com.goafanti.weChat.bo.outPublicReleaseLog">
  select a.id,a.aid ,a.prid ,a.remarks ,a.status ,b.name aname,a.photo_url photoUrl,
	date_format(a.create_time ,'%Y-%m-%d %H:%i:%S') createTimes
	from public_release_log a left join admin b on a.aid =b.id
	left  join public_release pr  on a.prid =pr.id
    <if test="ufid !=null">
  left join public_release_details prd on pr.id=prd.prid
    </if>
	where 1=1
	<if test="id !=null">
	and a.prid = #{id}
	</if>
	<if test="ufid !=null">
	and prd.ufid  = #{ufid}
	</if>
	order by a.create_time desc
  </select>

</mapper>
