Pārlūkot izejas kodu

Merge branch 'master' of http://101.36.160.140:21044/depot-tianjin/depot-business-tianjin.git

gaodd 2 gadi atpakaļ
vecāks
revīzija
34e18a08a0

+ 8 - 1
pom.xml

@@ -180,7 +180,14 @@
180 180
 		    <groupId>org.springframework.cloud</groupId>
181 181
 		    <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
182 182
 		</dependency>
183
-        
183
+
184
+        <!-- 加载mybatis逆向生成工具包 -->
185
+        <dependency>
186
+		    <groupId>org.mybatis.generator</groupId>
187
+		    <artifactId>mybatis-generator-core</artifactId>
188
+		    <!-- 注意版本.这里我使用的是1.3.2 -->
189
+		    <version>1.3.2</version>
190
+		</dependency>
184 191
 
185 192
 		<dependency>
186 193
 			<groupId>org.apache.commons</groupId>

+ 83 - 0
src/main/java/com/chinaitop/depot/business/controller/BusinessContractReceiveController.java

@@ -0,0 +1,83 @@
1
+package com.chinaitop.depot.business.controller;
2
+
3
+import java.util.HashMap;
4
+import java.util.List;
5
+import java.util.Map;
6
+
7
+import javax.annotation.Resource;
8
+
9
+import org.slf4j.Logger;
10
+import org.slf4j.LoggerFactory;
11
+import org.springframework.http.MediaType;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RequestMethod;
14
+import org.springframework.web.bind.annotation.RestController;
15
+
16
+import com.chinaitop.depot.business.model.BusinessContractReceive;
17
+import com.chinaitop.depot.business.service.BusinessContractReceiveService;
18
+import com.github.pagehelper.PageHelper;
19
+import com.github.pagehelper.PageInfo;
20
+
21
+import io.swagger.annotations.Api;
22
+import io.swagger.annotations.ApiImplicitParam;
23
+import io.swagger.annotations.ApiImplicitParams;
24
+import io.swagger.annotations.ApiOperation;
25
+
26
+@RestController
27
+@RequestMapping(value="/businessContractReceiveController")
28
+@Api(value= "BusinessContractController", description = "储备粮合同接收管理")
29
+public class BusinessContractReceiveController {
30
+
31
+	@Resource
32
+	private BusinessContractReceiveService businessContractReceiveService;
33
+	
34
+	public static final Logger logger = LoggerFactory.getLogger(BusinessContractController.class);
35
+	
36
+	@RequestMapping(value="/getList",produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.GET)
37
+	@ApiOperation(value="合同接收列表", notes = "支持分页")
38
+	@ApiImplicitParams({
39
+		@ApiImplicitParam(name = "pageNum", value = "页码", paramType = "query"),
40
+		@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "query"),
41
+		@ApiImplicitParam(name = "htbh", value = "合同编号", paramType = "query"),
42
+		@ApiImplicitParam(name = "orgId", value = "组织机构ID", paramType = "query"),
43
+		@ApiImplicitParam(name = "houseId", value = "仓房ID", paramType = "query"),
44
+		@ApiImplicitParam(name = "warehouseId", value = "货位ID", paramType = "query")
45
+	})
46
+    public PageInfo<BusinessContractReceive> getList(Integer pageNum, Integer pageSize, 
47
+    		String htbh ,Integer orgId, Integer houseId, Integer warehouseId) {
48
+       
49
+		PageInfo<BusinessContractReceive> pageInfo = null;
50
+		
51
+        List<BusinessContractReceive> list = null;
52
+        try {
53
+        	if (null != pageNum && null != pageSize) {
54
+        		PageHelper.startPage(pageNum, pageSize);
55
+        	}
56
+			list = businessContractReceiveService.queryByExample(htbh, orgId, houseId, warehouseId);
57
+			pageInfo = new PageInfo<BusinessContractReceive>(list);
58
+		} catch (Exception e) {
59
+			logger.error(e.getMessage(), e);
60
+		}
61
+        return pageInfo;
62
+    }
63
+
64
+	@RequestMapping(value="/saveContract",produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.POST)
65
+	@ApiOperation(value="合同接收保存", notes = "市平台推送来的合同")
66
+	@ApiImplicitParams({
67
+		@ApiImplicitParam(name = "datas", value = "数据串", paramType = "form")
68
+	})
69
+	public String saveContract(String datas) {
70
+		logger.info("接收市平台的通知单数据串:"+datas);
71
+		Map<String, String> result = new HashMap<>();
72
+		result.put("status", "200");
73
+		result.put("msg", "接收成功");
74
+//		try {
75
+//			result = businessContractReceiveService.receiveContractData(datas);
76
+//		} catch (Exception e) {
77
+//			result.put("status", "500");
78
+//			result.put("msg", "接口异常,请联系管理员");
79
+//			logger.error(e.getMessage(), e);
80
+//		}
81
+		return result.toString();
82
+	}
83
+}

+ 30 - 0
src/main/java/com/chinaitop/depot/business/mapper/BusinessContractReceiveMapper.java

@@ -0,0 +1,30 @@
1
+package com.chinaitop.depot.business.mapper;
2
+
3
+import com.chinaitop.depot.business.model.BusinessContractReceive;
4
+import com.chinaitop.depot.business.model.BusinessContractReceiveExample;
5
+import java.util.List;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+public interface BusinessContractReceiveMapper {
9
+    int countByExample(BusinessContractReceiveExample example);
10
+
11
+    int deleteByExample(BusinessContractReceiveExample example);
12
+
13
+    int deleteByPrimaryKey(Integer id);
14
+
15
+    int insert(BusinessContractReceive record);
16
+
17
+    int insertSelective(BusinessContractReceive record);
18
+
19
+    List<BusinessContractReceive> selectByExample(BusinessContractReceiveExample example);
20
+
21
+    BusinessContractReceive selectByPrimaryKey(Integer id);
22
+
23
+    int updateByExampleSelective(@Param("record") BusinessContractReceive record, @Param("example") BusinessContractReceiveExample example);
24
+
25
+    int updateByExample(@Param("record") BusinessContractReceive record, @Param("example") BusinessContractReceiveExample example);
26
+
27
+    int updateByPrimaryKeySelective(BusinessContractReceive record);
28
+
29
+    int updateByPrimaryKey(BusinessContractReceive record);
30
+}

+ 479 - 0
src/main/java/com/chinaitop/depot/business/mapper/BusinessContractReceiveMapper.xml

