@ -1,424 +1,424 @@
/* */ package com.archive.project.dasz.archivetype.service.impl
package com.archive.project.dasz.archivetype.service.impl
;
/* */
/* */ import com.archive.common.utils.StringUtils ;
/* */ import com.archive.framework.config.ArchiveConfig ;
/* */ import com.archive.project.common.service.IExecuteSqlService ;
/* */ import com.archive.project.dasz.archivetype.domain.ArchiveTableColumn ;
/* */ import com.archive.project.dasz.archivetype.service.IArchiveListService ;
/* */ import com.archive.project.dasz.gridcolumns.domain.TXtpzGridColumns ;
/* */ import com.archive.project.dasz.gridcolumns.service.ITXtpzGridColumnsService ;
/* */ import com.archive.project.dasz.physicaltable.domain.PhysicalTable ;
/* */ import com.archive.project.dasz.physicaltable.mapper.PhysicalTableMapper ;
/* */ import com.archive.project.dasz.physicaltablecolumn.domain.PhysicalTableColumn ;
/* */ import com.archive.project.dasz.physicaltablecolumn.mapper.PhysicalTableColumnMapper ;
/* */ import com.archive.project.system.dict.domain.DictData ;
/* */ import com.archive.project.system.dict.mapper.DictDataMapper ;
/* */ import java.util.ArrayList ;
/* */ import java.util.HashMap ;
/* */ import java.util.LinkedHashMap ;
/* */ import java.util.List ;
/* */ import java.util.Map ;
/* */ import java.util.Set ;
/* */ import org.springframework.beans.factory.annotation.Autowired ;
/* */ import org.springframework.stereotype.Service ;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Service
/* */ public class ArchiveListServiceImpl
/* */ implements IArchiveListService
/* */ {
/* */ @Autowired
/* */ private PhysicalTableMapper physicalTableMapper ;
/* */ @Autowired
/* */ private PhysicalTableColumnMapper physicalTableColumnMapper ;
/* */ @Autowired
/* */ private IExecuteSqlService executeSqlService ;
/* */ @Autowired
/* */ private ITXtpzGridColumnsService itXtpzGridColumnsService ;
/* */ @Autowired
/* */ private DictDataMapper dictDataMapper ;
/* */ @Autowired
/* */ private ArchiveConfig archiveConfig ;
/* */
/* */ public List < ArchiveTableColumn > getColumns ( String id , String code ) {
/* 58 */ List < ArchiveTableColumn > resultList = new ArrayList < > ( ) ;
/* */
/* */
/* 61 */ PhysicalTable physicalTable = new PhysicalTable ( ) ;
/* 62 */ physicalTable . setArchivetypeid ( id ) ;
/* 63 */ physicalTable . setTableCode ( code ) ;
/* 64 */ List < PhysicalTable > tablesList = this . physicalTableMapper . selectPhysicalTableList ( physicalTable ) ;
/* */
/* 66 */ if ( tablesList ! = null & & tablesList . size ( ) > 0 ) {
/* 67 */ physicalTable = tablesList . get ( 0 ) ;
/* 68 */ PhysicalTableColumn physicalTableColumn = new PhysicalTableColumn ( ) ;
/* 69 */ physicalTableColumn . setTableId ( physicalTable . getId ( ) ) ;
/* 70 */ physicalTableColumn . setLbx ( Long . valueOf ( 1L ) ) ;
/* 71 */ List < PhysicalTableColumn > columnsList = new ArrayList < > ( ) ;
/* 72 */ if ( "mysql" . equals ( this . archiveConfig . getDatabaseType ( ) ) ) {
/* 73 */ columnsList = this . physicalTableColumnMapper . selectPhysicalTableColumnListMysql ( physicalTableColumn ) ;
/* */ }
/* 75 */ else if ( "sqlite" . equals ( this . archiveConfig . getDatabaseType ( ) ) ) {
/* 76 */ columnsList = this . physicalTableColumnMapper . selectPhysicalTableColumnListSqlLite ( physicalTableColumn ) ;
/* */ }
/* */
/* 79 */ if ( columnsList ! = null & & columnsList . size ( ) > 0 ) {
/* */
/* 81 */ ArchiveTableColumn columnOne = new ArchiveTableColumn ( ) ;
/* 82 */ columnOne . setCheckbox ( true ) ;
/* 83 */ resultList . add ( columnOne ) ;
/* */
/* */
/* 86 */ ArchiveTableColumn columnTwo = new ArchiveTableColumn ( ) ;
/* 87 */ columnTwo . setField ( "id" ) ;
/* 88 */ columnTwo . setTitle ( "" ) ;
/* 89 */ columnTwo . setVisible ( false ) ;
/* 90 */ resultList . add ( columnTwo ) ;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* 104 */ TXtpzGridColumns tXtpzGridColumns = new TXtpzGridColumns ( ) ;
/* 105 */ tXtpzGridColumns . setTableId ( physicalTable . getId ( ) ) ;
/* 106 */ List < TXtpzGridColumns > tglist = this . itXtpzGridColumnsService . selectTXtpzGridColumnsList ( tXtpzGridColumns ) ;
/* 107 */ for ( TXtpzGridColumns tableColumn : tglist ) {
/* 108 */ ArchiveTableColumn column = new ArchiveTableColumn ( ) ;
/* */
/* 110 */ if ( StringUtils . isEmpty ( tableColumn . getBy1 ( ) ) ) {
/* 111 */ column . setField ( tableColumn . getColumnname ( ) ) ;
/* 112 */ column . setTitle ( tableColumn . getShowname ( ) ) ;
/* 113 */ column . setWidth ( Integer . parseInt ( String . valueOf ( tableColumn . getWidth ( ) ) ) ) ;
/* */ } else {
/* 115 */ column . setField ( tableColumn . getColumnname ( ) ) ;
/* 116 */ column . setTitle ( tableColumn . getShowname ( ) ) ;
/* 117 */ column . setCodeType ( tableColumn . getBy1 ( ) ) ;
/* 118 */ column . setWidth ( Integer . parseInt ( String . valueOf ( tableColumn . getWidth ( ) ) ) ) ;
/* */ }
/* 120 */ resultList . add ( column ) ;
/* */ }
/* */ }
/* */ }
/* 124 */ return resultList ;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public Map < String , String > getOrderColumns ( String id , String code ) {
/* 134 */ Map < String , String > map = new HashMap < > ( ) ;
/* 135 */ String orderColumns = "" ;
/* 136 */ String orderType = "asc" ;
/* */
/* 138 */ PhysicalTable physicalTable = new PhysicalTable ( ) ;
/* 139 */ physicalTable . setArchivetypeid ( id ) ;
/* 140 */ physicalTable . setTableCode ( code ) ;
/* 141 */ List < PhysicalTable > tablesList = this . physicalTableMapper . selectPhysicalTableList ( physicalTable ) ;
/* */
/* 143 */ if ( tablesList ! = null & & tablesList . size ( ) > 0 ) {
/* 144 */ physicalTable = tablesList . get ( 0 ) ;
/* 145 */ PhysicalTableColumn physicalTableColumn = new PhysicalTableColumn ( ) ;
/* 146 */ physicalTableColumn . setTableId ( physicalTable . getId ( ) ) ;
/* 147 */ physicalTableColumn . setPxx ( Long . valueOf ( 1L ) ) ;
/* 148 */ List < PhysicalTableColumn > columnsList = new ArrayList < > ( ) ;
/* 149 */ if ( "mysql" . equals ( this . archiveConfig . getDatabaseType ( ) ) ) {
/* 150 */ columnsList = this . physicalTableColumnMapper . selectPhysicalTableColumnListMysql ( physicalTableColumn ) ;
/* */ }
/* 152 */ else if ( "sqlite" . equals ( this . archiveConfig . getDatabaseType ( ) ) ) {
/* 153 */ columnsList = this . physicalTableColumnMapper . selectPhysicalTableColumnListSqlLite ( physicalTableColumn ) ;
/* */ }
/* */
/* 156 */ if ( columnsList ! = null & & columnsList . size ( ) > 0 ) {
/* 157 */ for ( PhysicalTableColumn tableColumn : columnsList ) {
/* */
/* */
/* 160 */ if ( tableColumn . getBz ( ) ! = null & & tableColumn . getBz ( ) . contains ( "倒序" ) ) {
/* 161 */ orderType = "desc" ;
/* */ }
/* 163 */ orderColumns = orderColumns + "," + tableColumn . getColumnCode ( ) + " " + orderType ;
/* */ }
/* */ }
/* */ }
/* 167 */ if ( orderColumns . length ( ) > 0 ) {
/* 168 */ orderColumns = orderColumns . substring ( 1 , orderColumns . length ( ) ) ;
/* */ }
/* 170 */ map . put ( "orderColumns" , orderColumns ) ;
/* 171 */ map . put ( "orderType" , orderType ) ;
/* 172 */ return map ;
/* */ }
/* */
/* */
/* */ public Map < String , Object > selectArchiveList ( String id , String code , String ownerid , Integer pageNum , Integer pageSize , String orderBy , String orderByColumn , Map < String , Object > formData , String isRecycle , String status ) {
/* 177 */ Map < String , Object > resultMap = new HashMap < > ( ) ;
/* 178 */ List < LinkedHashMap < String , Object > > resultList = new ArrayList < > ( ) ;
/* 179 */ Integer count = Integer . valueOf ( 0 ) ;
/* 180 */ Integer beginNum = Integer . valueOf ( ( pageNum . intValue ( ) - 1 ) * pageSize . intValue ( ) ) ;
/* */
/* */
/* 183 */ PhysicalTable physicalTable = new PhysicalTable ( ) ;
/* 184 */ physicalTable . setArchivetypeid ( id ) ;
/* 185 */ physicalTable . setTableCode ( code ) ;
/* 186 */ List < PhysicalTable > tablesList = this . physicalTableMapper . selectPhysicalTableList ( physicalTable ) ;
/* */
/* 188 */ if ( tablesList ! = null & & tablesList . size ( ) > 0 ) {
/* 189 */ physicalTable = tablesList . get ( 0 ) ;
/* */
/* */
/* 192 */ String condition = "" ;
/* */
/* 194 */ if ( ! "folder" . equals ( code ) & & StringUtils . isNotEmpty ( ownerid ) & & ! "ALL" . equals ( ownerid ) & & ! "0" . equals ( ownerid ) & & ! "ownerid" . equals ( ownerid ) ) {
/* 195 */ condition = condition + "ownerid in (" + ownerid + ") " ;
/* */ }
/* 197 */ PhysicalTableColumn physicalTableColumn1 = new PhysicalTableColumn ( ) ;
/* 198 */ physicalTableColumn1 . setTableId ( physicalTable . getId ( ) ) ;
/* 199 */ List < PhysicalTableColumn > columnsList1 = new ArrayList < > ( ) ;
/* 200 */ if ( "mysql" . equals ( this . archiveConfig . getDatabaseType ( ) ) ) {
/* 201 */ columnsList1 = this . physicalTableColumnMapper . selectPhysicalTableColumnListMysql ( physicalTableColumn1 ) ;
/* */ }
/* 203 */ else if ( "sqlite" . equals ( this . archiveConfig . getDatabaseType ( ) ) ) {
/* 204 */ columnsList1 = this . physicalTableColumnMapper . selectPhysicalTableColumnListSqlLite ( physicalTableColumn1 ) ;
/* */ }
/* */
/* 207 */ if ( columnsList1 ! = null & & columnsList1 . size ( ) > 0 ) {
/* 208 */ Set < String > keySet = formData . keySet ( ) ;
/* 209 */ for ( String key : keySet ) {
/* 210 */ String value = String . valueOf ( formData . get ( key ) ) ;
/* 211 */ for ( PhysicalTableColumn tableColumn : columnsList1 ) {
/* 212 */ String field = tableColumn . getColumnCode ( ) ;
/* 213 */ if ( ( key . equals ( field ) | | key . replaceAll ( "_Qazwsx13579!" , "" ) . equals ( field ) | | key . replaceAll ( "_Qazwsx24680!" , "" ) . equals ( field ) ) & &
/* 214 */ ! "pageNum" . equals ( key ) & & ! "pageSize" . equals ( key ) & & ! "isAsc" . equals ( key ) & & StringUtils . isNotEmpty ( value ) ) {
/* 215 */ Long jsfs = tableColumn . getJsfs ( ) ;
/* */
/* 217 */ if ( jsfs . longValue ( ) = = 0 L ) {
/* 218 */ condition = condition + "and " + field + " like '%" + value + "%' " ;
/* */ continue ;
/* */ }
/* 221 */ if ( jsfs . longValue ( ) = = 1L ) {
/* 222 */ condition = condition + "and " + field + " = '" + value + "' " ;
/* */ continue ;
/* */ }
/* 225 */ if ( jsfs . longValue ( ) = = 2L ) {
/* 226 */ condition = condition + "and " + field + " > '" + value + "' " ;
/* */ continue ;
/* */ }
/* 229 */ if ( jsfs . longValue ( ) = = 3L ) {
/* 230 */ condition = condition + "and " + field + " < '" + value + "' " ;
/* */ continue ;
/* */ }
/* 233 */ if ( jsfs . longValue ( ) = = 4L ) {
/* 234 */ condition = condition + "and " + field + " >= '" + value + "' " ;
/* */ continue ;
/* */ }
/* 237 */ if ( jsfs . longValue ( ) = = 5L ) {
/* 238 */ condition = condition + "and " + field + " <= '" + value + "' " ;
/* */ continue ;
/* */ }
/* 241 */ if ( jsfs . longValue ( ) = = 6L ) {
/* 242 */ if ( key . replaceAll ( "_Qazwsx13579!" , "" ) . equals ( field ) ) {
/* 243 */ condition = condition + "and " + field + " >= '" + value + "' " ;
/* */ }
/* 245 */ if ( key . replaceAll ( "_Qazwsx24680!" , "" ) . equals ( field ) ) {
/* 246 */ condition = condition + "and " + field + " <= '" + value + "' " ;
/* */ }
/* */ continue ;
/* */ }
/* 250 */ condition = condition + "and " + field + " like '%" + value + "%' " ;
/* */ }
/* */ }
/* */
/* */
/* 255 */ if ( "ids" . equals ( key ) ) {
/* 256 */ condition = condition + "and id in (" + value + ")" ;
/* */ }
/* */ }
/* */ }
/* */
/* 261 */ if ( condition . startsWith ( "and" ) ) {
/* 262 */ condition = condition . substring ( 3 ) ;
/* */ }
/* */
/* 265 */ if ( isRecycle . equals ( "true" ) ) {
/* 266 */ if ( condition . length ( ) > 0 ) {
/* 267 */ condition = " where is_delete = '1' and " + condition ;
/* */ } else {
/* 269 */ condition = " where is_delete = '1' " ;
/* */ }
/* */
/* 272 */ } else if ( condition . length ( ) > 0 ) {
/* 273 */ condition = " is_delete = '0' and " + condition ;
/* */ } else {
/* 275 */ condition = " is_delete = '0' " ;
/* */ }
/* */
/* */
/* */
/* 280 */ if ( status ! = null & & ! status . equals ( "" ) & & ! status . equals ( "0" ) ) {
/* 281 */ if ( condition . length ( ) > 0 ) {
/* 282 */ condition = " where status = '" + status + "' and " + condition ;
/* */ } else {
/* 284 */ condition = " where status = '" + status + "' " ;
/* */ }
/* */ }
/* */
/* */
/* */
/* 290 */ PhysicalTableColumn physicalTableColumn2 = new PhysicalTableColumn ( ) ;
/* 291 */ physicalTableColumn2 . setTableId ( physicalTable . getId ( ) ) ;
/* 292 */ physicalTableColumn2 . setLbx ( Long . valueOf ( 1L ) ) ;
/* 293 */ List < PhysicalTableColumn > columnsList2 = new ArrayList < > ( ) ;
/* 294 */ if ( "mysql" . equals ( this . archiveConfig . getDatabaseType ( ) ) ) {
/* 295 */ columnsList2 = this . physicalTableColumnMapper . selectPhysicalTableColumnListMysql ( physicalTableColumn2 ) ;
/* */ }
/* 297 */ else if ( "sqlite" . equals ( this . archiveConfig . getDatabaseType ( ) ) ) {
/* 298 */ columnsList2 = this . physicalTableColumnMapper . selectPhysicalTableColumnListSqlLite ( physicalTableColumn2 ) ;
/* */ }
/* */
/* 301 */ if ( columnsList2 ! = null & & columnsList2 . size ( ) > 0 ) {
/* 302 */ String sql = "select id," ;
/* 303 */ for ( PhysicalTableColumn tableColumn : columnsList2 ) {
/* 304 */ sql = sql + tableColumn . getColumnCode ( ) + "," ;
/* */ }
/* 306 */ sql = sql . substring ( 0 , sql . lastIndexOf ( "," ) ) ;
/* 307 */ sql = sql + " from " + physicalTable . getTablename ( ) + condition ;
/* 308 */ if ( StringUtils . isNotEmpty ( orderByColumn ) )
/* */ {
/* 310 */ sql = sql + " order by " + orderByColumn ;
/* */ }
/* 312 */ sql = sql + " limit " + beginNum + " , " + pageSize ;
/* 313 */ resultList = this . executeSqlService . queryList ( sql ) ;
/* */
/* 315 */ String countSql = "SELECT COUNT(*) FROM " + physicalTable . getTablename ( ) + condition ;
/* 316 */ count = this . executeSqlService . jdbcTemplateQueryCount ( countSql ) ;
/* */ }
/* */ }
/* 319 */ resultMap . put ( "list" , resultList ) ;
/* 320 */ resultMap . put ( "count" , count ) ;
/* 321 */ return resultMap ;
/* */ }
/* */
/* */
/* */ public String getSearchHtml ( String id , String code ) {
/* 326 */ String html = "" ;
/* 327 */ PhysicalTable physicalTable = new PhysicalTable ( ) ;
/* 328 */ physicalTable . setArchivetypeid ( id ) ;
/* 329 */ physicalTable . setTableCode ( code ) ;
/* 330 */ List < PhysicalTable > physicalTableList = this . physicalTableMapper . selectPhysicalTableList ( physicalTable ) ;
/* 331 */ if ( physicalTableList ! = null & & physicalTableList . size ( ) > 0 ) {
/* 332 */ Long tableId = ( ( PhysicalTable ) physicalTableList . get ( 0 ) ) . getId ( ) ;
/* 333 */ PhysicalTableColumn physicalTableColumn = new PhysicalTableColumn ( ) ;
/* 334 */ physicalTableColumn . setTableId ( tableId ) ;
/* 335 */ physicalTableColumn . setJsx ( Long . valueOf ( 1L ) ) ;
/* 336 */ List < PhysicalTableColumn > tableColumnsList = new ArrayList < > ( ) ;
/* 337 */ if ( "mysql" . equals ( this . archiveConfig . getDatabaseType ( ) ) ) {
/* 338 */ tableColumnsList = this . physicalTableColumnMapper . selectPhysicalTableColumnListMysql ( physicalTableColumn ) ;
/* */ }
/* 340 */ else if ( "sqlite" . equals ( this . archiveConfig . getDatabaseType ( ) ) ) {
/* 341 */ tableColumnsList = this . physicalTableColumnMapper . selectPhysicalTableColumnListSqlLite ( physicalTableColumn ) ;
/* */ }
/* 343 */ if ( tableColumnsList ! = null & & tableColumnsList . size ( ) > 0 ) {
/* 344 */ StringBuffer sb = new StringBuffer ( ) ;
/* 345 */ sb . append ( "<div class='col-sm-12 search-collapse'>" ) ;
/* 346 */ sb . append ( "<form id='archive-search-form'>" ) ;
/* 347 */ sb . append ( "<div class='select-list'>" ) ;
/* 348 */ sb . append ( "<ul>" ) ;
/* 349 */ for ( int i = 0 ; i < tableColumnsList . size ( ) ; i + + ) {
/* 350 */ PhysicalTableColumn tableColumns = tableColumnsList . get ( i ) ;
/* 351 */ String columnName = tableColumns . getColumnName ( ) ;
/* 352 */ String columnCode = tableColumns . getColumnCode ( ) ;
/* 353 */ String columnCodeType = tableColumns . getColumnCodetype ( ) ;
/* 354 */ Long jsfs = tableColumns . getJsfs ( ) ;
/* */
/* 356 */ if ( StringUtils . isEmpty ( columnCodeType ) ) {
/* 357 */ if ( jsfs . longValue ( ) = = 6L ) {
/* 358 */ sb . append ( "<li class='select-time'>" ) ;
/* 359 */ sb . append ( "<label>" + columnName + ": </label><input type='text' class='time-input' name='" + columnCode + "_Qazwsx13579!'/>" ) ;
/* 360 */ sb . append ( "<span>-</span>" ) ;
/* 361 */ sb . append ( "<input class='time-input' type='text' name='" + columnCode + "_Qazwsx24680!'/>" ) ;
/* 362 */ sb . append ( "</li>" ) ;
/* */ } else {
/* 364 */ sb . append ( "<li>" ) ;
/* 365 */ sb . append ( "<label>" + columnName + ": </label><input type='text' name='" + columnCode + "'/>" ) ;
/* 366 */ sb . append ( "</li>" ) ;
/* */ }
/* */
/* */ } else {
/* */
/* 371 */ DictData dictData = new DictData ( ) ;
/* 372 */ dictData . setDictType ( columnCodeType ) ;
/* 373 */ List < DictData > dictDataList = this . dictDataMapper . selectDictDataList ( dictData ) ;
/* 374 */ if ( jsfs . longValue ( ) = = 6L ) {
/* 375 */ sb . append ( "<li class='select-time'>" ) ;
/* 376 */ sb . append ( "<label>" + columnName + ": </label><select class='time-input' name='" + columnCode + "_Qazwsx13579!'>" ) ;
/* 377 */ sb . append ( "<option value=''>所有</option>" ) ; int j ;
/* 378 */ for ( j = 0 ; j < dictDataList . size ( ) ; j + + ) {
/* 379 */ DictData dictDataTemp = dictDataList . get ( j ) ;
/* 380 */ sb . append ( "<option value='" + dictDataTemp . getDictValue ( ) + "'>" + dictDataTemp . getDictLabel ( ) + "</option>" ) ;
/* */ }
/* 382 */ sb . append ( "</select>" ) ;
/* 383 */ sb . append ( "<span>-</span>" ) ;
/* 384 */ sb . append ( "<select class='time-input' name='" + columnCode + "_Qazwsx24680!'>" ) ;
/* 385 */ sb . append ( "<option value=''>所有</option>" ) ;
/* 386 */ for ( j = 0 ; j < dictDataList . size ( ) ; j + + ) {
/* 387 */ DictData dictDataTemp = dictDataList . get ( j ) ;
/* 388 */ sb . append ( "<option value='" + dictDataTemp . getDictValue ( ) + "'>" + dictDataTemp . getDictLabel ( ) + "</option>" ) ;
/* */ }
/* 390 */ sb . append ( "</select>" ) ;
/* 391 */ sb . append ( "</li>" ) ;
/* */ } else {
/* 393 */ sb . append ( "<li>" ) ;
/* 394 */ sb . append ( "<label>" + columnName + ": </label><select name='" + columnCode + "'>" ) ;
/* 395 */ sb . append ( "<option value=''>所有</option>" ) ;
/* 396 */ for ( int j = 0 ; j < dictDataList . size ( ) ; j + + ) {
/* 397 */ DictData dictDataTemp = dictDataList . get ( j ) ;
/* 398 */ sb . append ( "<option value='" + dictDataTemp . getDictValue ( ) + "'>" + dictDataTemp . getDictLabel ( ) + "</option>" ) ;
/* */ }
/* 400 */ sb . append ( "</select>" ) ;
/* 401 */ sb . append ( "</li>" ) ;
/* */ }
/* */ }
/* */ }
/* */
/* 406 */ sb . append ( "<li>" ) ;
/* 407 */ sb . append ( "<a class='btn btn-primary btn-rounded btn-sm' onclick='archiveSearch()'><i class='fa fa-search'></i> 搜索</a>" ) ;
/* 408 */ sb . append ( "<a class='btn btn-warning btn-rounded btn-sm' onclick='$.form.reset()'><i class='fa fa-refresh'></i> 重置</a>" ) ;
/* 409 */ sb . append ( "</li>" ) ;
/* */
/* 411 */ sb . append ( "</ul>" ) ;
/* 412 */ sb . append ( "</div>" ) ;
/* 413 */ sb . append ( "</form>" ) ;
/* 414 */ sb . append ( "</div>" ) ;
/* 415 */ html = sb . toString ( ) ;
/* */ }
/* */ }
/* 418 */ return html ;
/* */ }
/* */ }
import com.archive.common.utils.StringUtils ;
import com.archive.framework.config.ArchiveConfig ;
import com.archive.project.common.service.IExecuteSqlService ;
import com.archive.project.dasz.archivetype.domain.ArchiveTableColumn ;
import com.archive.project.dasz.archivetype.service.IArchiveListService ;
import com.archive.project.dasz.gridcolumns.domain.TXtpzGridColumns ;
import com.archive.project.dasz.gridcolumns.service.ITXtpzGridColumnsService ;
import com.archive.project.dasz.physicaltable.domain.PhysicalTable ;
import com.archive.project.dasz.physicaltable.mapper.PhysicalTableMapper ;
import com.archive.project.dasz.physicaltablecolumn.domain.PhysicalTableColumn ;
import com.archive.project.dasz.physicaltablecolumn.mapper.PhysicalTableColumnMapper ;
import com.archive.project.system.dict.domain.DictData ;
import com.archive.project.system.dict.mapper.DictDataMapper ;
import java.util.ArrayList ;
import java.util.HashMap ;
import java.util.LinkedHashMap ;
import java.util.List ;
import java.util.Map ;
import java.util.Set ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.stereotype.Service ;
@Service
public class ArchiveListServiceImpl
implements IArchiveListService
{
@Autowired
private PhysicalTableMapper physicalTableMapper ;
@Autowired
private PhysicalTableColumnMapper physicalTableColumnMapper ;
@Autowired
private IExecuteSqlService executeSqlService ;
@Autowired
private ITXtpzGridColumnsService itXtpzGridColumnsService ;
@Autowired
private DictDataMapper dictDataMapper ;
@Autowired
private ArchiveConfig archiveConfig ;
public List < ArchiveTableColumn > getColumns ( String id , String code ) {
List < ArchiveTableColumn > resultList = new ArrayList < > ( ) ;
PhysicalTable physicalTable = new PhysicalTable ( ) ;
physicalTable . setArchivetypeid ( id ) ;
physicalTable . setTableCode ( code ) ;
List < PhysicalTable > tablesList = this . physicalTableMapper . selectPhysicalTableList ( physicalTable ) ;
if ( tablesList ! = null & & tablesList . size ( ) > 0 ) {
physicalTable = tablesList . get ( 0 ) ;
PhysicalTableColumn physicalTableColumn = new PhysicalTableColumn ( ) ;
physicalTableColumn . setTableId ( physicalTable . getId ( ) ) ;
physicalTableColumn . setLbx ( Long . valueOf ( 1L ) ) ;
List < PhysicalTableColumn > columnsList = new ArrayList < > ( ) ;
if ( "mysql" . equals ( this . archiveConfig . getDatabaseType ( ) ) ) {
columnsList = this . physicalTableColumnMapper . selectPhysicalTableColumnListMysql ( physicalTableColumn ) ;
}
else if ( "sqlite" . equals ( this . archiveConfig . getDatabaseType ( ) ) ) {
columnsList = this . physicalTableColumnMapper . selectPhysicalTableColumnListSqlLite ( physicalTableColumn ) ;
}
if ( columnsList ! = null & & columnsList . size ( ) > 0 ) {
ArchiveTableColumn columnOne = new ArchiveTableColumn ( ) ;
columnOne . setCheckbox ( true ) ;
resultList . add ( columnOne ) ;
ArchiveTableColumn columnTwo = new ArchiveTableColumn ( ) ;
columnTwo . setField ( "id" ) ;
columnTwo . setTitle ( "" ) ;
columnTwo . setVisible ( false ) ;
resultList . add ( columnTwo ) ;
TXtpzGridColumns tXtpzGridColumns = new TXtpzGridColumns ( ) ;
tXtpzGridColumns . setTableId ( physicalTable . getId ( ) ) ;
List < TXtpzGridColumns > tglist = this . itXtpzGridColumnsService . selectTXtpzGridColumnsList ( tXtpzGridColumns ) ;
for ( TXtpzGridColumns tableColumn : tglist ) {
ArchiveTableColumn column = new ArchiveTableColumn ( ) ;
if ( StringUtils . isEmpty ( tableColumn . getBy1 ( ) ) ) {
column . setField ( tableColumn . getColumnname ( ) ) ;
column . setTitle ( tableColumn . getShowname ( ) ) ;
column . setWidth ( Integer . parseInt ( String . valueOf ( tableColumn . getWidth ( ) ) ) ) ;
} else {
column . setField ( tableColumn . getColumnname ( ) ) ;
column . setTitle ( tableColumn . getShowname ( ) ) ;
column . setCodeType ( tableColumn . getBy1 ( ) ) ;
column . setWidth ( Integer . parseInt ( String . valueOf ( tableColumn . getWidth ( ) ) ) ) ;
}
resultList . add ( column ) ;
}
}
}
return resultList ;
}
public Map < String , String > getOrderColumns ( String id , String code ) {
Map < String , String > map = new HashMap < > ( ) ;
String orderColumns = "" ;
String orderType = "asc" ;
PhysicalTable physicalTable = new PhysicalTable ( ) ;
physicalTable . setArchivetypeid ( id ) ;
physicalTable . setTableCode ( code ) ;
List < PhysicalTable > tablesList = this . physicalTableMapper . selectPhysicalTableList ( physicalTable ) ;
if ( tablesList ! = null & & tablesList . size ( ) > 0 ) {
physicalTable = tablesList . get ( 0 ) ;
PhysicalTableColumn physicalTableColumn = new PhysicalTableColumn ( ) ;
physicalTableColumn . setTableId ( physicalTable . getId ( ) ) ;
physicalTableColumn . setPxx ( Long . valueOf ( 1L ) ) ;
List < PhysicalTableColumn > columnsList = new ArrayList < > ( ) ;
if ( "mysql" . equals ( this . archiveConfig . getDatabaseType ( ) ) ) {
columnsList = this . physicalTableColumnMapper . selectPhysicalTableColumnListMysql ( physicalTableColumn ) ;
}
else if ( "sqlite" . equals ( this . archiveConfig . getDatabaseType ( ) ) ) {
columnsList = this . physicalTableColumnMapper . selectPhysicalTableColumnListSqlLite ( physicalTableColumn ) ;
}
if ( columnsList ! = null & & columnsList . size ( ) > 0 ) {
for ( PhysicalTableColumn tableColumn : columnsList ) {
if ( tableColumn . getBz ( ) ! = null & & tableColumn . getBz ( ) . contains ( "倒序" ) ) {
orderType = "desc" ;
}
orderColumns = orderColumns + "," + tableColumn . getColumnCode ( ) + " " + orderType ;
}
}
}
if ( orderColumns . length ( ) > 0 ) {
orderColumns = orderColumns . substring ( 1 , orderColumns . length ( ) ) ;
}
map . put ( "orderColumns" , orderColumns ) ;
map . put ( "orderType" , orderType ) ;
return map ;
}
public Map < String , Object > selectArchiveList ( String id , String code , String ownerid , Integer pageNum , Integer pageSize , String orderBy , String orderByColumn , Map < String , Object > formData , String isRecycle , String status ) {
Map < String , Object > resultMap = new HashMap < > ( ) ;
List < LinkedHashMap < String , Object > > resultList = new ArrayList < > ( ) ;
Integer count = Integer . valueOf ( 0 ) ;
Integer beginNum = Integer . valueOf ( ( pageNum . intValue ( ) - 1 ) * pageSize . intValue ( ) ) ;
PhysicalTable physicalTable = new PhysicalTable ( ) ;
physicalTable . setArchivetypeid ( id ) ;
physicalTable . setTableCode ( code ) ;
List < PhysicalTable > tablesList = this . physicalTableMapper . selectPhysicalTableList ( physicalTable ) ;
if ( tablesList ! = null & & tablesList . size ( ) > 0 ) {
physicalTable = tablesList . get ( 0 ) ;
String condition = "" ;
if ( ! "folder" . equals ( code ) & & StringUtils . isNotEmpty ( ownerid ) & & ! "ALL" . equals ( ownerid ) & & ! "0" . equals ( ownerid ) & & ! "ownerid" . equals ( ownerid ) ) {
condition = condition + "ownerid in (" + ownerid + ") " ;
}
PhysicalTableColumn physicalTableColumn1 = new PhysicalTableColumn ( ) ;
physicalTableColumn1 . setTableId ( physicalTable . getId ( ) ) ;
List < PhysicalTableColumn > columnsList1 = new ArrayList < > ( ) ;
if ( "mysql" . equals ( this . archiveConfig . getDatabaseType ( ) ) ) {
columnsList1 = this . physicalTableColumnMapper . selectPhysicalTableColumnListMysql ( physicalTableColumn1 ) ;
}
else if ( "sqlite" . equals ( this . archiveConfig . getDatabaseType ( ) ) ) {
columnsList1 = this . physicalTableColumnMapper . selectPhysicalTableColumnListSqlLite ( physicalTableColumn1 ) ;
}
if ( columnsList1 ! = null & & columnsList1 . size ( ) > 0 ) {
Set < String > keySet = formData . keySet ( ) ;
for ( String key : keySet ) {
String value = String . valueOf ( formData . get ( key ) ) ;
for ( PhysicalTableColumn tableColumn : columnsList1 ) {
String field = tableColumn . getColumnCode ( ) ;
if ( ( key . equals ( field ) | | key . replaceAll ( "_Qazwsx13579!" , "" ) . equals ( field ) | | key . replaceAll ( "_Qazwsx24680!" , "" ) . equals ( field ) ) & &
! "pageNum" . equals ( key ) & & ! "pageSize" . equals ( key ) & & ! "isAsc" . equals ( key ) & & StringUtils . isNotEmpty ( value ) ) {
Long jsfs = tableColumn . getJsfs ( ) ;
if ( jsfs . longValue ( ) = = 0 L ) {
condition = condition + "and " + field + " like '%" + value + "%' " ;
continue ;
}
if ( jsfs . longValue ( ) = = 1L ) {
condition = condition + "and " + field + " = '" + value + "' " ;
continue ;
}
if ( jsfs . longValue ( ) = = 2L ) {
condition = condition + "and " + field + " > '" + value + "' " ;
continue ;
}
if ( jsfs . longValue ( ) = = 3L ) {
condition = condition + "and " + field + " < '" + value + "' " ;
continue ;
}
if ( jsfs . longValue ( ) = = 4L ) {
condition = condition + "and " + field + " >= '" + value + "' " ;
continue ;
}
if ( jsfs . longValue ( ) = = 5L ) {
condition = condition + "and " + field + " <= '" + value + "' " ;
continue ;
}
if ( jsfs . longValue ( ) = = 6L ) {
if ( key . replaceAll ( "_Qazwsx13579!" , "" ) . equals ( field ) ) {
condition = condition + "and " + field + " >= '" + value + "' " ;
}
if ( key . replaceAll ( "_Qazwsx24680!" , "" ) . equals ( field ) ) {
condition = condition + "and " + field + " <= '" + value + "' " ;
}
continue ;
}
condition = condition + "and " + field + " like '%" + value + "%' " ;
}
}
if ( "ids" . equals ( key ) ) {
condition = condition + "and id in (" + value + ")" ;
}
}
}
if ( condition . startsWith ( "and" ) ) {
condition = condition . substring ( 3 ) ;
}
if ( isRecycle . equals ( "true" ) ) {
if ( condition . length ( ) > 0 ) {
condition = " where is_delete = '1' and " + condition ;
} else {
condition = " where is_delete = '1' " ;
}
} else if ( condition . length ( ) > 0 ) {
condition = " is_delete = '0' and " + condition ;
} else {
condition = " is_delete = '0' " ;
}
if ( status ! = null & & ! status . equals ( "" ) & & ! status . equals ( "0" ) ) {
if ( condition . length ( ) > 0 ) {
condition = " where status = '" + status + "' and " + condition ;
} else {
condition = " where status = '" + status + "' " ;
}
}
PhysicalTableColumn physicalTableColumn2 = new PhysicalTableColumn ( ) ;
physicalTableColumn2 . setTableId ( physicalTable . getId ( ) ) ;
physicalTableColumn2 . setLbx ( Long . valueOf ( 1L ) ) ;
List < PhysicalTableColumn > columnsList2 = new ArrayList < > ( ) ;
if ( "mysql" . equals ( this . archiveConfig . getDatabaseType ( ) ) ) {
columnsList2 = this . physicalTableColumnMapper . selectPhysicalTableColumnListMysql ( physicalTableColumn2 ) ;
}
else if ( "sqlite" . equals ( this . archiveConfig . getDatabaseType ( ) ) ) {
columnsList2 = this . physicalTableColumnMapper . selectPhysicalTableColumnListSqlLite ( physicalTableColumn2 ) ;
}
if ( columnsList2 ! = null & & columnsList2 . size ( ) > 0 ) {
String sql = "select id," ;
for ( PhysicalTableColumn tableColumn : columnsList2 ) {
sql = sql + tableColumn . getColumnCode ( ) + "," ;
}
sql = sql . substring ( 0 , sql . lastIndexOf ( "," ) ) ;
sql = sql + " from " + physicalTable . getTablename ( ) + condition ;
if ( StringUtils . isNotEmpty ( orderByColumn ) )
{
sql = sql + " order by " + orderByColumn ;
}
sql = sql + " limit " + beginNum + " , " + pageSize ;
resultList = this . executeSqlService . queryList ( sql ) ;
String countSql = "SELECT COUNT(*) FROM " + physicalTable . getTablename ( ) + condition ;
count = this . executeSqlService . jdbcTemplateQueryCount ( countSql ) ;
}
}
resultMap . put ( "list" , resultList ) ;
resultMap . put ( "count" , count ) ;
return resultMap ;
}
public String getSearchHtml ( String id , String code ) {
String html = "" ;
PhysicalTable physicalTable = new PhysicalTable ( ) ;
physicalTable . setArchivetypeid ( id ) ;
physicalTable . setTableCode ( code ) ;
List < PhysicalTable > physicalTableList = this . physicalTableMapper . selectPhysicalTableList ( physicalTable ) ;
if ( physicalTableList ! = null & & physicalTableList . size ( ) > 0 ) {
Long tableId = ( ( PhysicalTable ) physicalTableList . get ( 0 ) ) . getId ( ) ;
PhysicalTableColumn physicalTableColumn = new PhysicalTableColumn ( ) ;
physicalTableColumn . setTableId ( tableId ) ;
physicalTableColumn . setJsx ( Long . valueOf ( 1L ) ) ;
List < PhysicalTableColumn > tableColumnsList = new ArrayList < > ( ) ;
if ( "mysql" . equals ( this . archiveConfig . getDatabaseType ( ) ) ) {
tableColumnsList = this . physicalTableColumnMapper . selectPhysicalTableColumnListMysql ( physicalTableColumn ) ;
}
else if ( "sqlite" . equals ( this . archiveConfig . getDatabaseType ( ) ) ) {
tableColumnsList = this . physicalTableColumnMapper . selectPhysicalTableColumnListSqlLite ( physicalTableColumn ) ;
}
if ( tableColumnsList ! = null & & tableColumnsList . size ( ) > 0 ) {
StringBuffer sb = new StringBuffer ( ) ;
sb . append ( "<div class='col-sm-12 search-collapse'>" ) ;
sb . append ( "<form id='archive-search-form'>" ) ;
sb . append ( "<div class='select-list'>" ) ;
sb . append ( "<ul>" ) ;
for ( int i = 0 ; i < tableColumnsList . size ( ) ; i + + ) {
PhysicalTableColumn tableColumns = tableColumnsList . get ( i ) ;
String columnName = tableColumns . getColumnName ( ) ;
String columnCode = tableColumns . getColumnCode ( ) ;
String columnCodeType = tableColumns . getColumnCodetype ( ) ;
Long jsfs = tableColumns . getJsfs ( ) ;
if ( StringUtils . isEmpty ( columnCodeType ) ) {
if ( jsfs . longValue ( ) = = 6L ) {
sb . append ( "<li class='select-time'>" ) ;
sb . append ( "<label>" + columnName + ": </label><input type='text' class='time-input' name='" + columnCode + "_Qazwsx13579!'/>" ) ;
sb . append ( "<span>-</span>" ) ;
sb . append ( "<input class='time-input' type='text' name='" + columnCode + "_Qazwsx24680!'/>" ) ;
sb . append ( "</li>" ) ;
} else {
sb . append ( "<li>" ) ;
sb . append ( "<label>" + columnName + ": </label><input type='text' name='" + columnCode + "'/>" ) ;
sb . append ( "</li>" ) ;
}
} else {
DictData dictData = new DictData ( ) ;
dictData . setDictType ( columnCodeType ) ;
List < DictData > dictDataList = this . dictDataMapper . selectDictDataList ( dictData ) ;
if ( jsfs . longValue ( ) = = 6L ) {
sb . append ( "<li class='select-time'>" ) ;
sb . append ( "<label>" + columnName + ": </label><select class='time-input' name='" + columnCode + "_Qazwsx13579!'>" ) ;
sb . append ( "<option value=''>所有</option>" ) ; int j ;
for ( j = 0 ; j < dictDataList . size ( ) ; j + + ) {
DictData dictDataTemp = dictDataList . get ( j ) ;
sb . append ( "<option value='" + dictDataTemp . getDictValue ( ) + "'>" + dictDataTemp . getDictLabel ( ) + "</option>" ) ;
}
sb . append ( "</select>" ) ;
sb . append ( "<span>-</span>" ) ;
sb . append ( "<select class='time-input' name='" + columnCode + "_Qazwsx24680!'>" ) ;
sb . append ( "<option value=''>所有</option>" ) ;
for ( j = 0 ; j < dictDataList . size ( ) ; j + + ) {
DictData dictDataTemp = dictDataList . get ( j ) ;
sb . append ( "<option value='" + dictDataTemp . getDictValue ( ) + "'>" + dictDataTemp . getDictLabel ( ) + "</option>" ) ;
}
sb . append ( "</select>" ) ;
sb . append ( "</li>" ) ;
} else {
sb . append ( "<li>" ) ;
sb . append ( "<label>" + columnName + ": </label><select name='" + columnCode + "'>" ) ;
sb . append ( "<option value=''>所有</option>" ) ;
for ( int j = 0 ; j < dictDataList . size ( ) ; j + + ) {
DictData dictDataTemp = dictDataList . get ( j ) ;
sb . append ( "<option value='" + dictDataTemp . getDictValue ( ) + "'>" + dictDataTemp . getDictLabel ( ) + "</option>" ) ;
}
sb . append ( "</select>" ) ;
sb . append ( "</li>" ) ;
}
}
}
sb . append ( "<li>" ) ;
sb . append ( "<a class='btn btn-primary btn-rounded btn-sm' onclick='archiveSearch()'><i class='fa fa-search'></i> 搜索</a>" ) ;
sb . append ( "<a class='btn btn-warning btn-rounded btn-sm' onclick='$.form.reset()'><i class='fa fa-refresh'></i> 重置</a>" ) ;
sb . append ( "</li>" ) ;
sb . append ( "</ul>" ) ;
sb . append ( "</div>" ) ;
sb . append ( "</form>" ) ;
sb . append ( "</div>" ) ;
html = sb . toString ( ) ;
}
}
return html ;
}
}
/ * Location : C : \ Users \ Administrator \ Desktop \ extracted . zip ! \ extracted \ BOOT - INF \ classes \ com \ archive \ project \ dasz \ archivetype \ service \ impl \ ArchiveListServiceImpl . class