| | |
| | | import com.ycl.platform.domain.form.NotifyForm; |
| | | import com.ycl.platform.domain.vo.NotifyVO; |
| | | import com.ycl.platform.domain.query.NotifyQuery; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | @Override |
| | | public Result add(NotifyForm form) { |
| | | Notify entity = NotifyForm.getEntityByForm(form, null); |
| | | Date now = new Date(); |
| | | entity.setCreateTime(now); |
| | | entity.setUpdateTime(now); |
| | | if(baseMapper.insert(entity) > 0) { |
| | | return Result.ok("添加成功"); |
| | | } |
| | |
| | | public Result update(NotifyForm form) { |
| | | |
| | | Notify entity = baseMapper.selectById(form.getId()); |
| | | |
| | | // 为空抛IllegalArgumentException,做全局异常处理 |
| | | Assert.notNull(entity, "记录不存在"); |
| | | BeanUtils.copyProperties(form, entity); |
| | | Date now = new Date(); |
| | | entity.setUpdateTime(now); |
| | | if (baseMapper.updateById(entity) > 0) { |
| | | return Result.ok("修改成功"); |
| | | } |