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

Add employee name suffixes to work item information. Add password modification function.

This commit is contained in:
ggb
2023-06-06 23:32:32 +08:00
parent d3d7608efe
commit ca4b0fb1c4
8 changed files with 171 additions and 55 deletions

View File

@@ -16,6 +16,7 @@ import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* <p>
@@ -44,15 +45,17 @@ public class UserController {
@PutMapping("/passwd")
@Operation(summary = "修改密码")
public ResponseResult<?> modifyPasswd(String oldPasswd, String newPassword) {
if (oldPasswd == null || newPassword == null) {
public ResponseResult<?> modifyPasswd(@RequestBody Map<String, String> passwd) {
String oldPasswd = passwd.get("oldPasswd");
String newPasswd = passwd.get("newPasswd");
if (oldPasswd == null || newPasswd == null) {
throw new DataValidationFailedException();
}
newPassword = newPassword.trim();
if (oldPasswd.isBlank() || oldPasswd.length() < 8 || oldPasswd.length() > 64 || newPassword.isBlank() || newPassword.length() < 8 || newPassword.length() > 64) {
newPasswd = newPasswd.trim();
if (oldPasswd.isBlank() || newPasswd.isBlank() || newPasswd.length() < 8 || newPasswd.length() > 64) {
throw new DataValidationFailedException();
}
if (userService.modifyPasswd(oldPasswd, newPassword)) {
if (userService.modifyPasswd(oldPasswd, newPasswd)) {
return ResponseResult.databaseUpdateSuccess(null);
} else {
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_ERROR, "error", null);
@@ -70,14 +73,14 @@ public class UserController {
@PreAuthorize("hasAnyAuthority('work:manage:add', 'work:admin:add', 'attendance:manage:modify')")
@Operation(summary = "获取同部门下所有用户")
public ResponseResult<List<User>> getDepartmentUser() {
return ResponseResult.databaseSaveSuccess(userService.getDepartmentUser());
return ResponseResult.databaseSelectSuccess(userService.getDepartmentUser());
}
@GetMapping("/notice")
@PreAuthorize("hasAuthority('notice:manage:get')")
@Operation(summary = "获取拥有发布公告权限的用户")
public ResponseResult<List<User>> getNoticeUser() {
return ResponseResult.databaseSaveSuccess(userService.getNoticeUser());
return ResponseResult.databaseSelectSuccess(userService.getNoticeUser());
}
@GetMapping

View File

@@ -1,6 +1,5 @@
server:
port: 8621
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
@@ -16,4 +15,10 @@ mybatis-plus:
logic-not-delete-value: 0
logic-delete-value: id
id-type: assign_id
type-aliases-package: com.cfive.pinnacle.entity
type-aliases-package: com.cfive.pinnacle.entity
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
logging:
level:
root: debug

View File

@@ -12,10 +12,15 @@
<result property="status" column="status"/>
<result property="completeTime" column="complete_time"/>
</collection>
<collection property="worker" ofType="user">
<id property="id" column="worker_id"/>
<result property="username" column="worker_name"/>
</collection>
<collection property="worker" resultMap="workerMap"/>
</resultMap>
<resultMap id="workerMap" type="user">
<id property="id" column="worker_id"/>
<result property="username" column="worker_name"/>
<association property="staff" javaType="staff">
<result property="firstName" column="first_name"/>
<result property="lastName" column="last_name"/>
</association>
</resultMap>
<select id="getAll" resultMap="workMap">
select w.id,
@@ -27,12 +32,16 @@
tuw.user_id worker_id,
tu.username worker_name,
tuw.status status,
tuw.complete_time complete_time
tuw.complete_time complete_time,
first_name,
last_name
from t_work w
left join (select * from t_user where deleted = 0) as u on w.publisher_id = u.id
left join (select * from t_user_work where deleted = 0) as tuw on w.id = tuw.work_id
left join (select * from t_user where deleted = 0) as tu on tuw.user_id = tu.id
left join (select * from t_staff where deleted = 0) as ts on tuw.user_id = ts.user_id
where w.deleted = 0
and w.old = 0
order by w.id desc;
</select>
<select id="getWork" parameterType="long" resultMap="workMap">
@@ -45,13 +54,17 @@
tuw.user_id worker_id,
tu.username worker_name,
tuw.status status,
tuw.complete_time completeTime
tuw.complete_time completeTime,
first_name,
last_name
from t_work w
left join (select * from t_user where deleted = 0) as u on w.publisher_id = u.id
left join (select * from t_user_work where deleted = 0) as tuw on w.id = tuw.work_id
left join (select * from t_user where deleted = 0) as tu on tuw.user_id = tu.id
left join (select * from t_staff where deleted = 0) as ts on tuw.user_id = ts.user_id
where w.id = #{id}
and w.deleted = 0;
and w.deleted = 0
and w.old = 0;
</select>
<select id="getWorkByContent" parameterType="String" resultMap="workMap">
select w.id,
@@ -69,7 +82,8 @@
left join (select * from t_user_work where deleted = 0) as tuw on w.id = tuw.work_id
left join (select * from t_user where deleted = 0) as tu on tuw.user_id = tu.id
where w.content like '%${content}%'
and w.deleted = 0;
and w.deleted = 0
and w.old = 0;
</select>
<select id="getTodo" parameterType="long" resultMap="workMap">
select w.id,
@@ -89,6 +103,7 @@
tuw.user_id = #{userId}
and status = false
and w.deleted = 0
and w.old = 0
order by w.deadline asc, w.id desc;
</select>
<select id="getCard" parameterType="long" resultMap="workMap">
@@ -108,6 +123,7 @@
where tuw.user_id = #{userId}
and status = false
and w.deleted = 0
and w.old = 0
order by w.deadline asc, w.id desc
limit 5;
@@ -130,6 +146,7 @@
where tuw.user_id = #{userId}
and tuw.status = true
and w.deleted = 0
and w.old = 0
order by w.id desc;
</select>