| | |
| | | */
|
| | | @GetMapping("{id}")
|
| | | @ApiOperation(value = "按id查询数据")
|
| | | public R selectOne(@PathVariable Serializable id) {
|
| | | return success(this.newsInformationService.getById(id));
|
| | | public R selectOne(@PathVariable Integer id) {
|
| | | return success(this.newsInformationService.selectInformationById(id));
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | @ApiOperation(value = "修改数据")
|
| | | @Transactional
|
| | | public R update(@RequestBody NewsInformation newsInformation) {
|
| | | Integer informationId = newsInformation.getId();
|
| | | if (newsInformation.getIsSign()==0){
|
| | | newsInformationPoliceService.remove(new QueryWrapper<NewsInformationPolice>().eq("news_information_id",informationId));
|
| | | List<String> departmentIds = newsInformation.getDepartmentId();
|
| | | for (String departmentId:departmentIds){
|
| | | QueryWrapper<NewsPolice> wrapper = new QueryWrapper();
|
| | | wrapper.eq("news_department_id",departmentId);
|
| | | List<NewsPolice> list = policeService.list(wrapper);
|
| | | if (!list.isEmpty()){
|
| | | for (NewsPolice newsPolice:list){
|
| | | newsInformationPoliceService.save(NewsInformationPolice.builder().newsPoliceId(newsPolice.getId()).newsInformationId(informationId).isSign(0).build());
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | newsColumnInformationService.remove(new QueryWrapper<NewsColumnInformation>().eq("information_id",informationId));
|
| | | for (String columnId:newsInformation.getColumnId()){
|
| | | newsColumnInformationService.save(NewsColumnInformation.builder().columnId(Integer.parseInt(columnId)).informationId(informationId).build());
|
| | | }
|
| | | // Integer informationId = newsInformation.getId();
|
| | | // if (newsInformation.getIsSign()==0){
|
| | | // newsInformationPoliceService.remove(new QueryWrapper<NewsInformationPolice>().eq("news_information_id",informationId));
|
| | | // List<String> departmentIds = newsInformation.getDepartmentId();
|
| | | // for (String departmentId:departmentIds){
|
| | | // QueryWrapper<NewsPolice> wrapper = new QueryWrapper();
|
| | | // wrapper.eq("news_department_id",departmentId);
|
| | | // List<NewsPolice> list = policeService.list(wrapper);
|
| | | // if (!list.isEmpty()){
|
| | | // for (NewsPolice newsPolice:list){
|
| | | // newsInformationPoliceService.save(NewsInformationPolice.builder().newsPoliceId(newsPolice.getId()).newsInformationId(informationId).isSign(0).build());
|
| | | // }
|
| | | // }
|
| | | // }
|
| | | // }
|
| | | // newsColumnInformationService.remove(new QueryWrapper<NewsColumnInformation>().eq("information_id",informationId));
|
| | | // for (String columnId:newsInformation.getColumnId()){
|
| | | // newsColumnInformationService.save(NewsColumnInformation.builder().columnId(Integer.parseInt(columnId)).informationId(informationId).build());
|
| | | // }
|
| | |
|
| | | // return success(this.newsInformationService.updateInformationById(newsInformation));
|
| | | return success(this.newsInformationService.updateInformationById(newsInformation));
|
| | | }
|
| | |
|
| | |
| | | @DeleteMapping
|
| | | @ApiOperation(value = "删除数据")
|
| | | public R delete(@RequestParam("idList") List<Long> idList) {
|
| | | if (idList==null||idList.size()==0){
|
| | | return failed("请选择一个刹车农户对象");
|
| | | }
|
| | | for (long id:idList){
|
| | | newsColumnInformationService.remove(new QueryWrapper<NewsColumnInformation>().eq("information_id",id));
|
| | | }
|
| | | return success(this.newsInformationService.removeByIds(idList));
|
| | | }
|
| | | }
|