@@ -0,0 +1,479 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3
+<mapper namespace="com.chinaitop.depot.business.mapper.BusinessContractReceiveMapper" >
4
+  <resultMap id="BaseResultMap" type="com.chinaitop.depot.business.model.BusinessContractReceive" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="org_id" property="orgId" jdbcType="INTEGER" />
7
+    <result column="htbh" property="htbh" jdbcType="VARCHAR" />
8
+    <result column="htlx" property="htlx" jdbcType="VARCHAR" />
9
+    <result column="htzsl" property="htzsl" jdbcType="DECIMAL" />
10
+    <result column="htdj" property="htdj" jdbcType="DECIMAL" />
11
+    <result column="htzj" property="htzj" jdbcType="DECIMAL" />
12
+    <result column="yjsje" property="yjsje" jdbcType="DECIMAL" />
13
+    <result column="house_id" property="houseId" jdbcType="INTEGER" />
14
+    <result column="warehouse_id" property="warehouseId" jdbcType="INTEGER" />
15
+    <result column="lypz" property="lypz" jdbcType="INTEGER" />
16
+    <result column="mxpz" property="mxpz" jdbcType="INTEGER" />
17
+    <result column="lydj" property="lydj" jdbcType="INTEGER" />
18
+    <result column="lyxz" property="lyxz" jdbcType="INTEGER" />
19
+    <result column="scnf" property="scnf" jdbcType="INTEGER" />
20
+    <result column="shnd" property="shnd" jdbcType="INTEGER" />
21
+    <result column="lycd" property="lycd" jdbcType="INTEGER" />
22
+    <result column="rksj" property="rksj" jdbcType="TIMESTAMP" />
23
+    <result column="khmc" property="khmc" jdbcType="VARCHAR" />
24
+    <result column="tyxydm" property="tyxydm" jdbcType="VARCHAR" />
25
+    <result column="input_time" property="inputTime" jdbcType="TIMESTAMP" />
26
+    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
27
+  </resultMap>
28
+  <sql id="Example_Where_Clause" >
29
+    <where >
30
+      <foreach collection="oredCriteria" item="criteria" separator="or" >
31
+        <if test="criteria.valid" >
32
+          <trim prefix="(" suffix=")" prefixOverrides="and" >
33
+            <foreach collection="criteria.criteria" item="criterion" >
34
+              <choose >
35
+                <when test="criterion.noValue" >
36
+                  and ${criterion.condition}
37
+                </when>
38
+                <when test="criterion.singleValue" >
39
+                  and ${criterion.condition} #{criterion.value}
40
+                </when>
41
+                <when test="criterion.betweenValue" >
42
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
43
+                </when>
44
+                <when test="criterion.listValue" >
45
+                  and ${criterion.condition}
46
+                  <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
47
+                    #{listItem}
48
+                  </foreach>
49
+                </when>
50
+              </choose>
51
+            </foreach>
52
+          </trim>
53
+        </if>
54
+      </foreach>
55
+    </where>
56
+  </sql>
57
+  <sql id="Update_By_Example_Where_Clause" >
58
+    <where >
59
+      <foreach collection="example.oredCriteria" item="criteria" separator="or" >
60
+        <if test="criteria.valid" >
61
+          <trim prefix="(" suffix=")" prefixOverrides="and" >
62
+            <foreach collection="criteria.criteria" item="criterion" >
63
+              <choose >
64
+                <when test="criterion.noValue" >
65
+                  and ${criterion.condition}
66
+                </when>
67
+                <when test="criterion.singleValue" >
68
+                  and ${criterion.condition} #{criterion.value}
69
+                </when>
70
+                <when test="criterion.betweenValue" >
71
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
72
+                </when>
73
+                <when test="criterion.listValue" >
74
+                  and ${criterion.condition}
75
+                  <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
76
+                    #{listItem}
77
+                  </foreach>
78
+                </when>
79
+              </choose>
80
+            </foreach>
81
+          </trim>
82
+        </if>
83
+      </foreach>
84
+    </where>
85
+  </sql>
86
+  <sql id="Base_Column_List" >
87
+    id, org_id, htbh, htlx, htzsl, htdj, htzj, yjsje, house_id, warehouse_id, lypz, mxpz, 
88
+    lydj, lyxz, scnf, shnd, lycd, rksj, khmc, tyxydm, input_time, update_time
89
+  </sql>
90
+  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.business.model.BusinessContractReceiveExample" >
91
+    select
92
+    <if test="distinct" >
93
+      distinct
94
+    </if>
95
+    <include refid="Base_Column_List" />
96
+    from business_contract_receive
97
+    <if test="_parameter != null" >
98
+      <include refid="Example_Where_Clause" />
99
+    </if>
100
+    <if test="orderByClause != null" >
101
+      order by ${orderByClause}
102
+    </if>
103
+  </select>
104
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
105
+    select 
106
+    <include refid="Base_Column_List" />
107
+    from business_contract_receive
108
+    where id = #{id,jdbcType=INTEGER}
109
+  </select>
110
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
111
+    delete from business_contract_receive
112
+    where id = #{id,jdbcType=INTEGER}
113
+  </delete>
114
+  <delete id="deleteByExample" parameterType="com.chinaitop.depot.business.model.BusinessContractReceiveExample" >
115
+    delete from business_contract_receive
116
+    <if test="_parameter != null" >
117
+      <include refid="Example_Where_Clause" />
118
+    </if>
119
+  </delete>
120
+  <insert id="insert" parameterType="com.chinaitop.depot.business.model.BusinessContractReceive" >
121
+    insert into business_contract_receive (id, org_id, htbh, 
122
+      htlx, htzsl, htdj, 
123
+      htzj, yjsje, house_id, 
124
+      warehouse_id, lypz, mxpz, 
125
+      lydj, lyxz, scnf, shnd, 
126
+      lycd, rksj, khmc, 
127
+      tyxydm, input_time, update_time
128
+      )
129
+    values (#{id,jdbcType=INTEGER}, #{orgId,jdbcType=INTEGER}, #{htbh,jdbcType=VARCHAR}, 
130
+      #{htlx,jdbcType=VARCHAR}, #{htzsl,jdbcType=DECIMAL}, #{htdj,jdbcType=DECIMAL}, 
131
+      #{htzj,jdbcType=DECIMAL}, #{yjsje,jdbcType=DECIMAL}, #{houseId,jdbcType=INTEGER}, 
132
+      #{warehouseId,jdbcType=INTEGER}, #{lypz,jdbcType=INTEGER}, #{mxpz,jdbcType=INTEGER}, 
133
+      #{lydj,jdbcType=INTEGER}, #{lyxz,jdbcType=INTEGER}, #{scnf,jdbcType=INTEGER}, #{shnd,jdbcType=INTEGER}, 
134
+      #{lycd,jdbcType=INTEGER}, #{rksj,jdbcType=TIMESTAMP}, #{khmc,jdbcType=VARCHAR}, 
135
+      #{tyxydm,jdbcType=VARCHAR}, #{inputTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
136
+      )
137
+  </insert>
138
+  <insert id="insertSelective" parameterType="com.chinaitop.depot.business.model.BusinessContractReceive" >
139
+    insert into business_contract_receive
140
+    <trim prefix="(" suffix=")" suffixOverrides="," >
141
+      <if test="id != null" >
142
+        id,
143
+      </if>
144
+      <if test="orgId != null" >
145
+        org_id,
146
+      </if>
147
+      <if test="htbh != null" >
148
+        htbh,
149
+      </if>
150
+      <if test="htlx != null" >
151
+        htlx,
152
+      </if>
153
+      <if test="htzsl != null" >
154
+        htzsl,
155
+      </if>
156
+      <if test="htdj != null" >
157
+        htdj,
158
+      </if>
159
+      <if test="htzj != null" >
160
+        htzj,
161
+      </if>
162
+      <if test="yjsje != null" >
163
+        yjsje,
164
+      </if>
165
+      <if test="houseId != null" >
166
+        house_id,
167
+      </if>
168
+      <if test="warehouseId != null" >
169
+        warehouse_id,
170
+      </if>
171
+      <if test="lypz != null" >
172
+        lypz,
173
+      </if>
174
+      <if test="mxpz != null" >
175
+        mxpz,
176
+      </if>
177
+      <if test="lydj != null" >
178
+        lydj,
179
+      </if>
180
+      <if test="lyxz != null" >
181
+        lyxz,
182
+      </if>
183
+      <if test="scnf != null" >
184
+        scnf,
185
+      </if>
186
+      <if test="shnd != null" >
187
+        shnd,
188
+      </if>
189
+      <if test="lycd != null" >
190
+        lycd,
191
+      </if>
192
+      <if test="rksj != null" >
193
+        rksj,
194
+      </if>
195
+      <if test="khmc != null" >
196
+        khmc,
197
+      </if>
198
+      <if test="tyxydm != null" >
199
+        tyxydm,
200
+      </if>
201
+      <if test="inputTime != null" >
202
+        input_time,
203
+      </if>
204
+      <if test="updateTime != null" >
205
+        update_time,
206
+      </if>
207
+    </trim>
208
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
209
+      <if test="id != null" >
210
+        #{id,jdbcType=INTEGER},
211
+      </if>
212
+      <if test="orgId != null" >
213
+        #{orgId,jdbcType=INTEGER},
214
+      </if>
215
+      <if test="htbh != null" >
216
+        #{htbh,jdbcType=VARCHAR},
217
+      </if>
218
+      <if test="htlx != null" >
219
+        #{htlx,jdbcType=VARCHAR},
220
+      </if>
221
+      <if test="htzsl != null" >
222
+        #{htzsl,jdbcType=DECIMAL},
223
+      </if>
224
+      <if test="htdj != null" >
225
+        #{htdj,jdbcType=DECIMAL},
226
+      </if>
227
+      <if test="htzj != null" >
228
+        #{htzj,jdbcType=DECIMAL},
229
+      </if>
230
+      <if test="yjsje != null" >
231
+        #{yjsje,jdbcType=DECIMAL},
232
+      </if>
233
+      <if test="houseId != null" >
234
+        #{houseId,jdbcType=INTEGER},
235
+      </if>
236
+      <if test="warehouseId != null" >
237
+        #{warehouseId,jdbcType=INTEGER},
238
+      </if>
239
+      <if test="lypz != null" >
240
+        #{lypz,jdbcType=INTEGER},
241
+      </if>
242
+      <if test="mxpz != null" >
243
+        #{mxpz,jdbcType=INTEGER},
244
+      </if>
245
+      <if test="lydj != null" >
246
+        #{lydj,jdbcType=INTEGER},
247
+      </if>
248
+      <if test="lyxz != null" >
249
+        #{lyxz,jdbcType=INTEGER},
250
+      </if>
251
+      <if test="scnf != null" >
252
+        #{scnf,jdbcType=INTEGER},
253
+      </if>
254
+      <if test="shnd != null" >
255
+        #{shnd,jdbcType=INTEGER},
256
+      </if>
257
+      <if test="lycd != null" >
258
+        #{lycd,jdbcType=INTEGER},
259
+      </if>
260
+      <if test="rksj != null" >
261
+        #{rksj,jdbcType=TIMESTAMP},
262
+      </if>
263
+      <if test="khmc != null" >
264
+        #{khmc,jdbcType=VARCHAR},
265
+      </if>
266
+      <if test="tyxydm != null" >
267
+        #{tyxydm,jdbcType=VARCHAR},
268
+      </if>
269
+      <if test="inputTime != null" >
270
+        #{inputTime,jdbcType=TIMESTAMP},
271
+      </if>
272
+      <if test="updateTime != null" >
273
+        #{updateTime,jdbcType=TIMESTAMP},
274
+      </if>
275
+    </trim>
276
+  </insert>
277
+  <select id="countByExample" parameterType="com.chinaitop.depot.business.model.BusinessContractReceiveExample" resultType="java.lang.Integer" >
278
+    select count(*) from business_contract_receive
279
+    <if test="_parameter != null" >
280
+      <include refid="Example_Where_Clause" />
281
+    </if>
282
+  </select>
283
+  <update id="updateByExampleSelective" parameterType="map" >
284
+    update business_contract_receive
285
+    <set >
286
+      <if test="record.id != null" >
287
+        id = #{record.id,jdbcType=INTEGER},
288
+      </if>
289
+      <if test="record.orgId != null" >
290
+        org_id = #{record.orgId,jdbcType=INTEGER},
291
+      </if>
292
+      <if test="record.htbh != null" >
293
+        htbh = #{record.htbh,jdbcType=VARCHAR},
294
+      </if>
295
+      <if test="record.htlx != null" >
296
+        htlx = #{record.htlx,jdbcType=VARCHAR},
297
+      </if>
298
+      <if test="record.htzsl != null" >
299
+        htzsl = #{record.htzsl,jdbcType=DECIMAL},
300
+      </if>
301
+      <if test="record.htdj != null" >
302
+        htdj = #{record.htdj,jdbcType=DECIMAL},
303
+      </if>
304
+      <if test="record.htzj != null" >
305
+        htzj = #{record.htzj,jdbcType=DECIMAL},
306
+      </if>
307
+      <if test="record.yjsje != null" >
308
+        yjsje = #{record.yjsje,jdbcType=DECIMAL},
309
+      </if>
310
+      <if test="record.houseId != null" >
311
+        house_id = #{record.houseId,jdbcType=INTEGER},
312
+      </if>
313
+      <if test="record.warehouseId != null" >
314
+        warehouse_id = #{record.warehouseId,jdbcType=INTEGER},
315
+      </if>
316
+      <if test="record.lypz != null" >
317
+        lypz = #{record.lypz,jdbcType=INTEGER},
318
+      </if>
319
+      <if test="record.mxpz != null" >
320
+        mxpz = #{record.mxpz,jdbcType=INTEGER},
321
+      </if>
322
+      <if test="record.lydj != null" >
323
+        lydj = #{record.lydj,jdbcType=INTEGER},
324
+      </if>
325
+      <if test="record.lyxz != null" >
326
+        lyxz = #{record.lyxz,jdbcType=INTEGER},
327
+      </if>
328
+      <if test="record.scnf != null" >
329
+        scnf = #{record.scnf,jdbcType=INTEGER},
330
+      </if>
331
+      <if test="record.shnd != null" >
332
+        shnd = #{record.shnd,jdbcType=INTEGER},
333
+      </if>
334
+      <if test="record.lycd != null" >
335
+        lycd = #{record.lycd,jdbcType=INTEGER},
336
+      </if>
337
+      <if test="record.rksj != null" >
338
+        rksj = #{record.rksj,jdbcType=TIMESTAMP},
339
+      </if>
340
+      <if test="record.khmc != null" >
341
+        khmc = #{record.khmc,jdbcType=VARCHAR},
342
+      </if>
343
+      <if test="record.tyxydm != null" >
344
+        tyxydm = #{record.tyxydm,jdbcType=VARCHAR},
345
+      </if>
346
+      <if test="record.inputTime != null" >
347
+        input_time = #{record.inputTime,jdbcType=TIMESTAMP},
348
+      </if>
349
+      <if test="record.updateTime != null" >
350
+        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
351
+      </if>
352
+    </set>
353
+    <if test="_parameter != null" >
354
+      <include refid="Update_By_Example_Where_Clause" />
355
+    </if>
356
+  </update>
357
+  <update id="updateByExample" parameterType="map" >
358
+    update business_contract_receive
359
+    set id = #{record.id,jdbcType=INTEGER},
360
+      org_id = #{record.orgId,jdbcType=INTEGER},
361
+      htbh = #{record.htbh,jdbcType=VARCHAR},
362
+      htlx = #{record.htlx,jdbcType=VARCHAR},
363
+      htzsl = #{record.htzsl,jdbcType=DECIMAL},
364
+      htdj = #{record.htdj,jdbcType=DECIMAL},
365
+      htzj = #{record.htzj,jdbcType=DECIMAL},
366
+      yjsje = #{record.yjsje,jdbcType=DECIMAL},
367
+      house_id = #{record.houseId,jdbcType=INTEGER},
368
+      warehouse_id = #{record.warehouseId,jdbcType=INTEGER},
369
+      lypz = #{record.lypz,jdbcType=INTEGER},
370
+      mxpz = #{record.mxpz,jdbcType=INTEGER},
371
+      lydj = #{record.lydj,jdbcType=INTEGER},
372
+      lyxz = #{record.lyxz,jdbcType=INTEGER},
373
+      scnf = #{record.scnf,jdbcType=INTEGER},
374
+      shnd = #{record.shnd,jdbcType=INTEGER},
375
+      lycd = #{record.lycd,jdbcType=INTEGER},
376
+      rksj = #{record.rksj,jdbcType=TIMESTAMP},
377
+      khmc = #{record.khmc,jdbcType=VARCHAR},
378
+      tyxydm = #{record.tyxydm,jdbcType=VARCHAR},
379
+      input_time = #{record.inputTime,jdbcType=TIMESTAMP},
380
+      update_time = #{record.updateTime,jdbcType=TIMESTAMP}
381
+    <if test="_parameter != null" >
382
+      <include refid="Update_By_Example_Where_Clause" />
383
+    </if>
384
+  </update>
385
+  <update id="updateByPrimaryKeySelective" parameterType="com.chinaitop.depot.business.model.BusinessContractReceive" >
386
+    update business_contract_receive
387
+    <set >
388
+      <if test="orgId != null" >
389
+        org_id = #{orgId,jdbcType=INTEGER},
390
+      </if>
391
+      <if test="htbh != null" >
392
+        htbh = #{htbh,jdbcType=VARCHAR},
393
+      </if>
394
+      <if test="htlx != null" >
395
+        htlx = #{htlx,jdbcType=VARCHAR},
396
+      </if>
397
+      <if test="htzsl != null" >
398
+        htzsl = #{htzsl,jdbcType=DECIMAL},
399
+      </if>
400
+      <if test="htdj != null" >
401
+        htdj = #{htdj,jdbcType=DECIMAL},
402
+      </if>
403
+      <if test="htzj != null" >
404
+        htzj = #{htzj,jdbcType=DECIMAL},
405
+      </if>
406
+      <if test="yjsje != null" >
407
+        yjsje = #{yjsje,jdbcType=DECIMAL},
408
+      </if>
409
+      <if test="houseId != null" >
410
+        house_id = #{houseId,jdbcType=INTEGER},
411
+      </if>
412
+      <if test="warehouseId != null" >
413
+        warehouse_id = #{warehouseId,jdbcType=INTEGER},
414
+      </if>
415
+      <if test="lypz != null" >
416
+        lypz = #{lypz,jdbcType=INTEGER},
417
+      </if>
418
+      <if test="mxpz != null" >
419
+        mxpz = #{mxpz,jdbcType=INTEGER},
420
+      </if>
421
+      <if test="lydj != null" >
422
+        lydj = #{lydj,jdbcType=INTEGER},
423
+      </if>
424
+      <if test="lyxz != null" >
425
+        lyxz = #{lyxz,jdbcType=INTEGER},
426
+      </if>
427
+      <if test="scnf != null" >
428
+        scnf = #{scnf,jdbcType=INTEGER},
429
+      </if>
430
+      <if test="shnd != null" >
431
+        shnd = #{shnd,jdbcType=INTEGER},
432
+      </if>
433
+      <if test="lycd != null" >
434
+        lycd = #{lycd,jdbcType=INTEGER},
435
+      </if>
436
+      <if test="rksj != null" >
437
+        rksj = #{rksj,jdbcType=TIMESTAMP},
438
+      </if>
439
+      <if test="khmc != null" >
440
+        khmc = #{khmc,jdbcType=VARCHAR},
441
+      </if>
442
+      <if test="tyxydm != null" >
443
+        tyxydm = #{tyxydm,jdbcType=VARCHAR},
444
+      </if>
445
+      <if test="inputTime != null" >
446
+        input_time = #{inputTime,jdbcType=TIMESTAMP},
447
+      </if>
448
+      <if test="updateTime != null" >
449
+        update_time = #{updateTime,jdbcType=TIMESTAMP},
450
+      </if>
451
+    </set>
452
+    where id = #{id,jdbcType=INTEGER}
453
+  </update>
454
+  <update id="updateByPrimaryKey" parameterType="com.chinaitop.depot.business.model.BusinessContractReceive" >
455
+    update business_contract_receive
456
+    set org_id = #{orgId,jdbcType=INTEGER},
457
+      htbh = #{htbh,jdbcType=VARCHAR},
458
+      htlx = #{htlx,jdbcType=VARCHAR},
459
+      htzsl = #{htzsl,jdbcType=DECIMAL},
460
+      htdj = #{htdj,jdbcType=DECIMAL},
461
+      htzj = #{htzj,jdbcType=DECIMAL},
462
+      yjsje = #{yjsje,jdbcType=DECIMAL},
463
+      house_id = #{houseId,jdbcType=INTEGER},
464
+      warehouse_id = #{warehouseId,jdbcType=INTEGER},
465
+      lypz = #{lypz,jdbcType=INTEGER},
466
+      mxpz = #{mxpz,jdbcType=INTEGER},
467
+      lydj = #{lydj,jdbcType=INTEGER},
468
+      lyxz = #{lyxz,jdbcType=INTEGER},
469
+      scnf = #{scnf,jdbcType=INTEGER},
470
+      shnd = #{shnd,jdbcType=INTEGER},
471
+      lycd = #{lycd,jdbcType=INTEGER},
472
+      rksj = #{rksj,jdbcType=TIMESTAMP},
473
+      khmc = #{khmc,jdbcType=VARCHAR},
474
+      tyxydm = #{tyxydm,jdbcType=VARCHAR},
475
+      input_time = #{inputTime,jdbcType=TIMESTAMP},
476
+      update_time = #{updateTime,jdbcType=TIMESTAMP}
477
+    where id = #{id,jdbcType=INTEGER}
478
+  </update>
479
+</mapper>

