前言
easyui是一種基于jquery的用戶界面插件集合。
easyui為創建現代化,互動,javascript應用程序,提供必要的功能。
使用easyui你不需要寫很多代碼,你只需要通過編寫一些簡單html標記,就可以定義用戶界面。
本文主要給大家介紹了關于java easyui自定義網格視圖的相關內容,下面話不多說了,來一起看看詳細的介紹吧
方法如下:
一:前臺代碼如下
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
|
<!doctype html> <html> <head> <meta charset= "utf-8" > <title>insert title here</title> <link rel= "icon" type= "image/x-icon" href= "/favicon.ico" rel= "external nofollow" > <link rel= "stylesheet" type= "text/css" href= "/themes/metro-blue/easyui.css" rel= "external nofollow" > <link rel= "stylesheet" type= "text/css" href= "/themes/icon.css" rel= "external nofollow" > <link rel= "stylesheet" type= "text/css" href= "/themes/color.css" rel= "external nofollow" > <link rel= "stylesheet" type= "text/css" href= "/emoji/emoji.css" rel= "external nofollow" > <script type= "text/javascript" src= "/js/jquery-1.11.1.min.js" ></script> <script type= "text/javascript" src= "/js/jquery.easyui.min.js" ></script> <script type= "text/javascript" src= "/js/jquery.edatagrid.js" ></script> <script type= "text/javascript" src= "/js/datagrid-detailview.js" ></script> <script type= "text/javascript" src= "/js/datagrid-filter.js" ></script> <script type= "text/javascript" src= "/js/easyui-lang-zh_cn.js" ></script> <script type= "text/javascript" src= "/js/jquery.highlight.js" ></script> <script type= "text/javascript" src= "/js/tool.js" ></script> <script type= "text/javascript" src= "/js/datagrid-cellediting.js" ></script> <script type= "text/javascript" src= "/emoji/emoji.js" ></script> <style type= "text/css" > .textbox-label { display: inline-block; width: 70px; height: 22px; line-height: 22px; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0 ; padding-right: 5px; } .c-content{ overflow:hidden; text-overflow:ellipsis; display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp: 2 ; } .highlight{ background-color: yellow; } em.important{ background-color: red; } .c-label{ display:inline-block; width:50px; } .textbox-label-min { display: inline-block; width: 60px; height: 22px; line-height: 22px; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0 ; padding-right: 5px; } </style> </head> <body> <div id= "tb" style= "padding:2px 5px;" > <div id= "p" class = "easyui-panel" title= "" data-options= "iconcls:'icon-save',collapsible:true,minimizable:true,maximizable:true,closable:true" style= "width:100%;background-color:#f5f5f5;border-width: 0px;margin:10px;padding-bottom:10px;;border-bottom-width: 1px;" > <div> <form name= "searchform" method= "post" action= "" id= "searchform" > <input type= "hidden" name= "ss" id= "ss" > <div style= "margin-top:10px;width:100%;" > <span>標題/內容:</span> <input class = "easyui-textbox" id= "content" name= "content" style= "width:20%" data-options= "prompt:'主題'" > <span style= "margin-left:10px;" >用戶名: </span> <input class = "easyui-textbox" id= "author" name= "author" style= "width:10%" data-options= "prompt:'單行輸入'" > <span style= "margin-left:10px;" >頻道: </span> <input class = "easyui-combobox" name= "forumids" id= "forumids" panelheight= "auto" style= "width:10%" data-options=" url: '/channelpost/getchannel' , method: 'get' , valuefield: 'channelid' , textfield: 'channelname' , multiple: true , prompt: '多選' , panelheight: 'auto' "> <span style= "margin-left:10px;" id= "ssss" >品牌: </span> <input class = "easyui-combobox" name= "brandids" id= "brandids" panelheight= "auto" style= "width:10%" data-options=" url: '/channelpost/getbrand' , method: 'get' , valuefield: 'brandid' , textfield: 'brandname' , multiple: true , prompt: '多選' , panelheight: 'auto' "> <span style= "margin-left:10px;" >分類: </span> <select class = "easyui-combobox" name= "poststatus" id= "poststatus" data-options= " prompt:'單選'" style= "width:10%;" > <option value= 0 >全部</option> <option value= 10481001 >出售</option> <option value= 10481002 >求購</option> </select> <span style= "margin-left:10px;" >帖子狀態: </span> <select class = "easyui-combobox" name= "isdeleted" id= "isdeleted" data-options= " prompt:'單選'" style= "width:10%;" > <option value= 0 >全部</option> <option value= 1 >未刪除</option> <option value= 2 >已刪除</option> <option value= 3 >置頂</option> </select> </div> <div style= "margin-top:10px;width:90%;" > <span>發布時間:</span> <input class = "easyui-datetimebox" id= "startdate" name= "startdate" style= "width:16%;" > - <input class = "easyui-datetimebox" id= "enddate" name= "enddate" style= "width:16%;" > <a href= "#" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" id= "submitsearch" style= "float:right;" class = "easyui-linkbutton" iconcls= "icon-search" >查詢</a> </div> <div style= "margin-top:10px;width:90%;" > <a href= "#" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" id= "selall" class = "easyui-linkbutton" style= "margin-left:35px;" onclick= "allselectrow('dg')" >全選</a></td> <a href= "#" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" id= "selall" class = "easyui-linkbutton" style= "margin-left:35px;" onclick= "unselectrow('dg')" >反選</a></td> <a href= "#" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" id= "selall" class = "easyui-linkbutton" style= "margin-left:35px;" onclick= "dotop('is_top',1,'置頂')" >置頂</a></td> <a href= "#" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" id= "selall" class = "easyui-linkbutton" style= "margin-left:35px;" onclick= "dodel('is_admindel',1,'刪除')" >管理員刪除</a></td> <a href= "#" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" rel= "external nofollow" id= "selall" class = "easyui-linkbutton c5" style= "margin-left:35px;" onclick= "doofftop('is_top',0,'取消置頂')" >取消置頂</a></td> <div style= "width:100px;float:right;" > <select class = "easyui-combobox" panelheight= "auto" style= "width:100px;float:left;" data-options= " valuefield: 'id', onselect: function(rec){var s=false; if(rec.id ==0){s=true;} $('#dg').datagrid({singleselect:s})}" > <option value= "1" >多選</option> <option value= "0" >單選</option> </div></div> </select> </div> </div> </form> </div> </div> </div> <table id= "dg" style= "width:100%;padding: 0px;" data-options= "rownumbers:false,singleselect:false,pagination:true,url:'',method:'post',toolbar:'#tb',fit:true" > </table> <div id= "dw" class = "easyui-window" title= "" data-options= "modal:true,closed:true,iconcls:'icon-save'" style= "width:200px;height:60px;padding:10px;" > <div id= "wcontent" > 后臺處理中。。。 </div> </div> <script type= "text/javascript" > var cardview = $.extend({}, $.fn.datagrid.defaults.view, { //重繪視圖開始 renderrow: function(target, fields, frozen, rowindex, rowdata){ var cc = []; cc.push( '<td colspan=' + 3 + ' style="padding:10px 5px;border:0;">' ); if ( !frozen && rowdata.postid){ var _istop = rowdata.istop; var _isadmindel = rowdata.isadmindel; var _isdeleted = rowdata.isdelete; var cs = "" ; if (_isadmindel == 1 ){ cs = cs+ '<span style=" display:inline-block;padding: 3px 4px;color:white;background-color:#767d88;">管理員刪除</span>' ; } if (_isdeleted == 1 ){ cs = cs+ '<span style=" display:inline-block;padding: 3px 4px;color:white;background-color:#35373c;">用戶刪除</span>' ; } if (_istop== 1 ){ cs = cs+ '<span style=" display:inline-block;padding: 3px 4px;color:white;background-color:#4b8ae8">置頂</span>' ; } cc.push( '<div style="float:left;margin-left:20px;">' ); cc.push( '<div > <img src="' +rowdata.avatar+ '" height="100" width="100" ></div>' ); cc.push( '<div><span class="c-label">用戶名:</span> <span style="color:blue;">' + rowdata.nickname + '</span></div>' ); cc.push( '<div> ' +rowdata.channelname+ '>' + rowdata.brandname + '</div>' ); cc.push( '<div> 發布時間: ' +rowdata.createdate + '</div>' ); cc.push( '</div>' ); cc.push( '<div style="margin-left:230px;">' ); if (rowdata.channelid== 2 ){ if (rowdata.title != null ){ cc.push( '<div id="title_' +rowdata.postid+ '"> ' +cs+ '配件編號:' +jemoji.unifiedtohtml(rowdata.title )+ '</div>' ); } else { cc.push( '<div id="title_' +rowdata.postid+ '"> ' +cs+ '配件編號:</div>' ); } } else { if (rowdata.title != null ){ cc.push( '<div id="title_' +rowdata.postid+ '"> ' +cs+ '標題:' +jemoji.unifiedtohtml(rowdata.title )+ '</div>' ); } else { cc.push( '<div id="title_' +rowdata.postid+ '"> ' +cs+ '標題:</div>' ); } } if (rowdata.content != null ){ cc.push( '<div class="c-content" id="content_' +rowdata.postid+ '"> ' + '內容:' +jemoji.unifiedtohtml(rowdata.content )+ '</div>' ); } else { cc.push( '<div class="c-content" id="content_' +rowdata.postid+ '"> ' + '內容:</div>' ); } var ss = '<div> ' ; var attachmentlist = rowdata.channelpostattach ; for (var p in attachmentlist){ if (attachmentlist[p].type== 10121002 ){ /* ss +='<video src="'+attachmentlist[p].attachnameurl+'" controls="controls" height="100" width="100"></video>' */ /* ss +='<video id="example-video" width="100" height="100" class="video-js vjs-default-skin vjs-big-play-centered" poster=""><source src="'+attachmentlist[p].attachnameurl+'" type="application/x-mpegurl" id="target"></video>' */ /* ss+='<video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="100" height="100" poster="http://vjs.zencdn.net/v/oceans.png" data-setup="{}"><source src="'+attachmentlist[p].attachnameurl+'" type="video/mp4"></source><source src="'+attachmentlist[p].attachnameurl+'" type="video/webm"></source><source src="'+attachmentlist[p].attachnameurl+'" type="video/ogg"></source><p class="vjs-no-js">to view this video please enable javascript, and consider upgrading to a web browser that<a href="http://videojs.com/html5-video-support/" target="_blank">supports html5 video</a></p></video>' */ /* ss+='<embed src="'+attachmentlist[p].attachnameurl+'" quality= "high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" style="width:100px; height: 100px"></embed>' */ } if(attachmentlist[p].type==10121001){ ss += '<img style="margin-top:10px;margin-left:10px;" src="'+attachmentlist[p].attachnameurl+'" height="100" width="100" >'; } } ss +='</div> '; cc.push(ss); cc.push('</div>'); } cc.push('</td>'); return cc.join(''); }, onafterrender: function(target){ var rows = $(target).datagrid('getrows'); $.each(rows, function (index, row) { $('#title_'+row.postid).highlight($('#content').val()); $('#content_'+row.postid).highlight($('#content').val()); }); } });//重繪視圖結束 $(function(){ var dg =$('#dg').datagrid({//渲染表格 view: cardview,//更換默認視圖 rowstyler: function(index,row){ if((index+1)%2 ==0){//隔行變色 return {class:'datagrid-double-color'}; // return inline style } }, url:'/channelpost/showchannelpost', columns:[[ {field:'postid',title:'帖子', width:'20%', } ]], ondblclickrow:function(index,row){ window.open("/channelpost/getchannelpostdetail?postid="+row.postid,"channelpostdetail","scrollbars=yes,copyhistory=yes,width=1200, height=600"); }, nowrap:false, pagesize: 10,//每頁顯示的記錄條數,默認為15 pagelist: [10,20,30], onloadsuccess:function(data){ if(data.errcode == -1){ showresult("更新出錯"); }else if(data.errcode == 1){ }else{ showresult("更新成功"); } } }); }); $("#submitsearch").click(function(){ selectfunction(); }); function selectfunction(){ var content=$('#content').val(); var nickname=$('#author').val(); var dealtype=$('#poststatus').val(); var isdelete=$('#isdeleted').val(); var startdate=$('#startdate').val(); var enddate=$('#enddate').val(); var forumidarray = $('#forumids').combobox('getvalues'); var brandidarray = $('#brandids').combobox('getvalues'); var brandids =""; var forumids =""; for(var o in brandidarray){ brandids +=brandidarray[o]; if(o <brandidarray.length-1){ brandids +=","; } } for(var o in forumidarray){ forumids +=forumidarray[o]; if(o <forumidarray.length-1){ forumids +=","; } } var str=$(".validatebox-text.validatebox-invalid:first"); if(str.val()==null){ $('#dg').datagrid('load',{ "content":content, "nickname":nickname, "dealtypes":dealtype, "isdeletes":isdelete, "startdate":startdate, "enddate":enddate, "brandids":brandids, "channelids":forumids }); }else{ alert("請檢查填寫錯誤的數據!"); } } function allselectrow(tablename) { //全選 $('#' + tablename).datagrid('selectall'); } function unselectrow(tablename) { //反選 var s_rows = $.map($('#' + tablename).datagrid('getselections'), function(n) { return $('#' + tablename).datagrid('getrowindex', n); }); $('#' + tablename).datagrid('selectall'); $.each(s_rows, function(i, n) { $('#' + tablename).datagrid('unselectrow', n); }); } function dodel(column,value,msg) { //返回選中多行 var selrow = $('#dg').datagrid('getselections') //判斷是否選中行 if (selrow.length==0) { $.messager.alert("提示", "請選擇"+msg+"行!", "info"); return; }else{ var temid=""; //批量獲取選中行的id for (i = 0; i < selrow.length;i++) { if(selrow[i].isadmindel==1){ $.messager.alert("提示", "已經有選中行的狀態是'管理員刪除',請去掉此行重試", "info"); return; } /* if(selrow[i].istop==1){ $.messager.confirm('提示', '你選中要刪除的里面包含置頂帖,是否繼續?', function (r) { if (!r) { return; } }); } */ if (temid == "" ) { temid = selrow[i].postid } else { temid = selrow[i].postid + "," + temid; } } $.messager.confirm( '提示' , '是否' +msg+ '選中數據?' , function (r) { if (!r) { return ; } else { $.ajax({ type : "post" , //提交方式 async: false , url : "/channelpost/updatechannel" , //路徑 data : {item:column,value:value,strpostids:temid}, success:function(data) { if (data== 'ok' ){ $.messager.alert( "提示" , "ok" , "info" ); selectfunction(); } else { $.messager.alert( "提示" , "error" , "info" ); } } }); } }); } }; function dotop(column,value,msg) { //返回選中多行 var selrow = $( '#dg' ).datagrid( 'getselections' ) //判斷是否選中行 if (selrow.length== 0 ) { $.messager.alert( "提示" , "請選擇" +msg+ "行!" , "info" ); return ; } else { var temid= "" ; //批量獲取選中行的id for (i = 0 ; i < selrow.length;i++) { if (selrow[i].istop== 1 ){ $.messager.alert( "提示" , "已經有選中行的狀態是'置頂',請去掉此行重試" , "info" ); return ; } if (selrow[i].isadmindel== 1 ){ $.messager.alert( "提示" , "選中行的狀態有'管理員刪除',請去掉此行重試" , "info" ); return ; } if (selrow[i].isdelete== 1 ){ $.messager.alert( "提示" , "選中行的狀態有'用戶刪除',請去掉此行重試" , "info" ); return ; } if (temid == "" ) { temid = selrow[i].postid } else { temid = selrow[i].postid + "," + temid; } } $.messager.confirm( '提示' , '是否' +msg+ '選中數據?' , function (r) { if (!r) { return ; } $.ajax({ type : "post" , //提交方式 url : "/channelpost/updatechannel" , //路徑 data : {item:column,value:value,strpostids:temid}, success:function(data) { if (data== 'ok' ){ $.messager.alert( "提示" , "ok" , "info" ); selectfunction(); } else { $.messager.alert( "提示" , "error" , "info" ); } } }); }); } }; function doofftop(column,value,msg) { //返回選中多行 var selrow = $( '#dg' ).datagrid( 'getselections' ) //判斷是否選中行 if (selrow.length== 0 ) { $.messager.alert( "提示" , "請選擇" +msg+ "行!" , "info" ); return ; } else { var temid= "" ; //批量獲取選中行的id for (i = 0 ; i < selrow.length;i++) { if (selrow[i].istop!= 1 ){ $.messager.alert( "提示" , "只有'置頂'的才能取消置頂,檢查選中項" , "info" ); return ; } else { if (temid == "" ) { temid = selrow[i].postid } else { temid = selrow[i].postid + "," + temid; } } } $.messager.confirm( '提示' , '是否' +msg+ '選中數據?' , function (r) { if (!r) { return ; } $.ajax({ type : "post" , //提交方式 url : "/channelpost/updatechannel" , //路徑 data : {item:column,value:value,strpostids:temid}, success:function(data) { if (data== 'ok' ){ $.messager.alert( "提示" , "ok" , "info" ); selectfunction(); } else { $.messager.alert( "提示" , "error" , "info" ); } } }); }); } }; </script> </body> </html> |
二:后臺返回的數據格式
后臺返回的數據格式和經典的easyui的數據格式是一樣的
數據格式:
1
|
{ "total" : 67 , "errmsg" : "查詢成功" , "errcode" : 1 , "rows" :[{ "postid" : 77 , "dealtype" : 0 , "title" : "理解" , "partno" : null , "content" : "理解[圖片]" , "location" : null , "tradetype" : 0 , "brandid" : 0 , "quantity" : 0 , "contacts" : "sakuraaoi" , "contactnumber" : null , "color" : null , "channelid" : 1 , "createdate" : "2018-10-16 10:12:19" , "updatedate" : null , "status" : 0 , "isdelete" : 0 , "isadmindel" : 0 , "istop" : 0 , "replynumber" : 0 , "readnumber" : 0 , "thumbnumber" : 0 , "authorid" : 0 , "isoem" : 0 , "type" : 0 , "amount" : 0.0 , "channelpostattach" :[{ "attachid" : 99 , "postid" : 77 , "uploaddate" : 1539655939000 , "attachname" : "record-attach/sell/371-20181016101221.png" , "type" : 10121001 , "typename" : null , "attachnameurl" : "" }], "nickname" : "sakuraaoi" , "avatar" : "" , "channelname" : "新車交易" , "brandname" : "長安鈴木" , "startdate" : null , "enddate" : null , "brandids" : null , "channelids" : null , "strbrandids" : null , "strchannelids" : null , "begin" : 0 , "end" : 0 , "dealtypes" : null , "isdeletes" : null , "item" : null , "value" : 0 , "userid" : 0 , "actid" : 0 , "dealtypename" : null , "tradetypename" : null , "istopname" : null , "createdate2" : null }]} |
三:視圖效果
四:后臺數據的獲取
后臺數據的獲取為一對多,因為一個帖子會包含多個圖片附件。
帖子實體類:
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
|
public class bschannelpost { private int postid; private int dealtype; private string title; private string partno; private string content; private string location; private int tradetype; private int brandid; private int quantity; private string contacts; private string contactnumber; private string color; private int channelid; @jsonformat (pattern= "yyyy-mm-dd hh:mm:ss" ,timezone = "gmt+8" ) private date createdate; @jsonformat (pattern= "yyyy-mm-dd hh:mm:ss" ,timezone = "gmt+8" ) private date updatedate; private int status; private int isdelete; private int isadmindel; private int istop; private int replynumber; private int readnumber; private int thumbnumber; private int authorid; private int isoem; private int type; private double amount; private list<bschannelpostattach> channelpostattach; //附件 private string nickname; private string avatar; private string channelname; private string brandname; private string startdate; private string enddate; private list<integer> brandids; private list<integer> channelids; private string strbrandids; private string strchannelids; private int begin; private int end; private string dealtypes; private string isdeletes; private string item; private int value; private int userid; private int actid; private string dealtypename; private string tradetypename; private string istopname; private string createdate2; } |
附件實體類:
1
2
3
4
5
6
7
8
9
10
11
|
import lombok.data; @data //lombok 免寫get set public class bschannelpostattach { private int attachid; private int postid; private date uploaddate; private string attachname; private int type; private string typename; private string attachnameurl; } |
dao:
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
|
<resultmap type= "com.yonyou.wechatmng.domain.bschannelpost" id= "channelpost" > <id property= "postid" column= "postid" /> <collection property= "channelpostattach" javatype= "arraylist" select= "selectattach" column= "postid" oftype= "com.yonyou.wechatmng.domain.bschannelpostattach" ></collection> </resultmap> <select id= "selectattach" parametertype= "int" resulttype= "com.yonyou.wechatmng.domain.bschannelpostattach" > select attach_id attachid,post_id postid,upload_date uploaddate,attach_name attachname,type from bs_channel_post_attach where post_id = #{postid} order by attach_id </select> <select id= "getchannelpost" parametertype= "com.yonyou.wechatmng.domain.bschannelpost" resultmap= "channelpost" > select p.post_id postid,u.nickname nickname,c.channel_name channelname,b.brand_name brandname,p.create_date createdate,p.title title,p.content content,p.part_no partno,p.contacts contacts,u.avatar avatar,p.is_top istop, is_delete isdelete,p.is_admindel isadmindel,p.channel_id channelid from bs_channel_post p left join bs_channel c on p.channel_id=c.channel_id left join bs_brand b on p.brand_id=b.brand_id left join bs_user u on p.author_id=u.user_id where 1 = 1 < if test= "content!=null and content!=''" > and (p.content like '%${content}%' or p.title like '%${content}%' ) </ if > < if test= "nickname!=null and nickname!=''" > and u.nickname like '%${nickname}%' </ if > < if test= "dealtype!=0" > and p.deal_type=#{dealtype} </ if > < if test= "isdelete==1" > and (is_delete= 0 and is_admindel= 0 ) </ if > < if test= "isdelete==2" > and (is_delete= 1 or is_admindel= 1 ) </ if > < if test= "isdelete==3" > and is_top= 1 </ if > < if test= "brandids !=null and brandids.size()>0" > and p.brand_id in <foreach collection= "brandids" item= "id" index= "index" open= "(" close= ")" separator= "," > #{id} </foreach> </ if > < if test= "channelids !=null and channelids.size()>0" > and p.channel_id in <foreach collection= "channelids" item= "id" index= "index" open= "(" close= ")" separator= "," > #{id} </foreach> </ if > < if test= "(startdate!=null and startdate!='') and (enddate==null or enddate=='')" > and p.create_date>#{begindate} </ if > < if test= "(startdate==null or startdate=='') and (enddate!=null and enddate!='')" > and p.create_date <#{enddate} </ if > < if test= "(startdate!=null and startdate!='') and (enddate!=null and enddate!='')" > and p.create_date between #{begindate} and #{enddate} </ if > order by p.create_date desc limit #{begin},#{end} </select> |
總結
以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作具有一定的參考學習價值,如果有疑問大家可以留言交流,謝謝大家對服務器之家的支持。
原文鏈接:https://www.cnblogs.com/GH0522/p/9796791.html