Commit c6a9f1d4 by 吴迪

初始代码提交

parent a39fad8d
package io.office.modules.manage.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.office.modules.app.annotation.Login;
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;
import io.office.modules.manage.entity.NewsColumnEntity;
import io.office.modules.manage.service.NewsColumnService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-10-11 14:53:31
*/
@RestController
@RequestMapping("/newscolumn")
public class NewsColumnController {
@Autowired
private NewsColumnService newsColumnService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("manage:newscolumn:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = newsColumnService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{columnid}")
// @RequiresPermissions("manage:newscolumn:info")
public R info(@PathVariable("columnid") Integer columnid){
NewsColumnEntity newsColumn = newsColumnService.getById(columnid);
return R.ok().put("newsColumn", newsColumn);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("manage:newscolumn:save")
public R save(@RequestBody NewsColumnEntity newsColumn){
newsColumnService.save(newsColumn);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("manage:newscolumn:update")
public R update(@RequestBody NewsColumnEntity newsColumn){
newsColumnService.updateById(newsColumn);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("manage:newscolumn:delete")
public R delete(@RequestBody Integer[] columnids){
newsColumnService.removeByIds(Arrays.asList(columnids));
return R.ok();
}
/**
* 文章管理新增的时候获取栏目选项
*/
//@Login //标识必须登录状态下才能请求此接口
@RequestMapping("/getNewsClassList")
public R getNewsClassList(){
QueryWrapper<NewsColumnEntity> newsColumnEntityQueryWrapper = new QueryWrapper<>();
//之前前端固定写死的几个
List 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);
newsColumnEntityQueryWrapper.in("columnid",list);
List<NewsColumnEntity> newsColumnEntities = newsColumnService.list(newsColumnEntityQueryWrapper);
return R.ok().put("data",newsColumnEntities);
}
}
package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Map;
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;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.service.NewsService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-10-11 14:53:31
*/
@RestController
@RequestMapping("/news")
public class NewsController {
@Autowired
private NewsService newsService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("manage:news:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = newsService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
// @RequiresPermissions("manage:news:info")
public R info(@PathVariable("id") Integer id){
NewsEntity news = newsService.getById(id);
return R.ok().put("news", news);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("manage:news:save")
public R save(@RequestBody NewsEntity news){
newsService.save(news);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("manage:news:update")
public R update(@RequestBody NewsEntity news){
newsService.updateById(news);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("manage:news:delete")
public R delete(@RequestBody Integer[] ids){
newsService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}
package io.office.modules.manage.dao;
import io.office.modules.manage.entity.NewsColumnEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-10-11 14:53:31
*/
@Mapper
public interface NewsColumnDao extends BaseMapper<NewsColumnEntity> {
}
package io.office.modules.manage.dao;
import io.office.modules.manage.entity.NewsEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-10-11 14:53:31
*/
@Mapper
public interface NewsDao extends BaseMapper<NewsEntity> {
}
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-11 14:53:31
*/
@Data
@TableName("news_column")
public class NewsColumnEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
@TableId
private Integer columnid;
/**
* $column.comments
*/
private String columnname;
/**
* $column.comments
*/
private Integer channelid;
}
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-11 14:53:31
*/
@Data
@TableName("news")
public class NewsEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
@TableId
private Integer id;
/**
* $column.comments
*/
private Integer columnid;
/**
* $column.comments
*/
private String title;
/**
* $column.comments
*/
private String titleOld;
/**
* $column.comments
*/
private String keyword;
/**
* $column.comments
*/
private String brief;
/**
* $column.comments
*/
private Date releasedate;
/**
* $column.comments
*/
private Date updatedate;
/**
* $column.comments
*/
private String author;
/**
* $column.comments
*/
private String source;
/**
* $column.comments
*/
private Integer levels;
/**
* $column.comments
*/
private String directpath;
/**
* $column.comments
*/
private String pic;
/**
* $column.comments
*/
private String content;
/**
* $column.comments
*/
private Integer hits;
/**
* $column.comments
*/
private String editor;
/**
* $column.comments
*/
private String lasteditor;
/**
* $column.comments
*/
private Integer classid;
/**
* $column.comments
*/
private Date publicdate;
/**
* $column.comments
*/
private Date startdate;
/**
* $column.comments
*/
private String ishead;
/**
* $column.comments
*/
private Integer status;
/**
* $column.comments
*/
private String auditor;
/**
* $column.comments
*/
private String showtime;
/**
* $column.comments
*/
private Date checkdate;
}
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.NewsColumnEntity;
import java.util.Map;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-10-11 14:53:31
*/
public interface NewsColumnService extends IService<NewsColumnEntity> {
PageUtils queryPage(Map<String, Object> params);
}
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.NewsEntity;
import java.util.Map;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-10-11 14:53:31
*/
public interface NewsService extends IService<NewsEntity> {
PageUtils queryPage(Map<String, Object> params);
}
package io.office.modules.manage.service.impl;
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;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.modules.manage.dao.NewsColumnDao;
import io.office.modules.manage.entity.NewsColumnEntity;
import io.office.modules.manage.service.NewsColumnService;
@Service("newsColumnService")
public class NewsColumnServiceImpl extends ServiceImpl<NewsColumnDao, NewsColumnEntity> implements NewsColumnService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<NewsColumnEntity> page = this.page(
new Query<NewsColumnEntity>().getPage(params),
new QueryWrapper<NewsColumnEntity>()
);
return new PageUtils(page);
}
}
\ No newline at end of file
package io.office.modules.manage.service.impl;
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;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.modules.manage.dao.NewsDao;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.service.NewsService;
@Service("newsService")
public class NewsServiceImpl extends ServiceImpl<NewsDao, NewsEntity> implements NewsService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<NewsEntity> page = this.page(
new Query<NewsEntity>().getPage(params),
new QueryWrapper<NewsEntity>()
);
return new PageUtils(page);
}
}
\ No newline at end of file
......@@ -64,10 +64,10 @@ public class SysLoginController extends AbstractController {
*/
@PostMapping("/sys/login")
public Map<String, Object> login(@RequestBody SysLoginForm form)throws IOException {
boolean captcha = sysCaptchaService.validate(form.getUuid(), form.getCaptcha());
/*boolean captcha = sysCaptchaService.validate(form.getUuid(), form.getCaptcha());
if(!captcha){
return R.error("验证码不正确");
}
}*/
//用户信息
SysUserEntity user = sysUserService.queryByUserName(form.getUsername());
......
<?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.NewsColumnDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.NewsColumnEntity" id="newsColumnMap">
<result property="columnid" column="columnid"/>
<result property="columnname" column="columnname"/>
<result property="channelid" column="channelID"/>
</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.NewsDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.NewsEntity" id="newsMap">
<result property="id" column="id"/>
<result property="columnid" column="columnid"/>
<result property="title" column="title"/>
<result property="titleOld" column="title_old"/>
<result property="keyword" column="keyword"/>
<result property="brief" column="brief"/>
<result property="releasedate" column="releasedate"/>
<result property="updatedate" column="updatedate"/>
<result property="author" column="author"/>
<result property="source" column="source"/>
<result property="levels" column="levels"/>
<result property="directpath" column="directpath"/>
<result property="pic" column="pic"/>
<result property="content" column="content"/>
<result property="hits" column="hits"/>
<result property="editor" column="editor"/>
<result property="lasteditor" column="lasteditor"/>
<result property="classid" column="classid"/>
<result property="publicdate" column="publicdate"/>
<result property="startdate" column="startdate"/>
<result property="ishead" column="ishead"/>
<result property="status" column="status"/>
<result property="auditor" column="auditor"/>
<result property="showtime" column="showtime"/>
<result property="checkdate" column="checkdate"/>
</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