mirror of
https://gitee.com/orangeform/orange-admin.git
synced 2026-01-17 18:46:36 +08:00
commit:同步2.0版本
This commit is contained in:
@@ -161,7 +161,7 @@ public class LoginController {
|
||||
@PostMapping("/changePassword")
|
||||
public ResponseResult<Void> changePassword(
|
||||
@MyRequestBody String oldPass, @MyRequestBody String newPass) throws Exception {
|
||||
if (MyCommonUtil.existBlankArgument(oldPass, oldPass)) {
|
||||
if (MyCommonUtil.existBlankArgument(newPass, oldPass)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
TokenData tokenData = TokenData.takeFromRequest();
|
||||
|
||||
@@ -10,14 +10,12 @@ import com.flow.demo.common.core.object.*;
|
||||
import com.flow.demo.common.core.util.*;
|
||||
import com.flow.demo.common.core.constant.*;
|
||||
import com.flow.demo.common.core.annotation.MyRequestBody;
|
||||
import com.flow.demo.common.core.validator.UpdateGroup;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.groups.Default;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -44,7 +42,7 @@ public class SysDeptController {
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public ResponseResult<Long> add(@MyRequestBody SysDeptDto sysDeptDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysDeptDto);
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysDeptDto, false);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
@@ -70,7 +68,7 @@ public class SysDeptController {
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
public ResponseResult<Void> update(@MyRequestBody SysDeptDto sysDeptDto) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysDeptDto, Default.class, UpdateGroup.class);
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysDeptDto, true);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
@@ -188,16 +186,20 @@ public class SysDeptController {
|
||||
@MyRequestBody SysPostDto sysPostDtoFilter,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
ResponseResult<Void> verifyResult = this.doSysDeptPostVerify(deptId);
|
||||
if (!verifyResult.isSuccess()) {
|
||||
return ResponseResult.errorFrom(verifyResult);
|
||||
if (MyCommonUtil.isNotBlankOrNull(deptId) && !sysDeptService.existId(deptId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.INVALID_RELATED_RECORD_ID);
|
||||
}
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
}
|
||||
SysPost filter = MyModelUtil.copyTo(sysPostDtoFilter, SysPost.class);
|
||||
String orderBy = MyOrderParam.buildOrderBy(orderParam, SysPost.class);
|
||||
List<SysPost> sysPostList = sysPostService.getNotInSysPostListByDeptId(deptId, filter, orderBy);
|
||||
List<SysPost> sysPostList;
|
||||
if (MyCommonUtil.isNotBlankOrNull(deptId)) {
|
||||
sysPostList = sysPostService.getNotInSysPostListByDeptId(deptId, filter, orderBy);
|
||||
} else {
|
||||
sysPostList = sysPostService.getSysPostList(filter, orderBy);
|
||||
}
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(sysPostList, SysPost.INSTANCE));
|
||||
}
|
||||
|
||||
@@ -212,13 +214,12 @@ public class SysDeptController {
|
||||
*/
|
||||
@PostMapping("/listSysDeptPost")
|
||||
public ResponseResult<MyPageData<SysPostVo>> listSysDeptPost(
|
||||
@MyRequestBody Long deptId,
|
||||
@MyRequestBody(required = true) Long deptId,
|
||||
@MyRequestBody SysPostDto sysPostDtoFilter,
|
||||
@MyRequestBody MyOrderParam orderParam,
|
||||
@MyRequestBody MyPageParam pageParam) {
|
||||
ResponseResult<Void> verifyResult = this.doSysDeptPostVerify(deptId);
|
||||
if (!verifyResult.isSuccess()) {
|
||||
return ResponseResult.errorFrom(verifyResult);
|
||||
if (!sysDeptService.existId(deptId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.INVALID_RELATED_RECORD_ID);
|
||||
}
|
||||
if (pageParam != null) {
|
||||
PageMethod.startPage(pageParam.getPageNum(), pageParam.getPageSize());
|
||||
@@ -229,16 +230,6 @@ public class SysDeptController {
|
||||
return ResponseResult.success(MyPageUtil.makeResponseData(sysPostList, SysPost.INSTANCE));
|
||||
}
|
||||
|
||||
private ResponseResult<Void> doSysDeptPostVerify(Long deptId) {
|
||||
if (MyCommonUtil.existBlankArgument(deptId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
if (!sysDeptService.existId(deptId)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.INVALID_RELATED_RECORD_ID);
|
||||
}
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量添加部门管理和 [岗位管理] 对象的多对多关联关系数据。
|
||||
*
|
||||
@@ -253,11 +244,9 @@ public class SysDeptController {
|
||||
if (MyCommonUtil.existBlankArgument(deptId, sysDeptPostDtoList)) {
|
||||
return ResponseResult.error(ErrorCodeEnum.ARGUMENT_NULL_EXIST);
|
||||
}
|
||||
for (SysDeptPostDto sysDeptPost : sysDeptPostDtoList) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysDeptPost);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysDeptPostDtoList);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
Set<Long> postIdSet = sysDeptPostDtoList.stream().map(SysDeptPostDto::getPostId).collect(Collectors.toSet());
|
||||
if (!sysDeptService.existId(deptId) || !sysPostService.existUniqueKeyList("postId", postIdSet)) {
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.flow.demo.common.core.util.*;
|
||||
import com.flow.demo.common.core.constant.*;
|
||||
import com.flow.demo.common.core.annotation.MyRequestBody;
|
||||
import com.flow.demo.common.core.validator.AddGroup;
|
||||
import com.flow.demo.common.core.validator.UpdateGroup;
|
||||
import com.flow.demo.webadmin.config.ApplicationConfig;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
@@ -19,7 +18,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.groups.Default;
|
||||
|
||||
/**
|
||||
* 用户管理操作控制器类。
|
||||
@@ -54,7 +52,7 @@ public class SysUserController {
|
||||
@MyRequestBody String deptPostIdListString,
|
||||
@MyRequestBody String dataPermIdListString,
|
||||
@MyRequestBody String roleIdListString) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysUserDto, Default.class, AddGroup.class);
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysUserDto, false);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
@@ -86,7 +84,7 @@ public class SysUserController {
|
||||
@MyRequestBody String deptPostIdListString,
|
||||
@MyRequestBody String dataPermIdListString,
|
||||
@MyRequestBody String roleIdListString) {
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysUserDto, Default.class, UpdateGroup.class);
|
||||
String errorMessage = MyCommonUtil.getModelValidationError(sysUserDto, true);
|
||||
if (errorMessage != null) {
|
||||
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,13 @@ import java.util.*;
|
||||
*/
|
||||
public interface SysDeptMapper extends BaseDaoMapper<SysDept> {
|
||||
|
||||
/**
|
||||
* 批量插入对象列表。
|
||||
*
|
||||
* @param sysDeptList 新增对象列表。
|
||||
*/
|
||||
void insertList(List<SysDept> sysDeptList);
|
||||
|
||||
/**
|
||||
* 获取过滤后的对象列表。
|
||||
*
|
||||
|
||||
@@ -14,6 +14,13 @@ import java.util.*;
|
||||
*/
|
||||
public interface SysUserMapper extends BaseDaoMapper<SysUser> {
|
||||
|
||||
/**
|
||||
* 批量插入对象列表。
|
||||
*
|
||||
* @param sysUserList 新增对象列表。
|
||||
*/
|
||||
void insertList(List<SysUser> sysUserList);
|
||||
|
||||
/**
|
||||
* 获取过滤后的对象列表。
|
||||
*
|
||||
|
||||
@@ -13,6 +13,31 @@
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertList">
|
||||
INSERT INTO zz_sys_dept
|
||||
(dept_id,
|
||||
dept_name,
|
||||
show_order,
|
||||
parent_id,
|
||||
deleted_flag,
|
||||
create_user_id,
|
||||
update_user_id,
|
||||
create_time,
|
||||
update_time)
|
||||
VALUES
|
||||
<foreach collection="list" index="index" item="item" separator="," >
|
||||
(#{item.deptId},
|
||||
#{item.deptName},
|
||||
#{item.showOrder},
|
||||
#{item.parentId},
|
||||
#{item.deletedFlag},
|
||||
#{item.createUserId},
|
||||
#{item.updateUserId},
|
||||
#{item.createTime},
|
||||
#{item.updateTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 如果有逻辑删除字段过滤,请写到这里 -->
|
||||
<sql id="filterRef">
|
||||
<!-- 这里必须加上全包名,否则当filterRef被其他Mapper.xml包含引用的时候,就会调用Mapper.xml中的该SQL片段 -->
|
||||
|
||||
@@ -17,6 +17,39 @@
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertList">
|
||||
INSERT INTO zz_sys_user
|
||||
(user_id,
|
||||
login_name,
|
||||
password,
|
||||
show_name,
|
||||
dept_id,
|
||||
user_type,
|
||||
head_image_url,
|
||||
user_status,
|
||||
deleted_flag,
|
||||
create_user_id,
|
||||
update_user_id,
|
||||
create_time,
|
||||
update_time)
|
||||
VALUES
|
||||
<foreach collection="list" index="index" item="item" separator="," >
|
||||
(#{item.userId},
|
||||
#{item.loginName},
|
||||
#{item.password},
|
||||
#{item.showName},
|
||||
#{item.deptId},
|
||||
#{item.userType},
|
||||
#{item.headImageUrl},
|
||||
#{item.userStatus},
|
||||
#{item.deletedFlag},
|
||||
#{item.createUserId},
|
||||
#{item.updateUserId},
|
||||
#{item.createTime},
|
||||
#{item.updateTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 如果有逻辑删除字段过滤,请写到这里 -->
|
||||
<sql id="filterRef">
|
||||
<!-- 这里必须加上全包名,否则当filterRef被其他Mapper.xml包含引用的时候,就会调用Mapper.xml中的该SQL片段 -->
|
||||
|
||||
@@ -5,7 +5,7 @@ import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* SysDeptVO对象。
|
||||
* SysDeptVO视图对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* SysUserVO对象。
|
||||
* SysUserVO视图对象。
|
||||
*
|
||||
* @author Jerry
|
||||
* @date 2021-06-06
|
||||
|
||||
Reference in New Issue
Block a user