郑永安
2023-06-19 59e91a4e9ddaf23cebb12993c774aa899ab22d16
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
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>