Commit 2ddc7c6d by 吴迪

【新增】深度专题管理

parent 1bffd170
package io.office.modules.manage.controller;
import java.util.AbstractCollection;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.office.modules.manage.vo.request.NewtopicEntityVo;
import io.office.modules.sys.controller.AbstractController;
import io.office.modules.sys.entity.SysUserEntity;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.office.modules.manage.entity.NewtopicEntity;
import io.office.modules.manage.service.NewtopicService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-10-13 15:20:28
*/
@Slf4j
@RestController
@RequestMapping("/newtopic")
public class NewtopicController extends AbstractController {
@Autowired
private NewtopicService newtopicService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("manage:newtopic:list")
public R list(@RequestBody Map<String, Object> params) {
PageUtils page = newtopicService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{classid}")
// @RequiresPermissions("manage:newtopic:info")
public R info(@PathVariable("classid") Integer classid) {
NewtopicEntity newtopic = newtopicService.getById(classid);
return R.ok().put("newtopic", newtopic);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("manage:newtopic:save")
public R save(@RequestBody NewtopicEntityVo newtopicVo) {
newtopicService.insert(newtopicVo, getUser());
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("manage:newtopic:update")
public R update(@RequestBody NewtopicEntity newtopic) {
Date date = new Date();
SysUserEntity user = getUser();
newtopic.setLastupdate(date);
newtopic.setLasteditor(user.getUsername());
newtopicService.updateById(newtopic);
return R.ok();
}
/**
* 删除
*/
@Transactional
@RequestMapping("/delete")
// @RequiresPermissions("manage:newtopic:delete")
public R delete(@RequestBody Integer[] classids) {
Date date = new Date();
SysUserEntity user = getUser();
NewtopicEntity newtopicEntity = new NewtopicEntity();
newtopicEntity.setLastupdate(date);
newtopicEntity.setLasteditor(user.getUsername());
newtopicEntity.setLevels(0);
QueryWrapper<NewtopicEntity> newtopicEntityQueryWrapper = new QueryWrapper<>();
newtopicEntityQueryWrapper.in("classid",Arrays.asList(classids));
newtopicService.update(newtopicEntity,newtopicEntityQueryWrapper);
return R.ok();
}
@Transactional
@RequestMapping("/verify")
// @RequiresPermissions("manage:newtopic:verify")
public R verify(@RequestBody NewtopicEntityVo newtopicVo) {
Date date = new Date();
SysUserEntity user = getUser();
NewtopicEntity newtopicEntity = new NewtopicEntity();
newtopicEntity.setAuditor(user.getUsername());
QueryWrapper<NewtopicEntity> newtopicEntityQueryWrapper = new QueryWrapper<>();
newtopicEntityQueryWrapper.in("classid",newtopicEntity.getClassid());
newtopicService.update(newtopicEntity,newtopicEntityQueryWrapper);
return R.ok();
}
}
package io.office.modules.manage.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import io.office.modules.manage.vo.response.TemplateEntityVo;
import org.apache.commons.collections.CollectionUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.office.modules.manage.entity.TemplateEntity;
import io.office.modules.manage.service.TemplateService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-10-13 16:50:04
*/
@RestController
@RequestMapping("/template")
public class TemplateController {
@Autowired
private TemplateService templateService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("manage:template:list")
public R list(@RequestParam Map<String, Object> params) {
PageUtils page = templateService.queryPage(params);
return R.ok().put("page", page);
}
@RequestMapping("/listAll")
// @RequiresPermissions("manage:template:list")
public R listAll(@RequestParam Map<String, Object> params) {
return R.ok().put("data", templateService.listAll());
}
/**
* 信息
*/
@RequestMapping("/info/{tId}")
// @RequiresPermissions("manage:template:info")
public R info(@PathVariable("tId") Integer tId) {
TemplateEntity template = templateService.getById(tId);
return R.ok().put("template", template);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("manage:template:save")
public R save(@RequestBody TemplateEntity template) {
templateService.save(template);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("manage:template:update")
public R update(@RequestBody TemplateEntity template) {
templateService.updateById(template);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("manage:template:delete")
public R delete(@RequestBody Integer[] tIds) {
templateService.removeByIds(Arrays.asList(tIds));
return R.ok();
}
}
package io.office.modules.manage.dao;
import io.office.modules.manage.entity.NewtopicEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-10-13 15:20:28
*/
@Mapper
public interface NewtopicDao extends BaseMapper<NewtopicEntity> {
}
package io.office.modules.manage.dao;
import io.office.modules.manage.entity.TemplateEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-10-13 16:50:04
*/
@Mapper
public interface TemplateDao extends BaseMapper<TemplateEntity> {
}
package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-10-13 15:20:28
*/
@Data
@TableName("NewTopic")
public class NewtopicEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
@TableId
private Integer classid;
/**
* $column.comments
*/
private String title;
/**
* $column.comments
*/
private Integer categoryid;
/**
* $column.comments
*/
private Integer orderid;
/**
* $column.comments
*/
private Date lastupdate;
/**
* $column.comments
*/
private Integer parentid;
/**
* $column.comments
*/
private Integer child;
/**
* $column.comments
*/
private String ppath;
/**
* $column.comments
*/
private Integer depth;
/**
* $column.comments
*/
private Boolean lastnode;
/**
* $column.comments
*/
private Date time;
/**
* $column.comments
*/
private Integer levels;
/**
* $column.comments
*/
private Integer newtmpid;
/**
* $column.comments
*/
private String checkname;
/**
* $column.comments
*/
private Date checktime;
/**
* $column.comments
*/
private Integer checkflag;
/**
* $column.comments
*/
private String floatimg;
/**
* $column.comments
*/
private String flashurl;
/**
* $column.comments
*/
private String vote;
/**
* $column.comments
*/
private String img;
/**
* $column.comments
*/
private String shortcontent;
/**
* $column.comments
*/
private String headad;
/**
* $column.comments
*/
private String content;
/**
* $column.comments
*/
private String directpath;
/**
* $column.comments
*/
private String showtime;
/**
* $column.comments
*/
private String auditor;
/**
* $column.comments
*/
private String editor;
/**
* $column.comments
*/
private String lasteditor;
}
package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-10-13 16:50:04
*/
@Data
@TableName("t_Template")
public class TemplateEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
@TableId
private Integer tId;
/**
* $column.comments
*/
private String tType;
/**
* $column.comments
*/
private String tTitle;
/**
* $column.comments
*/
private String tContent;
/**
* $column.comments
*/
private Date tAtime;
/**
* $column.comments
*/
private Integer levels;
}
...@@ -24,6 +24,6 @@ public interface NewsclassService extends IService<NewsclassEntity> { ...@@ -24,6 +24,6 @@ public interface NewsclassService extends IService<NewsclassEntity> {
* 获取树形结构 * 获取树形结构
* @return * @return
*/ */
List<NewsclassEntityVo> getNewsClassList(); List<NewsclassEntityVo> getNewsClassList(List<Integer> ids);
} }
package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils;
import io.office.modules.manage.entity.NewtopicEntity;
import io.office.modules.manage.vo.request.NewtopicEntityVo;
import io.office.modules.sys.entity.SysUserEntity;
import java.util.Map;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-10-13 15:20:28
*/
public interface NewtopicService extends IService<NewtopicEntity> {
PageUtils queryPage(Map<String, Object> params);
void insert(NewtopicEntityVo newtopicEntityVo, SysUserEntity user);
}
package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils;
import io.office.modules.manage.entity.TemplateEntity;
import io.office.modules.manage.vo.response.TemplateEntityVo;
import java.util.List;
import java.util.Map;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-10-13 16:50:04
*/
public interface TemplateService extends IService<TemplateEntity> {
PageUtils queryPage(Map<String, Object> params);
/**
* 获取所有的模板数据
* @return
*/
List<TemplateEntityVo> listAll();
}
...@@ -35,21 +35,12 @@ public class NewsclassServiceImpl extends ServiceImpl<NewsclassDao, NewsclassEnt ...@@ -35,21 +35,12 @@ public class NewsclassServiceImpl extends ServiceImpl<NewsclassDao, NewsclassEnt
} }
@Override @Override
public List<NewsclassEntityVo> getNewsClassList() { public List<NewsclassEntityVo> getNewsClassList(List<Integer> ids) {
List<NewsclassEntityVo> newsclassEntityVoList = new ArrayList<>(); List<NewsclassEntityVo> newsclassEntityVoList = new ArrayList<>();
List<Integer> list = new ArrayList();
list.add(5);
list.add(6);
list.add(7);
list.add(8);
list.add(9);
list.add(29);
list.add(32);
list.add(33);
list.add(38);
list.add(42);
QueryWrapper<NewsclassEntity> newsclassEntityQueryWrapper = new QueryWrapper<>(); QueryWrapper<NewsclassEntity> newsclassEntityQueryWrapper = new QueryWrapper<>();
newsclassEntityQueryWrapper.in("id",list); if(CollectionUtils.isNotEmpty(ids)) {
newsclassEntityQueryWrapper.in("id",ids);
}
List<NewsclassEntity> newsclassEntities = baseMapper.selectList(newsclassEntityQueryWrapper); List<NewsclassEntity> newsclassEntities = baseMapper.selectList(newsclassEntityQueryWrapper);
if(CollectionUtils.isNotEmpty(newsclassEntities)) { if(CollectionUtils.isNotEmpty(newsclassEntities)) {
//获取全部的栏目 //获取全部的栏目
...@@ -68,7 +59,6 @@ public class NewsclassServiceImpl extends ServiceImpl<NewsclassDao, NewsclassEnt ...@@ -68,7 +59,6 @@ public class NewsclassServiceImpl extends ServiceImpl<NewsclassDao, NewsclassEnt
return newsclassEntityVoList; return newsclassEntityVoList;
} }
/** /**
* 递归调用属性结构 * 递归调用属性结构
*/ */
...@@ -97,7 +87,6 @@ public class NewsclassServiceImpl extends ServiceImpl<NewsclassDao, NewsclassEnt ...@@ -97,7 +87,6 @@ public class NewsclassServiceImpl extends ServiceImpl<NewsclassDao, NewsclassEnt
} }
} }
} }
// 递归退出条件 // 递归退出条件
if (childList.size() == 0) { if (childList.size() == 0) {
return null; return null;
...@@ -105,6 +94,4 @@ public class NewsclassServiceImpl extends ServiceImpl<NewsclassDao, NewsclassEnt ...@@ -105,6 +94,4 @@ public class NewsclassServiceImpl extends ServiceImpl<NewsclassDao, NewsclassEnt
return childList; return childList;
} }
} }
\ No newline at end of file
package io.office.modules.manage.service.impl;
import io.office.modules.manage.vo.request.NewtopicEntityVo;
import io.office.modules.sys.entity.SysUserEntity;
import org.springframework.beans.BeanUtils;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.modules.manage.dao.NewtopicDao;
import io.office.modules.manage.entity.NewtopicEntity;
import io.office.modules.manage.service.NewtopicService;
import org.springframework.transaction.annotation.Transactional;
@Service("newtopicService")
public class NewtopicServiceImpl extends ServiceImpl<NewtopicDao, NewtopicEntity> implements NewtopicService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
QueryWrapper queryWrapper = new QueryWrapper<NewtopicEntity>();
queryWrapper.orderByDesc("ClassId");
queryWrapper.eq("parentid",0);
if(params.containsKey("levels")) {
queryWrapper.eq("levels",params.get("levels"));
} else{
queryWrapper.gt("levels",0);
}
queryWrapper.select("classid,title,levels,categoryID,Time,Lastupdate,editor,lasteditor,auditor,checkflag");
IPage<NewtopicEntity> page = baseMapper.selectPage(new Query<NewtopicEntity>().getPage(params), queryWrapper);
return new PageUtils(page);
}
@Transactional
@Override
public void insert(NewtopicEntityVo newtopicEntityVo, SysUserEntity user) {
Date date = new Date();
newtopicEntityVo.setTime(date);
newtopicEntityVo.setLasteditor(user.getUsername());
newtopicEntityVo.setLastupdate(date);
NewtopicEntity newtopicEntity = new NewtopicEntity();
BeanUtils.copyProperties(newtopicEntityVo,newtopicEntity);
baseMapper.insert(newtopicEntity);
}
}
\ No newline at end of file
package io.office.modules.manage.service.impl;
import io.office.modules.manage.vo.response.TemplateEntityVo;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.modules.manage.dao.TemplateDao;
import io.office.modules.manage.entity.TemplateEntity;
import io.office.modules.manage.service.TemplateService;
@Service("templateService")
public class TemplateServiceImpl extends ServiceImpl<TemplateDao, TemplateEntity> implements TemplateService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<TemplateEntity> page = this.page(
new Query<TemplateEntity>().getPage(params),
new QueryWrapper<TemplateEntity>()
);
return new PageUtils(page);
}
@Override
public List<TemplateEntityVo> listAll() {
List<TemplateEntityVo> returnList = new ArrayList<>();
QueryWrapper<TemplateEntity> templateEntityQueryWrapper = new QueryWrapper<>();
List<TemplateEntity> templateEntityList = baseMapper.selectList(templateEntityQueryWrapper);
if (CollectionUtils.isNotEmpty(templateEntityList)) {
templateEntityList.forEach(templateEntity->{
TemplateEntityVo templateEntityVo = new TemplateEntityVo();
BeanUtils.copyProperties(templateEntity,templateEntityVo);
returnList.add(templateEntityVo);
});
}
return returnList;
}
}
\ No newline at end of file
...@@ -42,7 +42,6 @@ public class UploadUtils { ...@@ -42,7 +42,6 @@ public class UploadUtils {
throw new RRException(ErrorCodeEnum.FILE_IS_NULL); throw new RRException(ErrorCodeEnum.FILE_IS_NULL);
} }
String filename = ""; String filename = "";
//String originalFilename = file.getOriginalFilename();
filename = file.getOriginalFilename(); filename = file.getOriginalFilename();
File fileDir = new File(fileSavePath + DateUtils.formatDateToString(new Date(), DateUtils.FORMAT4) + "/"); File fileDir = new File(fileSavePath + DateUtils.formatDateToString(new Date(), DateUtils.FORMAT4) + "/");
if (!fileDir.exists()) { if (!fileDir.exists()) {
......
package io.office.modules.manage.vo.request;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
* 
 @description:
*
* @author wudi
* @date 15:40 2021/10/13
*/
@Data
public class NewtopicEntityVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private Integer classid;
/**
* 标题
*/
private String title;
/**
* 子类
*/
private Integer categoryid;
/**
*
*/
private Integer orderid;
/**
* 最后更新时间
*/
private Date lastupdate;
/**
*
*/
private Integer parentid;
/**
*
*/
private Integer child;
/**
*
*/
private String ppath;
/**
* $column.comments
*/
private Integer depth;
/**
* $column.comments
*/
private Boolean lastnode;
/**
* 新建时间
*/
private Date time;
/**
* 级别
*/
private Integer levels;
/**
* 专题模板
*/
private Integer newtmpid;
/**
* $column.comments
*/
private String checkname;
/**
* 审核时间
*/
private Date checktime;
/**
* 审核状态。1成功;-1失败;0等待审核
*/
private Integer checkflag;
/**
* $column.comments
*/
private String floatimg;
/**
* $column.comments
*/
private String flashurl;
/**
* $column.comments
*/
private String vote;
/**
* $column.comments
*/
private String img;
/**
* $column.comments
*/
private String shortcontent;
/**
* $column.comments
*/
private String headad;
/**
* $column.comments
*/
private String content;
/**
* $column.comments
*/
private String directpath;
/**
* $column.comments
*/
private String showtime;
/**
* $column.comments
*/
private String auditor;
/**
* $column.comments
*/
private String editor;
/**
* $column.comments
*/
private String lasteditor;
}
package io.office.modules.manage.vo.response;
import lombok.Data;
import java.io.Serializable;
/**
*
* 
 @description:
*
* @author wudi
* @date 16:55 2021/10/13
*/
@Data
public class TemplateEntityVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
private Integer tId;
/**
* $column.comments
*/
private String tType;
/**
* $column.comments
*/
private String tTitle;
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.office.modules.manage.dao.NewtopicDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.NewtopicEntity" id="newtopicMap">
<result property="classid" column="ClassId"/>
<result property="title" column="Title"/>
<result property="categoryid" column="categoryID"/>
<result property="orderid" column="OrderId"/>
<result property="lastupdate" column="Lastupdate"/>
<result property="parentid" column="ParentId"/>
<result property="child" column="Child"/>
<result property="ppath" column="Ppath"/>
<result property="depth" column="Depth"/>
<result property="lastnode" column="Lastnode"/>
<result property="time" column="Time"/>
<result property="levels" column="levels"/>
<result property="newtmpid" column="newTmpid"/>
<result property="checkname" column="checkname"/>
<result property="checktime" column="checktime"/>
<result property="checkflag" column="checkflag"/>
<result property="floatimg" column="floatimg"/>
<result property="flashurl" column="flashurl"/>
<result property="vote" column="vote"/>
<result property="img" column="img"/>
<result property="shortcontent" column="shortContent"/>
<result property="headad" column="headAd"/>
<result property="content" column="content"/>
<result property="directpath" column="directpath"/>
<result property="showtime" column="showtime"/>
<result property="auditor" column="auditor"/>
<result property="editor" column="editor"/>
<result property="lasteditor" column="lasteditor"/>
</resultMap>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.office.modules.manage.dao.TemplateDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.TemplateEntity" id="templateMap">
<result property="tId" column="t_id"/>
<result property="tType" column="t_type"/>
<result property="tTitle" column="t_title"/>
<result property="tContent" column="t_content"/>
<result property="tAtime" column="t_atime"/>
<result property="levels" column="levels"/>
</resultMap>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment