| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.Serializable; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | |
| | |
| | | ArrayList<PublicityVo> publicityVos = new ArrayList<>(); |
| | | PageParam<Publicity> publicityPageParam ; |
| | | if (publicity.getStatus()!=null ){ |
| | | publicityPageParam = publicityService.page(page, new QueryWrapper<Publicity>().like(StringUtils.isNotBlank(publicity.getPublicityTitle()),"publicity_title",publicity.getPublicityTitle()).eq("status",publicity.getStatus()).orderByDesc("ctime")); |
| | | publicityPageParam = publicityService.page(page, |
| | | new QueryWrapper<Publicity>().like(StringUtils.isNotBlank(publicity.getPublicityTitle()), |
| | | "publicity_title", |
| | | publicity.getPublicityTitle()).eq("status",publicity.getStatus()).orderByDesc("ctime")); |
| | | }else { |
| | | publicityPageParam = publicityService.page(page, new QueryWrapper<Publicity>().like(StringUtils.isNotBlank(publicity.getPublicityTitle()),"publicity_title",publicity.getPublicityTitle()).orderByDesc("ctime")); |
| | | publicityPageParam = publicityService.page(page, |
| | | new QueryWrapper<Publicity>().like(StringUtils.isNotBlank(publicity.getPublicityTitle()), |
| | | "publicity_title", |
| | | publicity.getPublicityTitle()).orderByDesc("ctime")); |
| | | } |
| | | publicityPageParam.getRecords().forEach(item->{ |
| | | PublicityVo publicityVo = new PublicityVo(); |
| | |
| | | return R.ok(publicityVoPageParam); |
| | | } |
| | | |
| | | @GetMapping("changTime") |
| | | @ApiOperation("修改时间") |
| | | public R changeTime(@RequestParam Integer id, @RequestParam String time){ |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Publicity publicity = publicityService.getById(id); |
| | | try { |
| | | publicity.setReleaseTime(sdf.parse(time)); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | boolean b = publicityService.updateById(publicity); |
| | | return b ? R.ok("修改成功") : R.failed("修改失败"); |
| | | } |
| | | |
| | | /** |
| | | * 通过主键查询单条数据 |
| | | * |