Skip to content

Commit

Permalink
Merge pull request #43 from Jzow/master
Browse files Browse the repository at this point in the history
Add dept api and fix createTime filed format show error
  • Loading branch information
Jzow authored Sep 23, 2023
2 parents c23f60b + 7dfdf8d commit 06bd953
Show file tree
Hide file tree
Showing 16 changed files with 1,497 additions and 2,652 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import com.wansensoft.service.common.CommonService;
import com.wansensoft.utils.response.Response;
import com.wansensoft.utils.constants.ApiVersionConstants;
import com.wansensoft.utils.enums.CodeEnum;
import com.wansensoft.utils.enums.BaseCodeEnum;
import com.wansensoft.vo.CaptchaVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
Expand All @@ -36,7 +36,7 @@ public CommonController(CommonService commonService) {
public Response<CaptchaVO> getCaptcha() {
CaptchaVO captchaVo = commonService.getCaptcha();
if(captchaVo == null) {
return Response.responseMsg(CodeEnum.ERROR);
return Response.responseMsg(BaseCodeEnum.ERROR);
}
return Response.responseData(captchaVo);
}
Expand All @@ -45,8 +45,8 @@ public Response<CaptchaVO> getCaptcha() {
public Response<String> sendSmsCode(@PathVariable Integer type, @PathVariable String phoneNumber) {
boolean result = commonService.sendSmsCode(type, phoneNumber);
if(!result) {
return Response.responseMsg(CodeEnum.PHONE_NUMBER_FORMAT_ERROR);
return Response.responseMsg(BaseCodeEnum.PHONE_NUMBER_FORMAT_ERROR);
}
return Response.responseMsg(CodeEnum.SMS_VERIFY_SEND_SUCCESS);
return Response.responseMsg(BaseCodeEnum.SMS_VERIFY_SEND_SUCCESS);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public Response<Page<UserListVO>> list(@RequestBody UserListDTO userListDto) {

@PostMapping(value = "update")
public Response<String> update(@RequestBody UpdateUserDTO updateUserDTO) {
return null;
return userService.updateUser(updateUserDTO);
}

}
1,272 changes: 1,272 additions & 0 deletions docs/wansenerp-2023-09-23.sql

Large diffs are not rendered by default.

1,017 changes: 0 additions & 1,017 deletions docs/wansenerp.sql

This file was deleted.

1,527 changes: 0 additions & 1,527 deletions docs/数据库更新记录-首次安装请勿使用.txt

This file was deleted.

18 changes: 16 additions & 2 deletions domain/src/main/java/com/wansensoft/vo/UserListVO.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
package com.wansensoft.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Builder;
import lombok.Data;

import java.time.LocalDateTime;

@Data
@Builder
@JsonInclude(JsonInclude.Include.NON_NULL)
public class UserListVO {

@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id;

@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long roleId;

@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long deptId;

private String username;

private String name;
Expand All @@ -23,6 +33,10 @@ public class UserListVO {

private Integer status;

@JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
private String createTime;
private String type;

private String deptName;

@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.wansensoft.entities.SysDepartment;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wansensoft.service.user.ISysUserService;
import com.wansensoft.utils.enums.CodeEnum;
import com.wansensoft.utils.enums.BaseCodeEnum;
import com.wansensoft.utils.response.Response;
import com.wansensoft.vo.DeptListVO;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -57,7 +57,7 @@ public Response<List<DeptListVO>> getUserDeptRel() {

var departments = departmentMapper.selectBatchIds(userDeptRelList);
if(departments.isEmpty()) {
return Response.responseMsg(CodeEnum.QUERY_DATA_EMPTY);
return Response.responseMsg(BaseCodeEnum.QUERY_DATA_EMPTY);
}
// find children department only 2 leave
departments.forEach(item -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
import com.wansensoft.entities.user.SysUserDeptRel;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;

/**
* <p>
* 部门用户关系表 服务类
* </p>
*/
public interface ISysUserDeptRelService extends IService<SysUserDeptRel> {

List<SysUserDeptRel> queryBatchByUserIds(List<Long> userIds);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@
public interface ISysUserRoleRelService extends IService<SysUserRoleRel> {

List<SysUserRoleRel> queryByUserId(long userId);

List<SysUserRoleRel> queryBatchByUserIds(List<Long> userIds);
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ public interface ISysUserService extends IService<SysUser> {
Response<String> userLogout();

Response<Page<UserListVO>> userList(UserListDTO pageDto);
Response<String> updateUser(UpdateUserDTO updateUserDTO);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* <p>
* 部门用户关系表 服务实现类
Expand All @@ -17,4 +19,10 @@
@Service
public class SysUserDeptRelServiceImpl extends ServiceImpl<SysUserDeptRelMapper, SysUserDeptRel> implements ISysUserDeptRelService {

@Override
public List<SysUserDeptRel> queryBatchByUserIds(List<Long> userIds) {
return lambdaQuery()
.in(SysUserDeptRel::getUserId, userIds)
.list();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,11 @@ public List<SysUserRoleRel> queryByUserId(long userId) {
.eq(SysUserRoleRel::getUserId, userId)
.list();
}

@Override
public List<SysUserRoleRel> queryBatchByUserIds(List<Long> userIds) {
return lambdaQuery()
.in(SysUserRoleRel::getUserId, userIds)
.list();
}
}
Loading

0 comments on commit 06bd953

Please sign in to comment.