| | |
| | | package com.ycl.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ycl.common.utils.SecurityUtils; |
| | | import com.ycl.domain.entity.ProjectInvestmentInfo; |
| | | import com.ycl.domain.entity.ProjectUnitRegistrationInfo; |
| | | import com.ycl.domain.vo.ProjectInvestmentInfoVO; |
| | | import com.ycl.mapper.ProjectUnitRegistrationInfoMapper; |
| | | import com.ycl.service.ProjectUnitRegistrationInfoService; |
| | | import com.ycl.common.base.Result; |
| | |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @param form |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result add(ProjectUnitRegistrationInfoForm form) { |
| | | ProjectUnitRegistrationInfo entity = ProjectUnitRegistrationInfoForm.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()); |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | * |
| | | * @param form |
| | | * @return |
| | | */ |
| | |
| | | // 为空抛IllegalArgumentException,做全局异常处理 |
| | | Assert.notNull(entity, "记录不存在"); |
| | | BeanUtils.copyProperties(form, entity); |
| | | Long userId = SecurityUtils.getUserId(); |
| | | entity.setUpdateBy(userId); |
| | | baseMapper.updateById(entity); |
| | | return Result.ok("修改成功"); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * id删除 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据id查找 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result detail(Integer id) { |
| | | ProjectUnitRegistrationInfoVO vo = baseMapper.getById(id); |
| | | Assert.notNull(vo, "记录不存在"); |
| | | QueryWrapper<ProjectUnitRegistrationInfo> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("project_id", id); |
| | | ProjectUnitRegistrationInfo entity = baseMapper.selectOne(queryWrapper); |
| | | ProjectUnitRegistrationInfoVO vo = new ProjectUnitRegistrationInfoVO(); |
| | | if (entity != null) { |
| | | vo = ProjectUnitRegistrationInfoVO.getVoByEntity(entity, null); |
| | | } |
| | | return Result.ok().data(vo); |
| | | } |
| | | |
| | | /** |
| | | * 列表 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |