package com.example.demo2.controller; import com.example.demo2.common.AjaxResult; import com.example.demo2.entity.gongWenInfo; import com.example.demo2.mapper.gongWenMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController @RequestMapping("/gong") public class gongWenController { @Autowired private gongWenMapper gongMapper; @RequestMapping("/addGongWen") public AjaxResult addGongWen(gongWenInfo wenInfo){ if (wenInfo == null) { return AjaxResult.fail(-1,"参数错误"); } int result=gongMapper.addGongWen(wenInfo); return AjaxResult.success(result); } @RequestMapping("/getNeedQian") public AjaxResult getNeedQian(){ List<gongWenInfo> gongWenInfoList=gongMapper.selectByQianshou(0); return AjaxResult.success(gongWenInfoList); } @RequestMapping("/jieShou") public AjaxResult jieShou(Integer id){ if (id == null||id<=0) { return AjaxResult.fail(-1,"参数错误"); } int result=gongMapper.jieShou(id); return AjaxResult.success(result); } @RequestMapping("/getYiQian") public AjaxResult getYiQian(){ List<gongWenInfo> gongWenInfoList=gongMapper.selectByQianshou(1); return AjaxResult.success(gongWenInfoList); } @RequestMapping("/zhanShi") public AjaxResult zhanShi(Integer id){ if (id == null||id<=0) { return AjaxResult.fail(-1,"参数错误"); } gongWenInfo wenInfo=gongMapper.findGongById(id); return AjaxResult.success(wenInfo); } @RequestMapping("showAllGongWen") public AjaxResult showAllGongWen(){ return AjaxResult.success(gongMapper.selectAllGongWen()); } @RequestMapping("/selectMoHu") public AjaxResult selectMoHu(Integer id, String content) { System.out.println("id->"+id); System.out.println("content->"+content); return AjaxResult.success(gongMapper.selectMoHuGongWen(id,content)); } @RequestMapping("/SelectAllByZanWu") public AjaxResult SelectAllByZanWu(){ return AjaxResult.success(gongMapper.SelectAllByZanWu("暂无")); } @RequestMapping("/UpdateSelectByZanWu") public AjaxResult UpdateSelectByZanWu(Integer id,String shenggaoyijian){ return AjaxResult.success(gongMapper.UpdateSelectByZanWu(id,shenggaoyijian)); } @RequestMapping("/ShanChuById") public AjaxResult ShanChuById(Integer id){ return AjaxResult.success(gongMapper.ShanChuById(id)); } }
标签:总结,23.12,AjaxResult,return,RequestMapping,每日,public,gongMapper,id From: https://www.cnblogs.com/laobing6214/p/17878144.html