1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-05 06:51:23 +08:00

temp 2023/5/5

This commit is contained in:
GGB
2023-05-05 18:25:33 +08:00
parent 41b6c77509
commit 24318d36b7
13 changed files with 199 additions and 84 deletions

View File

@@ -8,6 +8,7 @@ import com.cfive.pinnacle.entity.UserWork;
import com.cfive.pinnacle.entity.Work;
import com.cfive.pinnacle.entity.common.ResponseCode;
import com.cfive.pinnacle.entity.common.ResponseResult;
import com.cfive.pinnacle.service.IUserWorkService;
import com.cfive.pinnacle.service.IWorkService;
import com.cfive.pinnacle.service.impl.UserWorkServiceImpl;
import com.cfive.pinnacle.service.impl.WorkServiceImpl;
@@ -31,9 +32,9 @@ import java.util.List;
@RequestMapping("/work")
public class WorkController {
@Autowired
private WorkServiceImpl workService;
private IWorkService workService;
@Autowired
private UserWorkServiceImpl userWorkService;
private IUserWorkService userWorkService;
@GetMapping
public ResponseResult getAll() {
@@ -50,6 +51,11 @@ public class WorkController {
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", workService.getComplete(userId));
}
@GetMapping("/{workId}")
public ResponseResult getOne(@PathVariable Long workId) {
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success",workService.getOne(workId));
}
@PostMapping
public ResponseResult addWork(@RequestBody Work work) {
return ResponseResult.build(ResponseCode.DATABASE_SAVE_OK, "success", workService.addWork(work));

View File

@@ -56,12 +56,14 @@ public class Work implements Serializable {
* 创建时间
*/
@TableField("create_time")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", timezone = "UTC")
private LocalDateTime createTime;
/**
* 截止时间
*/
@TableField("deadline")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", timezone = "UTC")
private LocalDateTime deadline;
/**

View File

@@ -22,4 +22,6 @@ public interface WorkMapper extends BaseMapper<Work> {
List<Work> getComplete(Long userId);
Work getWork(Long workId);
}

View File

@@ -18,7 +18,7 @@ public interface IWorkService extends IService<Work> {
List<Work> getAll();
List<Work> getTodo(Long userId);
List<Work> getComplete(Long userId);
Work getOne(Long workId);
double getProgress(Long workId);
String getUserName(Long userId);

View File

@@ -62,6 +62,14 @@ public class WorkServiceImpl extends ServiceImpl<WorkMapper, Work> implements IW
return workList;
}
@Override
public Work getOne(Long workId) {
Work work = workMapper.getWork(workId);
work.setProgress(getProgress(workId));
work.setPublisherName(getUserName(work.getPublisherId()));
return work;
}
@Override
public double getProgress(Long workId) {
double workNum = userWorkMapper.selectCount(new QueryWrapper<UserWork>().eq("work_id",workId));

View File

@@ -33,18 +33,23 @@
and tuw.deleted = 0
order by w.id desc;
</select>
<select id="getWork" parameterType="work" resultType="work">
select id, user_id, content, create_time, deadline, task_status
from t_task
<where>
<if test="task_status!=null">
and task_status=#{task_status}
</if>
<if test="user_id!=null and user_id!=0">
and user_id=#{user_id}
</if>
</where>
order by deadline, id;
<select id="getWork" parameterType="long" resultMap="workMap">
select w.id,
content,
publisher_id,
create_time,
deadline,
tuw.user_id worker_id,
u.username worker_name,
tuw.status status
from t_work w,
t_user u,
t_user_work tuw
where w.id = #{id}
and w.id = tuw.work_id
and tuw.user_id = u.id
and w.deleted = 0
and tuw.deleted = 0;
</select>
<select id="getTodo" parameterType="long" resultMap="workMap">
select w.id,