bug
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
package com.peanut.modules.common.dao;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.peanut.modules.common.entity.TaihuWelfareEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface TaihuWelfareDao extends MPJBaseMapper<TaihuWelfareEntity> {
|
||||||
|
}
|
||||||
@@ -1,4 +1,27 @@
|
|||||||
package com.peanut.modules.common.entity;
|
package com.peanut.modules.common.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("taihu_welfare")
|
||||||
public class TaihuWelfareEntity {
|
public class TaihuWelfareEntity {
|
||||||
|
|
||||||
|
@TableId
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
@TableLogic
|
||||||
|
private Integer delFlag;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.peanut.modules.master.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.peanut.common.utils.R;
|
||||||
|
import com.peanut.modules.common.entity.TaihuWelfareEntity;
|
||||||
|
import com.peanut.modules.common.to.ParamTo;
|
||||||
|
import com.peanut.modules.master.service.TaihuWelfareService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController("masterTaihuWelfare")
|
||||||
|
@RequestMapping("master/taihuWelfare")
|
||||||
|
public class TaihuWelfareController {
|
||||||
|
@Autowired
|
||||||
|
private TaihuWelfareService taihuWelfareService;
|
||||||
|
|
||||||
|
@RequestMapping("/getArticleList")
|
||||||
|
public R getArticleList(@RequestBody ParamTo param){
|
||||||
|
Page articleList = taihuWelfareService.getArticleList(param.getPage(), param.getLimit());
|
||||||
|
return R.ok().put("page",articleList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/addArticle")
|
||||||
|
public R addArticle(@RequestBody TaihuWelfareEntity taihuWelfareEntity){
|
||||||
|
taihuWelfareService.save(taihuWelfareEntity);
|
||||||
|
return R.ok().put("result",taihuWelfareEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/editArticle")
|
||||||
|
public R editArticle(@RequestBody TaihuWelfareEntity taihuWelfareEntity){
|
||||||
|
taihuWelfareService.updateById(taihuWelfareEntity);
|
||||||
|
return R.ok().put("result",taihuWelfareEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/delArticle")
|
||||||
|
public R delArticle(@RequestBody Map<String,Integer> map){
|
||||||
|
int id = map.get("id");
|
||||||
|
taihuWelfareService.removeById(id);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.peanut.modules.master.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.peanut.modules.common.entity.TaihuWelfareEntity;
|
||||||
|
|
||||||
|
public interface TaihuWelfareService extends IService<TaihuWelfareEntity> {
|
||||||
|
|
||||||
|
Page getArticleList(int page,int limit);
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.peanut.modules.master.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.peanut.modules.common.dao.TaihuWelfareDao;
|
||||||
|
import com.peanut.modules.common.entity.TaihuWelfareEntity;
|
||||||
|
import com.peanut.modules.master.service.TaihuWelfareService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service("masterTaihuWelfareService")
|
||||||
|
public class TaihuWelfareServiceImpl extends ServiceImpl<TaihuWelfareDao, TaihuWelfareEntity> implements TaihuWelfareService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page getArticleList(int page, int limit) {
|
||||||
|
LambdaQueryWrapper<TaihuWelfareEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.orderByAsc(TaihuWelfareEntity::getSort);
|
||||||
|
Page<TaihuWelfareEntity> taihuWelfareEntityPage = this.getBaseMapper().selectPage(new Page<>(page, limit), wrapper);
|
||||||
|
return taihuWelfareEntityPage;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user