+ 402 - 0
src/main/java/com/chinaitop/depot/business/model/BusinessContractReceive.java

@@ -0,0 +1,402 @@
1
+package com.chinaitop.depot.business.model;
2
+
3
+import java.math.BigDecimal;
4
+import java.util.Date;
5
+
6
+public class BusinessContractReceive {
7
+    private Integer id;
8
+
9
+    private Integer orgId;
10
+
11
+    private String htbh;
12
+
13
+    private String htlx;
14
+
15
+    private BigDecimal htzsl;
16
+
17
+    private BigDecimal htdj;
18
+
19
+    private BigDecimal htzj;
20
+
21
+    private BigDecimal yjsje;
22
+
23
+    private Integer houseId;
24
+
25
+    private Integer warehouseId;
26
+
27
+    private Integer lypz;
28
+
29
+    private Integer mxpz;
30
+
31
+    private Integer lydj;
32
+
33
+    private Integer lyxz;
34
+
35
+    private Integer scnf;
36
+
37
+    private Integer shnd;
38
+
39
+    private Integer lycd;
40
+
41
+    private Date rksj;
42
+
43
+    private String khmc;
44
+
45
+    private String tyxydm;
46
+
47
+    private Date inputTime;
48
+
49
+    private Date updateTime;
50
+
51
+    /**
52
+     * 主键ID
53
+     * @return id 主键ID
54
+     */
55
+    public Integer getId() {
56
+        return id;
57
+    }
58
+
59
+    /**
60
+     * 主键ID
61
+     * @param id 主键ID
62
+     */
63
+    public void setId(Integer id) {
64
+        this.id = id;
65
+    }
66
+
67
+    /**
68
+     * 组织机构ID
69
+     * @return org_id 组织机构ID
70
+     */
71
+    public Integer getOrgId() {
72
+        return orgId;
73
+    }
74
+
75
+    /**
76
+     * 组织机构ID
77
+     * @param orgId 组织机构ID
78
+     */
79
+    public void setOrgId(Integer orgId) {
80
+        this.orgId = orgId;
81
+    }
82
+
83
+    /**
84
+     * 合同编号
85
+     * @return htbh 合同编号
86
+     */
87
+    public String getHtbh() {
88
+        return htbh;
89
+    }
90
+
91
+    /**
92
+     * 合同编号
93
+     * @param htbh 合同编号
94
+     */
95
+    public void setHtbh(String htbh) {
96
+        this.htbh = htbh == null ? null : htbh.trim();
97
+    }
98
+
99
+    /**
100
+     * 合同类型
101
+     * @return htlx 合同类型
102
+     */
103
+    public String getHtlx() {
104
+        return htlx;
105
+    }
106
+
107
+    /**
108
+     * 合同类型
109
+     * @param htlx 合同类型
110
+     */
111
+    public void setHtlx(String htlx) {
112
+        this.htlx = htlx == null ? null : htlx.trim();
113
+    }
114
+
115
+    /**
116
+     * 合同总数量
117
+     * @return htzsl 合同总数量
118
+     */
119
+    public BigDecimal getHtzsl() {
120
+        return htzsl;
121
+    }
122
+
123
+    /**
124
+     * 合同总数量
125
+     * @param htzsl 合同总数量
126
+     */
127
+    public void setHtzsl(BigDecimal htzsl) {
128
+        this.htzsl = htzsl;
129
+    }
130
+
131
+    /**
132
+     * 合同单价
133
+     * @return htdj 合同单价
134
+     */
135
+    public BigDecimal getHtdj() {
136
+        return htdj;
137
+    }
138
+
139
+    /**
140
+     * 合同单价
141
+     * @param htdj 合同单价
142
+     */
143
+    public void setHtdj(BigDecimal htdj) {
144
+        this.htdj = htdj;
145
+    }
146
+
147
+    /**
148
+     * 合同总价
149
+     * @return htzj 合同总价
150
+     */
151
+    public BigDecimal getHtzj() {
152
+        return htzj;
153
+    }
154
+
155
+    /**
156
+     * 合同总价
157
+     * @param htzj 合同总价
158
+     */
159
+    public void setHtzj(BigDecimal htzj) {
160
+        this.htzj = htzj;
161
+    }
162
+
163
+    /**
164
+     * 已结算金额
165
+     * @return yjsje 已结算金额
166
+     */
167
+    public BigDecimal getYjsje() {
168
+        return yjsje;
169
+    }
170
+
171
+    /**
172
+     * 已结算金额
173
+     * @param yjsje 已结算金额
174
+     */
175
+    public void setYjsje(BigDecimal yjsje) {
176
+        this.yjsje = yjsje;
177
+    }
178
+
179
+    /**
180
+     * 仓房ID
181
+     * @return house_id 仓房ID
182
+     */
183
+    public Integer getHouseId() {
184
+        return houseId;
185
+    }
186
+
187
+    /**
188
+     * 仓房ID
189
+     * @param houseId 仓房ID
190
+     */
191
+    public void setHouseId(Integer houseId) {
192
+        this.houseId = houseId;
193
+    }
194
+
195
+    /**
196
+     * 货位ID
197
+     * @return warehouse_id 货位ID
198
+     */
199
+    public Integer getWarehouseId() {
200
+        return warehouseId;
201
+    }
202
+
203
+    /**
204
+     * 货位ID
205
+     * @param warehouseId 货位ID
206
+     */
207
+    public void setWarehouseId(Integer warehouseId) {
208
+        this.warehouseId = warehouseId;
209
+    }
210
+
211
+    /**
212
+     * 粮油品种
213
+     * @return lypz 粮油品种
214
+     */
215
+    public Integer getLypz() {
216
+        return lypz;
217
+    }
218
+
219
+    /**
220
+     * 粮油品种
221
+     * @param lypz 粮油品种
222
+     */
223
+    public void setLypz(Integer lypz) {
224
+        this.lypz = lypz;
225
+    }
226
+
227
+    /**
228
+     * 明细品种
229
+     * @return mxpz 明细品种
230
+     */
231
+    public Integer getMxpz() {
232
+        return mxpz;
233
+    }
234
+
235
+    /**
236
+     * 明细品种
237
+     * @param mxpz 明细品种
238
+     */
239
+    public void setMxpz(Integer mxpz) {
240
+        this.mxpz = mxpz;
241
+    }
242
+
243
+    /**
244
+     * 粮油等级
245
+     * @return lydj 粮油等级
246
+     */
247
+    public Integer getLydj() {
248
+        return lydj;
249
+    }
250
+
251
+    /**
252
+     * 粮油等级
253
+     * @param lydj 粮油等级
254
+     */
255
+    public void setLydj(Integer lydj) {
256
+        this.lydj = lydj;
257
+    }
258
+
259
+    /**
260
+     * 粮油性质
261
+     * @return lyxz 粮油性质
262
+     */
263
+    public Integer getLyxz() {
264
+        return lyxz;
265
+    }
266
+
267
+    /**
268
+     * 粮油性质
269
+     * @param lyxz 粮油性质
270
+     */
271
+    public void setLyxz(Integer lyxz) {
272
+        this.lyxz = lyxz;
273
+    }
274
+
275
+    /**
276
+     * 生产年份
277
+     * @return scnf 生产年份
278
+     */
279
+    public Integer getScnf() {
280
+        return scnf;
281
+    }
282
+
283
+    /**
284
+     * 生产年份
285
+     * @param scnf 生产年份
286
+     */
287
+    public void setScnf(Integer scnf) {
288
+        this.scnf = scnf;
289
+    }
290
+
291
+    /**
292
+     * 收货年度
293
+     * @return shnd 收货年度
294
+     */
295
+    public Integer getShnd() {
296
+        return shnd;
297
+    }
298
+
299
+    /**
300
+     * 收货年度
301
+     * @param shnd 收货年度
302
+     */
303
+    public void setShnd(Integer shnd) {
304
+        this.shnd = shnd;
305
+    }
306
+
307
+    /**
308
+     * 粮油产地
309
+     * @return lycd 粮油产地
310
+     */
311
+    public Integer getLycd() {
312
+        return lycd;
313
+    }
314
+
315
+    /**
316
+     * 粮油产地
317
+     * @param lycd 粮油产地
318
+     */
319
+    public void setLycd(Integer lycd) {
320
+        this.lycd = lycd;
321
+    }
322
+
323
+    /**
324
+     * 入库时间
325
+     * @return rksj 入库时间
326
+     */
327
+    public Date getRksj() {
328
+        return rksj;
329
+    }
330
+
331
+    /**
332
+     * 入库时间
333
+     * @param rksj 入库时间
334
+     */
335
+    public void setRksj(Date rksj) {
336
+        this.rksj = rksj;
337
+    }
338
+
339
+    /**
340
+     * 客户名称
341
+     * @return khmc 客户名称
342
+     */
343
+    public String getKhmc() {
344
+        return khmc;
345
+    }
346
+
347
+    /**
348
+     * 客户名称
349
+     * @param khmc 客户名称
350
+     */
351
+    public void setKhmc(String khmc) {
352
+        this.khmc = khmc == null ? null : khmc.trim();
353
+    }
354
+
355
+    /**
356
+     * 统一信用代码
357
+     * @return tyxydm 统一信用代码
358
+     */
359
+    public String getTyxydm() {
360
+        return tyxydm;
361
+    }
362
+
363
+    /**
364
+     * 统一信用代码
365
+     * @param tyxydm 统一信用代码
366
+     */
367
+    public void setTyxydm(String tyxydm) {
368
+        this.tyxydm = tyxydm == null ? null : tyxydm.trim();
369
+    }
370
+
371
+    /**
372
+     * 数据创建时间
373
+     * @return input_time 数据创建时间
374
+     */
375
+    public Date getInputTime() {
376
+        return inputTime;
377
+    }
378
+
379
+    /**
380
+     * 数据创建时间
381
+     * @param inputTime 数据创建时间
382
+     */
383
+    public void setInputTime(Date inputTime) {
384
+        this.inputTime = inputTime;
385
+    }
386
+
387
+    /**
388
+     * 最后修改时间
389
+     * @return update_time 最后修改时间
390
+     */
391
+    public Date getUpdateTime() {
392
+        return updateTime;
393
+    }
394
+
395
+    /**
396
+     * 最后修改时间
397
+     * @param updateTime 最后修改时间
398
+     */
399
+    public void setUpdateTime(Date updateTime) {
400
+        this.updateTime = updateTime;
401
+    }
402
+}

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1580 - 0
src/main/java/com/chinaitop/depot/business/model/BusinessContractReceiveExample.java


