浏览代码

add:内容管理

liujunchi 3 年之前
父节点
当前提交
187bd13cfd
共有 27 个文件被更改,包括 688 次插入383 次删除
  1. 4 4
      cooleshow-cms/pom.xml
  2. 0 85
      cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/controller/HelpCenterCatalogController.java
  3. 125 0
      cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/controller/HelpCenterContentController.java
  4. 0 89
      cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/controller/HelpCenterContentControlller.java
  5. 68 66
      cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/controller/NewsController.java
  6. 16 1
      cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/controller/queryinfo/HelpCenterContentQueryInfo.java
  7. 14 11
      cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/controller/queryinfo/NewsInformationQueryInfo.java
  8. 2 0
      cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/dal/dao/HelpCenterContentDao.java
  9. 23 0
      cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/dal/dao/SysNewsInformationDao.java
  10. 56 16
      cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/dal/entity/HelpCenterContent.java
  11. 48 9
      cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/dal/entity/SysNewsInformation.java
  12. 13 0
      cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/dto/SysNewsInformationDto.java
  13. 2 0
      cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/service/HelpCenterContentService.java
  14. 16 0
      cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/service/SysNewsInformationService.java
  15. 7 0
      cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/service/impl/HelpCenterContentServiceImpl.java
  16. 30 9
      cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/service/impl/SysNewsInformationServiceImpl.java
  17. 45 28
      cooleshow-cms/src/main/resources/config/mybatis/HelpCenterContentMapper.xml
  18. 34 48
      cooleshow-cms/src/main/resources/config/mybatis/SysNewsInformationMapper.xml
  19. 34 0
      cooleshow-common/src/main/java/com/yonge/cooleshow/common/enums/PlatformEnum.java
  20. 25 17
      cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/SysManualController.java
  21. 12 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/SysManualDao.java
  22. 12 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/SysManual.java
  23. 23 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/queryInfo/SysManualQueryInfo.java
  24. 4 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/SysManualService.java
  25. 16 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/SysManualServiceImpl.java
  26. 40 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/SysManualVo.java
  27. 19 0
      cooleshow-user/user-biz/src/main/resources/config/mybatis/SysManualMapper.xml

+ 4 - 4
cooleshow-cms/pom.xml

@@ -68,6 +68,10 @@
 				</exclusion>
 			</exclusions>
 		</dependency>
+		<dependency>
+			<groupId>com.yonge.toolset</groupId>
+			<artifactId>utils</artifactId>
+		</dependency>
 	</dependencies>
 	
 	<build>
@@ -76,10 +80,6 @@
 				<groupId>org.springframework.boot</groupId>
 				<artifactId>spring-boot-maven-plugin</artifactId>
 			</plugin>
-			<plugin>
-				<groupId>com.spotify</groupId>
-				<artifactId>docker-maven-plugin</artifactId>
-			</plugin>
 		</plugins>
 	</build>
 </project>

+ 0 - 85
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/controller/HelpCenterCatalogController.java

