| | |
| | | import com.ycl.platform.domain.form.CalculateMoneyRuleForm; |
| | | import com.ycl.platform.domain.vo.CalculateMoneyRuleVO; |
| | | import com.ycl.platform.domain.query.CalculateMoneyRuleQuery; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | @Override |
| | | public Result add(CalculateMoneyRuleForm form) { |
| | | CalculateMoneyRule entity = CalculateMoneyRuleForm.getEntityByForm(form, null); |
| | | Date now = new Date(); |
| | | entity.setCreateTime(now); |
| | | entity.setUpdateTime(now); |
| | | if(baseMapper.insert(entity) > 0) { |
| | | return Result.ok("添加成功"); |
| | | } |
| | |
| | | public Result update(CalculateMoneyRuleForm form) { |
| | | |
| | | CalculateMoneyRule 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("修改成功"); |
| | | } |