| | |
| | | package com.ycl.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ycl.domain.entity.ProjectCodingStatus; |
| | | import com.ycl.mapper.ProjectCodingStatusMapper; |
| | | import com.ycl.service.ProjectCodingStatusService; |
| | | |
| | | import com.ycl.domain.entity.ProjectOvertimeTimes; |
| | | import com.ycl.domain.query.ProjectOvertimeTimesQuery; |
| | | import com.ycl.common.base.Result; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.domain.form.ProjectCodingStatusForm; |
| | | import com.ycl.domain.vo.ProjectCodingStatusVO; |
| | | import com.ycl.domain.query.ProjectCodingStatusQuery; |
| | | import com.ycl.domain.form.ProjectOvertimeTimesForm; |
| | | import com.ycl.domain.vo.ProjectOvertimeTimesVO; |
| | | import com.ycl.mapper.ProjectOvertimeTimesMapper; |
| | | import com.ycl.service.ProjectOvertimeTimesService; |
| | | import org.springframework.stereotype.Service; |
| | | import lombok.RequiredArgsConstructor; |
| | | import com.ycl.framework.utils.PageUtil; |
| | |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ProjectCodingStatusServiceImpl extends ServiceImpl<ProjectCodingStatusMapper, ProjectCodingStatus> implements ProjectCodingStatusService { |
| | | public class ProjectCodingStatusServiceImpl extends ServiceImpl<ProjectOvertimeTimesMapper, ProjectOvertimeTimes> implements ProjectOvertimeTimesService { |
| | | |
| | | private final ProjectCodingStatusMapper projectCodingStatusMapper; |
| | | private final ProjectOvertimeTimesMapper projectCodingStatusMapper; |
| | | |
| | | /** |
| | | * 添加 |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result add(ProjectCodingStatusForm form) { |
| | | ProjectCodingStatus entity = ProjectCodingStatusForm.getEntityByForm(form, null); |
| | | public Result add(ProjectOvertimeTimesForm form) { |
| | | ProjectOvertimeTimes entity = ProjectOvertimeTimesForm.getEntityByForm(form, null); |
| | | baseMapper.insert(entity); |
| | | return Result.ok("添加成功"); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result update(ProjectCodingStatusForm form) { |
| | | ProjectCodingStatus entity = baseMapper.selectById(form.getId()); |
| | | public Result update(ProjectOvertimeTimesForm form) { |
| | | ProjectOvertimeTimes entity = baseMapper.selectById(form.getId()); |
| | | |
| | | // 为空抛IllegalArgumentException,做全局异常处理 |
| | | Assert.notNull(entity, "记录不存在"); |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result page(ProjectCodingStatusQuery query) { |
| | | IPage<ProjectCodingStatusVO> page = PageUtil.getPage(query, ProjectCodingStatusVO.class); |
| | | public Result page(ProjectOvertimeTimesQuery query) { |
| | | IPage<ProjectOvertimeTimesVO> page = PageUtil.getPage(query, ProjectOvertimeTimesVO.class); |
| | | baseMapper.getPage(page, query); |
| | | return Result.ok().data(page.getRecords()).total(page.getTotal()); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public Result detail(Integer id) { |
| | | ProjectCodingStatusVO vo = baseMapper.getById(id); |
| | | ProjectOvertimeTimesVO vo = baseMapper.getById(id); |
| | | |
| | | Assert.notNull(vo, "记录不存在"); |
| | | return Result.ok().data(vo); |
| | |
| | | */ |
| | | @Override |
| | | public Result all() { |
| | | List<ProjectCodingStatus> entities = baseMapper.selectList(null); |
| | | List<ProjectCodingStatusVO> vos = entities.stream() |
| | | .map(entity -> ProjectCodingStatusVO.getVoByEntity(entity, null)) |
| | | List<ProjectOvertimeTimes> entities = baseMapper.selectList(null); |
| | | List<ProjectOvertimeTimesVO> vos = entities.stream() |
| | | .map(entity -> ProjectOvertimeTimesVO.getVoByEntity(entity, null)) |
| | | .collect(Collectors.toList()); |
| | | return Result.ok().data(vos); |
| | | } |