@@ -1,85 +0,0 @@
-package com.yonge.cooleshow.cms.controller;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-
-import java.util.Date;
-import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.yonge.cooleshow.cms.dal.entity.HelpCenterCatalog;
-import com.yonge.cooleshow.cms.service.HelpCenterCatalogService;
-import com.yonge.cooleshow.cms.service.HelpCenterContentService;
-import com.yonge.cooleshow.common.controller.BaseController;
-import com.yonge.toolset.log.model.AuditLogAnnotation;
-
-@RestController
-@RequestMapping("helpCenterCatalog")
-@Api(tags = "帮助中心分类")
-public class HelpCenterCatalogController extends BaseController {
-
-	@Autowired
-	private HelpCenterCatalogService helpCenterCatalogService;
-
-	@Autowired
-	private HelpCenterContentService helpCenterContentService;
-
-	@ApiOperation("分类列表分页查询")
-	@GetMapping(value = "list")
-	@ApiImplicitParams({ @ApiImplicitParam(name = "parentId", value = "父分类编号(可为空)", required = true, dataType = "Integer"),
-			@ApiImplicitParam(name = "status", value = "状态(1,显示 0,隐藏;可为空)", required = true, dataType = "Integer") })
-	public Object list(Long parentId, Integer status) {
-		List<HelpCenterCatalog> dataList = helpCenterCatalogService.queryByParentId(parentId, status);
-		return succeed(dataList);
-	}
-
-	@ApiOperation("分类详情查询")
-	@GetMapping(value = "get")
-	@ApiImplicitParam(name = "id", value = "分类编号", required = true, dataType = "Integer", paramType = "path")
-	public Object findHelpCatalogById(Long id) {
-		if (id == null || id <= 0)
-			return failed("请检查输入的ID");
-		return succeed(helpCenterCatalogService.get(id));
-	}
-
-	@ApiOperation("修改分类")
-	@PostMapping(value = "modify", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-	@AuditLogAnnotation(operateName = "帮助中心分类修改",interfaceURL = "helpCenterCatalog/modify")
-	public Object modifyHelpCatalog(HelpCenterCatalog helpCatalog) {
-		if (helpCatalog == null)
-			return failed("参数输入有误");
-		if (helpCatalog.getId() != null && helpCatalog.getId() > 0) {
-			helpCatalog.setModifyOn(new Date());
-			return helpCenterCatalogService.updateCatalog(helpCatalog) ? succeed() : failed("修改失败");
-		} else {
-			if (StringUtils.isBlank(helpCatalog.getText())) {
-				return failed("帮助分类不能为空");
-			}
-			helpCatalog.setCreateOn(new Date());
-			return helpCenterCatalogService.insert(helpCatalog) > 0 ? succeed() : failed("添加失败");
-		}
-	}
-
-	@ApiOperation("删除分类")
-	@PostMapping(value = "delete", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-	@ApiImplicitParam(name = "id", value = "分类编号", required = true, dataType = "Integer", paramType = "path")
-	@AuditLogAnnotation(operateName = "帮助中心分类删除",interfaceURL = "helpCenterCatalog/delete")
-	public Object delHelpCatalog(Long id) {
-		if (id == null || id <= 0)
-			return failed("ID解析失败");
-		List<HelpCenterCatalog> list = helpCenterCatalogService.queryByParentId(id, null);
-		if (list != null && list.size() > 0) {
-			return failed("删除失败,请先删除子集分类");
-		}
-		return helpCenterCatalogService.deleteCatalog(id) ? succeed() : failed("删除失败");
-	}
-}

+ 125 - 0
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/controller/HelpCenterContentController.java

@@ -0,0 +1,125 @@
+package com.yonge.cooleshow.cms.controller;
+
+import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
+import com.yonge.cooleshow.auth.api.entity.SysUser;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+
+import java.util.Date;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.*;
+
+import com.yonge.cooleshow.cms.controller.queryinfo.HelpCenterContentQueryInfo;
+import com.yonge.cooleshow.cms.dal.entity.HelpCenterContent;
+import com.yonge.cooleshow.cms.service.HelpCenterContentService;
+import com.yonge.cooleshow.common.controller.BaseController;
+import com.yonge.cooleshow.common.page.PageInfo;
+import com.yonge.toolset.log.model.AuditLogAnnotation;
+
+import javax.validation.Valid;
+
+@RestController
+@RequestMapping("helpCenterContent")
+@Api(tags = "帮助中心/公告内容")
+public class HelpCenterContentController extends BaseController {
+
+	@Autowired
+	private HelpCenterContentService helpCenterContentService;
+
+	@Autowired
+	private SysUserFeignService sysUserFeignService;
+
+	@ApiOperation(value = "帮助中心/公告内容列表分页查询", httpMethod="POST", consumes="application/json", produces="application/json")
+	@PostMapping(value = "list", consumes="application/json", produces="application/json")
+	public Object findHelpContentByCondition(@Valid @RequestBody HelpCenterContentQueryInfo queryInfo) {
+
+		PageInfo<HelpCenterContent> data = helpCenterContentService.queryPage(queryInfo);
+		return succeed(data);
+	}
+
+	@ApiOperation("帮助中心/公告内容明细查询")
+	@GetMapping(value = "get/{id}")
+	@ApiImplicitParam(name = "id", value = "编号", required = true, dataType = "Integer", paramType = "path")
+	public Object findHelpContentByKey(@PathVariable("id") Long id) {
+		if (id == null || id <= 0) {
+			return failed("请检查输入的参数");
+		}
+		return succeed(helpCenterContentService.get(id));
+	}
+
+	@ApiOperation(value = "新增/修改帮助中心/公告内容", httpMethod="POST", consumes="application/json", produces="application/json")
+	@PostMapping(value = "modify",consumes="application/json", produces="application/json")
+	public Object modifyHelpContent(@Valid @RequestBody HelpCenterContent helpContent) {
+		if (helpContent == null) {
+			return failed("参数输入有误");
+		}
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if (sysUser == null || sysUser.getId() == null) {
+			return failed("用户信息获取失败");
+		}
+		if (helpContent.getId() != null && helpContent.getId() > 0) {
+
+			HelpCenterContent helpCenterContent = helpCenterContentService.get(helpContent.getId());
+			if (helpCenterContent == null) {
+				return failed("未找到相关信息");
+			}
+			if (helpCenterContent.getStatus() == 1) {
+				return failed("启用状态下,不能修改");
+			}
+
+			helpContent.setStatus(0);
+			helpContent.setUpdateBy(sysUser.getId());
+			helpContent.setModifyOn(new Date());
+			return helpCenterContentService.update(helpContent) > 0 ? succeed() : failed("修改失败");
+		} else {
+			if (StringUtils.isBlank(helpContent.getContent())) {
+				return failed("帮助内容不能为空");
+			}
+			if (StringUtils.isBlank(helpContent.getTitle())) {
+				return failed("帮助中心标题不能为空");
+			}
+			if (helpContent.getCatalogId() < 0) {
+				return failed("请设置分类");
+			}
+			helpContent.setStatus(0);
+			helpContent.setUpdateBy(sysUser.getId());
+			helpContent.setModifyOn(new Date());
+			helpContent.setCreateOn(new Date());
+			helpContent.setCreateBy(sysUser.getId());
+			return helpCenterContentService.insert(helpContent) > 0 ? succeed() : failed("添加失败");
+		}
+	}
+
+	@ApiOperation("删除帮助中心/公告内容")
+	@PostMapping(value = "delete/{id}")
+	@ApiImplicitParam(name = "id", value = "编号", required = true, dataType = "Integer", paramType = "path")
+	public Object delHelpContent(@PathVariable("id") Long id) {
+		if (id == null || id <= 0)
+			return failed("ID解析失败");
+		HelpCenterContent helpCenterContent = helpCenterContentService.get(id);
+		if (helpCenterContent == null) {
+			return failed("未找到相关信息");
+		}
+		if (helpCenterContent.getStatus() == 1) {
+			return failed("启用状态下,不能删除");
+		}
+		return helpCenterContentService.delete(id) > 0 ? succeed() : failed("删除失败");
+	}
+
+	@ApiOperation("启用/禁用")
+	@PostMapping(value = "status/{id}")
+	@ApiImplicitParam(name = "id", value = "编号", required = true, dataType = "Integer", paramType = "path")
+	public Object statusHelpContent(@PathVariable("id") Long id) {
+		if (id == null || id <= 0)
+			return failed("ID解析失败");
+		HelpCenterContent helpCenterContent = helpCenterContentService.get(id);
+		if (helpCenterContent == null) {
+			return failed("未找到相关信息");
+		}
+		return succeed(helpCenterContentService.status(id));
+	}
+}

+ 0 - 89
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/controller/HelpCenterContentControlller.java

@@ -1,89 +0,0 @@
-package com.yonge.cooleshow.cms.controller;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiOperation;
-
-import java.util.Date;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.yonge.cooleshow.cms.controller.queryinfo.HelpCenterContentQueryInfo;
-import com.yonge.cooleshow.cms.dal.entity.HelpCenterContent;
-import com.yonge.cooleshow.cms.service.HelpCenterCatalogService;
-import com.yonge.cooleshow.cms.service.HelpCenterContentService;
-import com.yonge.cooleshow.common.controller.BaseController;
-import com.yonge.cooleshow.common.page.PageInfo;
-import com.yonge.toolset.log.model.AuditLogAnnotation;
-
-@RestController
-@RequestMapping("helpCenterContent")
-@Api(tags = "帮助中心内容")
-public class HelpCenterContentControlller extends BaseController {
-
-	@Autowired
-	private HelpCenterContentService helpCenterContentService;
-
-	@Autowired
-	private HelpCenterCatalogService helpCenterCatalogService;
-
-	@ApiOperation("帮助中心内容列表分页查询")
-	@GetMapping(value = "list")
-	public Object findHelpContentByCondition(HelpCenterContentQueryInfo queryInfo) {
-
-		PageInfo<HelpCenterContent> data = helpCenterContentService.queryPage(queryInfo);
-		return succeed(data);
-	}
-
-	@ApiOperation("帮助中心内容明细查询")
-	@GetMapping(value = "get")
-	@ApiImplicitParam(name = "id", value = "编号", required = true, dataType = "Integer", paramType = "path")
-	public Object findHelpContentByKey(Long id) {
-		if (id == null || id <= 0) {
-			return failed("请检查输入的参数");
-		}
-		return succeed(helpCenterContentService.get(id));
-	}
-
-	@ApiOperation("修改帮助中心内容")
-	@PostMapping(value = "modify", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-	@AuditLogAnnotation(operateName = "帮助中心内容修改",interfaceURL = "helpCenterContent/modify")
-	public Object modifyHelpContent(HelpCenterContent helpContent) {
-		if (helpContent == null) {
-			return failed("参数输入有误");
-		}
-
-		if (helpContent.getId() != null && helpContent.getId() > 0) {
-			helpContent.setModifyOn(new Date());
-			return helpCenterContentService.update(helpContent) > 0 ? succeed() : failed("修改失败");
-		} else {
-			if (StringUtils.isBlank(helpContent.getContent())) {
-				return failed("帮助内容不能为空");
-			}
-			if (StringUtils.isBlank(helpContent.getTitle())) {
-				return failed("帮助中心标题不能为空");
-			}
-			if (helpContent.getCatalogId() < 0) {
-				return failed("请选择分类");
-			}
-			helpContent.setCreateOn(new Date());
-			return helpCenterContentService.insert(helpContent) > 0 ? succeed() : failed("添加失败");
-		}
-	}
-
-	@ApiOperation("删除帮助中心内容")
-	@PostMapping(value = "delete", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-	@ApiImplicitParam(name = "id", value = "编号", required = true, dataType = "Integer", paramType = "path")
-	@AuditLogAnnotation(operateName = "帮助中心内容删除",interfaceURL = "helpCenterContent/delete")
-	public Object delHelpContent(Long id) {
-		if (id == null || id <= 0)
-			return failed("ID解析失败");
-		return helpCenterContentService.delete(id) > 0 ? succeed() : failed("删除失败");
-	}
-}

+ 68 - 66
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/controller/NewsController.java

@@ -1,5 +1,9 @@
 package com.yonge.cooleshow.cms.controller;
 
+import com.yonge.cooleshow.cms.dal.entity.NewsStatusEnum;
+import com.yonge.cooleshow.cms.dto.SysNewsInformationDto;
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import com.yonge.cooleshow.common.page.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
@@ -11,11 +15,7 @@ import java.util.Map;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.MediaType;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
@@ -29,99 +29,101 @@ import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.toolset.log.model.AuditLogAnnotation;
 import com.yonge.toolset.utils.collection.MapUtil;
 
+import javax.validation.Valid;
+
 @RestController
 @RequestMapping("news")
-@Api(tags = "资讯服务")
+@Api(tags = "资讯/广告/闪页/轮播图服务")
 public class NewsController extends BaseController {
 
 	@Autowired
 	private SysNewsInformationService sysNewsInformationService;
-	
-	@Autowired
-	private SysNewsTypeService sysNewsTypeService;
-	
-	@Autowired
-	private SysNewsInformationDao sysNewsInformationDao;
-	
+
 	@Autowired
 	private SysUserFeignService sysUserFeignService;
-	
-	@Autowired
-	private StudentRegistrationDao studentRegistrationDao;
-
-	@ApiOperation("资讯列表分页查询")
-	@GetMapping(value = "/list")
-	public Object getList(NewsInformationQueryInfo queryInfo) {
-		
-		Map<String, Object> params = new HashMap<String, Object>();
-		MapUtil.populateMap(params, queryInfo);
-		int count = sysNewsInformationDao.queryCount(params);
-		if(count == 0){
-			queryInfo.setMemo(null);
-		}
-		return succeed(sysNewsInformationService.queryPage(queryInfo));
-	}
 
-	@ApiOperation("资讯列表分页查询")
-	@GetMapping(value = "/queryPage")
-	public Object queryPage(NewsInformationQueryInfo queryInfo) {
+	@ApiOperation(value = "资讯/广告/闪页/轮播图 列表分页查询", httpMethod="POST", consumes="application/json", produces="application/json")
+	@PostMapping(value = "/page",  consumes="application/json", produces="application/json")
+	public HttpResponseResult<PageInfo<SysNewsInformationDto>> getList(@Valid @RequestBody NewsInformationQueryInfo queryInfo) {
 		
-		Map<String, Object> params = new HashMap<String, Object>();
+		Map<String, Object> params = new HashMap<>();
 		MapUtil.populateMap(params, queryInfo);
-		int count = sysNewsInformationDao.queryCount(params);
-		if(count == 0){
-			queryInfo.setMemo(null);
-		}
-		return succeed(sysNewsInformationService.queryPage(queryInfo));
+		return succeed(sysNewsInformationService.selectPage(queryInfo));
 	}
 
-	@ApiOperation("资讯类型列表查询")
-	@GetMapping(value = "/typeList")
-	public Object getTypeList(Long parentId) {
-		return succeed(sysNewsTypeService.queryByParentId(parentId));
-	}
 
-	@ApiOperation("资讯列表分页查询")
-	@GetMapping(value = "/homeList")
-	public Object getHomeList(NewsInformationQueryInfo queryInfo) {
-		queryInfo.setRows(10);
-		SysUser user = sysUserFeignService.queryUserInfo();
-		return succeed(sysNewsInformationService.getHomeList(user, queryInfo));
-	}
-
-	@ApiOperation("查询资讯详情")
+	@ApiOperation("查询资讯/广告/闪页/轮播图 详情")
 	@ApiImplicitParam(name = "id", value = "资讯ID编号", required = true, dataType = "Long", paramType = "path")
-	@GetMapping(value = "/query")
-	public Object query(Long id) {
+	@GetMapping(value = "/query/{id}")
+	public HttpResponseResult<SysNewsInformationDto> query(@PathVariable Long id) {
 
 		return succeed(sysNewsInformationService.queryById(id));
 	}
 
-	@ApiOperation("新增资讯")
-	@PostMapping(value = "/add", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+	@ApiOperation(value = "新增资讯/广告/闪页/轮播图 ", httpMethod="POST", consumes="application/json", produces="application/json")
+	@PostMapping(value = "/add",  consumes="application/json", produces="application/json")
 	@AuditLogAnnotation(operateName = "资讯新增",interfaceURL = "news/add")
-	@PreAuthorize("@pcs.hasPermissions('news/add')")
-	public Object add(SysNewsInformation newsInfo) {
+	// @PreAuthorize("@pcs.hasPermissions('news/add')")
+	public Object add(@Valid @RequestBody  SysNewsInformation newsInfo) {
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if (sysUser == null || sysUser.getId() == null) {
+			return failed("用户信息获取失败");
+		}
+		newsInfo.setStatus(NewsStatusEnum.HIDDEN);
+		newsInfo.setCreateTime(new Date());
+		newsInfo.setCreateBy(sysUser.getId());
+		newsInfo.setUpdateTime(new Date());
+		newsInfo.setUpdateBy(sysUser.getId());
 		return succeed(sysNewsInformationService.insert(newsInfo));
 	}
 
-	@ApiOperation("更新资讯")
-	@PostMapping(value = "/update", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+	@ApiOperation(value = "更新资讯/广告/闪页/轮播图 ", httpMethod="POST", consumes="application/json", produces="application/json")
+	@PostMapping(value = "/update",  consumes="application/json", produces="application/json")
 	@AuditLogAnnotation(operateName = "资讯更新",interfaceURL = "news/update")
-	@PreAuthorize("@pcs.hasPermissions('news/update')")
-	public Object update(SysNewsInformation newsInfo) {
-		Date date = new Date();
-		newsInfo.setUpdateTime(date);
+	// @PreAuthorize("@pcs.hasPermissions('news/update')")
+	public Object update(@Valid @RequestBody  SysNewsInformation newsInfo) {
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if (sysUser == null || sysUser.getId() == null) {
+			return failed("用户信息获取失败");
+		}
+
+		SysNewsInformationDto sysNewsInformationDto = sysNewsInformationService.queryById(newsInfo.getId());
+		if (sysNewsInformationDto == null) {
+			return failed("未找到相关信息");
+		}
+		if(NewsStatusEnum.SHOW.getCode().equals(sysNewsInformationDto.getStatus().getCode())) {
+			return failed("启用状态下,不可修改");
+		}
+		newsInfo.setUpdateTime(new Date());
+		newsInfo.setUpdateBy(sysUser.getId());
 
 		return succeed(sysNewsInformationService.update(newsInfo));
 	}
 
 	@ApiOperation("删除")
-	@PostMapping(value = "/del/{id}", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+	@PostMapping(value = "/del/{id}")
 	@AuditLogAnnotation(operateName = "资讯删除",interfaceURL = "news/del")
-	@PreAuthorize("@pcs.hasPermissions('news/del')")
+	// @PreAuthorize("@pcs.hasPermissions('news/del')")
 	public Object add(@PathVariable("id") Long id) {
+		SysNewsInformationDto sysNewsInformationDto = sysNewsInformationService.queryById(id);
+		if (sysNewsInformationDto == null) {
+			return failed("未找到相关信息");
+		}
+		if(NewsStatusEnum.SHOW.getCode().equals(sysNewsInformationDto.getStatus().getCode())) {
+			return failed("启用状态下,不可删除");
+		}
 		return succeed(sysNewsInformationService.deleteWithLogical(id));
 	}
 
+	@ApiOperation("启用/停用")
+	@PostMapping(value = "/status/{id}")
+	@AuditLogAnnotation(operateName = "资讯启用/停用",interfaceURL = "news/update")
+	// @PreAuthorize("@pcs.hasPermissions('news/del')")
+	public Object status(@PathVariable("id") Long id) {
+		SysNewsInformationDto sysNewsInformationDto = sysNewsInformationService.queryById(id);
+		if (sysNewsInformationDto == null) {
+			return failed("未找到相关信息");
+		}
+		return succeed(sysNewsInformationService.updateStatus(id));
+	}
 }

+ 16 - 1
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/controller/queryinfo/HelpCenterContentQueryInfo.java

@@ -4,17 +4,32 @@ import io.swagger.annotations.ApiModelProperty;
 
 import com.yonge.cooleshow.common.page.QueryInfo;
 
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
 public class HelpCenterContentQueryInfo extends QueryInfo {
 
-	@ApiModelProperty(value = "父分类ID,多个用逗号分隔", required = false)
+	@ApiModelProperty(value = "父分类ID,1:帮助中心,2:公告管理", required = false)
+	@NotNull(message = "父分类不能为空")
 	private String catalogIds;
 
+	@ApiModelProperty("平台类型 STUDENT:学生  TEACHER:老师")
+	private String catalogType;
+
 	@ApiModelProperty(value = "标题", required = false)
 	private String title;
 
 	@ApiModelProperty(value = "状态(1-显示 0-隐藏)", required = false)
 	private Integer status;
 
+	public String getCatalogType() {
+		return catalogType;
+	}
+
+	public void setCatalogType(String catalogType) {
+		this.catalogType = catalogType;
+	}
+
 	public String getCatalogIds() {
 		return catalogIds;
 	}

+ 14 - 11
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/controller/queryinfo/NewsInformationQueryInfo.java

@@ -8,29 +8,32 @@ import java.util.List;
 import com.yonge.cooleshow.cms.dal.entity.NewsStatusEnum;
 import com.yonge.cooleshow.common.page.QueryInfo;
 
+import javax.validation.constraints.NotNull;
+
 public class NewsInformationQueryInfo extends QueryInfo {
 
-	@ApiModelProperty(value = "类型,1精彩活动,2热门资讯,3banner类型", required = false)
+	@ApiModelProperty(value = "类型,1热门资讯,2开屏广告,3闪页管理,4轮播图管理", required = true)
+	@NotNull(message = "类型不能为空")
 	private Integer type;
-	
-	@ApiModelProperty(value = "子类型", required = false)
-	private Integer subType;
 
-	@ApiModelProperty(value = "资讯状态", required = false)
+	@ApiModelProperty(value = "子类型  IMAGE:图片,VIDEO:视频", required = false)
+	private String subType;
+
+	@ApiModelProperty(value = "资讯状态(0:禁用,1:启用)", required = false)
 	private NewsStatusEnum status;
 
-	@ApiModelProperty(value = "标题", required = false)
+	@ApiModelProperty(value = "编号/标题", required = false)
 	private String title;
 
 	@ApiModelProperty(value = "备注", required = false)
 	private String memo;
-	
+
 	@ApiModelProperty(value = "声部编号", required = false)
 	private Integer subjectId;
-	
+
 	@ApiModelProperty(value = "需排除编号")
 	private List<Long> excludeIds;
-	
+
 	private Date date;
 
 	public Integer getType() {
@@ -41,11 +44,11 @@ public class NewsInformationQueryInfo extends QueryInfo {
 		this.type = type;
 	}
 
-	public Integer getSubType() {
+	public String getSubType() {
 		return subType;
 	}
 
-	public void setSubType(Integer subType) {
+	public void setSubType(String subType) {
 		this.subType = subType;
 	}
 

+ 2 - 0
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/dal/dao/HelpCenterContentDao.java

@@ -10,4 +10,6 @@ public interface HelpCenterContentDao extends BaseDAO<Long, HelpCenterContent> {
 	public int updateContentByCatalog(Map<String, Object> map);
 
 	public int deleteContentByCatalog(Long catalogId);
+
+    void status(Long id);
 }

+ 23 - 0
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/dal/dao/SysNewsInformationDao.java

@@ -34,4 +34,27 @@ public interface SysNewsInformationDao extends BaseDAO<Long, SysNewsInformation>
 	List<SysNewsInformation> queryNeedUpdateStatusList();
 	
 	SysNewsInformationDto queryById(Long id);
+
+	/**
+	 * 分页数量
+	 *
+	 * @param params
+	 * @return
+	 */
+	int selectPageCount(Map<String, Object> params);
+
+	/**
+	 * 分页数据
+	 *
+	 * @param params
+	 * @return
+	 */
+	List<SysNewsInformationDto> selectPage(Map<String, Object> params);
+
+	/**
+	 * 修改状态
+	 *
+	 * @param id
+	 */
+    void updateStatus(Long id);
 }

+ 56 - 16
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/dal/entity/HelpCenterContent.java

@@ -2,42 +2,90 @@ package com.yonge.cooleshow.cms.dal.entity;
 
 import io.swagger.annotations.ApiModelProperty;
 
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
 public class HelpCenterContent {
 
 	@ApiModelProperty(value = "编号", required = false)
 	private Long id;
 
-	@ApiModelProperty(value = "标题", required = false)
+	@ApiModelProperty(value = "标题", required = true)
+	@NotBlank(message = "标题不能为空")
 	private String title;
 
-	@ApiModelProperty(value = "内容", required = false)
+	@ApiModelProperty(value = "内容", required = true)
+	@NotBlank(message = "正文不能为空")
 	private String content = "";
 
-	@ApiModelProperty(value = "分类ID", required = false)
+	@ApiModelProperty(value = "父分类ID,1:帮助中心,2:公告管理",required = true)
+	@NotNull(message = "分类不能为空 ")
 	private Long catalogId;
 
+	@ApiModelProperty(value = "分类类型 STUDENT:学生端  TEACHER:老师端",required = true)
+	@NotBlank(message = "平台类型不能为空")
+	private String catalogType;
 	/** 创建时间 */
 	private java.util.Date createOn;
 
 	/** 修改时间 */
 	private java.util.Date modifyOn;
 
+	private Long createBy;
+
+	private Long updateBy;
+
+
+
 	@ApiModelProperty(value = "状态 1显示 0隐藏", required = false)
 	private Integer status;
 
 	@ApiModelProperty(value = "排序", required = false)
 	private Integer order;
 
-	private HelpCenterCatalog catalog;
+	@ApiModelProperty("修改人姓名")
+	private String updateName;
+
+	public String getUpdateName() {
+		return updateName;
+	}
+
+	public void setUpdateName(String updateName) {
+		this.updateName = updateName;
+	}
+
+	public Long getCatalogId() {
+		return catalogId;
+	}
 
-	public HelpCenterCatalog getCatalog() {
-		return catalog;
+	public void setCatalogId(Long catalogId) {
+		this.catalogId = catalogId;
 	}
 
-	public void setCatalog(HelpCenterCatalog catalog) {
-		this.catalog = catalog;
+	public String getCatalogType() {
+		return catalogType;
 	}
 
+	public void setCatalogType(String catalogType) {
+		this.catalogType = catalogType;
+	}
+	public Long getCreateBy() {
+		return createBy;
+	}
+
+	public void setCreateBy(Long createBy) {
+		this.createBy = createBy;
+	}
+
+	public Long getUpdateBy() {
+		return updateBy;
+	}
+
+	public void setUpdateBy(Long updateBy) {
+		this.updateBy = updateBy;
+	}
+
+
 	public Integer getOrder() {
 		return order;
 	}
@@ -70,14 +118,6 @@ public class HelpCenterContent {
 		return this.content;
 	}
 
-	public void setCatalogId(Long catalogId) {
-		this.catalogId = catalogId;
-	}
-
-	public Long getCatalogId() {
-		return this.catalogId;
-	}
-
 	public void setCreateOn(java.util.Date createOn) {
 		this.createOn = createOn;
 	}

+ 48 - 9
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/dal/entity/SysNewsInformation.java

@@ -6,6 +6,9 @@ import java.util.Date;
 
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
 /**
  * 对应数据库表(sys_news_information):
  */
@@ -16,10 +19,12 @@ public class SysNewsInformation {
 
 	/** 标题 */
 	@ApiModelProperty(value = "标题", required = true)
+	@NotBlank(message = "标题不能为空")
 	private String title;
 
 	/** 内容 */
 	@ApiModelProperty(value = "内容", required = true)
+	@NotBlank(message = "内容不能为空")
 	private String content;
 
 	/** 封面图片 */
@@ -31,20 +36,21 @@ public class SysNewsInformation {
 	private String videoCoverImage;
 
 	/** 类型 */
-	@ApiModelProperty(value = "类型,1精彩活动,2热门资讯,3banner类型", required = true)
+	@ApiModelProperty(value = "类型,1热门资讯,2开屏广告,3闪页管理,4轮播图管理", required = true)
+	@NotNull(message = "类型不能为空")
 	private Integer type;
 	
-	@ApiModelProperty(value = "子类型", required = false)
-	private Integer subType;
+	@ApiModelProperty(value = "子类型  IMAGE:图片,VIDEO:视频 ", required = false)
+	private String subType;
 
 	/** 状态(1-可见 0-不可见) */
-	@ApiModelProperty(value = "状态(1-可见 0-不可见)", required = true)
+	@ApiModelProperty(value = "状态(1-启用 0-禁用)")
 	private NewsStatusEnum status;
 
-	@ApiModelProperty(value = "链接地址", required = true)
+	@ApiModelProperty(value = "链接地址")
 	private String linkUrl;
 
-	@ApiModelProperty(value = "跳转类型_bank,_slef", required = true)
+	@ApiModelProperty(value = "跳转类型_bank,_slef")
 	private String hrefTarget;
 
 	@ApiModelProperty(value = "顺序号", required = true)
@@ -56,9 +62,18 @@ public class SysNewsInformation {
 	@ApiModelProperty(value = "下线时间", required = false)
 	private Date offlineTime;
 
+	@ApiModelProperty("展示时间")
+	private Integer showTime;
 	/**  */
 	private java.util.Date createTime;
 
+
+	@ApiModelProperty(value = "创建人id",hidden = true)
+	private Long createBy;
+
+	@ApiModelProperty(value = "修改人id",hidden = true)
+	private Long updateBy;
+
 	/**  */
 	private java.util.Date updateTime;
 
@@ -74,7 +89,31 @@ public class SysNewsInformation {
 	private String subjectIdList;
 	
 	private String subjectName;
-	
+
+	public Integer getShowTime() {
+		return showTime;
+	}
+
+	public void setShowTime(Integer showTime) {
+		this.showTime = showTime;
+	}
+
+	public Long getCreateBy() {
+		return createBy;
+	}
+
+	public void setCreateBy(Long createBy) {
+		this.createBy = createBy;
+	}
+
+	public Long getUpdateBy() {
+		return updateBy;
+	}
+
+	public void setUpdateBy(Long updateBy) {
+		this.updateBy = updateBy;
+	}
+
 	public String getLinkUrl() {
 		return linkUrl;
 	}
@@ -187,11 +226,11 @@ public class SysNewsInformation {
 		this.delFlag = delFlag;
 	}
 
-	public Integer getSubType() {
+	public String getSubType() {
 		return subType;
 	}
 
-	public void setSubType(Integer subType) {
+	public void setSubType(String subType) {
 		this.subType = subType;
 	}
 

+ 13 - 0
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/dto/SysNewsInformationDto.java

@@ -1,6 +1,7 @@
 package com.yonge.cooleshow.cms.dto;
 
 import com.yonge.cooleshow.cms.dal.entity.SysNewsInformation;
+import io.swagger.annotations.ApiModelProperty;
 
 public class SysNewsInformationDto extends SysNewsInformation {
 
@@ -8,6 +9,18 @@ public class SysNewsInformationDto extends SysNewsInformation {
 
 	private String subTypeName;
 
+	@ApiModelProperty("更新人姓名")
+	private String updateName;
+
+
+	public String getUpdateName() {
+		return updateName;
+	}
+
+	public void setUpdateName(String updateName) {
+		this.updateName = updateName;
+	}
+
 	public String getTypeName() {
 		return typeName;
 	}

+ 2 - 0
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/service/HelpCenterContentService.java

@@ -8,4 +8,6 @@ public interface HelpCenterContentService extends BaseService<Long,HelpCenterCon
 	public boolean updateContentByCatalog(Long catalogId,Integer status);
 	
 	public boolean deleteContentByCatalog(Long catalogId);
+
+    boolean status(Long id);
 }

+ 16 - 0
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/service/SysNewsInformationService.java

@@ -8,6 +8,7 @@ import com.yonge.cooleshow.cms.controller.queryinfo.NewsInformationQueryInfo;
 import com.yonge.cooleshow.cms.dal.entity.SysNewsInformation;
 import com.yonge.cooleshow.cms.dto.SysNewsInformationDto;
 import com.yonge.cooleshow.common.page.PageInfo;
+import com.yonge.cooleshow.common.page.QueryInfo;
 import com.yonge.cooleshow.common.service.BaseService;
 
 public interface SysNewsInformationService extends BaseService<Long, SysNewsInformation> {
@@ -46,4 +47,19 @@ public interface SysNewsInformationService extends BaseService<Long, SysNewsInfo
 	 * @return
 	 */
 	boolean autoUpdateStatus();
+
+	/**
+	 * 分页查询
+	 *
+	 * @param params 参数
+	 * @return
+	 */
+	PageInfo<SysNewsInformationDto> selectPage(QueryInfo params);
+
+	/**
+	 * 修改状态
+	 * @param id
+	 * @return
+	 */
+    boolean updateStatus(Long id);
 }

+ 7 - 0
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/service/impl/HelpCenterContentServiceImpl.java

@@ -38,4 +38,11 @@ public class HelpCenterContentServiceImpl extends BaseServiceImpl<Long, HelpCent
 		return true;
 	}
 
+    @Override
+    public boolean status(Long id) {
+
+		contentCenterDao.status(id);
+		return true;
+    }
+
 }

+ 30 - 9
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/service/impl/SysNewsInformationServiceImpl.java

@@ -1,14 +1,5 @@
 package com.yonge.cooleshow.cms.service.impl;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.cms.controller.queryinfo.NewsInformationQueryInfo;
 import com.yonge.cooleshow.cms.dal.dao.SysNewsInformationDao;
@@ -21,6 +12,10 @@ import com.yonge.cooleshow.common.page.PageInfo;
 import com.yonge.cooleshow.common.page.QueryInfo;
 import com.yonge.cooleshow.common.service.impl.BaseServiceImpl;
 import com.yonge.toolset.utils.collection.MapUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
 
 @Service
 public class SysNewsInformationServiceImpl extends BaseServiceImpl<Long, SysNewsInformation> implements SysNewsInformationService {
@@ -156,4 +151,30 @@ public class SysNewsInformationServiceImpl extends BaseServiceImpl<Long, SysNews
 		return true;
 	}
 
+    @Override
+    public PageInfo<SysNewsInformationDto> selectPage(QueryInfo queryInfo) {
+		PageInfo<SysNewsInformationDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+		Map<String, Object> params = new HashMap<>();
+		MapUtil.populateMap(params, queryInfo);
+		List<SysNewsInformationDto> dataList = null;
+		int count = sysNewsInformationDao.selectPageCount(params);
+		if (count > 0) {
+			pageInfo.setTotal(count);
+			params.put("offset", pageInfo.getOffset());
+			dataList = sysNewsInformationDao.selectPage(params);
+		}
+		if (count == 0) {
+			dataList = new ArrayList<>();
+		}
+		pageInfo.setRows(dataList);
+		return pageInfo;
+    }
+
+    @Override
+    public boolean updateStatus(Long id) {
+		sysNewsInformationDao.updateStatus(id);
+
+		return true;
+    }
+
 }

+ 45 - 28
cooleshow-cms/src/main/resources/config/mybatis/HelpCenterContentMapper.xml

@@ -2,24 +2,22 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="com.yonge.cooleshow.cms.dal.dao.HelpCenterContentDao">
 	<resultMap id="HelpCenterContent" type="com.yonge.cooleshow.cms.dal.entity.HelpCenterContent">
-		<id column="id_" property="id" jdbcType="INTEGER" />
+		<id column="id_" property="id" jdbcType="BIGINT" />
 		<result column="title_" property="title" jdbcType="VARCHAR" />
 		<result column="create_on_" property="createOn" jdbcType="TIMESTAMP" />
 		<result column="modify_on_" property="modifyOn" jdbcType="TIMESTAMP" />
 		<result column="status_" property="status" jdbcType="INTEGER" />
 		<result column="order_" property="order" jdbcType="INTEGER" />
-		<result column="catalog_id_" property="catalogId" jdbcType="INTEGER" />
-		<association property="catalog" 
-			javaType="com.yonge.cooleshow.cms.dal.entity.HelpCenterCatalog">
-			<result column="catalog_id_" property="id" />
-			<result column="name_" property="text" />
-			<result column="parent_id_" property="parentId" />
-		</association>
+		<result column="catalog_id_" property="catalogId" jdbcType="BIGINT" />
+		<result column="catalog_type_" property="catalogType" jdbcType="VARCHAR"/>
+		<result column="create_by_" property="createBy" jdbcType="BIGINT" />
+		<result column="update_by_" property="updateBy" jdbcType="BIGINT" />
 	</resultMap>
 
 	<resultMap id="HelpCenterContentBlobs" type="com.yonge.cooleshow.cms.dal.entity.HelpCenterContent"
 		extends="HelpCenterContent">
 		<result column="content_" property="content" jdbcType="LONGVARCHAR" />
+		<result column="updateName" property="updateName" jdbcType="VARCHAR" />
 	</resultMap>
 	<!-- 查询条件 -->
 	<sql id="queryConditionUnion">
@@ -33,6 +31,9 @@
 			<if test="status!= null">
 				and content.status_ = #{status}
 			</if>
+			<if test="catalogType != null and catalogType != ''">
+				and content.catalog_type_ = #{catalogType}
+			</if>
 		</where>
 	</sql>
 	
@@ -45,29 +46,31 @@
 		content.create_on_,
 		content.modify_on_,content.status_,content.content_,content.order_,
 		catalog.id_,
-		catalog.name_, catalog.parent_id_
+		catalog.name_, catalog.parent_id_,content.catalog_type_,content.create_by_,content.update_by_
 	</sql>
 
 	<sql id="Blob_Column_List">
 		content_
 	</sql>
 
-	<select id="get" resultMap="HelpCenterContentBlobs" parameterType="java.lang.Integer">
+	<select id="get" resultMap="HelpCenterContentBlobs">
 		select
 		<include refid="Base_Column_List_union" />
-		from help_center_content content left join help_center_catalog catalog on
+		from help_center_content content
+		left join help_center_catalog catalog on
 		content.catalog_id_=catalog.id_
-		where content.id_ =
-		#{id,jdbcType=INTEGER}
+		where content.id_ = #{id}
 	</select>
 
 	<select id="queryPage" parameterType="map" resultMap="HelpCenterContentBlobs">
 		select
 		<include refid="Base_Column_List_union" />
-		from help_center_content content left join help_center_catalog catalog on
-		content.catalog_id_=catalog.id_
+		,su.username_ as updateName
+		from help_center_content content
+		left join help_center_catalog catalog on content.catalog_id_=catalog.id_
+		left join sys_user su on content.update_by_ = su.id_
 		<include refid="queryConditionUnion" />
-		order by order_ asc
+		order by content.order_ asc
 		<include refid="global.limit" />
 	</select>
 
@@ -77,9 +80,9 @@
 		<include refid="queryConditionUnion" />
 	</select>
 
-	<delete id="delete" parameterType="java.lang.Integer">
+	<delete id="delete">
 		delete from help_center_content
-		where id_ = #{id,jdbcType=INTEGER}
+		where id_ = #{id}
 	</delete>
 	
 	<delete id="deleteContentByCatalog" parameterType="java.lang.Integer">
@@ -90,13 +93,13 @@
 	<insert id="insert" parameterType="com.yonge.cooleshow.cms.dal.entity.HelpCenterContent">
 		insert into help_center_content
 		(id_, title_, catalog_id_,
-		create_on_, modify_on_, content_,status_,order_
+		create_on_, modify_on_, content_,status_,order_,update_by_,create_by_,catalog_type_
 		)
 		values
 		(#{id,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR},
 		#{catalogId,jdbcType=INTEGER},
 		#{createOn,jdbcType=TIMESTAMP},
-		#{modifyOn,jdbcType=TIMESTAMP}, #{content,jdbcType=LONGVARCHAR},#{status,jdbcType=INTEGER},#{order,jdbcType=INTEGER}
+		#{modifyOn,jdbcType=TIMESTAMP}, #{content,jdbcType=LONGVARCHAR},#{status,jdbcType=INTEGER},#{order,jdbcType=INTEGER},#{createBy},#{updateBy},#{catalogType}
 		)
 	</insert>
 
@@ -104,28 +107,37 @@
 		update help_center_content
 		<set>
 			<if test="title != null">
-				title_ = #{title,jdbcType=VARCHAR},
+				title_ = #{title},
 			</if>
 			<if test="catalogId != null">
-				catalog_id_ = #{catalogId,jdbcType=INTEGER},
+				catalog_id_ =#{catalogId},
 			</if>
 			<if test="createOn != null">
-				create_on_ = #{createOn,jdbcType=TIMESTAMP},
+				create_on_ = #{createOn},
 			</if>
 			<if test="modifyOn != null">
-				modify_on_ = #{modifyOn,jdbcType=TIMESTAMP},
+				modify_on_ = #{modifyOn},
 			</if>
 			<if test="content != null">
-				content_ = #{content,jdbcType=LONGVARCHAR},
+				content_ = #{content},
 			</if>
 			<if test="status != null">
-				status_ = #{status,jdbcType=INTEGER},
+				status_ = #{status},
 			</if>
 			<if test="order != null">
-				order_ = #{order,jdbcType=INTEGER},
+				order_ = #{order},
+			</if>
+			<if test="updateBy != null">
+				update_by_ = #{updateBy},
+			</if>
+			<if test="createBy != null">
+				create_by_ = #{createBy},
+			</if>
+			<if test="catalogType != null and catalogType != ''">
+				catalog_type_ = #{catalogType}
 			</if>
 		</set>
-		where id_ = #{id,jdbcType=INTEGER}
+		where id_ = #{id}
 	</update>
 
 	<update id="updateBlobs" parameterType="com.yonge.cooleshow.cms.dal.entity.HelpCenterContent">
@@ -161,4 +173,9 @@
 	<update id="updateContentByCatalog" parameterType="map">
 		update help_center_content set status_=#{status} where catalog_id_=#{catalogId}
 	</update>
+
+	<update id="status">
+		update help_center_content set status_=if(status_ =0,1,0) where id_=#{catalogId}
+
+	</update>
 </mapper>

+ 34 - 48
cooleshow-cms/src/main/resources/config/mybatis/SysNewsInformationMapper.xml

@@ -26,12 +26,13 @@
 		<result column="memo_" property="memo" />
 		<result column="attribute1_" property="attribute1" />
 		<result column="attribute2_" property="attribute2" />
-		<result column="subject_id_list_" property="subjectIdList" />
+		<result column="show_time_" property="showTime" />
+		<result column="update_by_" property="updateBy" />
+		<result column="create_by_" property="createBy" />
 	</resultMap>
 	
 	<resultMap type="com.yonge.cooleshow.cms.dto.SysNewsInformationDto" id="SysNewsInformationDto" extends="SysNewsInformation">
-		<result column="typeName" property="typeName" />
-		<result column="subTypeName" property="subTypeName" />
+		<result column="updateName" property="updateName" />
 	</resultMap>
 	
 	<sql id="queryCondition">
@@ -40,14 +41,16 @@
 			<if test="type != null">
 				and sni.type_ = #{type}
 			</if>
-			<if test="subType != null">
+			<if test="subType != null and subType != ''">
 				and sni.sub_type_ = #{subType}
 			</if>
 			<if test="status != null">
 				and sni.status_ = #{status, typeHandler=com.yonge.cooleshow.common.dal.CustomEnumTypeHandler}
 			</if>
 			<if test="title != null">
-				and sni.title_ like '%' #{title} '%'
+				and (sni.title_ like '%' #{title} '%'
+				or sni.id_ like concat('%',#{titile},'%')
+				)
 			</if>
 			<if test="search != null">
 				and sni.title_ like '%' #{search} '%'
@@ -61,16 +64,6 @@
 					#{excludeId}
 				</foreach>
 			</if>
-			<if test="clientName != 'manage'">
-				<choose>
-					<when test="memo != null and memo != ''">
-						and sni.memo_ = #{memo}
-					</when>
-					<otherwise>
-						and (sni.memo_ is null or sni.memo_ = '')
-					</otherwise>
-				</choose>
-			</if>
 		</where>
 	</sql>
 	
@@ -86,8 +79,8 @@
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.yonge.cooleshow.cms.dal.entity.SysNewsInformation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		INSERT INTO sys_news_information (id_,title_,content_,cover_image_,video_cover_image_,type_,online_time_,offline_time_,sub_type_,status_,create_time_,update_time_,link_url_,href_target_,order_,del_flag_,memo_,attribute1_,attribute2_,subject_id_list_)
-		VALUES(#{id},#{title},#{content},#{coverImage},#{videoCoverImage},#{type},#{onlineTime},#{offlineTime},#{subType},#{status, typeHandler=com.yonge.cooleshow.common.dal.CustomEnumTypeHandler},now(),now(),#{linkUrl},#{hrefTarget},#{order},0,#{memo},#{attribute1},#{attribute2},#{subjectIdList})
+		INSERT INTO sys_news_information (id_,title_,content_,cover_image_,video_cover_image_,type_,online_time_,offline_time_,sub_type_,status_,create_time_,update_time_,link_url_,href_target_,order_,del_flag_,memo_,attribute1_,attribute2_,subject_id_list_,create_by_,update_by_,show_time_)
+		VALUES(#{id},#{title},#{content},#{coverImage},#{videoCoverImage},#{type},#{onlineTime},#{offlineTime},#{subType},#{status, typeHandler=com.yonge.cooleshow.common.dal.CustomEnumTypeHandler},now(),now(),#{linkUrl},#{hrefTarget},#{order},0,#{memo},#{attribute1},#{attribute2},#{subjectIdList},#{createBy},#{updateBy},#{showTime})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -117,7 +110,7 @@
 			</if>
 				online_time_ = #{onlineTime},
 				offline_time_ = #{offlineTime},
-			<if test="subType != null">
+			<if test="subType != null and subType != ''">
 				sub_type_ = #{subType},
 			</if>
 			<if test="linkUrl != null">
@@ -144,6 +137,12 @@
 			<if test="subjectIdList != null">
 				subject_id_list_ = #{subjectIdList},
 			</if>
+			<if test="updateBy != null">
+				update_by_ = #{updateBy},
+			</if>
+			<if test="showTime != null">
+				show_time_ = #{showTime}
+			</if>
 		</set>
 		WHERE id_ = #{id}
 	</update>
@@ -154,17 +153,18 @@
 	</delete>
 	
 	<!-- 分页查询 -->
-	<select id="queryPage" resultMap="SysNewsInformation" parameterType="map">
-		SELECT sni.*,GROUP_CONCAT(distinct s.name_) subject_name_,GROUP_CONCAT(distinct o.name_) organ_name_list_ FROM sys_news_information sni left join subject s on find_in_set(s.id_,sni.subject_id_list_)
-		left join organization o on find_in_set(o.id_,sni.organ_id_list_)
+	<select id="selectPage" resultMap="SysNewsInformationDto" parameterType="map">
+		SELECT sni.*
+		, su.username_ as updateName
+		FROM sys_news_information sni
+		left join sys_user su on sni.update_by_ = su.id_
 		<include refid="queryCondition" />
-		group by sni.id_
 		order by sni.status_ desc,sni.order_ desc,sni.update_time_ desc
 		<include refid="global.limit"/>
 	</select>
 	
 	<!-- 查询当前表的总记录数 -->
-	<select id="queryCount" resultType="int">
+	<select id="selectPageCount" resultType="int">
 		SELECT COUNT(sni.id_) FROM sys_news_information sni
 		<include refid="queryCondition" />
 	</select>
@@ -186,11 +186,13 @@
 	<!-- 分页查询 -->
 	<select id="queryHomePage" resultMap="SysNewsInformation"
 		parameterType="map">
-		SELECT sni.*,GROUP_CONCAT(s.name_) subject_name_ FROM sys_news_information sni left join subject s on find_in_set(s.id_,sni.subject_id_list_) where sni.del_flag_=0
+		SELECT sni.*
+		FROM sys_news_information sni
+		where sni.del_flag_=0
 		<if test="type != null">
 			and sni.type_ = #{type}
 		</if>
-		<if test="subType != null">
+		<if test="subType != null and subType != ''">
 			and sni.sub_type_ = #{subType}
 		</if>
 		<if test="status != null">
@@ -212,16 +214,6 @@
 			<if test="subjectId != null">
 				and find_in_set(#{subjectId},sni.subject_id_list_)
 			</if>
-		<if test="clientName != 'manage'">
-			<choose>
-				<when test="memo != null and memo != ''">
-					and sni.memo_ = #{memo}
-				</when>
-				<otherwise>
-					and (sni.memo_ is null or sni.memo_ = '')
-				</otherwise>
-			</choose>
-		</if>
 		group by sni.id_
 		order by sni.status_ desc,sni.order_ desc,sni.update_time_ desc
 		<include refid="global.limit" />
@@ -249,16 +241,6 @@
 			<if test="subjectId != null">
 				and find_in_set(#{subjectId},sni.subject_id_list_)
 			</if>
-		<if test="clientName != 'manage'">
-			<choose>
-				<when test="memo != null and memo != ''">
-					and sni.memo_ = #{memo}
-				</when>
-				<otherwise>
-					and (sni.memo_ is null or sni.memo_ = '')
-				</otherwise>
-			</choose>
-		</if>
 	</select>
 	
 	<select id="queryNeedUpdateStatusList" resultMap="SysNewsInformation" >
@@ -270,9 +252,13 @@
 	</select>
 	
 	<select id="queryById" resultMap="SysNewsInformationDto" >
-		SELECT sni.*,sntp.name_ typeName,snts.name_ subTypeName FROM sys_news_information sni 
-		left join sys_news_type sntp on sni.type_ = sntp.id_
-		left join sys_news_type snts on sni.sub_type_ = snts.id_
+		SELECT sni.*,su.username_ as updateName
+		FROM sys_news_information sni
+		left join sys_user su on sni.update_by_ = su.id_
 		where sni.id_ = #{id}
 	</select>
+
+	<update id="updateStatus">
+		UPDATE sys_news_information SET status_ = if(status_ = 0,1,0),update_time_ = NOW() WHERE id_ = #{id}
+    </update>
 </mapper>

+ 34 - 0
cooleshow-common/src/main/java/com/yonge/cooleshow/common/enums/PlatformEnum.java

@@ -0,0 +1,34 @@
+package com.yonge.cooleshow.common.enums;
+
+/**
+ * Description
+ *
+ * @author liujunchi
+ * @date 2022-04-24
+ */
+public enum PlatformEnum implements BaseEnum<String,PlatformEnum>{
+
+    STUDENT("STUDENT","STUDENT"),
+    TEACHER("TEACHER","TEACHER");
+
+    private String code;
+    private String msg;
+
+    PlatformEnum(String code,String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+    @Override
+    public String getCode() {
+        return this.code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+}

+ 25 - 17
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/SysManualController.java

@@ -1,13 +1,16 @@
 package com.yonge.cooleshow.admin.controller;
 
+import com.yonge.cooleshow.biz.dal.enums.YesOrNoEnum;
+import com.yonge.cooleshow.biz.dal.support.PageUtil;
+import com.yonge.cooleshow.biz.dal.vo.SysManualVo;
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import com.yonge.cooleshow.common.exception.BizException;
+import com.yonge.cooleshow.common.page.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
@@ -34,32 +37,29 @@ public class SysManualController extends BaseController {
     @Autowired
     private SysUserFeignService sysUserFeignService;
 
-    @ApiOperation(value = "查询操作手册")
-    @RequestMapping("/listMenuIds")
-    public Object listMenuIds() {
-        return succeed(sysManualService.listMenuIds());
-    }
+
 
     @ApiOperation(value = "查询操作手册")
     @RequestMapping("/list")
-    public Object list(SysManualQueryInfo queryInfo) {
-        return succeed(sysManualService.query(queryInfo));
+    public HttpResponseResult<PageInfo<SysManualVo>> list( @RequestBody SysManualQueryInfo queryInfo) {
+        return succeed(PageUtil.pageInfo(sysManualService.query(PageUtil.getPage(queryInfo),queryInfo)));
     }
 
     @ApiOperation(value = "新增帮助手册")
     @PostMapping("/add")
-    public Object add(@RequestBody SysManual sysManual) throws Exception {
+    public HttpResponseResult<Boolean> add(@RequestBody SysManual sysManual) throws Exception {
         this.check(sysManual);
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         if (sysUser == null) {
             return failed("用户信息获取失败");
         }
+        sysManual.setStatus(YesOrNoEnum.NO);
         return succeed(sysManualService.add(sysManual, sysUser.getId()));
     }
 
     @ApiOperation(value = "修改帮助手册")
     @PostMapping("/update")
-    public Object update(@RequestBody SysManual sysManual) throws Exception {
+    public  HttpResponseResult<Boolean>  update(@RequestBody SysManual sysManual) throws Exception {
         this.check(sysManual);
         if (sysManual.getId() == null) {
             throw new Exception("更新必须有id");
@@ -68,7 +68,7 @@ public class SysManualController extends BaseController {
         if (sysUser == null) {
             return failed("用户信息获取失败");
         }
-        return succeed(sysManualService.update(sysManual, sysUser.getId()));
+        return succeed(sysManualService.update(sysManual, sysUser.getId()) >0);
     }
 
     private void check(SysManual sysManual) throws Exception {
@@ -96,9 +96,17 @@ public class SysManualController extends BaseController {
     }
 
     @ApiOperation(value = "删除帮助手册")
-    @PostMapping("/remove")
-    public Object remove(@RequestBody SysManual sysManual) throws Exception {
-        sysManualService.removeById(sysManual.getId());
+    @PostMapping("/remove/{id}")
+    public  HttpResponseResult<Boolean>  remove(@PathVariable("id") Long id) throws Exception {
+
+        if (id == null) {
+            return failed("参数错误");
+        }
+        SysManual manual = sysManualService.getById(id);
+        if (YesOrNoEnum.YES.getCode().equals(manual.getStatus().getCode())) {
+            throw  new BizException("启用状态下,不能删除");
+        }
+        sysManualService.removeById(id);
         return succeed();
     }
 

+ 12 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/SysManualDao.java

@@ -3,6 +3,9 @@ package com.yonge.cooleshow.biz.dal.dao;
 import java.util.List;
 import java.util.Map;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.yonge.cooleshow.biz.dal.queryInfo.SysManualQueryInfo;
+import com.yonge.cooleshow.biz.dal.vo.SysManualVo;
 import org.apache.ibatis.annotations.Param;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -23,5 +26,14 @@ public interface SysManualDao extends BaseMapper<SysManual> {
     List<SysManual> queryRecord(Map<String, Object> params);
 
     List<String> listMenuIds();
+
+    /**
+     * 分页查询
+     *
+     * @param page      分页信息
+     * @param queryInfo 查询条件
+     * @return
+     */
+    IPage<SysManualVo> query(@Param("page") IPage<SysManualVo> page, @Param("param") SysManualQueryInfo queryInfo);
 }
 

+ 12 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/SysManual.java

@@ -5,6 +5,7 @@ import java.util.Date;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.yonge.cooleshow.biz.dal.enums.YesOrNoEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import com.baomidou.mybatisplus.annotation.TableId;
@@ -31,6 +32,10 @@ public class SysManual implements Serializable {
     @ApiModelProperty(value = "手册名称")
     private String name;
 
+    @TableField("status_")
+    @ApiModelProperty(value = "状态 0:禁用 1:启用")
+    private YesOrNoEnum status;
+
     @TableField("op_flow_")
     @ApiModelProperty(value = "操作流程")
     private String opFlow;
@@ -156,5 +161,12 @@ public class SysManual implements Serializable {
     }
 
 
+    public YesOrNoEnum getStatus() {
+        return status;
+    }
+
+    public void setStatus(YesOrNoEnum status) {
+        this.status = status;
+    }
 }
 

+ 23 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/queryInfo/SysManualQueryInfo.java

@@ -1,5 +1,6 @@
 package com.yonge.cooleshow.biz.dal.queryInfo;
 
+import com.yonge.cooleshow.biz.dal.enums.YesOrNoEnum;
 import io.swagger.annotations.ApiModelProperty;
 
 import com.yonge.cooleshow.common.page.QueryInfo;
@@ -17,6 +18,28 @@ public class SysManualQueryInfo  extends QueryInfo {
     @ApiModelProperty(value = "按菜单查询")
     private Integer menuId;
 
+    @ApiModelProperty("标题")
+    private String title;
+
+    @ApiModelProperty(value = "状态 0:禁用 1:启用")
+    private YesOrNoEnum status;
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public YesOrNoEnum getStatus() {
+        return status;
+    }
+
+    public void setStatus(YesOrNoEnum status) {
+        this.status = status;
+    }
+
     public Integer getMenuId() {
         return menuId;
     }

+ 4 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/SysManualService.java

@@ -1,8 +1,10 @@
 package com.yonge.cooleshow.biz.dal.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.yonge.cooleshow.biz.dal.entity.SysManual;
 import com.yonge.cooleshow.biz.dal.queryInfo.SysManualQueryInfo;
+import com.yonge.cooleshow.biz.dal.vo.SysManualVo;
 import com.yonge.cooleshow.common.page.PageInfo;
 
 /**
@@ -20,5 +22,7 @@ public interface SysManualService extends IService<SysManual> {
     int update(SysManual sysManual, Long userId);
 
     String listMenuIds();
+
+     IPage<SysManualVo> query(IPage<SysManualVo> page, SysManualQueryInfo queryInfo);
 }
 

+ 16 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/SysManualServiceImpl.java

@@ -6,6 +6,10 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.yonge.cooleshow.biz.dal.enums.YesOrNoEnum;
+import com.yonge.cooleshow.biz.dal.vo.SysManualVo;
+import com.yonge.cooleshow.common.exception.BizException;
 import jodd.util.StringUtil;
 
 import org.slf4j.Logger;
@@ -62,6 +66,13 @@ public class SysManualServiceImpl extends ServiceImpl<SysManualDao, SysManual> i
     }
 
     public int update(SysManual sysManual, Long userId) {
+        SysManual manual = this.getById(sysManual.getId());
+        if (manual == null) {
+            throw new BizException("未找到相关信息");
+        }
+        if (YesOrNoEnum.YES.getCode().equals(manual.getStatus().getCode())) {
+            throw  new BizException("启用状态下,不能修改");
+        }
         sysManual.setOperatorId(userId);
         sysManual.setUpdateTime(new Date());
         return sysManualDao.updateById(sysManual);
@@ -72,5 +83,10 @@ public class SysManualServiceImpl extends ServiceImpl<SysManualDao, SysManual> i
         List<String> menuIds = sysManualDao.listMenuIds();
         return StringUtil.join(menuIds, ",");
     }
+
+    @Override
+    public IPage<SysManualVo> query(IPage<SysManualVo> page, SysManualQueryInfo queryInfo) {
+        return sysManualDao.query(page,queryInfo);
+    }
 }
 

+ 40 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/SysManualVo.java

@@ -0,0 +1,40 @@
+package com.yonge.cooleshow.biz.dal.vo;
+
+import com.yonge.cooleshow.biz.dal.entity.SysManual;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Description 操作手册
+ *
+ * @author liujunchi
+ * @date 2022-04-22
+ */
+@ApiModel("操作手册")
+public class SysManualVo extends SysManual {
+
+    @ApiModelProperty("菜单名")
+    private String menuName;
+
+    @ApiModelProperty("修改人名")
+    private String operatorName;
+
+
+    @Override
+    public String getMenuName() {
+        return menuName;
+    }
+
+    @Override
+    public void setMenuName(String menuName) {
+        this.menuName = menuName;
+    }
+
+    public String getOperatorName() {
+        return operatorName;
+    }
+
+    public void setOperatorName(String operatorName) {
+        this.operatorName = operatorName;
+    }
+}

+ 19 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/SysManualMapper.xml

@@ -67,4 +67,23 @@
 		select menu_id_ from sys_manual
 	</select>
 
+	<select id="query" resultType="com.yonge.cooleshow.biz.dal.vo.SysManualVo">
+		select sm.*
+		, u.username_ as operatorName
+		, m.name_ as menuName
+		from sys_manual sm
+		left join sys_user u on sm.operator_id_ = u.id_
+		left join sys_menu m on sm.menu_id_ = m.id_
+		<where>
+			<if test="param.menuId != null">
+				AND sm.menu_id_ = #{param.menuId}
+			</if>
+			<if test="param.status != null">
+				AND sm.status_ = #{param.status}
+			</if>
+			<if test="param.title != null and param.title != ''">
+				and sm.name_ like concat('%',#{param.title},'%')
+			</if>
+		</where>
+    </select>
 </mapper>