Skip to content

Commit a2d45e0

Browse files
committed
7. 添加工厂字段到前端表格 17:02
1 parent bf4dbf0 commit a2d45e0

File tree

8 files changed

+134
-49
lines changed

8 files changed

+134
-49
lines changed

src/main/java/com/tencent/pojo/TsmcpFactory.java

Lines changed: 91 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -33,103 +33,147 @@ public Integer getId() {
3333
return id;
3434
}
3535

36-
public void setId(Integer id) {
37-
this.id = id;
38-
}
39-
4036
public Integer getFlag() {
4137
return flag;
4238
}
4339

44-
public void setFlag(Integer flag) {
45-
this.flag = flag;
46-
}
47-
4840
public Date getCreateTime() {
4941
return createTime;
5042
}
5143

52-
public void setCreateTime(Date createTime) {
53-
this.createTime = createTime;
54-
}
55-
5644
public Integer getCreateUserid() {
5745
return createUserid;
5846
}
5947

60-
public void setCreateUserid(Integer createUserid) {
61-
this.createUserid = createUserid;
62-
}
63-
6448
public Date getUpdateTime() {
6549
return updateTime;
6650
}
6751

68-
public void setUpdateTime(Date updateTime) {
69-
this.updateTime = updateTime;
70-
}
71-
7252
public Integer getUpdateUserid() {
7353
return updateUserid;
7454
}
7555

76-
public void setUpdateUserid(Integer updateUserid) {
77-
this.updateUserid = updateUserid;
78-
}
79-
8056
public String getBak() {
8157
return bak;
8258
}
8359

84-
public void setBak(String bak) {
85-
this.bak = bak == null ? null : bak.trim();
86-
}
87-
8860
public String getFactoryName() {
8961
return factoryName;
9062
}
9163

92-
public void setFactoryName(String factoryName) {
93-
this.factoryName = factoryName == null ? null : factoryName.trim();
94-
}
95-
9664
public String getFactoryImgUrl() {
9765
return factoryImgUrl;
9866
}
9967

100-
public void setFactoryImgUrl(String factoryImgUrl) {
101-
this.factoryImgUrl = factoryImgUrl == null ? null : factoryImgUrl.trim();
102-
}
103-
10468
public String getFactoryAddr() {
10569
return factoryAddr;
10670
}
10771

108-
public void setFactoryAddr(String factoryAddr) {
109-
this.factoryAddr = factoryAddr == null ? null : factoryAddr.trim();
110-
}
111-
11272
public String getFactoryUrl() {
11373
return factoryUrl;
11474
}
11575

116-
public void setFactoryUrl(String factoryUrl) {
117-
this.factoryUrl = factoryUrl == null ? null : factoryUrl.trim();
118-
}
119-
12076
public Integer getFactoryWorker() {
12177
return factoryWorker;
12278
}
12379

80+
public Integer getFactoryStatus() {
81+
return factoryStatus;
82+
}
83+
84+
public void setId(Integer id) {
85+
this.id = id;
86+
}
87+
88+
public void setFlag(Integer flag) {
89+
this.flag = flag;
90+
}
91+
92+
public void setCreateTime(Date createTime) {
93+
this.createTime = createTime;
94+
}
95+
96+
public void setCreateUserid(Integer createUserid) {
97+
this.createUserid = createUserid;
98+
}
99+
100+
public void setUpdateTime(Date updateTime) {
101+
this.updateTime = updateTime;
102+
}
103+
104+
public void setUpdateUserid(Integer updateUserid) {
105+
this.updateUserid = updateUserid;
106+
}
107+
108+
public void setBak(String bak) {
109+
this.bak = bak;
110+
}
111+
112+
public void setFactoryName(String factoryName) {
113+
this.factoryName = factoryName;
114+
}
115+
116+
public void setFactoryImgUrl(String factoryImgUrl) {
117+
this.factoryImgUrl = factoryImgUrl;
118+
}
119+
120+
public void setFactoryAddr(String factoryAddr) {
121+
this.factoryAddr = factoryAddr;
122+
}
123+
124+
public void setFactoryUrl(String factoryUrl) {
125+
this.factoryUrl = factoryUrl;
126+
}
127+
124128
public void setFactoryWorker(Integer factoryWorker) {
125129
this.factoryWorker = factoryWorker;
126130
}
127131

