提交 73059c86 authored 作者: renjiancai's avatar renjiancai

--no commit message

上级 a8d0bf20
......@@ -3,15 +3,13 @@
*/
package com.zrqx.content.bg.controller.content;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.catalina.startup.Catalina;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -119,15 +117,14 @@ public class ContentController {
@ApiOperation(value = "单条更新", notes = "更新内容")
@PostMapping(value = ContentRequestPath.UPDATE_OID)
public CallBack<Boolean> update(@RequestBody SaveUpdateContentForm form) {
Content content = new Content();
Content content = service.selectByPrimaryKey(form.getId());
BeanUtils.copyProperties(form, content);
// 所属栏目
if (content.getColumnId() == null) {
if (form.getColumnId() == null) {
throw new BaseException(7, "请选择所属栏目");
}
Content content2 = service.selectByPrimaryKey(form.getId());
if(!content2.getColumnId().equals(form.getColumnId())){
ContentColumn column1 = contentColumnService.selectByPrimaryKey(content2.getColumnId());
if(!content.getColumnId().equals(form.getColumnId())){
ContentColumn column1 = contentColumnService.selectByPrimaryKey(content.getColumnId());
if(column1!=null){
if(column1.getContentNum()>0){
column1.setContentNum(column1.getContentNum()-1);
......@@ -145,16 +142,18 @@ public class ContentController {
ContentSource source = new ContentSource();
source.setSourceName(content.getSource());
if (content.getSourceId() == null) {
ContentSource cs = sourceService.selectOne(source);
if (cs == null || cs.getId() == null) {
source.setWebsite(content.getWebsite());
Integer maxSort = sourceService.getMaxSort();
source.setSort(maxSort + 1);
source.setCreateTime(new Date());
sourceService.insert(source);
cs.setId(source.getId());
if(content.getSourceState().equals(1)){
ContentSource cs = sourceService.selectOne(source);
if (cs == null || cs.getId() == null) {
source.setWebsite(content.getWebsite());
Integer maxSort = sourceService.getMaxSort();
source.setSort(maxSort + 1);
source.setCreateTime(new Date());
sourceService.insert(source);
cs.setId(source.getId());
}
content.setSourceId(cs.getId());
}
content.setSourceId(cs.getId());
}
}
content.setUpdateTime(new Date());
......@@ -195,17 +194,18 @@ public class ContentController {
if (form.getIds().length == 0) {
throw new BaseException("没有选中任何数据,请重新选择");
}
Criteria cr = service.createCriteria();
cr.andIn("id", Arrays.asList(form.getIds()));
Content content = new Content();
if (form.getStatus() != null) {
content.setStatus(form.getStatus());
}
if (form.getIsDelete() == 1) {
content.setDeleteTime(new Date());
for (Integer str : form.getIds()) {
Content content = service.selectByPrimaryKey(str);
if (form.getStatus() != null) {
content.setStatus(form.getStatus());
}
if (form.getIsDelete() == 1) {
content.setDeleteTime(new Date());
}
content.setIsDelete(form.getIsDelete());
service.updateByPrimaryKey(content);
}
content.setIsDelete(form.getIsDelete());
return CallBack.success(service.updateByCriteriaSelective(content));
return CallBack.success();
}
@ApiOperation(value = "批量彻底删除", notes = "批量彻底删除,回收站彻底删除才调用")
......@@ -232,7 +232,7 @@ public class ContentController {
@PostMapping(value = ContentRequestPath.DELETE_ALL)
public CallBack<Integer> deleteAll() {
int num = service.count();
if (num ==0) {
if (num < 1) {
throw new BaseException("回收站也没有余粮了");
}
List<Integer> list = service.selectAllId();
......@@ -278,12 +278,6 @@ public class ContentController {
@ApiOperation(value = "分页查询", notes = "分页查询")
@GetMapping(value = ContentRequestPath.PAGE)
public CallBack<PageInfo<ContentVo>> page(ContentSelectForm form, PageParam pageParam) {
if (form.getIsDelete() == 0) {
pageParam.setOrderBy("uploadTime desc");
}
if (form.getIsDelete() == 1) {
pageParam.setOrderBy("deleteTime desc");
}
return CallBack.success(service.page(form, pageParam));
}
......
/**
* @author niguanghui
1 * @author niguanghui
* @date 2018年12月24日 下午4:58:44
*/
package com.zrqx.content.bg.controller.contentSource;
......@@ -90,7 +90,7 @@ public class ContentSourceController {
}
@ApiOperation(value = "按来源名称模糊查找", notes = "按来源名称模糊查找")
@GetMapping(ContentRequestPath.PAGE + ContentRequestPath.NAME)
@GetMapping(ContentRequestPath.PAGE)
public CallBack<PageInfo<ContentSource>> selectByCondition(String sourceName,PageParam pageParam) {
if (null != pageParam && StringUtils.isBlank(pageParam.getOrderBy())) {
pageParam.setOrderBy("createTime desc");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论