修改了查询我参与的功能模块

This commit is contained in:
DESKTOP-G8BCEP0\HP 2021-08-31 10:45:41 +08:00
parent 89e9e2c975
commit 3f8e3f2a39
5 changed files with 28 additions and 20 deletions

View File

@ -25,11 +25,11 @@ public interface WorkHourRecordDao extends JpaRepository<WorkHourRecord,Long> {
* @return
*/
@Query(value = "select new com.xkrs.model.vo.MemberWorkRecordVo " +
"(po.projectNumber,po.projectName,po.projectStage,po.projectStatus,sum(whr.workHour)) " +
"(po.projectNumber,po.projectName,po.projectStage,po.projectStatus,sum(whr.workHour),mp.joinTime) " +
"from WorkHourRecord whr,ProjectOverview po,MemberProject mp " +
"where po.projectNumber = mp.memberProjectNumber and whr.projectNumber = mp.memberProjectNumber " +
"and whr.userId = mp.memberId and mp.applicationType = '1' and mp.memberId = :userId " +
"group by po.projectNumber,po.projectName,po.projectStage,po.projectStatus")
"group by po.projectNumber,po.projectName,po.projectStage,po.projectStatus,mp.joinTime")
List<MemberWorkRecordVo> selectMemberWorkRecord(@Param("userId") Integer userId);
/**
@ -37,13 +37,13 @@ public interface WorkHourRecordDao extends JpaRepository<WorkHourRecord,Long> {
* @param userId
* @return
*/
@Query(value = "select new com.xkrs.model.vo.MemberWorkRecordVo " +
/*@Query(value = "select new com.xkrs.model.vo.MemberWorkRecordVo " +
"(po.projectNumber,po.projectName,po.projectStage,po.projectStatus,sum(whr.workHour)) " +
"from WorkHourRecord whr,ProjectOverview po,ResponsibleProject rp " +
"where po.projectNumber = rp.responsibleProjectNumber and whr.projectNumber = rp.responsibleProjectNumber " +
"and whr.userId = rp.principalId and rp.auditType = '1' and rp.principalId = :userId " +
"group by po.projectNumber,po.projectName,po.projectStage,po.projectStatus")
List<MemberWorkRecordVo> selectMemberAndParWorkRecord(@Param("userId") Integer userId);
List<MemberWorkRecordVo> selectMemberAndParWorkRecord(@Param("userId") Integer userId);*/
/**
@ -51,7 +51,7 @@ public interface WorkHourRecordDao extends JpaRepository<WorkHourRecord,Long> {
* @param userId
* @return
*/
@Query(value = "select po.project_number projectNumber,po.project_name projectName,po.project_stage projectStage,po.project_status projectStatus,(select count(mp.*)+1 from member_project mp where mp.member_project_number = po.project_number and mp.application_type = '1') as peopleNum,sum(whr.work_hour) as workHour " +
@Query(value = "select po.project_number projectNumber,po.project_name projectName,po.project_stage projectStage,po.project_status projectStatus,(select count(mp.*) from member_project mp where mp.member_project_number = po.project_number and mp.application_type = '1') as peopleNum,sum(whr.work_hour) as workHour " +
"from work_hour_record whr,project_overview po,responsible_project rp " +
"where po.project_number = rp.responsible_project_number " +
"and whr.project_number = rp.responsible_project_number " +
@ -72,12 +72,12 @@ public interface WorkHourRecordDao extends JpaRepository<WorkHourRecord,Long> {
/**
* 修改工时记录
* @param workContent
* @param submitTime
* @param
* @param id
*/
@Query(value = "update work_hour_record set work_content = ?1,submit_time = ?2 where id = ?3",nativeQuery = true)
@Query(value = "update work_hour_record set work_content = ?1 where id = ?2",nativeQuery = true)
@Modifying(clearAutomatically=true)
void updateRecord(String workContent,String submitTime,Integer id);
void updateRecord(String workContent,Integer id);
/**
* 删除记录

View File

@ -17,15 +17,18 @@ public class MemberWorkRecordVo implements Serializable {
private Long workHour;
private String joinTime;
public MemberWorkRecordVo() {
}
public MemberWorkRecordVo(String projectNumber, String projectName, String projectStage, String projectStatus, Long workHour) {
public MemberWorkRecordVo(String projectNumber, String projectName, String projectStage, String projectStatus, Long workHour, String joinTime) {
this.projectNumber = projectNumber;
this.projectName = projectName;
this.projectStage = projectStage;
this.projectStatus = projectStatus;
this.workHour = workHour;
this.joinTime = joinTime;
}
public String getProjectNumber() {
@ -68,6 +71,14 @@ public class MemberWorkRecordVo implements Serializable {
this.workHour = workHour;
}
public String getJoinTime() {
return joinTime;
}
public void setJoinTime(String joinTime) {
this.joinTime = joinTime;
}
@Override
public String toString() {
return "MemberWorkRecordVo{" +
@ -76,6 +87,7 @@ public class MemberWorkRecordVo implements Serializable {
", projectStage='" + projectStage + '\'' +
", projectStatus='" + projectStatus + '\'' +
", workHour=" + workHour +
", joinTime='" + joinTime + '\'' +
'}';
}
}

View File

@ -34,7 +34,7 @@ public interface WorkHourRecordService {
* @param userId
* @return
*/
List<MemberWorkRecordVo> selectMemberAndParWorkRecord(Integer userId);
//List<MemberWorkRecordVo> selectMemberAndParWorkRecord(Integer userId);
/**
* 查询我管理的项目

View File

@ -64,11 +64,7 @@ public class WorkHourRecordServiceImpl implements WorkHourRecordService {
workHourRecord.setProjectNumber(workRecordQo.getProjectNumber());
workHourRecord.setSubmitTime(workRecordQo.getSubmitTime());
WorkHourRecord save = workHourRecordDao.save(workHourRecord);
if(save != null){
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"提交成功",locale);
}else {
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"提交失败",locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"提交成功",locale);
}
/**
@ -86,10 +82,10 @@ public class WorkHourRecordServiceImpl implements WorkHourRecordService {
* @param userId
* @return
*/
@Override
/*@Override
public List<MemberWorkRecordVo> selectMemberAndParWorkRecord(Integer userId) {
return workHourRecordDao.selectMemberAndParWorkRecord(userId);
}
}*/
/**
* 查询我管理的项目
@ -120,8 +116,8 @@ public class WorkHourRecordServiceImpl implements WorkHourRecordService {
@Transactional(rollbackOn = Exception.class)
@Override
public void updateRecord(String workContent, Integer id) {
String time = DateTimeUtil.dateTimeToString(LocalDateTime.now());
workHourRecordDao.updateRecord(workContent,time,id);
//String time = DateTimeUtil.dateTimeToString(LocalDateTime.now());
workHourRecordDao.updateRecord(workContent,id);
}
/**

View File

@ -29,7 +29,7 @@ spring.datasource.hikari.validation-timeout = 3000
## Spring Data JPA 配置
spring.jpa.database = POSTGRESQL
spring.jpa.database-platform = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.show-sql = false
spring.jpa.show-sql = true
# 指定 ddl mode (none, validate, create, create-drop, update)
spring.jpa.hibernate.ddl-auto = update
# 命名策略