+ 27 - 0
src/main/java/com/chinaitop/depot/business/service/BusinessContractReceiveService.java

@@ -0,0 +1,27 @@
1
+package com.chinaitop.depot.business.service;
2
+
3
+import java.util.List;
4
+import java.util.Map;
5
+
6
+import com.chinaitop.depot.business.model.BusinessContractReceive;
7
+
8
+public interface BusinessContractReceiveService {
9
+
10
+	/**
11
+	 * 接收市平台下发的合同数据
12
+	 * @param data
13
+	 * @return
14
+	 * @throws Exception
15
+	 */
16
+	Map<String, String> receiveContractData(String data) throws Exception;
17
+
18
+	/**
19
+	 * 接收通知单列表页查询
20
+	 * @param htbh 合同编号
21
+	 * @param orgId 组织机构ID
22
+	 * @param houseId 仓房ID
23
+	 * @param warehouseId 货位ID
24
+	 * @return
25
+	 */
26
+	List<BusinessContractReceive> queryByExample(String htbh, Integer orgId, Integer houseId, Integer warehouseId) throws Exception;
27
+}

+ 62 - 0
src/main/java/com/chinaitop/depot/business/service/impl/BusinessContractReceiveServiceImpl.java

@@ -0,0 +1,62 @@
1
+package com.chinaitop.depot.business.service.impl;
2
+
3
+import java.util.HashMap;
4
+import java.util.List;
5
+import java.util.Map;
6
+
7
+import javax.annotation.Resource;
8
+
9
+import org.apache.commons.lang.StringUtils;
10
+import org.springframework.stereotype.Service;
11
+
12
+import com.alibaba.fastjson.JSONObject;
13
+import com.chinaitop.depot.business.mapper.BusinessContractReceiveMapper;
14
+import com.chinaitop.depot.business.model.BusinessContractReceive;
15
+import com.chinaitop.depot.business.model.BusinessContractReceiveExample;
16
+import com.chinaitop.depot.business.model.BusinessContractReceiveExample.Criteria;
17
+import com.chinaitop.depot.business.service.BusinessContractReceiveService;
18
+
19
+@Service
20
+public class BusinessContractReceiveServiceImpl implements BusinessContractReceiveService {
21
+
22
+	@Resource
23
+	private BusinessContractReceiveMapper businessContractReceiveMapper;
24
+
25
+	@Override
26
+	public Map<String, String> receiveContractData(String data) throws Exception {
27
+		Map<String, String> resultMap = new HashMap<>();
28
+		if (StringUtils.isBlank(data)) {
29
+			resultMap.put("status", "500");
30
+			resultMap.put("msg", "下发数据不能为空");
31
+			return resultMap;
32
+		}
33
+		JSONObject obj = JSONObject.parseObject(data);
34
+		/*市平台货位ID*/
35
+		String hwdm = obj.getString("");
36
+		return resultMap;
37
+	}
38
+
39
+	@Override
40
+	public List<BusinessContractReceive> queryByExample(String htbh, Integer orgId, Integer houseId, Integer warehouseId)
41
+			throws Exception {
42
+		List<BusinessContractReceive> list = null;
43
+		BusinessContractReceiveExample example = new BusinessContractReceiveExample();
44
+		Criteria criteria = example.createCriteria();
45
+		if (StringUtils.isNotBlank(htbh)) {
46
+			criteria.andHtbhLike("%"+htbh+"%");
47
+		}
48
+		if (null != orgId) {
49
+			criteria.andOrgIdEqualTo(orgId);
50
+		}
51
+		if (null != houseId) {
52
+			criteria.andHouseIdEqualTo(houseId);
53
+		}
54
+		if (null != warehouseId) {
55
+			criteria.andWarehouseIdEqualTo(warehouseId);
56
+		}
57
+		example.setOrderByClause("input_time desc");
58
+		list = businessContractReceiveMapper.selectByExample(example);
59
+		return list;
60
+	}
61
+
62
+}

