Commit 99cc08b0 by 吴迪

Merge remote-tracking branch 'origin/master'

parents 785adf1f 0f4b9709
package io.office.common.enumpack.manage;
/**
* @author rkl
* @description
* @date 2021/10/20
*/
public enum IndexCarouselManageEnum {
SUCCESS("1", "成功"),//成功
FAIL("-1", "失败"),//失败
ALL("2","全部");
private String code;
private String msg;
IndexCarouselManageEnum(String code) {
this.code = code;
}
IndexCarouselManageEnum(String code, String message) {
this.code = code;
this.msg = message;
}
public String code() {
return this.code;
}
public String message() {
return this.msg;
}
}
package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Map;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.manage.entity.IndexCarouselManageEntity;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.dto.IndexCarouselManageParams;
import io.office.modules.manage.service.IndexCarouselManageService;
import io.office.modules.sys.controller.AbstractController;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* 首页轮播管理
*
* @author rkl
* @email
* @date 2021-10-18 16:27:25
*/
@RestController
@Slf4j
@RequestMapping("/indexCarouselManage")
public class IndexCarouselManageController extends AbstractController {
@Autowired
private IndexCarouselManageService indexCarouselManageService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("generator:indexcarouselmanage:list")
public R list(@RequestBody IndexCarouselManageParams indexCarouselManage){
Page<IndexCarouselManageEntity> page = this.indexCarouselManageService.selectIndexCarouselManageList(indexCarouselManage,
new Page(indexCarouselManage.getPage(),indexCarouselManage.getLimit()));
PageUtils pageUtils = new PageUtils(page);
return R.ok().put("page", pageUtils);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
// @RequiresPermissions("generator:indexcarouselmanage:info")
public R info(@PathVariable("id") Integer id){
IndexCarouselManageEntity indexCarouselManage = indexCarouselManageService.getById(id);
return R.ok().put("indexCarouselManage", indexCarouselManage);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("generator:indexcarouselmanage:save")
public R save(@RequestBody IndexCarouselManageEntity indexCarouselManage){
try {
R r = this.indexCarouselManageService.insertIndexCarouselManage(indexCarouselManage,getUser());
return r;
} catch (Exception e) {
log.error("indexCarouselManage save error:", e);
return R.error(e.getMessage());
}
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("generator:indexcarouselmanage:update")
public R update(@RequestBody IndexCarouselManageEntity indexCarouselManage){
try {
R r = this.indexCarouselManageService.updateIndexCarouselManage(indexCarouselManage,getUser());
return r;
} catch (Exception e) {
log.error("indexCarouselManage update error:", e);
return R.error(e.getMessage());
}
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("generator:indexcarouselmanage:delete")
public R delete(@RequestBody Integer[] ids){
try{
R r = indexCarouselManageService.deleteIndexCarouselManage(Arrays.asList(ids),getUser());
return r;
}catch (Exception e){
log.error("indexCarouselManage delete error:",e);
return R.error(e.getMessage());
}
}
/**
* 审核
*/
@PostMapping("/verifyIndexCarouselManage")
// @RequiresPermissions("generator:indexcarouselmanage:verify")
public R verify(@RequestBody IndexCarouselManageEntity indexCarouselManage) {
try {
R r = this.indexCarouselManageService.verifyIndexCarouselManage(indexCarouselManage,getUser());
return r;
} catch (Exception e) {
log.error("verifyIndexCarouselManage error:", e);
return R.error(e.getMessage());
}
}
}
package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Map;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.TopicnewsEntity;
import io.office.modules.manage.service.TopicnewsService;
import io.office.modules.sys.controller.AbstractController;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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;
/**
* 党办资讯 活动报道
*
* @author rkl
* @email
* @date 2021-10-21 10:20:27
*/
@RestController
@Slf4j
@RequestMapping("/topicnews")
public class TopicnewsController extends AbstractController {
@Autowired
private TopicnewsService topicnewsService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("generator:topicnews:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = topicnewsService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
// @RequiresPermissions("generator:topicnews:info")
public R info(@PathVariable("id") Integer id){
TopicnewsEntity topicnews = topicnewsService.getById(id);
return R.ok().put("topicnews", topicnews);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("generator:topicnews:save")
public R save(@RequestBody NewsEntity news){
try {
R r = this.topicnewsService.insertHdbd(news, getUser());
return r;
} catch (Exception e) {
log.error("insertHdbd error:", e);
return R.error(e.getMessage());
}
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("generator:topicnews:update")
public R update(@RequestBody TopicnewsEntity topicnews){
topicnewsService.updateById(topicnews);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("generator:topicnews:delete")
public R delete(@RequestBody Integer[] ids){
topicnewsService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}
package io.office.modules.manage.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.modules.manage.entity.IndexCarouselManageEntity;
import io.office.modules.manage.entity.dto.IndexCarouselManageParams;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* ${comments}
*
* @author chenshun
* @email sunlightcs@gmail.com
* @date 2021-10-18 16:27:25
*/
@Mapper
public interface IndexCarouselManageDao extends BaseMapper<IndexCarouselManageEntity> {
List<IndexCarouselManageEntity> selectIndexCarouselManageList(@Param("indexCarouselManage") IndexCarouselManageParams indexCarouselManage, Page page);
}
package io.office.modules.manage.dao;
import io.office.modules.manage.entity.TopicnewsEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* ${comments}
*
* @author chenshun
* @email sunlightcs@gmail.com
* @date 2021-10-21 10:20:27
*/
@Mapper
public interface TopicnewsDao extends BaseMapper<TopicnewsEntity> {
}
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 chenshun
* @email sunlightcs@gmail.com
* @date 2021-10-18 16:27:25
*/
@Data
@TableName("index_carousel_manage")
public class IndexCarouselManageEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
@TableId
private Integer id;
/**
* 大小轮播 类型
*/
private String classnum;
/**
* 标题
*/
private String title;
/**
* 轮播介绍
*/
private String brief;
/**
* 等级
*/
private Integer levels;
/**
*
*/
private Integer levelsIndex;
/**
*跳转地址
*/
private String directpath;
/**
* 图片地址
*/
private String picIndexPath;
/**
* 审核标识
*/
private Integer checkflagIndex;
/**
* 作者
*/
private String checkIndexAuthor;
/**
* 编辑
*/
private String editorIndex;
/**
* 最后编辑人
*/
private String lasteditorIndex;
/**
* 开始时间
*/
private Date starttimeIndex;
/**
* 更新时间
*/
private Date updatetimeIndex;
/**
* 背景色
*/
private String colorBackground;
/**
*
*/
private String colorBrief;
/**
* 跳转色
*/
private String colorMore;
/**
* $column.comments
*/
private String briefShow;
}
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 chenshun
* @email sunlightcs@gmail.com
* @date 2021-10-21 10:20:27
*/
@Data
@TableName("TopIcNews")
public class TopicnewsEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
@TableId
private Integer id;
/**
* $column.comments
*/
private Integer classid;
/**
* $column.comments
*/
private Integer newsid;
/**
* $column.comments
*/
private Integer newslevels;
/**
* $column.comments
*/
private Date time;
}
package io.office.modules.manage.entity.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.office.modules.manage.entity.page.PageParams;
import lombok.Data;
import java.util.*;
/**
* @author rkl
* @description 首页轮播管理入参实体类
* @date 2021/10/20
*/
@Data
public class IndexCarouselManageParams extends PageParams {
private String title;
private String status;
private String classnum;
private String levels;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
}
package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.manage.entity.IndexCarouselManageEntity;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.dto.IndexCarouselManageParams;
import io.office.modules.sys.entity.SysUserEntity;
import java.util.List;
import java.util.Map;
/**
* ${comments}
*
* @author chenshun
* @email sunlightcs@gmail.com
* @date 2021-10-18 16:27:25
*/
public interface IndexCarouselManageService extends IService<IndexCarouselManageEntity> {
PageUtils queryPage(Map<String, Object> params);
R insertIndexCarouselManage(IndexCarouselManageEntity indexCarouselManage, SysUserEntity user);
R updateIndexCarouselManage(IndexCarouselManageEntity indexCarouselManage, SysUserEntity user);
R deleteIndexCarouselManage(List<Integer> asList,SysUserEntity user);
R verifyIndexCarouselManage(IndexCarouselManageEntity indexCarouselManage, SysUserEntity user);
Page<IndexCarouselManageEntity> selectIndexCarouselManageList(IndexCarouselManageParams indexCarouselManage, Page page);
}
package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.TopicnewsEntity;
import io.office.modules.sys.entity.SysUserEntity;
import java.util.Map;
/**
* ${comments}
*
* @author rkl
* @email
* @date 2021-10-21 10:20:27
*/
public interface TopicnewsService extends IService<TopicnewsEntity> {
PageUtils queryPage(Map<String, Object> params);
R insertHdbd(NewsEntity news, SysUserEntity user);
}
package io.office.modules.manage.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.office.common.enumpack.manage.IndexCarouselManageEnum;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.common.utils.R;
import io.office.modules.manage.dao.IndexCarouselManageDao;
import io.office.modules.manage.entity.IndexCarouselManageEntity;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.dto.IndexCarouselManageParams;
import io.office.modules.manage.service.IndexCarouselManageService;
import io.office.modules.sys.entity.SysUserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import static com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.XmlToken.All;
@Service("indexCarouselManageService")
public class IndexCarouselManageServiceImpl extends ServiceImpl<IndexCarouselManageDao, IndexCarouselManageEntity> implements IndexCarouselManageService {
@Autowired
private IndexCarouselManageDao indexCarouselManageDao;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<IndexCarouselManageEntity> page = this.page(
new Query<IndexCarouselManageEntity>().getPage(params),
new QueryWrapper<IndexCarouselManageEntity>()
);
return new PageUtils(page);
}
@Override
public R insertIndexCarouselManage(IndexCarouselManageEntity indexCarouselManage, SysUserEntity user) {
indexCarouselManage.setEditorIndex(user.getUsername());
indexCarouselManage.setLasteditorIndex(user.getUsername());
indexCarouselManage.setStarttimeIndex(new Date());
indexCarouselManage.setUpdatetimeIndex(new Date());
indexCarouselManage.setCheckIndexAuthor(user.getUsername());
indexCarouselManage.setBriefShow(indexCarouselManage.getBrief());
indexCarouselManage.setLevelsIndex(indexCarouselManage.getLevels()-1);
int insert = baseMapper.insert(indexCarouselManage);
if (insert>0){
return R.ok("新增成功!");
}else{
return R.error("新增失败!");
}
}
@Override
public R updateIndexCarouselManage(IndexCarouselManageEntity indexCarouselManage, SysUserEntity user) {
if(indexCarouselManage.getId() ==null){
return R.error("id不能为空!");
}
QueryWrapper<IndexCarouselManageEntity> newsEntityQueryWrapper = new QueryWrapper<>();
newsEntityQueryWrapper.eq("id",indexCarouselManage.getId());
indexCarouselManage.setEditorIndex(user.getUsername());
indexCarouselManage.setLasteditorIndex(user.getUsername());
indexCarouselManage.setUpdatetimeIndex(new Date());
indexCarouselManage.setBriefShow(indexCarouselManage.getBrief());
indexCarouselManage.setLevelsIndex(indexCarouselManage.getLevels()-1);
int update = baseMapper.update(indexCarouselManage, newsEntityQueryWrapper);
if (update>0){
return R.ok("修改成功!");
}else{
return R.error("修改失败!");
}
}
@Override
public R deleteIndexCarouselManage(List<Integer> asList,SysUserEntity user) {
IndexCarouselManageEntity indexCarouselManageEntity = new IndexCarouselManageEntity();
indexCarouselManageEntity.setLevels(0);
indexCarouselManageEntity.setLasteditorIndex(user.getUsername());
indexCarouselManageEntity.setUpdatetimeIndex(new Date());
QueryWrapper<IndexCarouselManageEntity> newsEntityQueryWrapper = new QueryWrapper<>();
newsEntityQueryWrapper.in("id",asList);
int delete = baseMapper.update(indexCarouselManageEntity, newsEntityQueryWrapper);
if (delete>0){
return R.ok("删除成功!");
}else{
return R.error("删除失败!");
}
}
@Override
public R verifyIndexCarouselManage(IndexCarouselManageEntity indexCarouselManage, SysUserEntity user) {
indexCarouselManage.setCheckIndexAuthor(user.getUsername());
indexCarouselManage.setLasteditorIndex(user.getUsername());
indexCarouselManage.setUpdatetimeIndex(new Date());
QueryWrapper<IndexCarouselManageEntity> newsEntityQueryWrapper = new QueryWrapper<>();
newsEntityQueryWrapper.eq("id",indexCarouselManage.getId());
int verify = baseMapper.update(indexCarouselManage, newsEntityQueryWrapper);
if (verify>0){
return R.ok("审核成功!");
}else{
return R.error("审核失败!");
}
}
@Override
public Page<IndexCarouselManageEntity> selectIndexCarouselManageList(IndexCarouselManageParams indexCarouselManage, Page page) {
if(IndexCarouselManageEnum.ALL.code().equals(indexCarouselManage.getStatus())){
indexCarouselManage.setStatus("");
}
List<IndexCarouselManageEntity> list = this.indexCarouselManageDao.selectIndexCarouselManageList(indexCarouselManage,page);
page.setRecords(list);
return page;
}
}
\ No newline at end of file
package io.office.modules.manage.service.impl;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.common.utils.R;
import io.office.modules.manage.dao.TopicnewsDao;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.TopicnewsEntity;
import io.office.modules.manage.service.TopicnewsService;
import io.office.modules.sys.entity.SysUserEntity;
import org.springframework.stereotype.Service;
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;
@Service("topicnewsService")
public class TopicnewsServiceImpl extends ServiceImpl<TopicnewsDao, TopicnewsEntity> implements TopicnewsService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<TopicnewsEntity> page = this.page(
new Query<TopicnewsEntity>().getPage(params),
new QueryWrapper<TopicnewsEntity>()
);
return new PageUtils(page);
}
@Override
public R insertHdbd(NewsEntity news, SysUserEntity user) {
return null;
}
}
\ 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.IndexCarouselManageDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.IndexCarouselManageEntity" id="indexCarouselManageMap">
<result property="id" column="id"/>
<result property="classnum" column="classnum"/>
<result property="title" column="Title"/>
<result property="brief" column="brief"/>
<result property="levels" column="levels"/>
<result property="levelsIndex" column="levels_index"/>
<result property="directpath" column="directpath"/>
<result property="picIndexPath" column="pic_index_path"/>
<result property="checkflagIndex" column="checkflag_index"/>
<result property="checkIndexAuthor" column="check_index_author"/>
<result property="editorIndex" column="editor_index"/>
<result property="lasteditorIndex" column="lasteditor_index"/>
<result property="starttimeIndex" column="starttime_index"/>
<result property="updatetimeIndex" column="updatetime_index"/>
<result property="colorBackground" column="color_background"/>
<result property="colorBrief" column="color_brief"/>
<result property="colorMore" column="color_more"/>
<result property="briefShow" column="brief_show"/>
</resultMap>
<select id="selectIndexCarouselManageList" resultMap="indexCarouselManageMap" parameterType="io.office.modules.manage.entity.dto.IndexCarouselManageParams">
SELECT
t.id,
t.Title,
t.classnum,
t.starttime_index,
t.updatetime_index,
t.editor_index,
t.lasteditor_index,
t.check_index_author,
t.checkflag_index,
t.levels
FROM
index_carousel_manage t
where 1=1
<if test="indexCarouselManage.title !=null and indexCarouselManage.title !=''">
and t.Title like concat('%',#{indexCarouselManage.title},'%')
</if>
<if test="indexCarouselManage.status !=null and indexCarouselManage.status !=''">
and t.checkflag_index like concat('%',#{indexCarouselManage.status},'%')
</if>
<if test="indexCarouselManage.classnum !=null and indexCarouselManage.classnum !=''">
and t.classnum = #{indexCarouselManage.classnum}
</if>
<choose>
<when test="indexCarouselManage.levels != 0">
AND t.levels = #{indexCarouselManage.levels}
</when>
<otherwise>
AND t.levels = 0
</otherwise>
</choose>
ORDER BY
t.levels desc,t.starttime_index DESC,t.id desc
</select>
</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.TopicnewsDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.TopicnewsEntity" id="topicnewsMap">
<result property="id" column="Id"/>
<result property="classid" column="Classid"/>
<result property="newsid" column="NewsId"/>
<result property="newslevels" column="NewsLevels"/>
<result property="time" column="time"/>
</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