郑永安
2023-06-19 59e91a4e9ddaf23cebb12993c774aa899ab22d16
src/main/java/com/gk/firework/Mapper/mybatis/EnterpriseFeedMapper.xml
对比新文件
@@ -0,0 +1,208 @@
<?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.gk.firework.Mapper.EnterpriseFeedMapper" >
  <resultMap id="BaseResultMap" type="com.gk.firework.Domain.EnterpriseFeed" >
    <!--          -->
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="content" property="content" jdbcType="VARCHAR" />
    <result column="createby" property="createby" jdbcType="BIGINT" />
    <result column="createtime" property="createtime" jdbcType="TIMESTAMP" />
    <result column="source" property="source" jdbcType="VARCHAR" />
    <result column="enterpriseid" property="enterpriseid" jdbcType="BIGINT" />
    <collection property="enterpriseResources"
                javaType="java.util.List"
                ofType="com.gk.firework.Domain.EnterpriseResource"
                column="{efid=id,tabletype=tabletype}"
                select="selectInner">
    </collection>
  </resultMap>
  <sql id="Base_Column_List" >
    <!--          -->
    id, content, createby, createtime, from, enterpriseid
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    <!--          -->
    select
    <include refid="Base_Column_List" />
    from enterprisefeed
    where id = #{id,jdbcType=BIGINT}
  </select>
  <select id="selectInner" parameterType = "java.util.Map" resultType="com.gk.firework.Domain.EnterpriseResource">
      select  er.id id, er.url,er.filename,er.tabletype
      from enterpriseresource er
      where  er.validflag = 1
      and er.tabletype = #{tabletype}
      and er.belongid = #{efid}
    </select>
  <select id="selectPages" parameterType = "java.util.Map" resultMap="BaseResultMap">
    select ef.*,
    #{params.tabletype} tabletype
    from enterprisefeed as ef
    where ef.validflag = 1
    and ef.enterpriseid = #{params.id}
    order by ef.createtime desc
  </select>
  <select id="selectExportFeed" resultType="java.util.Map">
    select e.enterprisename,
    ef.createtime,
    ef.findtime,
    ef.createbyname,
    ef.content
    from enterprisefeed as ef
    left join enterprise as e on e.id = ef.enterpriseid and e.validflag = 1
    where  e.validflag = 1
    and ef.validflag = 1
    <choose>
      <when test="params.enterprisenumber != null and params.enterprisenumber != ''">
        and e.enterprisenumber = #{params.enterprisenumber}
      </when>
      <otherwise>
        <if test="params.province != null and params.province != ''">
          and e.province = #{params.province}
        </if>
        <if test="params.city != null and params.city != ''">
          and e.city = #{params.city}
        </if>
        <if test="params.district != null and params.district != ''">
          and e.district = #{params.district}
        </if>
        <if test="params.street != null and params.street != ''">
          and e.street = #{params.street}
        </if>
        <if test="params.committee != null and params.committee != ''">
          and e.committee = #{params.committee}
        </if>
      </otherwise>
    </choose>
    <if test="params.safetySupervision != null and params.safetySupervision != ''">
      and e.safetysupervision = #{params.safetySupervision}
    </if>
    <if test="params.economicIndustry != null and params.economicIndustry != ''">
      and e.economicIndustry = #{params.economicIndustry}
    </if>
    <if test="params.valid != null and params.valid != ''">
      <if test="params.valid == 1">
        and e.validendtime &gt; now()
      </if>
      <if test="params.valid == 2">
        and e.validendtime &lt;= now()
      </if>
    </if>
    <if test="params.filterProvince != null and params.filterProvince  != ''">
      and e.province = #{params.filterProvince}
    </if>
    <if test="params.filterCity != null and  params.filterCity  != ''">
      and e.city = #{params.filterCity}
    </if>
    <if test="params.filterDistrict != null and params.filterDistrict  != ''">
      and e.district = #{params.filterDistrict}
    </if>
    <if test="params.filterStreet != null and params.filterStreet  != ''">
      and e.street = #{params.filterStreet}
    </if>
    <if test="params.filterCommittee != null and params.filterCommittee  != ''">
      and e.committee = #{params.filterCommittee}
    </if>
    <if test="params.enterprisename != null and params.enterprisename  != ''">
      and e.enterprisename like concat("%",#{params.enterprisename},"%")
    </if>
  </select>
    <select id="selectExportFeedById" resultType="java.util.Map">
      select e.enterprisename,
      feedback.findtime,
      feedback.createtime,
      feedback.createbyname,
      feedback.content
      from enterprisefeed as feedback
      left join  enterprise as e on e.id = feedback.enterpriseid
      where feedback.validflag = 1
      and feedback.enterpriseid = #{id}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    <!--          -->
    delete from enterprisefeed
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insertSelective" parameterType="com.gk.firework.Domain.EnterpriseFeed" >
    <!--          -->
    insert into enterprisefeed
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="content != null" >
        content,
      </if>
      <if test="createby != null" >
        createby,
      </if>
      <if test="createtime != null" >
        createtime,
      </if>
      <if test="from != null" >
        from,
      </if>
      <if test="enterpriseid != null" >
        enterpriseid,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=BIGINT},
      </if>
      <if test="content != null" >
        #{content,jdbcType=VARCHAR},
      </if>
      <if test="createby != null" >
        #{createby,jdbcType=BIGINT},
      </if>
      <if test="createtime != null" >
        #{createtime,jdbcType=TIMESTAMP},
      </if>
      <if test="from != null" >
        #{from,jdbcType=VARCHAR},
      </if>
      <if test="enterpriseid != null" >
        #{enterpriseid,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.gk.firework.Domain.EnterpriseFeed" >
    <!--          -->
    update enterprisefeed
    <set >
      <if test="content != null" >
        content = #{content,jdbcType=VARCHAR},
      </if>
      <if test="createby != null" >
        createby = #{createby,jdbcType=BIGINT},
      </if>
      <if test="createtime != null" >
        createtime = #{createtime,jdbcType=TIMESTAMP},
      </if>
      <if test="from != null" >
        from = #{from,jdbcType=VARCHAR},
      </if>
      <if test="enterpriseid != null" >
        enterpriseid = #{enterpriseid,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.gk.firework.Domain.EnterpriseFeed" >
    <!--          -->
    update enterprisefeed
    set content = #{content,jdbcType=VARCHAR},
      createby = #{createby,jdbcType=BIGINT},
      createtime = #{createtime,jdbcType=TIMESTAMP},
      from = #{from,jdbcType=VARCHAR},
      enterpriseid = #{enterpriseid,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>