| | |
| | | package com.fgkj.controller; |
| | | |
| | | import com.fgkj.util.*; |
| | | |
| | | import com.fgkj.dto.Announce; |
| | | import com.fgkj.dto.ServiceModel; |
| | | import com.fgkj.dto.User_inf; |
| | | import com.fgkj.services.AnnounceService; |
| | | import com.fgkj.util.*; |
| | | import com.fgkj.util.ActionUtil; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | |
| | | @RequestMapping("announce") |
| | | @RestController |
| | | @Api |
| | | @Api(tags = "announce接口") |
| | | public class AnnounceController{ |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private AnnounceService service; |
| | | |
| | | //接收前台传入的数据 |
| | | private Announce anno; |
| | | // private Announce anno; |
| | | |
| | | //0.6公告信息显示 |
| | | @GetMapping("all") |
| | | @ApiOperation(notes = "",value="公告信息显示") |
| | | public ServiceModel searchAll(){ |
| | | ServiceModel model=service.searchAll(); |
| | | return model; |
| | |
| | | |
| | | //发布新公告 |
| | | @PostMapping("/") |
| | | public ServiceModel add(@RequestBody Announce a) { |
| | | @ApiOperation(notes = "KEY announce_time VALUE 2018/7/7 11:11:00",value="发布新公告") |
| | | public ServiceModel add(@ApiParam(value = "时间 格式 2018/7/7 11:11:00" ,required = true)@RequestParam Date announce_time, |
| | | @ApiParam(value = "消息" ,required = true)@RequestParam String message, |
| | | @ApiParam(value = "备注" ,required = true)@RequestParam String note) { |
| | | Announce a= new Announce(); |
| | | a.setAnnounce_time(announce_time); |
| | | a.setMessage(message); |
| | | a.setNote(note); |
| | | // Announce a=ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, Announce.class); |
| | | User_inf uinf=(User_inf) ActionUtil.getUser(); |
| | | a.setUsr_id(uinf.getUId()); |
| | | a.setUsr_id(uinf.getuId()); |
| | | ServiceModel model=service.add(a); |
| | | return model; |
| | | } |
| | | |
| | | //更新公告 |
| | | |
| | | //更新公告 |
| | | @PutMapping("/") |
| | | @ApiOperation(notes = "{ \"num\": 13, \"usr_id\": \"1001\", \"announce_time\": \"2026-09-05 07:30:00\", \"message\": \"news\", \"note\": \" \" }",value="更新公告") |
| | | public ServiceModel update(@RequestBody Announce a) { |
| | | // Announce a=ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, Announce.class); |
| | | ServiceModel model=service.update(a); |
| | | return model; |
| | | } |
| | | ServiceModel model = service.update(a); |
| | | return model; |
| | | } |
| | | |
| | | //删除公告 |
| | | @DeleteMapping("/") |
| | | public ServiceModel delete(@RequestBody Announce a) { |
| | | // Announce a=ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, Announce.class); |
| | | @ApiOperation(notes = "",value="删除公告") |
| | | public ServiceModel delete(@RequestParam Integer num) { |
| | | Announce a= new Announce(); |
| | | a.setNum(num); |
| | | ServiceModel model=service.delete(a); |
| | | return model; |
| | | } |
| | | |
| | | //根据条件查询公告信息 |
| | | @GetMapping("byCondition") |
| | | public ServiceModel serchByCondition(@RequestBody Announce a){ |
| | | // Announce a=ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, Announce.class); |
| | | ServiceModel model=service.serchByCondition(a); |
| | | @PostMapping("byCondition") |
| | | @ApiOperation(notes = "{ \"announce_time\":\"2000-09-05 07:30:00\", \"announce_time1\":\"2016-09-05 07:30:00\", \"message\":\"news\", \"usr_id\":\"1002\", \"pageBean\":{ \"pageNum\":\"1\", \"pageSize\":\"10\" } }",value="根据条件查询公告信息") |
| | | public ServiceModel serchByCondition(@RequestBody Announce a) { |
| | | ServiceModel model = service.serchByCondition(a); |
| | | return model; |
| | | } |
| | | } |
| | | |
| | | } |