diff --git a/src/main/java/com/xkrs/dao/WorkHourRecordDao.java b/src/main/java/com/xkrs/dao/WorkHourRecordDao.java index 7d4df83..c7e591e 100644 --- a/src/main/java/com/xkrs/dao/WorkHourRecordDao.java +++ b/src/main/java/com/xkrs/dao/WorkHourRecordDao.java @@ -25,11 +25,11 @@ public interface WorkHourRecordDao extends JpaRepository { * @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 selectMemberWorkRecord(@Param("userId") Integer userId); /** @@ -37,13 +37,13 @@ public interface WorkHourRecordDao extends JpaRepository { * @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 selectMemberAndParWorkRecord(@Param("userId") Integer userId); + List selectMemberAndParWorkRecord(@Param("userId") Integer userId);*/ /** @@ -51,7 +51,7 @@ public interface WorkHourRecordDao extends JpaRepository { * @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 { /** * 修改工时记录 * @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); /** * 删除记录 diff --git a/src/main/java/com/xkrs/model/vo/MemberWorkRecordVo.java b/src/main/java/com/xkrs/model/vo/MemberWorkRecordVo.java index 78591d1..8839a8b 100644 --- a/src/main/java/com/xkrs/model/vo/MemberWorkRecordVo.java +++ b/src/main/java/com/xkrs/model/vo/MemberWorkRecordVo.java @@ -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 + '\'' + '}'; } } diff --git a/src/main/java/com/xkrs/service/WorkHourRecordService.java b/src/main/java/com/xkrs/service/WorkHourRecordService.java index 3119987..628e412 100644 --- a/src/main/java/com/xkrs/service/WorkHourRecordService.java +++ b/src/main/java/com/xkrs/service/WorkHourRecordService.java @@ -34,7 +34,7 @@ public interface WorkHourRecordService { * @param userId * @return */ - List selectMemberAndParWorkRecord(Integer userId); + //List selectMemberAndParWorkRecord(Integer userId); /** * 查询我管理的项目 diff --git a/src/main/java/com/xkrs/service/impl/WorkHourRecordServiceImpl.java b/src/main/java/com/xkrs/service/impl/WorkHourRecordServiceImpl.java index 1f338b1..ad019c4 100644 --- a/src/main/java/com/xkrs/service/impl/WorkHourRecordServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/WorkHourRecordServiceImpl.java @@ -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 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); } /** diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index d23403d..e19252a 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -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 # 命名策略