|
@@ -7,8 +7,10 @@ import com.gqy.common.core.domain.AjaxResult;
|
|
import com.gqy.common.core.domain.AjaxResultCQY;
|
|
import com.gqy.common.core.domain.AjaxResultCQY;
|
|
import com.gqy.common.utils.StringUtils;
|
|
import com.gqy.common.utils.StringUtils;
|
|
import com.gqy.document.domain.DcTemplate;
|
|
import com.gqy.document.domain.DcTemplate;
|
|
|
|
+import com.gqy.document.domain.Document;
|
|
import com.gqy.document.domain.vo.PageResult;
|
|
import com.gqy.document.domain.vo.PageResult;
|
|
import com.gqy.document.service.IDcTemplateService;
|
|
import com.gqy.document.service.IDcTemplateService;
|
|
|
|
+import com.gqy.document.service.IDocumentService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -25,6 +27,44 @@ public class DcTemplateController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private IDcTemplateService templateService;
|
|
private IDcTemplateService templateService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IDocumentService iDocumentService;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ *
|
|
|
|
+ * @param request
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("/searchList")
|
|
|
|
+ public @ResponseBody AjaxResultCQY searchList(@RequestBody Map request) {
|
|
|
|
+ String page = request.get("page").toString();
|
|
|
|
+ String pageSizeStr = request.get("pageSize").toString();
|
|
|
|
+ Integer pageNum = StringUtils.isNotEmpty(page) ? Integer.valueOf(page) : 1;
|
|
|
|
+ Integer pageSize = StringUtils.isNotEmpty(pageSizeStr) ? Integer.valueOf(pageSizeStr) : 10;
|
|
|
|
+ String category_id = request.get("category_id").toString();
|
|
|
|
+ Document dcTemplateQuery = new Document();
|
|
|
|
+ if(StringUtils.isNotEmpty(category_id)){
|
|
|
|
+ dcTemplateQuery.setCategory_id(Long.valueOf(category_id));
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
|
+
|
|
|
|
+ List<Document> list = iDocumentService.searchList(dcTemplateQuery);
|
|
|
|
+ // 3. 获取分页信息
|
|
|
|
+ PageInfo<Document> pageInfo = new PageInfo<>(list);
|
|
|
|
+
|
|
|
|
+ // 4. 封装并返回结果
|
|
|
|
+ PageResult PageResult= new PageResult(
|
|
|
|
+ pageInfo.getPageNum(),
|
|
|
|
+ pageInfo.getPageSize(),
|
|
|
|
+ pageInfo.getPages(),
|
|
|
|
+ pageInfo.getTotal(),
|
|
|
|
+ pageInfo.getList());
|
|
|
|
+
|
|
|
|
+ return AjaxResultCQY.success("查询成功", PageResult);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 分页查询模板列表
|
|
* 分页查询模板列表
|
|
@@ -115,7 +155,7 @@ public class DcTemplateController extends BaseController {
|
|
*/
|
|
*/
|
|
@PostMapping("/info")
|
|
@PostMapping("/info")
|
|
public AjaxResultCQY info(@RequestBody Map map) {
|
|
public AjaxResultCQY info(@RequestBody Map map) {
|
|
- Integer id = (Integer) map.get("id");
|
|
|
|
|
|
+ Integer id = Integer.valueOf(map.get("id").toString()) ;
|
|
return templateService.getInfo(id.longValue());
|
|
return templateService.getInfo(id.longValue());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -138,4 +178,7 @@ public class DcTemplateController extends BaseController {
|
|
return templateService.update(template);
|
|
return templateService.update(template);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|