|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
package web.controller; |
|
|
|
|
|
|
|
|
|
import db.form.DBAction; |
|
|
|
|
import db.form.PageResult; |
|
|
|
|
import db.model.bilibili.DataModel; |
|
|
|
|
import org.apache.commons.io.IOUtils; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
@ -11,16 +12,18 @@ import org.springframework.stereotype.Controller; |
|
|
|
|
import org.springframework.ui.Model; |
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
import web.model.DataModelForm; |
|
|
|
|
import web.service.DataService; |
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpSession; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.nio.charset.Charset; |
|
|
|
|
import java.util.EnumSet; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
@Controller |
|
|
|
|
@RequestMapping("/data") |
|
|
|
|
public class DataController extends TableController<DataModel, web.model.DataModel,DataService> { |
|
|
|
|
public class DataController extends TableController<DataModel, DataModelForm,DataService> { |
|
|
|
|
|
|
|
|
|
private final String regionJson=IOUtils.toString(DataController.class.getResourceAsStream("/region.json"), Charset.forName("UTF-8")); |
|
|
|
|
|
|
|
|
@ -31,7 +34,7 @@ public class DataController extends TableController<DataModel, web.model.DataMod |
|
|
|
|
@RequestMapping |
|
|
|
|
public String find(HttpSession session,Model model) { |
|
|
|
|
session.setAttribute("regionJson",regionJson); |
|
|
|
|
return super.find(model,new web.model.DataModel(),0,10); |
|
|
|
|
return super.find(model,new DataModelForm(),new PageResult(0,10)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping("start/{size}") |
|
|
|
@ -51,16 +54,22 @@ public class DataController extends TableController<DataModel, web.model.DataMod |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected DetachedCriteria getDetachedCriteria(web.model.DataModel queryCommand) { |
|
|
|
|
protected DetachedCriteria getDetachedCriteria(DataModelForm queryCommand) { |
|
|
|
|
DetachedCriteria criteria= super.getDetachedCriteria(queryCommand); |
|
|
|
|
if(StringUtils.isNotEmpty(queryCommand.getTitle())){ |
|
|
|
|
criteria.add(Property.forName("title").like(queryCommand.getTitle(),MatchMode.ANYWHERE)); |
|
|
|
|
} |
|
|
|
|
// if(queryCommand.getTypeIds()!=null){
|
|
|
|
|
// criteria.add(Property.forName("typeId").in(queryCommand.getTypeIds()));
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
return criteria; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected List find(DataModelForm command, Integer firstResult, Integer maxResults) { |
|
|
|
|
return service.find(command, firstResult, maxResults); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected long rowCount(DataModelForm command) { |
|
|
|
|
return service.rowCount(command); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|