|
@@ -1,8 +1,14 @@
|
|
|
package com.siwei.apply.service.impl;
|
|
|
|
|
|
+import com.siwei.apply.domain.Project;
|
|
|
import com.siwei.apply.domain.Tdhyhs;
|
|
|
+import com.siwei.apply.domain.res.TdhyhsRes;
|
|
|
+import com.siwei.apply.domain.vo.TdhyhsUpdateVo;
|
|
|
+import com.siwei.apply.domain.vo.TdhyhsVo;
|
|
|
+import com.siwei.apply.mapper.ProjectMapper;
|
|
|
import com.siwei.apply.mapper.TdhyhsMapper;
|
|
|
import com.siwei.apply.service.TdhyhsService;
|
|
|
+import com.siwei.common.core.utils.bean.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -15,9 +21,18 @@ import static com.siwei.apply.common.Common.UserId;
|
|
|
public class TdhyhsImpl implements TdhyhsService {
|
|
|
@Autowired
|
|
|
private TdhyhsMapper tdhyhsMapper;
|
|
|
+ @Autowired
|
|
|
+ private ProjectMapper projectMapper;
|
|
|
|
|
|
@Override
|
|
|
- public String add(Tdhyhs tdhyhs) {
|
|
|
+ public Boolean isExit(String projectId) {
|
|
|
+ return tdhyhsMapper.isExit(projectId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String add(TdhyhsVo tdhyhsVo) {
|
|
|
+ Tdhyhs tdhyhs = new Tdhyhs();
|
|
|
+ BeanUtils.copyProperties(tdhyhsVo, tdhyhs);
|
|
|
tdhyhs.generateId();
|
|
|
tdhyhs.setCreatorId(UserId);
|
|
|
tdhyhsMapper.add(tdhyhs);
|
|
@@ -25,12 +40,19 @@ public class TdhyhsImpl implements TdhyhsService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Tdhyhs get(String id) {
|
|
|
- return tdhyhsMapper.get(id);
|
|
|
+ public TdhyhsRes get(String projectId) {
|
|
|
+ Tdhyhs tdhyhs = tdhyhsMapper.get(projectId);
|
|
|
+ Project project = projectMapper.get(projectId);
|
|
|
+
|
|
|
+ TdhyhsRes tdhyhsRes = new TdhyhsRes();
|
|
|
+ BeanUtils.copyProperties(tdhyhs, tdhyhsRes);
|
|
|
+ tdhyhsRes.setProjectName(project.getName());
|
|
|
+ tdhyhsRes.setProjectCode(project.getCode());
|
|
|
+ return tdhyhsRes;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void update(Tdhyhs tdhyhs) {
|
|
|
- tdhyhsMapper.update(tdhyhs);
|
|
|
+ public void update(TdhyhsUpdateVo tdhyhsUpdateVo) {
|
|
|
+ tdhyhsMapper.update(tdhyhsUpdateVo);
|
|
|
}
|
|
|
}
|