Commit 0f4b9709 by rongkailun

【新增】活动报道

parent c58a490a
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 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-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.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 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.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