+ 53 - 0
src/main/java/com/chinaitop/depot/utils/GeneratorSqlmap.java

@@ -0,0 +1,53 @@
1
+package com.chinaitop.depot.utils;
2
+
3
+import org.mybatis.generator.api.MyBatisGenerator;
4
+import org.mybatis.generator.config.Configuration;
5
+import org.mybatis.generator.config.xml.ConfigurationParser;
6
+import org.mybatis.generator.internal.DefaultShellCallback;
7
+import org.springframework.core.io.ClassPathResource;
8
+
9
+import java.io.File;
10
+import java.util.ArrayList;
11
+import java.util.List;
12
+
13
+public class GeneratorSqlmap {
14
+
15
+	public void generator() throws Exception{
16
+
17
+		List<String> warnings = new ArrayList<String>();
18
+		boolean overwrite = true;
19
+		//指定 逆向工程配置文件名称
20
+		ClassPathResource classPathResource = new ClassPathResource("generatorConfig.xml");
21
+		//获取文件
22
+		File file = classPathResource.getFile();
23
+		//获取路径
24
+		String path = classPathResource.getPath();
25
+		System.out.println("path:" + path);
26
+		System.out.println("file:" + file);
27
+		System.out.println(file.toString());
28
+		File configFile = new File(file.toString());
29
+		ConfigurationParser cp = new ConfigurationParser(warnings);
30
+		Configuration config = cp.parseConfiguration(configFile);
31
+		DefaultShellCallback callback = new DefaultShellCallback(overwrite);
32
+		MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config,
33
+				callback, warnings);
34
+		myBatisGenerator.generate(null);
35
+		if (warnings.isEmpty()) {
36
+			System.out.println("MyBatis文件生成成功!!");
37
+		} else {
38
+			System.err.println(warnings);
39
+		}
40
+	} 
41
+	public static void main(String[] args) throws Exception {
42
+		try {
43
+			GeneratorSqlmap generatorSqlmap = new GeneratorSqlmap();
44
+			generatorSqlmap.generator();
45
+			System.out.println("生成成功");
46
+		} catch (Exception e) {
47
+			e.printStackTrace();
48
+			System.out.println("生成失败");
49
+		}
50
+		
51
+	}
52
+
53
+}

