| | |
| | | import com.example.jz.modle.entity.User; |
| | | import com.example.jz.modle.vo.PublicityVo; |
| | | import com.example.jz.service.PublicityService; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.SneakyThrows; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.Serializable; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | |
| | |
| | | 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("修改失败"); |
| | | } |
| | | |
| | | /** |
| | | * 通过主键查询单条数据 |
| | | * |