|
|
@ -1,16 +1,10 @@ |
|
|
package com.zdxt.knowledge.controller; |
|
|
package com.zdxt.knowledge.controller; |
|
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
import com.zdxt.auth.dto.DictDataBean; |
|
|
import com.zdxt.auth.dto.DictDataBean; |
|
|
import com.zdxt.auth.feign.DictDataApi; |
|
|
import com.zdxt.auth.feign.DictDataApi; |
|
|
import com.zdxt.common.ZDResponse; |
|
|
import com.zdxt.common.ZDResponse; |
|
|
import com.zdxt.common.controller.BaseController; |
|
|
import com.zdxt.common.controller.BaseController; |
|
|
import com.zdxt.common.util.TableDataInfo; |
|
|
import com.zdxt.common.util.TableDataInfo; |
|
|
import com.zdxt.flow.util.DateUtil; |
|
|
|
|
|
import com.zdxt.knowledge.domain.KnowledgeLibrary; |
|
|
|
|
|
import com.zdxt.knowledge.domain.KnowledgeLibrary; |
|
|
import com.zdxt.knowledge.domain.KnowledgeLibrary; |
|
|
import com.zdxt.knowledge.service.IKnowledgeLibraryService; |
|
|
import com.zdxt.knowledge.service.IKnowledgeLibraryService; |
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions; |
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions; |
|
|
@ -21,6 +15,10 @@ import org.springframework.validation.annotation.Validated; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 知识库Controller |
|
|
* 知识库Controller |
|
|
* |
|
|
* |
|
|
@ -29,17 +27,17 @@ import org.springframework.web.multipart.MultipartFile; |
|
|
*/ |
|
|
*/ |
|
|
@Controller |
|
|
@Controller |
|
|
@RequestMapping("/small/library") |
|
|
@RequestMapping("/small/library") |
|
|
public class KnowledgeLibraryController extends BaseController |
|
|
public class KnowledgeLibraryController extends BaseController { |
|
|
{ |
|
|
|
|
|
private String prefix = "project/smallProgram/library"; |
|
|
private String prefix = "project/smallProgram/library"; |
|
|
|
|
|
|
|
|
@Autowired private IKnowledgeLibraryService knowledgeLibraryService; |
|
|
@Autowired |
|
|
@Autowired private DictDataApi dictDataApi; |
|
|
private IKnowledgeLibraryService knowledgeLibraryService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private DictDataApi dictDataApi; |
|
|
|
|
|
|
|
|
@RequiresPermissions("small:library:view") |
|
|
@RequiresPermissions("small:library:view") |
|
|
@GetMapping() |
|
|
@GetMapping() |
|
|
public String library() |
|
|
public String library() { |
|
|
{ |
|
|
|
|
|
return prefix + "/view"; |
|
|
return prefix + "/view"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -49,19 +47,39 @@ public class KnowledgeLibraryController extends BaseController |
|
|
@RequiresPermissions("small:library:view") |
|
|
@RequiresPermissions("small:library:view") |
|
|
@PostMapping("/list") |
|
|
@PostMapping("/list") |
|
|
@ResponseBody |
|
|
@ResponseBody |
|
|
public TableDataInfo list(KnowledgeLibrary knowledgeLibrary) |
|
|
public TableDataInfo list(KnowledgeLibrary knowledgeLibrary) { |
|
|
{ |
|
|
|
|
|
startPage(); |
|
|
startPage(); |
|
|
List<KnowledgeLibrary> list = knowledgeLibraryService.selectKnowledgeLibraryList(knowledgeLibrary); |
|
|
List<KnowledgeLibrary> list = knowledgeLibraryService.selectKnowledgeLibraryList(knowledgeLibrary); |
|
|
return getDataTable(list); |
|
|
return getDataTable(list); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 查询小程序 |
|
|
|
|
|
*/ |
|
|
|
|
|
@PostMapping("/listApp") |
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
public TableDataInfo listApp(@RequestBody KnowledgeLibrary knowledgeLibrary) { |
|
|
|
|
|
startPage(); |
|
|
|
|
|
knowledgeLibrary.setPublishstate(1); |
|
|
|
|
|
List<KnowledgeLibrary> list = knowledgeLibraryService.selectKnowledgeLibraryList(knowledgeLibrary); |
|
|
|
|
|
return getDataTable(list); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 查询 |
|
|
|
|
|
*/ |
|
|
|
|
|
@PostMapping("/getById") |
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
public ZDResponse getById(@RequestBody KnowledgeLibrary knowledgeLibrary) { |
|
|
|
|
|
KnowledgeLibrary library = knowledgeLibraryService.selectKnowledgeLibraryById(knowledgeLibrary.getGuid()); |
|
|
|
|
|
return ZDResponse.success("成功", library); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 新增知识库 |
|
|
* 新增知识库 |
|
|
*/ |
|
|
*/ |
|
|
@GetMapping("/add") |
|
|
@GetMapping("/add") |
|
|
public String add(ModelMap mmap) |
|
|
public String add(ModelMap mmap) { |
|
|
{ |
|
|
|
|
|
DictDataBean dictBean = new DictDataBean(); |
|
|
DictDataBean dictBean = new DictDataBean(); |
|
|
dictBean.setDictType("knowledge_flag"); |
|
|
dictBean.setDictType("knowledge_flag"); |
|
|
mmap.put("dicts", dictDataApi.getDictData(dictBean)); |
|
|
mmap.put("dicts", dictDataApi.getDictData(dictBean)); |
|
|
@ -74,8 +92,7 @@ public class KnowledgeLibraryController extends BaseController |
|
|
@RequiresPermissions("small:library:add") |
|
|
@RequiresPermissions("small:library:add") |
|
|
@PostMapping("/add") |
|
|
@PostMapping("/add") |
|
|
@ResponseBody |
|
|
@ResponseBody |
|
|
public ZDResponse addSave(@RequestParam("file") MultipartFile[] files, @Validated KnowledgeLibrary knowledgeLibrary) |
|
|
public ZDResponse addSave(@RequestParam("file") MultipartFile[] files, @Validated KnowledgeLibrary knowledgeLibrary) { |
|
|
{ |
|
|
|
|
|
int resNum = knowledgeLibraryService.insertKnowledgeLibrary(knowledgeLibrary, files); |
|
|
int resNum = knowledgeLibraryService.insertKnowledgeLibrary(knowledgeLibrary, files); |
|
|
return resNum > 0 ? ZDResponse.success("操作成功", resNum) : ZDResponse.error("操作失败", resNum); |
|
|
return resNum > 0 ? ZDResponse.success("操作成功", resNum) : ZDResponse.error("操作失败", resNum); |
|
|
} |
|
|
} |
|
|
@ -84,8 +101,7 @@ public class KnowledgeLibraryController extends BaseController |
|
|
* 修改知识库 |
|
|
* 修改知识库 |
|
|
*/ |
|
|
*/ |
|
|
@GetMapping("/edit/{guid}") |
|
|
@GetMapping("/edit/{guid}") |
|
|
public String edit(@PathVariable("guid") String guid, ModelMap mmap) |
|
|
public String edit(@PathVariable("guid") String guid, ModelMap mmap) { |
|
|
{ |
|
|
|
|
|
KnowledgeLibrary knowledgeLibrary = knowledgeLibraryService.selectKnowledgeLibraryById(guid); |
|
|
KnowledgeLibrary knowledgeLibrary = knowledgeLibraryService.selectKnowledgeLibraryById(guid); |
|
|
mmap.put("knowledgeLibrary", knowledgeLibrary); |
|
|
mmap.put("knowledgeLibrary", knowledgeLibrary); |
|
|
|
|
|
|
|
|
@ -109,8 +125,7 @@ public class KnowledgeLibraryController extends BaseController |
|
|
@RequiresPermissions("small:library:edit") |
|
|
@RequiresPermissions("small:library:edit") |
|
|
@PostMapping("/edit") |
|
|
@PostMapping("/edit") |
|
|
@ResponseBody |
|
|
@ResponseBody |
|
|
public ZDResponse editSave(@RequestParam("file") MultipartFile[] files, KnowledgeLibrary knowledgeLibrary) |
|
|
public ZDResponse editSave(@RequestParam("file") MultipartFile[] files, KnowledgeLibrary knowledgeLibrary) { |
|
|
{ |
|
|
|
|
|
int resNum = knowledgeLibraryService.updateKnowledgeLibrary(knowledgeLibrary, files); |
|
|
int resNum = knowledgeLibraryService.updateKnowledgeLibrary(knowledgeLibrary, files); |
|
|
return resNum > 0 ? ZDResponse.success("操作成功", resNum) : ZDResponse.error("操作失败", resNum); |
|
|
return resNum > 0 ? ZDResponse.success("操作成功", resNum) : ZDResponse.error("操作失败", resNum); |
|
|
} |
|
|
} |
|
|
@ -119,8 +134,7 @@ public class KnowledgeLibraryController extends BaseController |
|
|
* 知识库详情 |
|
|
* 知识库详情 |
|
|
*/ |
|
|
*/ |
|
|
@GetMapping("/detail/{guid}") |
|
|
@GetMapping("/detail/{guid}") |
|
|
public String detail(@PathVariable("guid") String guid, ModelMap mmap) |
|
|
public String detail(@PathVariable("guid") String guid, ModelMap mmap) { |
|
|
{ |
|
|
|
|
|
KnowledgeLibrary knowledgeLibrary = knowledgeLibraryService.selectKnowledgeLibraryById(guid); |
|
|
KnowledgeLibrary knowledgeLibrary = knowledgeLibraryService.selectKnowledgeLibraryById(guid); |
|
|
mmap.put("knowledgeLibrary", knowledgeLibrary); |
|
|
mmap.put("knowledgeLibrary", knowledgeLibrary); |
|
|
|
|
|
|
|
|
@ -144,8 +158,7 @@ public class KnowledgeLibraryController extends BaseController |
|
|
@RequiresPermissions("small:library:remove") |
|
|
@RequiresPermissions("small:library:remove") |
|
|
@PostMapping("/remove") |
|
|
@PostMapping("/remove") |
|
|
@ResponseBody |
|
|
@ResponseBody |
|
|
public ZDResponse remove(String ids) |
|
|
public ZDResponse remove(String ids) { |
|
|
{ |
|
|
|
|
|
int resNum = knowledgeLibraryService.deleteKnowledgeLibraryByIds(ids); |
|
|
int resNum = knowledgeLibraryService.deleteKnowledgeLibraryByIds(ids); |
|
|
return resNum > 0 ? ZDResponse.success("操作成功", resNum) : ZDResponse.error("操作失败", resNum); |
|
|
return resNum > 0 ? ZDResponse.success("操作成功", resNum) : ZDResponse.error("操作失败", resNum); |
|
|
} |
|
|
} |
|
|
@ -156,8 +169,7 @@ public class KnowledgeLibraryController extends BaseController |
|
|
@RequiresPermissions("small:library:edit") |
|
|
@RequiresPermissions("small:library:edit") |
|
|
@PostMapping("/toPublishState") |
|
|
@PostMapping("/toPublishState") |
|
|
@ResponseBody |
|
|
@ResponseBody |
|
|
public ZDResponse toPublishState(String ids, String state) |
|
|
public ZDResponse toPublishState(String ids, String state) { |
|
|
{ |
|
|
|
|
|
int resNum = knowledgeLibraryService.updatePublishState(ids, state); |
|
|
int resNum = knowledgeLibraryService.updatePublishState(ids, state); |
|
|
return resNum > 0 ? ZDResponse.success("操作成功", resNum) : ZDResponse.error("操作失败", resNum); |
|
|
return resNum > 0 ? ZDResponse.success("操作成功", resNum) : ZDResponse.error("操作失败", resNum); |
|
|
} |
|
|
} |
|
|
@ -168,8 +180,7 @@ public class KnowledgeLibraryController extends BaseController |
|
|
@RequiresPermissions("custom:image:edit") |
|
|
@RequiresPermissions("custom:image:edit") |
|
|
@PostMapping("/changeUp") |
|
|
@PostMapping("/changeUp") |
|
|
@ResponseBody |
|
|
@ResponseBody |
|
|
public ZDResponse changeUp(KnowledgeLibrary knowledge) |
|
|
public ZDResponse changeUp(KnowledgeLibrary knowledge) { |
|
|
{ |
|
|
|
|
|
int resNum = knowledgeLibraryService.updateSrot(knowledge.getSrot(), knowledge.getSrot() + 1); |
|
|
int resNum = knowledgeLibraryService.updateSrot(knowledge.getSrot(), knowledge.getSrot() + 1); |
|
|
if (resNum > 0) { |
|
|
if (resNum > 0) { |
|
|
knowledge.setSrot(knowledge.getSrot() + 1); |
|
|
knowledge.setSrot(knowledge.getSrot() + 1); |
|
|
@ -184,8 +195,7 @@ public class KnowledgeLibraryController extends BaseController |
|
|
@RequiresPermissions("custom:image:edit") |
|
|
@RequiresPermissions("custom:image:edit") |
|
|
@PostMapping("/changeUnder") |
|
|
@PostMapping("/changeUnder") |
|
|
@ResponseBody |
|
|
@ResponseBody |
|
|
public ZDResponse changeUnder(KnowledgeLibrary knowledge) |
|
|
public ZDResponse changeUnder(KnowledgeLibrary knowledge) { |
|
|
{ |
|
|
|
|
|
int resNum = knowledgeLibraryService.updateSrot(knowledge.getSrot(), knowledge.getSrot() - 1); |
|
|
int resNum = knowledgeLibraryService.updateSrot(knowledge.getSrot(), knowledge.getSrot() - 1); |
|
|
if (resNum > 0) { |
|
|
if (resNum > 0) { |
|
|
knowledge.setSrot(knowledge.getSrot() - 1); |
|
|
knowledge.setSrot(knowledge.getSrot() - 1); |
|
|
@ -196,6 +206,7 @@ public class KnowledgeLibraryController extends BaseController |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 查询附件信息 |
|
|
* 查询附件信息 |
|
|
|
|
|
* |
|
|
* @param key |
|
|
* @param key |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@ -209,6 +220,7 @@ public class KnowledgeLibraryController extends BaseController |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 查询附件信息 |
|
|
* 查询附件信息 |
|
|
|
|
|
* |
|
|
* @param key |
|
|
* @param key |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
@ -222,6 +234,7 @@ public class KnowledgeLibraryController extends BaseController |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 删除案例要素附件 |
|
|
* 删除案例要素附件 |
|
|
|
|
|
* |
|
|
* @param key |
|
|
* @param key |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
|