提交 f3e7de77 authored 作者: renjiancai's avatar renjiancai

--no commit message

上级 15e5eacf
......@@ -10,6 +10,7 @@ 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;
......@@ -102,7 +103,7 @@ public class ContentController {
ContentColumn column = contentColumnService.selectByPrimaryKey(content.getColumnId());
if(column!=null){
column.setContentNum(column.getContentNum()+1);
contentColumnService.updateByCriteria(column);
contentColumnService.updateByPrimaryKey(column);
}
if (!service.insert(content)) {
throw new BaseException(ResponseCodeEnum.FAIL);
......@@ -230,14 +231,17 @@ public class ContentController {
@PostMapping(value = ContentRequestPath.DELETE_ALL)
public CallBack<Integer> deleteAll() {
int num = service.count();
if (num < 1) {
if (num ==0) {
throw new BaseException("回收站也没有余粮了");
}
List<Integer> list = service.selectAllId();
if (service.deleteAll() != num) {
Criteria cr =service.createCriteria();
cr.andEqualTo("isDelete", 1);
Boolean b= service.deleteByCriteria();
if (b) {
throw new BaseException(ResponseCodeEnum.FAIL);
}
// 删除图组
List<Integer> list = service.selectAllId();
ContentImg img = new ContentImg();
for (Integer id : list) {
img.setContentId(id);
......
......@@ -23,12 +23,6 @@ import com.zrqx.core.vo.content.content.ContentVo;
@Mapper
public interface ContentMapper extends BaseMapper<Content> {
/** 清空回收站 */
@Delete("<script>"
+ "DELETE FROM con_content WHERE isDelete = 1 "
+ "</script>")
Integer deleteAll();
/** 统计回收站有多少条数据 */
@Select("<script>"
+ "SELECT COUNT(*) FROM con_content WHERE isDelete = 1 "
......
......@@ -19,9 +19,6 @@ import com.zrqx.core.vo.content.content.ContentVo;
*/
public interface ContentService extends BaseService<Content, Integer> {
/** 清空回收站 */
Integer deleteAll();
/** 统计回收站有多少条数据 */
Integer count();
......
......@@ -33,12 +33,6 @@ public class ContentServiceImpl extends BaseServiceImpl<Content, Integer> implem
return mapper;
}
/** 清空回收站 */
@Override
public Integer deleteAll() {
return mapper.deleteAll();
}
/** 统计回收站有多少条数据 */
@Override
public Integer count() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论