+ 242 - 0
src/main/java/com/chinaitop/depot/utils/MyCommentGenerator.java

@@ -0,0 +1,242 @@
1
+package com.chinaitop.depot.utils;
2
+import java.text.SimpleDateFormat;
3
+import java.util.Date;
4
+import java.util.Properties;
5
+
6
+import static org.mybatis.generator.internal.util.StringUtility.isTrue;
7
+import org.mybatis.generator.api.CommentGenerator;
8
+import org.mybatis.generator.api.IntrospectedColumn;
9
+import org.mybatis.generator.api.IntrospectedTable;
10
+import org.mybatis.generator.api.dom.java.CompilationUnit;
11
+import org.mybatis.generator.api.dom.java.Field;
12
+import org.mybatis.generator.api.dom.java.InnerClass;
13
+import org.mybatis.generator.api.dom.java.InnerEnum;
14
+import org.mybatis.generator.api.dom.java.JavaElement;
15
+import org.mybatis.generator.api.dom.java.Method;
16
+import org.mybatis.generator.api.dom.java.Parameter;
17
+import org.mybatis.generator.api.dom.xml.XmlElement;
18
+import org.mybatis.generator.config.MergeConstants;
19
+import org.mybatis.generator.config.PropertyRegistry;
20
+
21
+public class MyCommentGenerator implements CommentGenerator {
22
+
23
+	private Properties properties;
24
+	private Properties systemPro;
25
+	private boolean suppressDate;
26
+	private boolean suppressAllComments;
27
+	private String currentDateStr;
28
+
29
+	public MyCommentGenerator() {
30
+	    super();
31
+	    properties = new Properties();
32
+	    systemPro = System.getProperties();
33
+	    suppressDate = false;
34
+	    suppressAllComments = false;
35
+	    currentDateStr = (new SimpleDateFormat("yyyy-MM-dd")).format(new Date());
36
+	}
37
+
38
+	
39
+	@Override
40
+	public void addClassComment(InnerClass innerClass, IntrospectedTable introspectedTable) {
41
+		if (suppressAllComments) {
42
+	        return;
43
+	    }
44
+	    StringBuilder sb = new StringBuilder();
45
+	    innerClass.addJavaDocLine("/**");
46
+	    sb.append(" * ");
47
+	    sb.append(introspectedTable.getFullyQualifiedTable());
48
+	    sb.append(" ");
49
+	    sb.append(getDateString());
50
+	    innerClass.addJavaDocLine(sb.toString());
51
+	    innerClass.addJavaDocLine(" */");
52
+
53
+	}
54
+
55
+	@Override
56
+	public void addClassComment(InnerClass innerClass, IntrospectedTable introspectedTable, boolean arg2) {
57
+		if (suppressAllComments) {
58
+	        return;
59
+	    }
60
+
61
+	    StringBuilder sb = new StringBuilder();
62
+
63
+	    innerClass.addJavaDocLine("/**");
64
+	    sb.append(" * ");
65
+	    sb.append(introspectedTable.getFullyQualifiedTable());
66
+	    innerClass.addJavaDocLine(sb.toString());
67
+
68
+	    sb.setLength(0);
69
+	    sb.append(" * @author ");
70
+	    sb.append(systemPro.getProperty("user.name"));
71
+	    sb.append(" ");
72
+	    sb.append(currentDateStr);
73
+
74
+	    //      addJavadocTag(innerClass, markAsDoNotDelete);
75
+
76
+	    innerClass.addJavaDocLine(" */");
77
+
78
+	}
79
+
80
+	@Override
81
+	public void addComment(XmlElement arg0) {
82
+		return;
83
+	}
84
+
85
+	@Override
86
+	public void addConfigurationProperties(Properties properties) {
87
+		this.properties.putAll(properties);
88
+
89
+	    suppressDate = isTrue(properties.getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_DATE));
90
+
91
+	    suppressAllComments = isTrue(properties.getProperty(PropertyRegistry.COMMENT_GENERATOR_SUPPRESS_ALL_COMMENTS));
92
+
93
+	}
94
+	
95
+	/**
96
+	 * This method adds the custom javadoc tag for. You may do nothing if you do
97
+	 * not wish to include the Javadoc tag - however, if you do not include the
98
+	 * Javadoc tag then the Java merge capability of the eclipse plugin will
99
+	 * break.
100
+	 * 
101
+	 * @param javaElement
102
+	 *            the java element
103
+	 */
104
+	protected void addJavadocTag(JavaElement javaElement, boolean markAsDoNotDelete) {
105
+	    javaElement.addJavaDocLine(" *");
106
+	    StringBuilder sb = new StringBuilder();
107
+	    sb.append(" * ");
108
+	    sb.append(MergeConstants.NEW_ELEMENT_TAG);
109
+	    if (markAsDoNotDelete) {
110
+	        sb.append(" do_not_delete_during_merge");
111
+	    }
112
+	    String s = getDateString();
113
+	    if (s != null) {
114
+	        sb.append(' ');
115
+	        sb.append(s);
116
+	    }
117
+	    javaElement.addJavaDocLine(sb.toString());
118
+	}
119
+	
120
+	protected String getDateString() {
121
+	    String result = null;
122
+	    if (!suppressDate) {
123
+	        result = currentDateStr;
124
+	    }
125
+	    return result;
126
+	}
127
+
128
+
129
+	@Override
130
+	public void addEnumComment(InnerEnum innerEnum, IntrospectedTable introspectedTable) {
131
+		if (suppressAllComments) {
132
+	        return;
133
+	    }
134
+
135
+	    StringBuilder sb = new StringBuilder();
136
+
137
+	    innerEnum.addJavaDocLine("/**");
138
+	    //      addJavadocTag(innerEnum, false);
139
+	    sb.append(" * ");
140
+	    sb.append(introspectedTable.getFullyQualifiedTable());
141
+	    innerEnum.addJavaDocLine(sb.toString());
142
+	    innerEnum.addJavaDocLine(" */");
143
+
144
+	}
145
+
146
+	@Override
147
+	public void addFieldComment(Field field, IntrospectedTable introspectedTable) {
148
+		if (suppressAllComments) {
149
+	        return;
150
+	    }
151
+
152
+	    StringBuilder sb = new StringBuilder();
153
+
154
+	    field.addJavaDocLine("/**");
155
+	    sb.append(" * ");
156
+	    sb.append(introspectedTable.getFullyQualifiedTable());
157
+	    field.addJavaDocLine(sb.toString());
158
+	    field.addJavaDocLine(" */");
159
+
160
+	}
161
+
162
+	@Override
163
+	public void addFieldComment(Field arg0, IntrospectedTable arg1, IntrospectedColumn arg2) {
164
+		// TODO Auto-generated method stub
165
+
166
+	}
167
+
168
+	@Override
169
+	public void addGeneralMethodComment(Method arg0, IntrospectedTable arg1) {
170
+		if (suppressAllComments) {
171
+	        return;
172
+	    }
173
+	    //      method.addJavaDocLine("/**");
174
+	    //      addJavadocTag(method, false);
175
+	    //      method.addJavaDocLine(" */");
176
+
177
+	}
178
+
179
+	@Override
180
+	public void addGetterComment(Method method, IntrospectedTable arg1, IntrospectedColumn introspectedColumn) {
181
+		if (suppressAllComments) {
182
+	        return;
183
+	    }
184
+
185
+	    method.addJavaDocLine("/**");
186
+
187
+	    StringBuilder sb = new StringBuilder();
188
+	    sb.append(" * ");
189
+	    sb.append(introspectedColumn.getRemarks());
190
+	    method.addJavaDocLine(sb.toString());
191
+
192
+	    sb.setLength(0);
193
+	    sb.append(" * @return ");
194
+	    sb.append(introspectedColumn.getActualColumnName());
195
+	    sb.append(" ");
196
+	    sb.append(introspectedColumn.getRemarks());
197
+	    method.addJavaDocLine(sb.toString());
198
+
199
+	    //      addJavadocTag(method, false);
200
+
201
+	    method.addJavaDocLine(" */");
202
+
203
+	}
204
+
205
+	@Override
206
+	public void addJavaFileComment(CompilationUnit arg0) {
207
+		return;
208
+	}
209
+
210
+	@Override
211
+	public void addRootComment(XmlElement arg0) {
212
+		return;
213
+	}
214
+
215
+	@Override
216
+	public void addSetterComment(Method method, IntrospectedTable arg1, IntrospectedColumn introspectedColumn) {
217
+		if (suppressAllComments) {
218
+	        return;
219
+	    }
220
+
221
+
222
+	    method.addJavaDocLine("/**");
223
+	    StringBuilder sb = new StringBuilder();
224
+	    sb.append(" * ");
225
+	    sb.append(introspectedColumn.getRemarks());
226
+	    method.addJavaDocLine(sb.toString());
227
+
228
+	    Parameter parm = method.getParameters().get(0);
229
+	    sb.setLength(0);
230
+	    sb.append(" * @param ");
231
+	    sb.append(parm.getName());
232
+	    sb.append(" ");
233
+	    sb.append(introspectedColumn.getRemarks());
234
+	    method.addJavaDocLine(sb.toString());
235
+
236
+	    //      addJavadocTag(method, false);
237
+
238
+	    method.addJavaDocLine(" */");
239
+
240
+	}
241
+
242
+}