128-
public Integer getFactoryStatus() {
129-
return factoryStatus;
132+
public void setFactoryStatus(Integer factoryStatus) {
133+
this.factoryStatus = factoryStatus;
130134
}
131135

132-
public void setFactoryStatus(Integer factoryStatus) {
136+
137+
public TsmcpFactory(Integer id, Integer flag, Date createTime,
138+
Integer createUserid, Date updateTime,
139+
Integer updateUserid, String bak,
140+
String factoryName, String factoryImgUrl,
141+
String factoryAddr, String factoryUrl,
142+
Integer factoryWorker, Integer factoryStatus) {
143+
this.id = id;
144+
this.flag = flag;
145+
this.createTime = createTime;
146+
this.createUserid = createUserid;
147+
this.updateTime = updateTime;
148+
this.updateUserid = updateUserid;
149+
this.bak = bak;
150+
this.factoryName = factoryName;
151+
this.factoryImgUrl = factoryImgUrl;
152+
this.factoryAddr = factoryAddr;
153+
this.factoryUrl = factoryUrl;
154+
this.factoryWorker = factoryWorker;
133155
this.factoryStatus = factoryStatus;
134156
}
157+
158+
public TsmcpFactory() {
159+
}
160+
161+
@Override
162+
public String toString() {
163+
return "TsmcpFactory{" +
164+
"id=" + id +
165+
", flag=" + flag +
166+
", createTime=" + createTime +
167+
", createUserid=" + createUserid +
168+
", updateTime=" + updateTime +
169+
", updateUserid=" + updateUserid +
170+
", bak='" + bak + '\'' +
171+
", factoryName='" + factoryName + '\'' +
172+
", factoryImgUrl='" + factoryImgUrl + '\'' +
173+
", factoryAddr='" + factoryAddr + '\'' +
174+
", factoryUrl='" + factoryUrl + '\'' +
175+
", factoryWorker=" + factoryWorker +
176+
", factoryStatus=" + factoryStatus +
177+
'}';
178+
}
135179
}

src/main/java/com/tencent/pojo/TsmcpProduct.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ public class TsmcpProduct {
2323

2424
private Integer factoryId;
2525

26+
private TsmcpFactory tsmcpFactory;
27+
28+
public TsmcpFactory getTsmcpFactory() {
29+
return tsmcpFactory;
30+
}
31+
32+
public void setTsmcpFactory(TsmcpFactory tsmcpFactory) {
33+
this.tsmcpFactory = tsmcpFactory;
34+
}
35+
2636
public Integer getId() {
2737
return id;
2838
}

src/main/java/com/tencent/service/impl/ITsmcpProductServiceImpl.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,17 @@ public List<TsmcpProduct> selectAll() {
2727
public Map<String ,Object> selectAll2() {
2828
Map<String,Object> map = new HashMap<>();
2929
List<TsmcpProduct> tsmcpProducts = tsmcpProductMapper.selectAll2();
30+
/**
31+
* 此处得空拼接
32+
*/
33+
// for(int i = 0;i < tsmcpProducts.size();i++){
34+
// if(tsmcpProducts.get(i).getTsmcpFactory().getFactoryName()){
35+
//
36+
// }
37+
// }
3038
map.put("key","value");
3139
map.put("data",tsmcpProducts);
40+
System.out.println(tsmcpProducts.get(0).getTsmcpFactory());
3241
return map;
3342
}
3443
}

src/main/resources/mapper/TsmcpProductMapper.xml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@
1212
<result column="product_name" jdbcType="VARCHAR" property="productName" />
1313
<result column="product_img_url" jdbcType="VARCHAR" property="productImgUrl" />
1414
<result column="factory_id" jdbcType="INTEGER" property="factoryId" />
15+
<!-- 一对一:association -->
16+
<association property="tsmcpFactory" javaType="com.tencent.pojo.TsmcpFactory">
17+
<id column="id" jdbcType="INTEGER" property="id" />
18+
<result column="flag" jdbcType="INTEGER" property="flag" />
19+
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
20+
<result column="create_userid" jdbcType="INTEGER" property="createUserid" />
21+
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
22+
<result column="update_userid" jdbcType="INTEGER" property="updateUserid" />
23+
<result column="bak" jdbcType="VARCHAR" property="bak" />
24+
<result column="factory_name" jdbcType="VARCHAR" property="factoryName" />
25+
<result column="factory_img_url" jdbcType="VARCHAR" property="factoryImgUrl" />
26+
<result column="factory_addr" jdbcType="VARCHAR" property="factoryAddr" />
27+
<result column="factory_url" jdbcType="VARCHAR" property="factoryUrl" />
28+
<result column="factory_worker" jdbcType="INTEGER" property="factoryWorker" />
29+
<result column="factory_status" jdbcType="INTEGER" property="factoryStatus" />
30+
</association>
1531
</resultMap>
1632
<sql id="Example_Where_Clause">
1733
<where>
@@ -106,7 +122,8 @@
106122
2019-11-07
107123
-->
108124
<select id="selectAll2" resultMap="BaseResultMap">
109-
select * from tsmcp_product
125+
select tsmcp_product.*,tsmcp_factory.factory_name from tsmcp_product inner join tsmcp_factory
126+
on tsmcp_product.factory_id = tsmcp_factory.id
110127
</select>
111128

112129

src/main/resources/static/assets/DataTables-1.10.15/media/js/jquery.dataTables.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6473,7 +6473,8 @@
64736473
}
64746474

64756475
if ( type == 'alert' ) {
6476-
alert( msg );
6476+
// alert( msg );
6477+
console.error(msg);
64776478
}
64786479
else if ( type == 'throw' ) {
64796480
throw new Error(msg);

src/main/resources/static/pages/prodMgr.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ <h4><i class="icon-reorder"></i>产品表</h4>
219219
<th class="hidden-phone">产品编号</th>
220220
<th class="hidden-phone">产品图片</th>
221221
<th class="hidden-phone">产品名称</th>
222+
<th class="hidden-phone">工厂名称</th>
222223
<th class="hidden-phone">操作</th>
223224
</tr>
224225
</thead>
@@ -322,6 +323,9 @@ <h4><i class="icon-reorder"></i>产品表</h4>
322323
{
323324
data:"productName"
324325
},
326+
{
327+
data:"tsmcpFactory.factoryName"
328+
},
325329
{
326330
data:null,
327331
render:function (data,type,row,meta) {
1.07 KB
Binary file not shown.
324 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)