Commit 785adf1f by 吴迪

【修改】视频管理模块修改

parent 6304c8c2
package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.office.common.annotation.SysLog;
import io.office.modules.manage.entity.NewtopicEntity;
import io.office.modules.manage.vo.request.NewsMovieEntityVo;
import io.office.modules.manage.vo.request.NewtopicEntityVo;
import io.office.modules.sys.controller.AbstractController;
import io.office.modules.sys.entity.SysUserEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
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.NewsMovieEntity;
import io.office.modules.manage.service.NewsMovieService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-10-19 14:13:58
*/
@RestController
@RequestMapping("/newsmovie")
public class NewsMovieController extends AbstractController {
@Autowired
private NewsMovieService newsMovieService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("manage:newsmovie:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = newsMovieService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
// @RequiresPermissions("manage:newsmovie:info")
public R info(@PathVariable("id") Integer id){
NewsMovieEntity newsMovie = newsMovieService.getById(id);
return R.ok().put("newsMovie", newsMovie);
}
/**
* 保存
*/
@SysLog("保存newsMovie")
@Transactional
@RequestMapping("/save")
// @RequiresPermissions("manage:newsmovie:save")
public R save(@RequestBody NewsMovieEntityVo newsMovieEntityVo){
SysUserEntity user = getUser();
newsMovieService.insert(newsMovieEntityVo,user);
return R.ok();
}
/**
* 修改
*/
@SysLog("修改newsMovie")
@Transactional
@RequestMapping("/update")
// @RequiresPermissions("manage:newsmovie:update")
public R update(@RequestBody NewsMovieEntity newsMovieEntity){
SysUserEntity user = getUser();
newsMovieEntity.setLasteditor(user.getUsername());
QueryWrapper<NewsMovieEntity> newsMovieEntityQueryWrapper = new QueryWrapper<>();
newsMovieEntityQueryWrapper.eq("id",newsMovieEntity.getId());
newsMovieService.update(newsMovieEntity,newsMovieEntityQueryWrapper);
return R.ok();
}
/**
* 删除
*/
@SysLog("删除newsMovie")
@Transactional
@RequestMapping("/delete")
// @RequiresPermissions("manage:newsmovie:delete")
public R delete(@RequestBody Integer[] ids){
SysUserEntity user = getUser();
NewsMovieEntity newsMovieEntity = new NewsMovieEntity();
newsMovieEntity.setLasteditor(user.getUsername());
newsMovieEntity.setLevels(0);
QueryWrapper<NewsMovieEntity> newsMovieEntityQueryWrapper = new QueryWrapper<>();
newsMovieEntityQueryWrapper.in("id",Arrays.asList(ids));
newsMovieService.update(newsMovieEntity,newsMovieEntityQueryWrapper);
return R.ok();
}
@SysLog("审核newsMovie")
@Transactional
@RequestMapping("/verify")
// @RequiresPermissions("manage:newsmovie:verify")
public R verify(@RequestBody NewsMovieEntityVo newsMovieEntityVo) {
SysUserEntity user = getUser();
NewsMovieEntity newsMovieEntity = new NewsMovieEntity();
newsMovieEntity.setAuditor(user.getUsername());
BeanUtils.copyProperties(newsMovieEntityVo,newsMovieEntity);
QueryWrapper<NewsMovieEntity> newsMovieEntityQueryWrapper = new QueryWrapper<>();
newsMovieEntityQueryWrapper.eq("id",newsMovieEntityVo.getId());
newsMovieService.update(newsMovieEntity,newsMovieEntityQueryWrapper);
return R.ok();
}
}
...@@ -122,7 +122,7 @@ public class NewtopicController extends AbstractController { ...@@ -122,7 +122,7 @@ public class NewtopicController extends AbstractController {
NewtopicEntity newtopicEntity = new NewtopicEntity(); NewtopicEntity newtopicEntity = new NewtopicEntity();
newtopicEntity.setAuditor(user.getUsername()); newtopicEntity.setAuditor(user.getUsername());
QueryWrapper<NewtopicEntity> newtopicEntityQueryWrapper = new QueryWrapper<>(); QueryWrapper<NewtopicEntity> newtopicEntityQueryWrapper = new QueryWrapper<>();
newtopicEntityQueryWrapper.in("classid",newtopicEntity.getClassid()); newtopicEntityQueryWrapper.eq("classid",newtopicEntity.getClassid());
newtopicService.update(newtopicEntity,newtopicEntityQueryWrapper); newtopicService.update(newtopicEntity,newtopicEntityQueryWrapper);
return R.ok(); return R.ok();
} }
......
package io.office.modules.manage.dao;
import io.office.modules.manage.entity.NewsMovieEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-10-19 14:13:58
*/
@Mapper
public interface NewsMovieDao extends BaseMapper<NewsMovieEntity> {
}
package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.TableField;
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-19 14:13:58
*/
@Data
@TableName("news_movie")
public class NewsMovieEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
@TableId
private Integer id;
/**
* $column.comments
*/
private String title;
/**
* $column.comments
*/
private String titleOld;
/**
* $column.comments
*/
private String keyword;
/**
* $column.comments
*/
private Date releasedate;
/**
* $column.comments
*/
private Date updatedate;
/**
* $column.comments
*/
private String rmname;
/**
* $column.comments
*/
private String wavname;
/**
* $column.comments
*/
private String littlepic;
/**
* $column.comments
*/
private String bigpic;
/**
* $column.comments
*/
private String author;
/**
* $column.comments
*/
private String clanguage;
/**
* $column.comments
*/
@TableField("long")
private String longStr;
/**
* $column.comments
*/
private String stdate;
/**
* $column.comments
*/
private String editor;
/**
* $column.comments
*/
private Integer hits;
/**
* $column.comments
*/
private Integer levels;
/**
* $column.comments
*/
private Integer status;
/**
* $column.comments
*/
private String type;
/**
* $column.comments
*/
private Integer newsRelease;
/**
* $column.comments
*/
private String brief;
/**
* $column.comments
*/
private String directpath;
/**
* $column.comments
*/
private String showtime;
/**
* $column.comments
*/
private String auditor;
/**
* $column.comments
*/
private String lasteditor;
}
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.NewsMovieEntity;
import io.office.modules.manage.vo.request.NewsMovieEntityVo;
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-19 14:13:58
*/
public interface NewsMovieService extends IService<NewsMovieEntity> {
PageUtils queryPage(Map<String, Object> params);
void insert(NewsMovieEntityVo newsMovieEntityVo, SysUserEntity user);
}
package io.office.modules.manage.service.impl;
import io.office.modules.manage.vo.request.NewsMovieEntityVo;
import io.office.modules.sys.entity.SysUserEntity;
import org.springframework.beans.BeanUtils;
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.NewsMovieDao;
import io.office.modules.manage.entity.NewsMovieEntity;
import io.office.modules.manage.service.NewsMovieService;
@Service("newsMovieService")
public class NewsMovieServiceImpl extends ServiceImpl<NewsMovieDao, NewsMovieEntity> implements NewsMovieService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
QueryWrapper<NewsMovieEntity> newsMovieEntityQueryWrapper = new QueryWrapper<>();
newsMovieEntityQueryWrapper.select("id,title,keyword,author,releasedate,long as longStr,clanguage,lasteditor,showtime,auditor,status");
if(params.containsKey("levels")) {
newsMovieEntityQueryWrapper.eq("levels",params.get("levels"));
} else{
newsMovieEntityQueryWrapper.gt("levels","0");
}
newsMovieEntityQueryWrapper.likeLeft(params.containsKey("title"),"title",params.get("levels"));
newsMovieEntityQueryWrapper.likeLeft(params.containsKey("author"),"author",params.get("author"));
newsMovieEntityQueryWrapper.likeLeft(params.containsKey("auditor"),"auditor",params.get("auditor"));
newsMovieEntityQueryWrapper.likeLeft(params.containsKey("keyword"),"keyword",params.get("keyword"));
newsMovieEntityQueryWrapper.eq(params.containsKey("status"),"status",params.get("status"));
newsMovieEntityQueryWrapper.eq(params.containsKey("clanguage"),"clanguage",params.get("clanguage"));
newsMovieEntityQueryWrapper.orderByDesc("releasedate");
IPage<NewsMovieEntity> page = this.page(
new Query<NewsMovieEntity>().getPage(params),
newsMovieEntityQueryWrapper
);
return new PageUtils(page);
}
@Override
public void insert(NewsMovieEntityVo newtopicEntityVo, SysUserEntity user) {
Date date = new Date();
newtopicEntityVo.setAuthor(user.getUsername());
newtopicEntityVo.setReleasedate(date);
newtopicEntityVo.setUpdatedate(date);
newtopicEntityVo.setLasteditor(user.getUsername());
NewsMovieEntity newsMovieEntity = new NewsMovieEntity();
BeanUtils.copyProperties(newtopicEntityVo,newsMovieEntity);
baseMapper.insert(newsMovieEntity);
}
}
\ No newline at end of file
package io.office.modules.manage.vo.request;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
* 
 @description:
*
* @author wudi
* @date 15:54 2021/10/20
*/
@Data
public class NewsMovieEntityVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
private Integer id;
/**
* $column.comments
*/
private String title;
/**
* $column.comments
*/
private String titleOld;
/**
* $column.comments
*/
private String keyword;
/**
* $column.comments
*/
private Date releasedate;
/**
* $column.comments
*/
private Date updatedate;
/**
* $column.comments
*/
private String rmname;
/**
* $column.comments
*/
private String wavname;
/**
* $column.comments
*/
private String littlepic;
/**
* $column.comments
*/
private String bigpic;
/**
* $column.comments
*/
private String author;
/**
* $column.comments
*/
private String clanguage;
/**
* $column.comments
*/
private String longStr;
/**
* $column.comments
*/
private String stdate;
/**
* $column.comments
*/
private String editor;
/**
* $column.comments
*/
private Integer hits;
/**
* $column.comments
*/
private Integer levels;
/**
* $column.comments
*/
private Integer status;
/**
* $column.comments
*/
private String type;
/**
* $column.comments
*/
private Integer newsRelease;
/**
* $column.comments
*/
private String brief;
/**
* $column.comments
*/
private String directpath;
/**
* $column.comments
*/
private String showtime;
/**
* $column.comments
*/
private String auditor;
/**
* $column.comments
*/
private String lasteditor;
}
<?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.NewsMovieDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.NewsMovieEntity" id="newsMovieMap">
<result property="id" column="id"/>
<result property="title" column="title"/>
<result property="titleOld" column="title_old"/>
<result property="keyword" column="keyword"/>
<result property="releasedate" column="releasedate"/>
<result property="updatedate" column="updatedate"/>
<result property="rmname" column="rmname"/>
<result property="wavname" column="wavname"/>
<result property="littlepic" column="littlepic"/>
<result property="bigpic" column="bigpic"/>
<result property="author" column="author"/>
<result property="clanguage" column="clanguage"/>
<result property="longStr" column="long"/>
<result property="stdate" column="stdate"/>
<result property="editor" column="editor"/>
<result property="hits" column="hits"/>
<result property="levels" column="levels"/>
<result property="status" column="status"/>
<result property="type" column="type"/>
<result property="newsRelease" column="news_release"/>
<result property="brief" column="brief"/>
<result property="directpath" column="directpath"/>
<result property="showtime" column="showtime"/>
<result property="auditor" column="auditor"/>
<result property="lasteditor" column="lasteditor"/>
</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