+ 56 - 0
src/main/resources/generatorConfig.xml

@@ -0,0 +1,56 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE generatorConfiguration
3
+  PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
4
+  "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
5
+
6
+<generatorConfiguration>
7
+<context id="testTables" targetRuntime="MyBatis3">
8
+	<!-- 生成注释时,必须加type="MyCommentGenerator" -->
9
+	<commentGenerator type="com.chinaitop.depot.utils.MyCommentGenerator">
10
+		<!-- 是否去除自动生成的注释 true:是 : false:否 -->
11
+		<property name="suppressAllComments" value="false" />
12
+	</commentGenerator>
13
+
14
+	<!--数据库连接的信息:驱动类、连接地址、用户名、密码 -->
15
+	<jdbcConnection
16
+			driverClass="com.mysql.jdbc.Driver"
17
+			connectionURL="jdbc:mysql://101.36.160.140:10311/depot-tj?useUnicode=true&amp;characterEncoding=utf-8"
18
+			userId="root"
19
+			password="123456">
20
+	</jdbcConnection>
21
+
22
+	<!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL 和
23
+        NUMERIC 类型解析为java.math.BigDecimal -->
24
+	<javaTypeResolver>
25
+		<property name="forceBigDecimals" value="false" />
26
+	</javaTypeResolver>
27
+
28
+	<!-- targetProject:生成PO类的位置 -->
29
+	<javaModelGenerator targetPackage="com.chinaitop.depot.business.model"
30
+						targetProject=".\src\main\java">
31
+		<!-- enableSubPackages:是否让schema作为包的后缀 -->
32
+		<property name="enableSubPackages" value="false" />
33
+		<!-- 从数据库返回的值被清理前后的空格 -->
34
+		<property name="trimStrings" value="true" />
35
+	</javaModelGenerator>
36
+
37
+	<!-- targetProject:mapper映射文件生成的位置 -->
38
+	<sqlMapGenerator targetPackage="com.chinaitop.depot.business.mapper"
39
+					 targetProject=".\src\main\java">
40
+		<!-- enableSubPackages:是否让schema作为包的后缀 -->
41
+		<property name="enableSubPackages" value="false" />
42
+	</sqlMapGenerator>
43
+
44
+	<!-- targetPackage:mapper接口生成的位置 -->
45
+	<javaClientGenerator type="XMLMAPPER"
46
+						 targetPackage="com.chinaitop.depot.business.mapper"
47
+						 targetProject=".\src\main\java">
48
+		<!-- enableSubPackages:是否让schema作为包的后缀 -->
49
+		<property name="enableSubPackages" value="false" />
50
+	</javaClientGenerator>
51
+
52
+	<!-- 指定要反向生成的数据库表 -->
53
+	<table schema="" tableName="business_contract_receive"></table>
54
+
55
+</context>
56
+</generatorConfiguration>