| | |
| | | package com.ycl.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.ycl.common.utils.SecurityUtils; |
| | | import com.ycl.domain.entity.ProjectInvestmentFunding; |
| | | import com.ycl.domain.entity.ProjectInvestmentInfo; |
| | | import com.ycl.domain.vo.ProjectInvestmentInfoVO; |
| | | import com.ycl.mapper.ProjectInvestmentFundingMapper; |
| | | import com.ycl.service.ProjectInvestmentFundingService; |
| | | import com.ycl.common.base.Result; |
| | |
| | | @Override |
| | | public Result add(ProjectInvestmentFundingForm form) { |
| | | ProjectInvestmentFunding entity = ProjectInvestmentFundingForm.getEntityByForm(form, null); |
| | | Long userId = SecurityUtils.getUserId(); |
| | | entity.setCreateBy(userId); |
| | | entity.setUpdateBy(userId); |
| | | baseMapper.insert(entity); |
| | | return Result.ok("添加成功"); |
| | | //避免新增一个后重复新增返回id给前端判断 |
| | | return Result.ok("添加成功").data(entity.getId()); |
| | | } |
| | | |
| | | /** |
| | |
| | | // 为空抛IllegalArgumentException,做全局异常处理 |
| | | Assert.notNull(entity, "记录不存在"); |
| | | BeanUtils.copyProperties(form, entity); |
| | | Long userId = SecurityUtils.getUserId(); |
| | | entity.setUpdateBy(userId); |
| | | baseMapper.updateById(entity); |
| | | return Result.ok("修改成功"); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public Result detail(Integer id) { |
| | | ProjectInvestmentFundingVO vo = baseMapper.getById(id); |
| | | Assert.notNull(vo, "记录不存在"); |
| | | ProjectInvestmentFunding entity = new LambdaQueryChainWrapper<>(baseMapper) |
| | | .eq(ProjectInvestmentFunding::getProjectId, id) |
| | | .one(); |
| | | ProjectInvestmentFundingVO vo =new ProjectInvestmentFundingVO(); |
| | | if(entity!=null){ |
| | | vo = ProjectInvestmentFundingVO.getVoByEntity(entity, null); |
| | | } |
| | | return Result.ok().data(vo); |
| | | } |
| | | |