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 map){ int id = map.get("id"); taihuWelfareService.removeById(id); return R.ok(); } @RequestMapping("/getArticleDetail") public R getArticleDetail(@RequestBody Map map){ int id = map.get("id"); TaihuWelfareEntity byId = taihuWelfareService.getById(id); return R.ok().put("result",byId); } }