refactor(system): 重构系统模块代码结构和依赖配置,迁移新功能到springboot3中
This commit is contained in:
+2
-2
@@ -68,7 +68,7 @@ public class SystemDeptController {
|
||||
Set<SystemDeptTb> deptSet = new LinkedHashSet<>();
|
||||
for (Long id : ids) {
|
||||
// 同级数据
|
||||
SystemDeptTb dept = systemDeptService.queryDeptById(id);
|
||||
SystemDeptTb dept = systemDeptService.getDeptById(id);
|
||||
// 上级数据
|
||||
List<SystemDeptTb> depts = systemDeptService.querySuperiorDeptListByPid(dept, new ArrayList<>());
|
||||
if (exclude) {
|
||||
@@ -97,7 +97,7 @@ public class SystemDeptController {
|
||||
@PostMapping(value = "/modifyDept")
|
||||
@PreAuthorize("@el.check('dept:edit')")
|
||||
public ResponseEntity<Void> modifyDept(@Validated(SystemDeptTb.Update.class) @RequestBody SystemDeptTb args) {
|
||||
systemDeptService.modifyDept(args);
|
||||
systemDeptService.updateDept(args);
|
||||
return ResponseEntity.ok(null);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ public class SystemDictDetailController {
|
||||
@PostMapping(value = "/queryDictDetailByArgs")
|
||||
public ResponseEntity<KitPageResult<SystemDictDetailTb>> queryDictDetailByArgs(@Validated @RequestBody KitPageArgs<SystemQueryDictDetailArgs> args) {
|
||||
SystemQueryDictDetailArgs criteria = args.getArgs();
|
||||
Page<Object> page = new Page<>(args.getPage(), args.getSize());
|
||||
Page<SystemDictDetailTb> page = new Page<>(args.getPage(), args.getSize());
|
||||
return ResponseEntity.ok(systemDictDetailService.queryDictDetailByArgs(criteria, page));
|
||||
}
|
||||
|
||||
|
||||
+54
-57
@@ -29,14 +29,22 @@ import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import cn.odboy.system.dal.model.SystemQueryUserArgs;
|
||||
import cn.odboy.system.dal.model.SystemUpdateUserPasswordArgs;
|
||||
import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
import cn.odboy.system.service.*;
|
||||
import cn.odboy.system.service.SystemDataService;
|
||||
import cn.odboy.system.service.SystemDeptService;
|
||||
import cn.odboy.system.service.SystemEmailService;
|
||||
import cn.odboy.system.service.SystemRoleService;
|
||||
import cn.odboy.system.service.SystemUserService;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import cn.odboy.util.KitRsaEncryptUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -44,30 +52,26 @@ import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
@Tag(name = "系统:用户管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/user")
|
||||
public class SystemUserController {
|
||||
@Autowired
|
||||
private PasswordEncoder passwordEncoder;
|
||||
@Autowired
|
||||
private SystemUserService systemUserService;
|
||||
@Autowired
|
||||
private SystemDataService systemDataService;
|
||||
@Autowired
|
||||
private SystemDeptService systemDeptService;
|
||||
@Autowired
|
||||
private SystemRoleService systemRoleService;
|
||||
@Autowired
|
||||
private SystemEmailService systemEmailService;
|
||||
@Autowired
|
||||
private AppProperties properties;
|
||||
@Autowired private PasswordEncoder passwordEncoder;
|
||||
@Autowired private SystemUserService systemUserService;
|
||||
@Autowired private SystemDataService systemDataService;
|
||||
@Autowired private SystemDeptService systemDeptService;
|
||||
@Autowired private SystemRoleService systemRoleService;
|
||||
@Autowired private SystemEmailService systemEmailService;
|
||||
@Autowired private AppProperties properties;
|
||||
|
||||
@Operation(summary = "导出用户数据")
|
||||
@GetMapping(value = "/download")
|
||||
@@ -79,7 +83,8 @@ public class SystemUserController {
|
||||
@Operation(summary = "查询用户")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('user:list')")
|
||||
public ResponseEntity<KitPageResult<SystemUserTb>> queryUserByArgs(@Validated @RequestBody KitPageArgs<SystemQueryUserArgs> args) {
|
||||
public ResponseEntity<KitPageResult<SystemUserTb>> queryUserByArgs(
|
||||
@Validated @RequestBody KitPageArgs<SystemQueryUserArgs> args) {
|
||||
Page<SystemUserTb> page = new Page<>(args.getPage(), args.getSize());
|
||||
SystemQueryUserArgs criteria = args.getArgs();
|
||||
if (!ObjectUtils.isEmpty(criteria.getDeptId())) {
|
||||
@@ -90,7 +95,8 @@ public class SystemUserController {
|
||||
criteria.getDeptIds().addAll(systemDeptService.queryChildDeptIdListByDeptIds(data));
|
||||
}
|
||||
// 数据权限
|
||||
List<Long> dataScopes = systemDataService.queryDeptIdListByArgs(systemUserService.getUserByUsername(KitSecurityHelper.getCurrentUsername()));
|
||||
List<Long> dataScopes = systemDataService.findDeptIdListByArgs(
|
||||
systemUserService.getUserByUsername(KitSecurityHelper.getCurrentUsername()));
|
||||
// criteria.getDeptIds() 不为空并且数据权限不为空则取交集
|
||||
if (!CollectionUtils.isEmpty(criteria.getDeptIds()) && !CollectionUtils.isEmpty(dataScopes)) {
|
||||
// 取交集
|
||||
@@ -128,7 +134,8 @@ public class SystemUserController {
|
||||
|
||||
@Operation(summary = "修改用户:个人中心")
|
||||
@PostMapping(value = "modifyUserCenterInfoById")
|
||||
public ResponseEntity<Object> modifyUserCenterInfoById(@Validated(SystemUserTb.Update.class) @RequestBody SystemUserTb args) {
|
||||
public ResponseEntity<Object> modifyUserCenterInfoById(
|
||||
@Validated(SystemUserTb.Update.class) @RequestBody SystemUserTb args) {
|
||||
if (!args.getId().equals(KitSecurityHelper.getCurrentUserId())) {
|
||||
throw new BadRequestException("不能修改他人资料");
|
||||
}
|
||||
@@ -141,11 +148,14 @@ public class SystemUserController {
|
||||
@PreAuthorize("@el.check('user:del')")
|
||||
public ResponseEntity<Object> removeUserByIds(@RequestBody Set<Long> ids) {
|
||||
for (Long id : ids) {
|
||||
Integer currentLevel =
|
||||
Collections.min(systemRoleService.queryRoleByUsersId(KitSecurityHelper.getCurrentUserId()).stream().map(SystemRoleTb::getLevel).toList());
|
||||
Integer optLevel = Collections.min(systemRoleService.queryRoleByUsersId(id).stream().map(SystemRoleTb::getLevel).toList());
|
||||
Integer currentLevel = Collections.min(
|
||||
systemRoleService.queryRoleByUsersId(KitSecurityHelper.getCurrentUserId()).stream()
|
||||
.map(SystemRoleTb::getLevel).toList());
|
||||
Integer optLevel =
|
||||
Collections.min(systemRoleService.queryRoleByUsersId(id).stream().map(SystemRoleTb::getLevel).toList());
|
||||
if (currentLevel > optLevel) {
|
||||
throw new BadRequestException("角色权限不足, 不能删除:" + systemUserService.getUserById(id).getUsername());
|
||||
throw new BadRequestException(
|
||||
"角色权限不足, 不能删除:" + systemUserService.getUserById(id).getUsername());
|
||||
}
|
||||
}
|
||||
systemUserService.removeUserByIds(ids);
|
||||
@@ -154,9 +164,12 @@ public class SystemUserController {
|
||||
|
||||
@Operation(summary = "修改密码")
|
||||
@PostMapping(value = "/modifyUserPasswordByUsername")
|
||||
public ResponseEntity<Object> modifyUserPasswordByUsername(@RequestBody SystemUpdateUserPasswordArgs passVo) throws Exception {
|
||||
String oldPass = KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), passVo.getOldPass());
|
||||
String newPass = KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), passVo.getNewPass());
|
||||
public ResponseEntity<Object> modifyUserPasswordByUsername(@RequestBody SystemUpdateUserPasswordArgs passVo)
|
||||
throws Exception {
|
||||
String oldPass =
|
||||
KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), passVo.getOldPass());
|
||||
String newPass =
|
||||
KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), passVo.getNewPass());
|
||||
SystemUserTb user = systemUserService.getUserByUsername(KitSecurityHelper.getCurrentUsername());
|
||||
if (!passwordEncoder.matches(oldPass, user.getPassword())) {
|
||||
throw new BadRequestException("修改失败,旧密码错误");
|
||||
@@ -184,8 +197,10 @@ public class SystemUserController {
|
||||
|
||||
@Operation(summary = "修改邮箱")
|
||||
@PostMapping(value = "/modifyUserEmailByUsername/{code}")
|
||||
public ResponseEntity<Object> modifyUserEmailByUsername(@PathVariable String code, @RequestBody SystemUserTb args) throws Exception {
|
||||
String password = KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), args.getPassword());
|
||||
public ResponseEntity<Object> modifyUserEmailByUsername(@PathVariable String code, @RequestBody SystemUserTb args)
|
||||
throws Exception {
|
||||
String password =
|
||||
KitRsaEncryptUtil.decryptByPrivateKey(properties.getRsa().getPrivateKey(), args.getPassword());
|
||||
SystemUserTb user = systemUserService.getUserByUsername(KitSecurityHelper.getCurrentUsername());
|
||||
if (!passwordEncoder.matches(password, user.getPassword())) {
|
||||
throw new BadRequestException("密码错误");
|
||||
@@ -201,39 +216,21 @@ public class SystemUserController {
|
||||
* @param args /
|
||||
*/
|
||||
private void checkLevel(SystemUserTb args) {
|
||||
Integer currentLevel =
|
||||
Collections.min(systemRoleService.queryRoleByUsersId(KitSecurityHelper.getCurrentUserId()).stream().map(SystemRoleTb::getLevel).toList());
|
||||
Integer currentLevel = Collections.min(
|
||||
systemRoleService.queryRoleByUsersId(KitSecurityHelper.getCurrentUserId()).stream()
|
||||
.map(SystemRoleTb::getLevel).toList());
|
||||
Integer optLevel = systemRoleService.getDeptLevelByRoles(args.getRoles());
|
||||
if (currentLevel > optLevel) {
|
||||
throw new BadRequestException("角色权限不足");
|
||||
}
|
||||
}
|
||||
|
||||
@Operation(summary = "查询用户基础数据")
|
||||
@ApiOperation("查询用户基础数据")
|
||||
@PostMapping(value = "/queryUserMetadataOptions")
|
||||
@PreAuthorize("@el.check('user:list')")
|
||||
public ResponseEntity<List<KitSelectOptionVo>> queryUserMetadataOptions(@Validated @RequestBody KitPageArgs<SystemQueryUserArgs> args) {
|
||||
int maxPageSize = 50;
|
||||
SystemQueryUserArgs criteria = args.getArgs();
|
||||
LambdaQueryWrapper<SystemUserTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.and(c -> {
|
||||
c.eq(SystemUserTb::getPhone, criteria.getBlurry());
|
||||
c.or();
|
||||
c.eq(SystemUserTb::getEmail, criteria.getBlurry());
|
||||
c.or();
|
||||
c.like(SystemUserTb::getUsername, criteria.getBlurry());
|
||||
c.or();
|
||||
c.like(SystemUserTb::getNickName, criteria.getBlurry());
|
||||
});
|
||||
List<KitSelectOptionVo> collect =
|
||||
systemUserService.queryUserByBlurry(wrapper, new Page<>(criteria.getPage(), maxPageSize)).getRecords().stream().map(m -> {
|
||||
Map<String, Object> ext = new HashMap<>(1);
|
||||
ext.put("id", m.getId());
|
||||
ext.put("deptId", m.getDeptId());
|
||||
ext.put("email", m.getEmail());
|
||||
ext.put("phone", m.getPhone());
|
||||
return KitSelectOptionVo.builder().label(m.getNickName()).value(String.valueOf(m.getId())).ext(ext).build();
|
||||
}).toList();
|
||||
public ResponseEntity<List<KitSelectOptionVo>> queryUserMetadataOptions(
|
||||
@Validated @RequestBody KitPageArgs<SystemQueryUserArgs> args) {
|
||||
List<KitSelectOptionVo> collect = systemUserService.queryUserMetadataOptions(args);
|
||||
return ResponseEntity.ok(collect);
|
||||
}
|
||||
}
|
||||
|
||||
+16
-39
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.dataobject;
|
||||
|
||||
import cn.odboy.base.KitBaseUserTimeTb;
|
||||
@@ -22,51 +21,29 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("system_dept")
|
||||
public class SystemDeptTb extends KitBaseUserTimeTb {
|
||||
|
||||
@NotNull(groups = Update.class)
|
||||
@TableId(value = "dept_id", type = IdType.AUTO)
|
||||
@Schema(name = "ID", hidden = true)
|
||||
private Long id;
|
||||
|
||||
@TableField(exist = false)
|
||||
@JSONField(serialize = false)
|
||||
@Schema(name = "角色")
|
||||
private Set<SystemRoleTb> roles;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(name = "子部门")
|
||||
private List<SystemDeptTb> children;
|
||||
|
||||
@Schema(name = "排序")
|
||||
private Integer deptSort;
|
||||
|
||||
@NotBlank
|
||||
@Schema(name = "部门名称")
|
||||
private String name;
|
||||
|
||||
@NotNull
|
||||
@Schema(name = "是否启用")
|
||||
private Boolean enabled;
|
||||
|
||||
@Schema(name = "上级部门")
|
||||
private Long pid;
|
||||
|
||||
@Schema(name = "子节点数目", hidden = true)
|
||||
private Integer subCount = 0;
|
||||
@NotNull(groups = Update.class) @TableId(value = "dept_id", type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "ID", hidden = true) private Long id;
|
||||
@TableField(exist = false) @JSONField(serialize = false) @ApiModelProperty(value = "角色") private Set<SystemRoleTb>
|
||||
roles;
|
||||
@TableField(exist = false) @ApiModelProperty(value = "子部门") private List<SystemDeptTb> children;
|
||||
@ApiModelProperty(value = "排序") private Integer deptSort;
|
||||
@NotBlank @ApiModelProperty(value = "部门名称") private String name;
|
||||
@NotNull @ApiModelProperty(value = "是否启用") private Boolean enabled;
|
||||
@ApiModelProperty(value = "上级部门") private Long pid;
|
||||
@ApiModelProperty(value = "子节点数目", hidden = true) private Integer subCount = 0;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
@@ -85,17 +62,17 @@ public class SystemDeptTb extends KitBaseUserTimeTb {
|
||||
return Objects.hash(id, name);
|
||||
}
|
||||
|
||||
@Schema(name = "是否有子节点")
|
||||
@ApiModelProperty(value = "是否有子节点")
|
||||
public Boolean getHasChildren() {
|
||||
return subCount > 0;
|
||||
}
|
||||
|
||||
@Schema(name = "是否为叶子")
|
||||
@ApiModelProperty(value = "是否为叶子")
|
||||
public Boolean getLeaf() {
|
||||
return subCount <= 0;
|
||||
}
|
||||
|
||||
@Schema(name = "标签名称")
|
||||
@ApiModelProperty(value = "标签名称")
|
||||
public String getLabel() {
|
||||
return name;
|
||||
}
|
||||
|
||||
+8
-24
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.dataobject;
|
||||
|
||||
import cn.odboy.base.KitBaseUserTimeTb;
|
||||
@@ -21,7 +20,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -30,26 +29,11 @@ import lombok.Setter;
|
||||
@Setter
|
||||
@TableName("system_dict_detail")
|
||||
public class SystemDictDetailTb extends KitBaseUserTimeTb {
|
||||
|
||||
@NotNull(groups = Update.class)
|
||||
@Schema(name = "ID", hidden = true)
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@TableField(value = "dict_id")
|
||||
@Schema(hidden = true)
|
||||
private Long dictId;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(name = "字典")
|
||||
private SystemDictTb dict;
|
||||
|
||||
@Schema(name = "字典标签")
|
||||
private String label;
|
||||
|
||||
@Schema(name = "字典值")
|
||||
private String value;
|
||||
|
||||
@Schema(name = "排序")
|
||||
private Integer dictSort = 999;
|
||||
@NotNull(groups = Update.class) @ApiModelProperty(value = "ID", hidden = true)
|
||||
@TableId(value = "id", type = IdType.AUTO) private Long id;
|
||||
@TableField(value = "dict_id") @ApiModelProperty(hidden = true) private Long dictId;
|
||||
@TableField(exist = false) @ApiModelProperty(value = "字典") private SystemDictTb dict;
|
||||
@ApiModelProperty(value = "字典标签") private String label;
|
||||
@ApiModelProperty(value = "字典值") private String value;
|
||||
@ApiModelProperty(value = "排序") private Integer dictSort = 999;
|
||||
}
|
||||
+10
-16
@@ -13,12 +13,15 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.dataobject;
|
||||
|
||||
import cn.odboy.base.KitBaseUserTimeTb;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
@@ -28,17 +31,8 @@ import lombok.Setter;
|
||||
@Setter
|
||||
@TableName("system_dict")
|
||||
public class SystemDictTb extends KitBaseUserTimeTb {
|
||||
|
||||
@NotNull(groups = Update.class)
|
||||
@Schema(name = "ID", hidden = true)
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@NotBlank
|
||||
@Schema(name = "名称")
|
||||
private String name;
|
||||
|
||||
@Schema(name = "描述")
|
||||
@TableField(updateStrategy = FieldStrategy.ALWAYS)
|
||||
private String description;
|
||||
@NotNull(groups = Update.class) @ApiModelProperty(value = "ID", hidden = true)
|
||||
@TableId(value = "id", type = IdType.AUTO) private Long id;
|
||||
@NotBlank @ApiModelProperty(value = "名称") private String name;
|
||||
@ApiModelProperty(value = "描述") @TableField(updateStrategy = FieldStrategy.ALWAYS) private String description;
|
||||
}
|
||||
+7
-25
@@ -13,13 +13,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.dataobject;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -31,27 +30,10 @@ import lombok.EqualsAndHashCode;
|
||||
@TableName("system_email_config")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SystemEmailConfigTb extends KitObject {
|
||||
|
||||
@TableId("config_id")
|
||||
private Long id;
|
||||
|
||||
@NotBlank
|
||||
@Schema(name = "邮件服务器SMTP地址")
|
||||
private String host;
|
||||
|
||||
@NotBlank
|
||||
@Schema(name = "邮件服务器 SMTP 端口")
|
||||
private String port;
|
||||
|
||||
@NotBlank
|
||||
@Schema(name = "发件者用户名")
|
||||
private String user;
|
||||
|
||||
@NotBlank
|
||||
@Schema(name = "密码")
|
||||
private String password;
|
||||
|
||||
@NotBlank
|
||||
@Schema(name = "收件人")
|
||||
private String fromUser;
|
||||
@TableId("config_id") private Long id;
|
||||
@NotBlank @ApiModelProperty(value = "邮件服务器SMTP地址") private String host;
|
||||
@NotBlank @ApiModelProperty(value = "邮件服务器 SMTP 端口") private String port;
|
||||
@NotBlank @ApiModelProperty(value = "发件者用户名") private String user;
|
||||
@NotBlank @ApiModelProperty(value = "密码") private String password;
|
||||
@NotBlank @ApiModelProperty(value = "收件人") private String fromUser;
|
||||
}
|
||||
|
||||
+7
-21
@@ -13,42 +13,28 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.dataobject;
|
||||
|
||||
import cn.odboy.base.KitBaseUserTimeTb;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Objects;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("system_job")
|
||||
public class SystemJobTb extends KitBaseUserTimeTb {
|
||||
|
||||
@NotNull(groups = Update.class)
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@Schema(name = "ID", hidden = true)
|
||||
private Long id;
|
||||
|
||||
@NotBlank
|
||||
@Schema(name = "岗位名称")
|
||||
private String name;
|
||||
|
||||
@NotNull
|
||||
@Schema(name = "岗位排序")
|
||||
private Long jobSort;
|
||||
|
||||
@NotNull
|
||||
@Schema(name = "是否启用")
|
||||
private Boolean enabled;
|
||||
@NotNull(groups = Update.class) @TableId(value = "id", type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "ID", hidden = true) private Long id;
|
||||
@NotBlank @ApiModelProperty(value = "岗位名称") private String name;
|
||||
@NotNull @ApiModelProperty(value = "岗位排序") private Long jobSort;
|
||||
@NotNull @ApiModelProperty(value = "是否启用") private Boolean enabled;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
+9
-27
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.dataobject;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
@@ -22,7 +21,7 @@ import cn.odboy.base.KitBaseUserTimeTb;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -30,31 +29,14 @@ import lombok.Setter;
|
||||
@Setter
|
||||
@TableName("system_local_storage")
|
||||
public class SystemLocalStorageTb extends KitBaseUserTimeTb {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@Schema(name = "ID", hidden = true)
|
||||
private Long id;
|
||||
|
||||
@Schema(name = "真实文件名")
|
||||
private String realName;
|
||||
|
||||
@Schema(name = "文件名")
|
||||
private String name;
|
||||
|
||||
@Schema(name = "后缀")
|
||||
private String suffix;
|
||||
|
||||
@Schema(name = "路径")
|
||||
private String path;
|
||||
|
||||
@Schema(name = "类型")
|
||||
private String type;
|
||||
|
||||
@Schema(name = "大小")
|
||||
private String size;
|
||||
|
||||
@Schema(name = "日期分组")
|
||||
private String dateGroup;
|
||||
@TableId(value = "id", type = IdType.AUTO) @ApiModelProperty(value = "ID", hidden = true) private Long id;
|
||||
@ApiModelProperty(value = "真实文件名") private String realName;
|
||||
@ApiModelProperty(value = "文件名") private String name;
|
||||
@ApiModelProperty(value = "后缀") private String suffix;
|
||||
@ApiModelProperty(value = "路径") private String path;
|
||||
@ApiModelProperty(value = "类型") private String type;
|
||||
@ApiModelProperty(value = "大小") private String size;
|
||||
@ApiModelProperty(value = "日期分组") private String dateGroup;
|
||||
|
||||
public void copy(SystemLocalStorageTb source) {
|
||||
BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
|
||||
+24
-61
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.dataobject;
|
||||
|
||||
import cn.odboy.base.KitBaseUserTimeTb;
|
||||
@@ -22,72 +21,36 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("system_menu")
|
||||
public class SystemMenuTb extends KitBaseUserTimeTb {
|
||||
|
||||
@NotNull(groups = {Update.class})
|
||||
@TableId(value = "menu_id", type = IdType.AUTO)
|
||||
@Schema(name = "ID", hidden = true)
|
||||
private Long id;
|
||||
|
||||
@TableField(exist = false)
|
||||
@JSONField(serialize = false)
|
||||
@Schema(name = "菜单角色")
|
||||
@NotNull(groups = {Update.class}) @TableId(value = "menu_id", type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "ID", hidden = true) private Long id;
|
||||
@TableField(exist = false) @JSONField(serialize = false) @ApiModelProperty(value = "菜单角色")
|
||||
private Set<SystemRoleTb> roles;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<SystemMenuTb> children;
|
||||
|
||||
@Schema(name = "菜单标题")
|
||||
private String title;
|
||||
|
||||
@TableField(value = "name")
|
||||
@Schema(name = "菜单组件名称")
|
||||
private String componentName;
|
||||
|
||||
@Schema(name = "排序")
|
||||
private Integer menuSort = 999;
|
||||
|
||||
@Schema(name = "组件路径")
|
||||
private String component;
|
||||
|
||||
@Schema(name = "路由地址")
|
||||
private String path;
|
||||
|
||||
@Schema(name = "菜单类型,目录、菜单、按钮")
|
||||
private Integer type;
|
||||
|
||||
@Schema(name = "权限标识")
|
||||
private String permission;
|
||||
|
||||
@Schema(name = "菜单图标")
|
||||
private String icon;
|
||||
|
||||
@Schema(name = "缓存")
|
||||
private Boolean cache;
|
||||
|
||||
@Schema(name = "是否隐藏")
|
||||
private Boolean hidden;
|
||||
|
||||
@Schema(name = "上级菜单")
|
||||
private Long pid;
|
||||
|
||||
@Schema(name = "子节点数目", hidden = true)
|
||||
private Integer subCount = 0;
|
||||
|
||||
@Schema(name = "外链菜单")
|
||||
private Boolean iFrame;
|
||||
@TableField(exist = false) private List<SystemMenuTb> children;
|
||||
@ApiModelProperty(value = "菜单标题") private String title;
|
||||
@TableField(value = "name") @ApiModelProperty(value = "菜单组件名称") private String componentName;
|
||||
@ApiModelProperty(value = "排序") private Integer menuSort = 999;
|
||||
@ApiModelProperty(value = "组件路径") private String component;
|
||||
@ApiModelProperty(value = "路由地址") private String path;
|
||||
@ApiModelProperty(value = "菜单类型,目录、菜单、按钮") private Integer type;
|
||||
@ApiModelProperty(value = "权限标识") private String permission;
|
||||
@ApiModelProperty(value = "菜单图标") private String icon;
|
||||
@ApiModelProperty(value = "缓存") private Boolean cache;
|
||||
@ApiModelProperty(value = "是否隐藏") private Boolean hidden;
|
||||
@ApiModelProperty(value = "上级菜单") private Long pid;
|
||||
@ApiModelProperty(value = "子节点数目", hidden = true) private Integer subCount = 0;
|
||||
@ApiModelProperty(value = "外链菜单") private Boolean iFrame;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
@@ -106,17 +69,17 @@ public class SystemMenuTb extends KitBaseUserTimeTb {
|
||||
return Objects.hash(id);
|
||||
}
|
||||
|
||||
@Schema(name = "是否有子节点")
|
||||
@ApiModelProperty(value = "是否有子节点")
|
||||
public Boolean getHasChildren() {
|
||||
return subCount > 0;
|
||||
}
|
||||
|
||||
@Schema(name = "是否为叶子")
|
||||
@ApiModelProperty(value = "是否为叶子")
|
||||
public Boolean getLeaf() {
|
||||
return subCount <= 0;
|
||||
}
|
||||
|
||||
@Schema(name = "标签名称")
|
||||
@ApiModelProperty(value = "标签名称")
|
||||
public String getLabel() {
|
||||
return title;
|
||||
}
|
||||
|
||||
+20
-31
@@ -13,18 +13,21 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.dataobject;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统审计日志
|
||||
@@ -37,64 +40,50 @@ import java.util.Date;
|
||||
@Setter
|
||||
@ToString
|
||||
@TableName("system_operation_log")
|
||||
@Schema(name = "SystemOperationLog对象", description = "审计日志")
|
||||
@ApiModel(value = "SystemOperationLog对象", description = "审计日志")
|
||||
public class SystemOperationLogTb extends KitObject {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Schema(name = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("id") @TableId(value = "id", type = IdType.AUTO) private Long id;
|
||||
/**
|
||||
* 业务名称
|
||||
*/
|
||||
@TableField("biz_name")
|
||||
private String bizName;
|
||||
@TableField("biz_name") private String bizName;
|
||||
/**
|
||||
* 业务方法
|
||||
*/
|
||||
@TableField("method")
|
||||
private String method;
|
||||
@TableField("method") private String method;
|
||||
/**
|
||||
* 业务参数
|
||||
*/
|
||||
@TableField("params")
|
||||
private String params;
|
||||
@TableField("params") private String params;
|
||||
/**
|
||||
* 访问来源IP
|
||||
*/
|
||||
@TableField("request_ip")
|
||||
private String requestIp;
|
||||
@TableField("request_ip") private String requestIp;
|
||||
/**
|
||||
* 执行时间
|
||||
*/
|
||||
@TableField("execute_time")
|
||||
private Long executeTime;
|
||||
@TableField("execute_time") private Long executeTime;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@TableField("username")
|
||||
private String username;
|
||||
@TableField("username") private String username;
|
||||
/**
|
||||
* 访问来源地址
|
||||
*/
|
||||
@TableField("address")
|
||||
private String address;
|
||||
@TableField("address") private String address;
|
||||
/**
|
||||
* 浏览器信息
|
||||
*/
|
||||
@TableField("browser_info")
|
||||
private String browserInfo;
|
||||
@TableField("browser_info") private String browserInfo;
|
||||
/**
|
||||
* 异常详情
|
||||
*/
|
||||
@TableField("exception_detail")
|
||||
private String exceptionDetail;
|
||||
@TableField("exception_detail") private String exceptionDetail;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
@TableField(value = "create_time", fill = FieldFill.INSERT) private Date createTime;
|
||||
}
|
||||
|
||||
+16
-42
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.dataobject;
|
||||
|
||||
import cn.odboy.base.KitBaseUserTimeTb;
|
||||
@@ -21,7 +20,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -36,45 +36,19 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("system_oss_storage")
|
||||
@Schema(name = "SystemOssStorage对象", description = "OSS存储")
|
||||
@ApiModel(value = "SystemOssStorage对象", description = "OSS存储")
|
||||
public class SystemOssStorageTb extends KitBaseUserTimeTb {
|
||||
@Schema(name = "ID")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
@TableField("service_type")
|
||||
@Schema(name = "类型,比如minio")
|
||||
private String serviceType;
|
||||
@TableField("endpoint")
|
||||
@Schema(name = "服务地址")
|
||||
private String endpoint;
|
||||
@TableField("bucket_name")
|
||||
@Schema(name = "存储桶名称")
|
||||
private String bucketName;
|
||||
@TableField("file_name")
|
||||
@Schema(name = "完整文件名称")
|
||||
private String fileName;
|
||||
@TableField("file_size")
|
||||
@Schema(name = "文件大小, 单位:字节")
|
||||
private Long fileSize;
|
||||
@TableField("file_mime")
|
||||
@Schema(name = "文件类型")
|
||||
private String fileMime;
|
||||
@Schema(name = "短文件名")
|
||||
@TableField("file_prefix")
|
||||
private String filePrefix;
|
||||
@Schema(name = "文件后缀")
|
||||
@TableField("file_suffix")
|
||||
private String fileSuffix;
|
||||
@TableField("file_md5")
|
||||
@Schema(name = "文件md5")
|
||||
private String fileMd5;
|
||||
@TableField("file_url")
|
||||
@Schema(name = "文件链接")
|
||||
private String fileUrl;
|
||||
@TableField("file_code")
|
||||
@Schema(name = "文件编码")
|
||||
private String fileCode;
|
||||
@TableField("object_name")
|
||||
@Schema(name = "对象路径")
|
||||
private String objectName;
|
||||
@ApiModelProperty("ID") @TableId(value = "id", type = IdType.AUTO) private Long id;
|
||||
@TableField("service_type") @ApiModelProperty("类型,比如minio") private String serviceType;
|
||||
@TableField("endpoint") @ApiModelProperty("服务地址") private String endpoint;
|
||||
@TableField("bucket_name") @ApiModelProperty("存储桶名称") private String bucketName;
|
||||
@TableField("file_name") @ApiModelProperty("完整文件名称") private String fileName;
|
||||
@TableField("file_size") @ApiModelProperty("文件大小, 单位:字节") private Long fileSize;
|
||||
@TableField("file_mime") @ApiModelProperty("文件类型") private String fileMime;
|
||||
@ApiModelProperty("短文件名") @TableField("file_prefix") private String filePrefix;
|
||||
@ApiModelProperty("文件后缀") @TableField("file_suffix") private String fileSuffix;
|
||||
@TableField("file_md5") @ApiModelProperty("文件md5") private String fileMd5;
|
||||
@TableField("file_url") @ApiModelProperty("文件链接") private String fileUrl;
|
||||
@TableField("file_code") @ApiModelProperty("文件编码") private String fileCode;
|
||||
@TableField("object_name") @ApiModelProperty("对象路径") private String objectName;
|
||||
}
|
||||
|
||||
+20
-50
@@ -13,12 +13,15 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.dataobject;
|
||||
|
||||
import cn.odboy.base.KitBaseUserTimeTb;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
@@ -28,52 +31,19 @@ import lombok.Setter;
|
||||
@Setter
|
||||
@TableName("system_quartz_job")
|
||||
public class SystemQuartzJobTb extends KitBaseUserTimeTb {
|
||||
|
||||
public static final String JOB_KEY = "JOB_KEY";
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@NotNull(groups = {Update.class})
|
||||
private Long id;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(name = "用于子任务唯一标识", hidden = true)
|
||||
private String uuid;
|
||||
|
||||
@Schema(name = "定时器名称")
|
||||
private String jobName;
|
||||
|
||||
@NotBlank
|
||||
@Schema(name = "Bean名称")
|
||||
private String beanName;
|
||||
|
||||
@NotBlank
|
||||
@Schema(name = "方法名称")
|
||||
private String methodName;
|
||||
|
||||
@Schema(name = "参数")
|
||||
private String params;
|
||||
|
||||
@NotBlank
|
||||
@Schema(name = "cron表达式")
|
||||
private String cronExpression;
|
||||
|
||||
@Schema(name = "状态:暂停或启动")
|
||||
private Boolean isPause = false;
|
||||
|
||||
@Schema(name = "负责人")
|
||||
private String personInCharge;
|
||||
|
||||
@Schema(name = "报警邮箱")
|
||||
private String email;
|
||||
|
||||
@Schema(name = "子任务")
|
||||
private String subTask;
|
||||
|
||||
@Schema(name = "失败后暂停")
|
||||
private Boolean pauseAfterFailure;
|
||||
|
||||
@NotBlank
|
||||
@Schema(name = "备注")
|
||||
@TableField(updateStrategy = FieldStrategy.ALWAYS)
|
||||
private String description;
|
||||
@TableId(value = "id", type = IdType.AUTO) @NotNull(groups = {Update.class}) private Long id;
|
||||
@TableField(exist = false) @ApiModelProperty(value = "用于子任务唯一标识", hidden = true) private String uuid;
|
||||
@ApiModelProperty(value = "定时器名称") private String jobName;
|
||||
@NotBlank @ApiModelProperty(value = "Bean名称") private String beanName;
|
||||
@NotBlank @ApiModelProperty(value = "方法名称") private String methodName;
|
||||
@ApiModelProperty(value = "参数") private String params;
|
||||
@NotBlank @ApiModelProperty(value = "cron表达式") private String cronExpression;
|
||||
@ApiModelProperty(value = "状态:暂停或启动") private Boolean isPause = false;
|
||||
@ApiModelProperty(value = "负责人") private String personInCharge;
|
||||
@ApiModelProperty(value = "报警邮箱") private String email;
|
||||
@ApiModelProperty(value = "子任务") private String subTask;
|
||||
@ApiModelProperty(value = "失败后暂停") private Boolean pauseAfterFailure;
|
||||
@NotBlank @ApiModelProperty(value = "备注") @TableField(updateStrategy = FieldStrategy.ALWAYS) private String
|
||||
description;
|
||||
}
|
||||
+17
-37
@@ -13,51 +13,31 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.dataobject;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("system_quartz_log")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SystemQuartzLogTb extends KitObject {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@Schema(name = "ID", hidden = true)
|
||||
private Long id;
|
||||
|
||||
@Schema(name = "任务名称", hidden = true)
|
||||
private String jobName;
|
||||
|
||||
@Schema(name = "bean名称", hidden = true)
|
||||
private String beanName;
|
||||
|
||||
@Schema(name = "方法名称", hidden = true)
|
||||
private String methodName;
|
||||
|
||||
@Schema(name = "参数", hidden = true)
|
||||
private String params;
|
||||
|
||||
@Schema(name = "cron表达式", hidden = true)
|
||||
private String cronExpression;
|
||||
|
||||
@Schema(name = "状态", hidden = true)
|
||||
private Boolean isSuccess;
|
||||
|
||||
@Schema(name = "异常详情", hidden = true)
|
||||
private String exceptionDetail;
|
||||
|
||||
@Schema(name = "执行耗时", hidden = true)
|
||||
private Long time;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(name = "创建时间", hidden = true)
|
||||
private Date createTime;
|
||||
@TableId(value = "id", type = IdType.AUTO) @ApiModelProperty(value = "ID", hidden = true) private Long id;
|
||||
@ApiModelProperty(value = "任务名称", hidden = true) private String jobName;
|
||||
@ApiModelProperty(value = "bean名称", hidden = true) private String beanName;
|
||||
@ApiModelProperty(value = "方法名称", hidden = true) private String methodName;
|
||||
@ApiModelProperty(value = "参数", hidden = true) private String params;
|
||||
@ApiModelProperty(value = "cron表达式", hidden = true) private String cronExpression;
|
||||
@ApiModelProperty(value = "状态", hidden = true) private Boolean isSuccess;
|
||||
@ApiModelProperty(value = "异常详情", hidden = true) private String exceptionDetail;
|
||||
@ApiModelProperty(value = "执行耗时", hidden = true) private Long time;
|
||||
@TableField(fill = FieldFill.INSERT) @ApiModelProperty(value = "创建时间", hidden = true) private Date createTime;
|
||||
}
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2021-2025 Odboy
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package cn.odboy.system.dal.dataobject;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("system_roles_depts")
|
||||
public class SystemRoleDeptTb extends KitObject {
|
||||
@TableField(value = "role_id") private Long roleId;
|
||||
@TableField(value = "dept_id") private Long deptId;
|
||||
}
|
||||
+3
-2
@@ -1,5 +1,6 @@
|
||||
package cn.odboy.system.dal.dataobject;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -11,6 +12,6 @@ import lombok.Setter;
|
||||
@Setter
|
||||
@TableName("system_roles_menus")
|
||||
public class SystemRoleMenuTb {
|
||||
private Long menuId;
|
||||
private Long roleId;
|
||||
@TableField(value = "role_id") private Long roleId;
|
||||
@TableField(value = "menu_id") private Long menuId;
|
||||
}
|
||||
|
||||
+18
-37
@@ -13,21 +13,23 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.dataobject;
|
||||
|
||||
import cn.odboy.base.KitBaseUserTimeTb;
|
||||
import cn.odboy.system.constant.SystemDataScopeEnum;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 角色
|
||||
*/
|
||||
@@ -35,37 +37,16 @@ import java.util.Set;
|
||||
@Setter
|
||||
@TableName("system_role")
|
||||
public class SystemRoleTb extends KitBaseUserTimeTb {
|
||||
|
||||
@NotNull(groups = {Update.class})
|
||||
@TableId(value = "role_id", type = IdType.AUTO)
|
||||
@Schema(name = "ID", hidden = true)
|
||||
private Long id;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(name = "用户", hidden = true)
|
||||
private Set<SystemUserTb> users;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(name = "菜单", hidden = true)
|
||||
private Set<SystemMenuTb> menus;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(name = "部门", hidden = true)
|
||||
private Set<SystemDeptTb> depts;
|
||||
|
||||
@NotBlank
|
||||
@Schema(name = "名称", hidden = true)
|
||||
private String name;
|
||||
|
||||
@Schema(name = "数据权限,全部 、 本级 、 自定义")
|
||||
private String dataScope = SystemDataScopeEnum.THIS_LEVEL.getValue();
|
||||
|
||||
@Schema(name = "级别,数值越小,级别越大")
|
||||
private Integer level = 3;
|
||||
|
||||
@Schema(name = "描述")
|
||||
@TableField(updateStrategy = FieldStrategy.ALWAYS)
|
||||
private String description;
|
||||
@NotNull(groups = {Update.class}) @TableId(value = "role_id", type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "ID", hidden = true) private Long id;
|
||||
@TableField(exist = false) @ApiModelProperty(value = "用户", hidden = true) private Set<SystemUserTb> users;
|
||||
@TableField(exist = false) @ApiModelProperty(value = "菜单", hidden = true) private Set<SystemMenuTb> menus;
|
||||
@TableField(exist = false) @ApiModelProperty(value = "部门", hidden = true) private Set<SystemDeptTb> depts;
|
||||
@NotBlank @ApiModelProperty(value = "名称", hidden = true) private String name;
|
||||
@ApiModelProperty(value = "数据权限,全部 、 本级 、 自定义") private String dataScope =
|
||||
SystemDataScopeEnum.THIS_LEVEL.getValue();
|
||||
@ApiModelProperty(value = "级别,数值越小,级别越大") private Integer level = 3;
|
||||
@ApiModelProperty(value = "描述") @TableField(updateStrategy = FieldStrategy.ALWAYS) private String description;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package cn.odboy.system.dal.dataobject;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 角色菜单
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("system_users_jobs")
|
||||
public class SystemUserJobTb {
|
||||
@TableField(value = "user_id") private Long userId;
|
||||
@TableField(value = "job_id") private Long jobId;
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2021-2025 Odboy
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package cn.odboy.system.dal.dataobject;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("system_users_roles")
|
||||
public class SystemUserRoleTb extends KitObject {
|
||||
@TableField(value = "user_id") private Long userId;
|
||||
@TableField(value = "role_id") private Long roleId;
|
||||
}
|
||||
+21
-66
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.dataobject;
|
||||
|
||||
import cn.odboy.base.KitBaseUserTimeTb;
|
||||
@@ -21,81 +20,37 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("system_user")
|
||||
public class SystemUserTb extends KitBaseUserTimeTb {
|
||||
|
||||
@NotNull(groups = Update.class)
|
||||
@TableId(value = "user_id", type = IdType.AUTO)
|
||||
@Schema(name = "ID", hidden = true)
|
||||
private Long id;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(name = "用户角色")
|
||||
private Set<SystemRoleTb> roles;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(name = "用户岗位")
|
||||
private Set<SystemJobTb> jobs;
|
||||
|
||||
@TableField(value = "dept_id")
|
||||
@Schema(hidden = true)
|
||||
private Long deptId;
|
||||
|
||||
@Schema(name = "用户部门")
|
||||
@TableField(exist = false)
|
||||
private SystemDeptTb dept;
|
||||
|
||||
@NotBlank
|
||||
@Schema(name = "用户名称")
|
||||
private String username;
|
||||
|
||||
@NotBlank
|
||||
@Schema(name = "用户昵称")
|
||||
private String nickName;
|
||||
|
||||
@Email
|
||||
@NotBlank
|
||||
@Schema(name = "邮箱")
|
||||
private String email;
|
||||
|
||||
@NotBlank
|
||||
@Schema(name = "电话号码")
|
||||
private String phone;
|
||||
|
||||
@Schema(name = "用户性别")
|
||||
private String gender;
|
||||
|
||||
@Schema(name = "头像真实名称", hidden = true)
|
||||
private String avatarName;
|
||||
|
||||
@Schema(name = "头像存储的路径", hidden = true)
|
||||
private String avatarPath;
|
||||
|
||||
@Schema(name = "密码")
|
||||
private String password;
|
||||
|
||||
@NotNull
|
||||
@Schema(name = "是否启用")
|
||||
private Boolean enabled;
|
||||
|
||||
@Schema(name = "是否为admin账号", hidden = true)
|
||||
private Boolean isAdmin = false;
|
||||
|
||||
@Schema(name = "最后修改密码的时间", hidden = true)
|
||||
private Date pwdResetTime;
|
||||
@NotNull(groups = Update.class) @TableId(value = "user_id", type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "ID", hidden = true) private Long id;
|
||||
@TableField(exist = false) @ApiModelProperty(value = "用户角色") private Set<SystemRoleTb> roles;
|
||||
@TableField(exist = false) @ApiModelProperty(value = "用户岗位") private Set<SystemJobTb> jobs;
|
||||
@TableField(value = "dept_id") @ApiModelProperty(hidden = true) private Long deptId;
|
||||
@ApiModelProperty(value = "用户部门") @TableField(exist = false) private SystemDeptTb dept;
|
||||
@NotBlank @ApiModelProperty(value = "用户名称") private String username;
|
||||
@NotBlank @ApiModelProperty(value = "用户昵称") private String nickName;
|
||||
@Email @NotBlank @ApiModelProperty(value = "邮箱") private String email;
|
||||
@NotBlank @ApiModelProperty(value = "电话号码") private String phone;
|
||||
@ApiModelProperty(value = "用户性别") private String gender;
|
||||
@ApiModelProperty(value = "头像真实名称", hidden = true) private String avatarName;
|
||||
@ApiModelProperty(value = "头像存储的路径", hidden = true) private String avatarPath;
|
||||
@ApiModelProperty(value = "密码") private String password;
|
||||
@NotNull @ApiModelProperty(value = "是否启用") private Boolean enabled;
|
||||
@ApiModelProperty(value = "是否为admin账号", hidden = true) private Boolean isAdmin = false;
|
||||
@ApiModelProperty(value = "最后修改密码的时间", hidden = true) private Date pwdResetTime;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
||||
+3
-7
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
@@ -24,10 +23,7 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemCheckEmailCaptchaArgs extends KitObject {
|
||||
@NotBlank(message = "邮箱不能为空")
|
||||
private String email;
|
||||
@NotBlank(message = "验证码不能为空")
|
||||
private String code;
|
||||
@NotBlank(message = "验证码业务标识不能为空")
|
||||
private String bizCode;
|
||||
@NotBlank(message = "邮箱不能为空") private String email;
|
||||
@NotBlank(message = "验证码不能为空") private String code;
|
||||
@NotBlank(message = "验证码业务标识不能为空") private String bizCode;
|
||||
}
|
||||
|
||||
+2
-5
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
@@ -25,10 +24,8 @@ import lombok.EqualsAndHashCode;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SystemCreateDeptArgs extends KitObject {
|
||||
@NotBlank(message = "部门名称必填")
|
||||
private String name;
|
||||
@NotNull(message = "部门排序必填")
|
||||
private Integer deptSort;
|
||||
@NotBlank(message = "部门名称必填") private String name;
|
||||
@NotNull(message = "部门排序必填") private Integer deptSort;
|
||||
private Boolean enabled;
|
||||
private String isTop;
|
||||
private Long pid;
|
||||
|
||||
+1
-3
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
@@ -24,7 +23,6 @@ import lombok.EqualsAndHashCode;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SystemCreateDictArgs extends KitObject {
|
||||
@NotBlank(message = "字典名称必填")
|
||||
private String name;
|
||||
@NotBlank(message = "字典名称必填") private String name;
|
||||
private String description;
|
||||
}
|
||||
|
||||
+4
-9
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
@@ -26,12 +25,8 @@ import lombok.EqualsAndHashCode;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SystemCreateDictDetailArgs extends KitObject {
|
||||
@NotNull(message = "参数dict必填")
|
||||
private SystemDictTb dict;
|
||||
@NotBlank(message = "字典标签必填")
|
||||
private String label;
|
||||
@NotBlank(message = "字典值必填")
|
||||
private String value;
|
||||
@NotNull(message = "字典排序必填")
|
||||
private Integer dictSort;
|
||||
@NotNull(message = "参数dict必填") private SystemDictTb dict;
|
||||
@NotBlank(message = "字典标签必填") private String label;
|
||||
@NotBlank(message = "字典值必填") private String value;
|
||||
@NotNull(message = "字典排序必填") private Integer dictSort;
|
||||
}
|
||||
|
||||
+2
-5
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
@@ -25,9 +24,7 @@ import lombok.EqualsAndHashCode;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SystemCreateJobArgs extends KitObject {
|
||||
@NotBlank(message = "职位名称必填")
|
||||
private String name;
|
||||
@NotNull(message = "职位排序必填")
|
||||
private Integer jobSort;
|
||||
@NotBlank(message = "职位名称必填") private String name;
|
||||
@NotNull(message = "职位排序必填") private Integer jobSort;
|
||||
private Boolean enabled;
|
||||
}
|
||||
|
||||
+4
-9
@@ -13,27 +13,22 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import java.util.Set;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SystemCreateRoleArgs extends KitObject {
|
||||
@NotBlank(message = "角色名称必填")
|
||||
private String name;
|
||||
@NotNull(message = "角色级别必填")
|
||||
private Integer level;
|
||||
@NotBlank(message = "数据范围必填")
|
||||
private String dataScope;
|
||||
@NotBlank(message = "角色名称必填") private String name;
|
||||
@NotNull(message = "角色级别必填") private Integer level;
|
||||
@NotBlank(message = "数据范围必填") private String dataScope;
|
||||
private String description;
|
||||
/**
|
||||
* 关联的部门
|
||||
|
||||
+4
-11
@@ -13,11 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -26,13 +25,7 @@ import lombok.EqualsAndHashCode;
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SystemMenuMetaVo extends KitObject {
|
||||
|
||||
@Schema(name = "菜单标题")
|
||||
private String title;
|
||||
|
||||
@Schema(name = "菜单图标")
|
||||
private String icon;
|
||||
|
||||
@Schema(name = "缓存")
|
||||
private Boolean noCache;
|
||||
@ApiModelProperty(value = "菜单标题") private String title;
|
||||
@ApiModelProperty(value = "菜单图标") private String icon;
|
||||
@ApiModelProperty(value = "缓存") private Boolean noCache;
|
||||
}
|
||||
|
||||
+10
-28
@@ -13,44 +13,26 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 构建前端路由时用到
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SystemMenuVo extends KitObject {
|
||||
|
||||
@Schema(name = "菜单名称")
|
||||
private String name;
|
||||
|
||||
@Schema(name = "路径")
|
||||
private String path;
|
||||
|
||||
@Schema(name = "隐藏状态")
|
||||
private Boolean hidden;
|
||||
|
||||
@Schema(name = "重定向")
|
||||
private String redirect;
|
||||
|
||||
@Schema(name = "组件")
|
||||
private String component;
|
||||
|
||||
@Schema(name = "总是显示")
|
||||
private Boolean alwaysShow;
|
||||
|
||||
@Schema(name = "元数据")
|
||||
private SystemMenuMetaVo meta;
|
||||
|
||||
@Schema(name = "子路由")
|
||||
private List<SystemMenuVo> children;
|
||||
@ApiModelProperty(value = "菜单名称") private String name;
|
||||
@ApiModelProperty(value = "路径") private String path;
|
||||
@ApiModelProperty(value = "隐藏状态") private Boolean hidden;
|
||||
@ApiModelProperty(value = "重定向") private String redirect;
|
||||
@ApiModelProperty(value = "组件") private String component;
|
||||
@ApiModelProperty(value = "总是显示") private Boolean alwaysShow;
|
||||
@ApiModelProperty(value = "元数据") private SystemMenuMetaVo meta;
|
||||
@ApiModelProperty(value = "子路由") private List<SystemMenuVo> children;
|
||||
}
|
||||
|
||||
-1
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemOssStorageTb;
|
||||
|
||||
+1
-3
@@ -13,15 +13,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemProductLineTreeVo extends KitObject {
|
||||
|
||||
-1
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
|
||||
+8
-22
@@ -13,33 +13,19 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SystemQueryDeptArgs {
|
||||
|
||||
@Schema(name = "部门id集合")
|
||||
private List<Long> ids;
|
||||
|
||||
@Schema(name = "部门名称")
|
||||
private String name;
|
||||
|
||||
@Schema(name = "是否启用")
|
||||
private Boolean enabled;
|
||||
|
||||
@Schema(name = "上级部门")
|
||||
private Long pid;
|
||||
|
||||
@Schema(name = "PID为空查询")
|
||||
private Boolean pidIsNull;
|
||||
|
||||
@Schema(name = "创建时间")
|
||||
private List<Date> createTime;
|
||||
@ApiModelProperty(value = "部门id集合") private List<Long> ids;
|
||||
@ApiModelProperty(value = "部门名称") private String name;
|
||||
@ApiModelProperty(value = "是否启用") private Boolean enabled;
|
||||
@ApiModelProperty(value = "上级部门") private Long pid;
|
||||
@ApiModelProperty(value = "PID为空查询") private Boolean pidIsNull;
|
||||
@ApiModelProperty(value = "创建时间") private List<Date> createTime;
|
||||
}
|
||||
|
||||
+4
-11
@@ -13,21 +13,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SystemQueryDictArgs {
|
||||
|
||||
@Schema(name = "模糊查询")
|
||||
private String blurry;
|
||||
|
||||
@Schema(name = "页码", example = "1")
|
||||
private Integer page = 1;
|
||||
|
||||
@Schema(name = "每页数据量", example = "10")
|
||||
private Integer size = 10;
|
||||
@ApiModelProperty(value = "模糊查询") private String blurry;
|
||||
@ApiModelProperty(value = "页码", example = "1") private Integer page = 1;
|
||||
@ApiModelProperty(value = "每页数据量", example = "10") private Integer size = 10;
|
||||
}
|
||||
|
||||
+3
-7
@@ -13,20 +13,16 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemQueryDictDetailArgs extends KitObject {
|
||||
@Schema(name = "标签")
|
||||
private String label;
|
||||
|
||||
@Schema(name = "字典名称")
|
||||
private String dictName;
|
||||
@ApiModelProperty(value = "标签") private String label;
|
||||
@ApiModelProperty(value = "字典名称") private String dictName;
|
||||
}
|
||||
+8
-20
@@ -13,32 +13,20 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class SystemQueryJobArgs {
|
||||
|
||||
@Schema(name = "岗位名称")
|
||||
private String name;
|
||||
|
||||
@Schema(name = "是否启用")
|
||||
private Boolean enabled;
|
||||
|
||||
@Schema(name = "创建时间")
|
||||
private List<Date> createTime;
|
||||
|
||||
@Schema(name = "页码", example = "1")
|
||||
private Integer page = 1;
|
||||
|
||||
@Schema(name = "每页数据量", example = "10")
|
||||
private Integer size = 10;
|
||||
@ApiModelProperty(value = "岗位名称") private String name;
|
||||
@ApiModelProperty(value = "是否启用") private Boolean enabled;
|
||||
@ApiModelProperty(value = "创建时间") private List<Date> createTime;
|
||||
@ApiModelProperty(value = "页码", example = "1") private Integer page = 1;
|
||||
@ApiModelProperty(value = "每页数据量", example = "10") private Integer size = 10;
|
||||
}
|
||||
|
||||
+6
-16
@@ -13,27 +13,17 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SystemQueryMenuArgs {
|
||||
|
||||
@Schema(name = "模糊查询")
|
||||
private String blurry;
|
||||
|
||||
@Schema(name = "创建时间")
|
||||
private List<Date> createTime;
|
||||
|
||||
@Schema(name = "PID为空查询")
|
||||
private Boolean pidIsNull;
|
||||
|
||||
@Schema(name = "PID")
|
||||
private Long pid;
|
||||
@ApiModelProperty(value = "模糊查询") private String blurry;
|
||||
@ApiModelProperty(value = "创建时间") private List<Date> createTime;
|
||||
@ApiModelProperty(value = "PID为空查询") private Boolean pidIsNull;
|
||||
@ApiModelProperty(value = "PID") private Long pid;
|
||||
}
|
||||
|
||||
+7
-19
@@ -13,30 +13,18 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SystemQueryQuartzJobArgs {
|
||||
|
||||
@Schema(name = "定时任务名称")
|
||||
private String jobName;
|
||||
|
||||
@Schema(name = "是否成功")
|
||||
private Boolean isSuccess;
|
||||
|
||||
@Schema(name = "创建时间")
|
||||
private List<Date> createTime;
|
||||
|
||||
@Schema(name = "页码", example = "1")
|
||||
private Integer page = 1;
|
||||
|
||||
@Schema(name = "每页数据量", example = "10")
|
||||
private Integer size = 10;
|
||||
@ApiModelProperty(value = "定时任务名称") private String jobName;
|
||||
@ApiModelProperty(value = "是否成功") private Boolean isSuccess;
|
||||
@ApiModelProperty(value = "创建时间") private List<Date> createTime;
|
||||
@ApiModelProperty(value = "页码", example = "1") private Integer page = 1;
|
||||
@ApiModelProperty(value = "每页数据量", example = "10") private Integer size = 10;
|
||||
}
|
||||
|
||||
+7
-19
@@ -13,30 +13,18 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SystemQueryRoleArgs {
|
||||
|
||||
@Schema(name = "模糊查询")
|
||||
private String blurry;
|
||||
|
||||
@Schema(name = "创建时间")
|
||||
private List<Date> createTime;
|
||||
|
||||
@Schema(name = "页码", example = "1")
|
||||
private Integer page = 1;
|
||||
|
||||
@Schema(name = "每页数据量", example = "10")
|
||||
private Integer size = 10;
|
||||
|
||||
@Schema(name = "偏移量", hidden = true)
|
||||
private long offset;
|
||||
@ApiModelProperty(value = "模糊查询") private String blurry;
|
||||
@ApiModelProperty(value = "创建时间") private List<Date> createTime;
|
||||
@ApiModelProperty(value = "页码", example = "1") private Integer page = 1;
|
||||
@ApiModelProperty(value = "每页数据量", example = "10") private Integer size = 10;
|
||||
@ApiModelProperty(value = "偏移量", hidden = true) private long offset;
|
||||
}
|
||||
|
||||
+6
-16
@@ -13,27 +13,17 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SystemQueryStorageArgs {
|
||||
|
||||
@Schema(name = "模糊查询")
|
||||
private String blurry;
|
||||
|
||||
@Schema(name = "创建时间")
|
||||
private List<Date> createTime;
|
||||
|
||||
@Schema(name = "页码", example = "1")
|
||||
private Integer page = 1;
|
||||
|
||||
@Schema(name = "每页数据量", example = "10")
|
||||
private Integer size = 10;
|
||||
@ApiModelProperty(value = "模糊查询") private String blurry;
|
||||
@ApiModelProperty(value = "创建时间") private List<Date> createTime;
|
||||
@ApiModelProperty(value = "页码", example = "1") private Integer page = 1;
|
||||
@ApiModelProperty(value = "每页数据量", example = "10") private Integer size = 10;
|
||||
}
|
||||
|
||||
+11
-29
@@ -13,44 +13,26 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SystemQueryUserArgs extends KitObject {
|
||||
|
||||
@Schema(name = "ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(name = "多个ID")
|
||||
private Set<Long> deptIds = new HashSet<>();
|
||||
|
||||
@Schema(name = "模糊查询")
|
||||
private String blurry;
|
||||
|
||||
@Schema(name = "是否启用")
|
||||
private Boolean enabled;
|
||||
|
||||
@Schema(name = "部门ID")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(name = "创建时间")
|
||||
private List<Date> createTime;
|
||||
|
||||
@Schema(name = "页码", example = "1")
|
||||
private Integer page = 1;
|
||||
|
||||
@Schema(name = "每页数据量", example = "10")
|
||||
private Integer size = 10;
|
||||
@ApiModelProperty(value = "ID") private Long id;
|
||||
@ApiModelProperty(value = "多个ID") private Set<Long> deptIds = new HashSet<>();
|
||||
@ApiModelProperty(value = "模糊查询") private String blurry;
|
||||
@ApiModelProperty(value = "是否启用") private Boolean enabled;
|
||||
@ApiModelProperty(value = "部门ID") private Long deptId;
|
||||
@ApiModelProperty(value = "创建时间") private List<Date> createTime;
|
||||
@ApiModelProperty(value = "页码", example = "1") private Integer page = 1;
|
||||
@ApiModelProperty(value = "每页数据量", example = "10") private Integer size = 10;
|
||||
}
|
||||
|
||||
+2
-5
@@ -13,10 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -29,7 +28,5 @@ import org.springframework.security.core.GrantedAuthority;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SystemRoleCodeVo implements GrantedAuthority {
|
||||
|
||||
@Schema(name = "角色名")
|
||||
private String authority;
|
||||
@ApiModelProperty(value = "角色名") private String authority;
|
||||
}
|
||||
|
||||
+5
-16
@@ -13,18 +13,16 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.List;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 发送邮件时,接收参数的类
|
||||
*/
|
||||
@@ -32,16 +30,7 @@ import java.util.List;
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SystemSendEmailArgs {
|
||||
|
||||
@NotEmpty
|
||||
@Schema(name = "收件人")
|
||||
private List<String> tos;
|
||||
|
||||
@NotBlank
|
||||
@Schema(name = "主题")
|
||||
private String subject;
|
||||
|
||||
@NotBlank
|
||||
@Schema(name = "内容")
|
||||
private String content;
|
||||
@NotEmpty @ApiModelProperty(value = "收件人") private List<String> tos;
|
||||
@NotBlank @ApiModelProperty(value = "主题") private String subject;
|
||||
@NotBlank @ApiModelProperty(value = "内容") private String content;
|
||||
}
|
||||
|
||||
+14
-28
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
@@ -21,38 +20,25 @@ import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Set;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SystemSimpleUserVo extends KitObject {
|
||||
@Schema(name = "ID", hidden = true)
|
||||
private Long id;
|
||||
@Schema(name = "用户角色")
|
||||
private Set<SystemRoleTb> roles;
|
||||
@Schema(name = "用户岗位")
|
||||
private Set<SystemJobTb> jobs;
|
||||
@ApiModelProperty(value = "ID", hidden = true) private Long id;
|
||||
@ApiModelProperty(value = "用户角色") private Set<SystemRoleTb> roles;
|
||||
@ApiModelProperty(value = "用户岗位") private Set<SystemJobTb> jobs;
|
||||
private Long deptId;
|
||||
@TableField(exist = false)
|
||||
private SystemDeptTb dept;
|
||||
@Schema(name = "用户名称")
|
||||
private String username;
|
||||
@Schema(name = "用户昵称")
|
||||
private String nickName;
|
||||
@Schema(name = "邮箱")
|
||||
private String email;
|
||||
@Schema(name = "电话号码")
|
||||
private String phone;
|
||||
@Schema(name = "用户性别")
|
||||
private String gender;
|
||||
@Schema(name = "头像真实名称", hidden = true)
|
||||
private String avatarName;
|
||||
@Schema(name = "是否启用")
|
||||
private Boolean enabled;
|
||||
@Schema(name = "是否为admin账号", hidden = true)
|
||||
private Boolean isAdmin = false;
|
||||
@TableField(exist = false) private SystemDeptTb dept;
|
||||
@ApiModelProperty(value = "用户名称") private String username;
|
||||
@ApiModelProperty(value = "用户昵称") private String nickName;
|
||||
@ApiModelProperty(value = "邮箱") private String email;
|
||||
@ApiModelProperty(value = "电话号码") private String phone;
|
||||
@ApiModelProperty(value = "用户性别") private String gender;
|
||||
@ApiModelProperty(value = "头像真实名称", hidden = true) private String avatarName;
|
||||
@ApiModelProperty(value = "是否启用") private Boolean enabled;
|
||||
@ApiModelProperty(value = "是否为admin账号", hidden = true) private Boolean isAdmin = false;
|
||||
}
|
||||
+5
-11
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
@@ -25,22 +24,17 @@ import lombok.EqualsAndHashCode;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class SystemUpdateQuartzJobArgs extends KitObject {
|
||||
@NotNull
|
||||
private Long id;
|
||||
@NotNull private Long id;
|
||||
private String uuid;
|
||||
private String jobName;
|
||||
@NotBlank
|
||||
private String beanName;
|
||||
@NotBlank
|
||||
private String methodName;
|
||||
@NotBlank private String beanName;
|
||||
@NotBlank private String methodName;
|
||||
private String params;
|
||||
@NotBlank
|
||||
private String cronExpression;
|
||||
@NotBlank private String cronExpression;
|
||||
private Boolean isPause = false;
|
||||
private String personInCharge;
|
||||
private String email;
|
||||
private String subTask;
|
||||
private Boolean pauseAfterFailure;
|
||||
@NotBlank
|
||||
private String description;
|
||||
@NotBlank private String description;
|
||||
}
|
||||
|
||||
+3
-8
@@ -13,10 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -24,10 +23,6 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class SystemUpdateUserPasswordArgs {
|
||||
|
||||
@Schema(name = "旧密码")
|
||||
private String oldPass;
|
||||
|
||||
@Schema(name = "新密码")
|
||||
private String newPass;
|
||||
@ApiModelProperty(value = "旧密码") private String oldPass;
|
||||
@ApiModelProperty(value = "新密码") private String newPass;
|
||||
}
|
||||
|
||||
+2
-4
@@ -13,16 +13,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.odboy.base.KitObject;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
|
||||
+7
-15
@@ -13,32 +13,24 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public class SystemUserJwtVo implements UserDetails {
|
||||
|
||||
@Schema(name = "用户")
|
||||
private final SystemUserTb user;
|
||||
|
||||
@Schema(name = "数据权限")
|
||||
private final List<Long> dataScopes;
|
||||
|
||||
@Schema(name = "角色")
|
||||
private final List<SystemRoleCodeVo> authorities;
|
||||
@ApiModelProperty(value = "用户") private final SystemUserTb user;
|
||||
@ApiModelProperty(value = "数据权限") private final List<Long> dataScopes;
|
||||
@ApiModelProperty(value = "角色") private final List<SystemRoleCodeVo> authorities;
|
||||
|
||||
public Set<String> getRoles() {
|
||||
return authorities.stream().map(SystemRoleCodeVo::getAuthority).collect(Collectors.toSet());
|
||||
|
||||
+5
-16
@@ -13,10 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -24,18 +23,8 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
public class SystemUserLoginArgs {
|
||||
|
||||
@NotBlank
|
||||
@Schema(name = "用户名")
|
||||
private String username;
|
||||
|
||||
@NotBlank
|
||||
@Schema(name = "密码")
|
||||
private String password;
|
||||
|
||||
@Schema(name = "验证码")
|
||||
private String code;
|
||||
|
||||
@Schema(name = "验证码的key")
|
||||
private String uuid = "";
|
||||
@NotBlank @ApiModelProperty(value = "用户名") private String username;
|
||||
@NotBlank @ApiModelProperty(value = "密码") private String password;
|
||||
@ApiModelProperty(value = "验证码") private String code;
|
||||
@ApiModelProperty(value = "验证码的key") private String uuid = "";
|
||||
}
|
||||
|
||||
+11
-30
@@ -13,43 +13,24 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.model;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 在线用户
|
||||
*/
|
||||
@Data
|
||||
public class SystemUserOnlineVo {
|
||||
@Schema(name = "Token编号")
|
||||
private String uid;
|
||||
|
||||
@Schema(name = "用户名")
|
||||
private String userName;
|
||||
|
||||
@Schema(name = "昵称")
|
||||
private String nickName;
|
||||
|
||||
@Schema(name = "岗位")
|
||||
private String dept;
|
||||
|
||||
@Schema(name = "浏览器")
|
||||
private String browser;
|
||||
|
||||
@Schema(name = "IP")
|
||||
private String ip;
|
||||
|
||||
@Schema(name = "地址")
|
||||
private String address;
|
||||
|
||||
@Schema(name = "token")
|
||||
private String key;
|
||||
|
||||
@Schema(name = "登录时间")
|
||||
private Date loginTime;
|
||||
@ApiModelProperty(value = "Token编号") private String uid;
|
||||
@ApiModelProperty(value = "用户名") private String userName;
|
||||
@ApiModelProperty(value = "昵称") private String nickName;
|
||||
@ApiModelProperty(value = "岗位") private String dept;
|
||||
@ApiModelProperty(value = "浏览器") private String browser;
|
||||
@ApiModelProperty(value = "IP") private String ip;
|
||||
@ApiModelProperty(value = "地址") private String address;
|
||||
@ApiModelProperty(value = "token") private String key;
|
||||
@ApiModelProperty(value = "登录时间") private Date loginTime;
|
||||
}
|
||||
|
||||
+47
-15
@@ -13,16 +13,17 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.model.SystemQueryDeptArgs;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 部门 Mapper
|
||||
@@ -31,15 +32,46 @@ import java.util.List;
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemDeptMapper extends BaseMapper<SystemDeptTb> {
|
||||
List<SystemDeptTb> selectDeptByArgs(@Param("criteria") SystemQueryDeptArgs criteria);
|
||||
|
||||
List<SystemDeptTb> selectDeptByPid(@Param("pid") Long pid);
|
||||
|
||||
int countDeptByPid(@Param("pid") Long pid);
|
||||
|
||||
List<SystemDeptTb> selectDeptByPidIsNull();
|
||||
|
||||
List<SystemDeptTb> selectDeptByRoleId(@Param("roleId") Long roleId);
|
||||
|
||||
void updateDeptSubCountById(@Param("count") Integer count, @Param("id") Long id);
|
||||
default List<SystemDeptTb> selectDeptByPidIsNull() {
|
||||
LambdaQueryWrapper<SystemDeptTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.isNull(SystemDeptTb::getPid);
|
||||
return selectList(wrapper);
|
||||
}
|
||||
default long countDeptByPid(Long pid) {
|
||||
LambdaQueryWrapper<SystemDeptTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemDeptTb::getPid, pid);
|
||||
return selectCount(wrapper);
|
||||
}
|
||||
default List<SystemDeptTb> queryDeptByArgs(SystemQueryDeptArgs criteria) {
|
||||
LambdaQueryWrapper<SystemDeptTb> wrapper = new LambdaQueryWrapper<>();
|
||||
if (criteria != null) {
|
||||
wrapper.in(CollUtil.isNotEmpty(criteria.getIds()), SystemDeptTb::getId, criteria.getIds());
|
||||
wrapper.like(StrUtil.isNotBlank(criteria.getName()), SystemDeptTb::getName, criteria.getName());
|
||||
wrapper.eq(criteria.getEnabled() != null, SystemDeptTb::getEnabled, criteria.getEnabled());
|
||||
wrapper.eq(criteria.getPid() != null, SystemDeptTb::getPid, criteria.getPid());
|
||||
wrapper.isNull(criteria.getPidIsNull() != null, SystemDeptTb::getPid);
|
||||
if (CollUtil.isNotEmpty(criteria.getCreateTime()) && criteria.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemDeptTb::getCreateTime, criteria.getCreateTime().get(0),
|
||||
criteria.getCreateTime().get(1));
|
||||
}
|
||||
}
|
||||
wrapper.orderByAsc(SystemDeptTb::getDeptSort);
|
||||
return selectList(wrapper);
|
||||
}
|
||||
default List<SystemDeptTb> selectEnabledDepts() {
|
||||
LambdaQueryWrapper<SystemDeptTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemDeptTb::getEnabled, 1);
|
||||
return selectList(wrapper);
|
||||
}
|
||||
default List<SystemDeptTb> selectDeptByPid(long pid) {
|
||||
LambdaQueryWrapper<SystemDeptTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemDeptTb::getPid, pid);
|
||||
return selectList(wrapper);
|
||||
}
|
||||
default void updateDeptSubCountById(long count, Long deptId) {
|
||||
LambdaUpdateWrapper<SystemDeptTb> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.eq(SystemDeptTb::getId, deptId);
|
||||
wrapper.set(SystemDeptTb::getSubCount, count);
|
||||
update(null, wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-8
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemDictDetailTb;
|
||||
@@ -21,12 +20,10 @@ import cn.odboy.system.dal.model.SystemQueryDictDetailArgs;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 字典明细 Mapper
|
||||
*
|
||||
@@ -34,9 +31,6 @@ import java.util.Set;
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemDictDetailMapper extends BaseMapper<SystemDictDetailTb> {
|
||||
IPage<SystemDictDetailTb> selectDictDetailByArgs(@Param("criteria") SystemQueryDictDetailArgs criteria, Page<Object> page);
|
||||
|
||||
IPage<SystemDictDetailTb> selectDictDetailByArgs(@Param("criteria") SystemQueryDictDetailArgs criteria, Page<SystemDictDetailTb> page);
|
||||
List<SystemDictDetailTb> selectDictDetailByArgs(@Param("criteria") SystemQueryDictDetailArgs criteria);
|
||||
|
||||
void deleteDictDetailByDictIds(@Param("dictIds") Set<Long> dictIds);
|
||||
}
|
||||
|
||||
+19
-8
@@ -13,18 +13,16 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.system.dal.dataobject.SystemDictTb;
|
||||
import cn.odboy.system.dal.model.SystemQueryDictArgs;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 字典 Mapper
|
||||
@@ -33,7 +31,20 @@ import java.util.List;
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemDictMapper extends BaseMapper<SystemDictTb> {
|
||||
IPage<SystemDictTb> selectDictByArgs(@Param("criteria") SystemQueryDictArgs criteria, Page<SystemDictTb> page);
|
||||
|
||||
List<SystemDictTb> selectDictByArgs(@Param("criteria") SystemQueryDictArgs criteria);
|
||||
default void injectQueryParams(SystemQueryDictArgs args, LambdaQueryWrapper<SystemDictTb> wrapper) {
|
||||
if (args != null) {
|
||||
wrapper.and(StrUtil.isNotBlank(args.getBlurry()), c -> c.like(SystemDictTb::getName, args.getBlurry()).or()
|
||||
.like(SystemDictTb::getDescription, args.getBlurry()));
|
||||
}
|
||||
}
|
||||
default List<SystemDictTb> selectDictByArgs(SystemQueryDictArgs args) {
|
||||
LambdaQueryWrapper<SystemDictTb> wrapper = new LambdaQueryWrapper<>();
|
||||
injectQueryParams(args, wrapper);
|
||||
return selectList(wrapper);
|
||||
}
|
||||
default List<SystemDictTb> selectDictByArgs(SystemQueryDictArgs args, Page<SystemDictTb> page) {
|
||||
LambdaQueryWrapper<SystemDictTb> wrapper = new LambdaQueryWrapper<>();
|
||||
injectQueryParams(args, wrapper);
|
||||
return selectList(page, wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-3
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemEmailConfigTb;
|
||||
@@ -26,5 +25,4 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @author odboy
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemEmailConfigMapper extends BaseMapper<SystemEmailConfigTb> {
|
||||
}
|
||||
public interface SystemEmailConfigMapper extends BaseMapper<SystemEmailConfigTb> {}
|
||||
|
||||
+31
-4
@@ -13,16 +13,18 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.model.SystemQueryJobArgs;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 职位 Mapper
|
||||
@@ -31,7 +33,32 @@ import org.apache.ibatis.annotations.Param;
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemJobMapper extends BaseMapper<SystemJobTb> {
|
||||
SystemJobTb getJobByName(@Param("name") String name);
|
||||
default SystemJobTb getJobByName(String name) {
|
||||
LambdaQueryWrapper<SystemJobTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemJobTb::getName, name);
|
||||
return selectOne(wrapper);
|
||||
}
|
||||
default void injectQueryParams(SystemQueryJobArgs criteria, LambdaQueryWrapper<SystemJobTb> wrapper) {
|
||||
if (criteria != null) {
|
||||
wrapper.like(StrUtil.isNotBlank(criteria.getName()), SystemJobTb::getName, criteria.getName());
|
||||
wrapper.eq(criteria.getEnabled() != null, SystemJobTb::getEnabled, criteria.getEnabled());
|
||||
if (CollUtil.isNotEmpty(criteria.getCreateTime()) && criteria.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemJobTb::getCreateTime, criteria.getCreateTime().get(0),
|
||||
criteria.getCreateTime().get(1));
|
||||
}
|
||||
}
|
||||
wrapper.orderByDesc(SystemJobTb::getJobSort, SystemJobTb::getId);
|
||||
}
|
||||
|
||||
IPage<SystemJobTb> selectJobByArgs(@Param("criteria") SystemQueryJobArgs criteria, Page<SystemJobTb> page);
|
||||
default IPage<SystemJobTb> selectJobByArgs(SystemQueryJobArgs criteria, Page<SystemJobTb> page) {
|
||||
LambdaQueryWrapper<SystemJobTb> wrapper = new LambdaQueryWrapper<>();
|
||||
this.injectQueryParams(criteria, wrapper);
|
||||
return selectPage(page, wrapper);
|
||||
}
|
||||
|
||||
default List<SystemJobTb> selectJobByArgs(SystemQueryJobArgs criteria) {
|
||||
LambdaQueryWrapper<SystemJobTb> wrapper = new LambdaQueryWrapper<>();
|
||||
this.injectQueryParams(criteria, wrapper);
|
||||
return selectList(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
+31
-3
@@ -13,16 +13,18 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.system.dal.dataobject.SystemLocalStorageTb;
|
||||
import cn.odboy.system.dal.model.SystemQueryStorageArgs;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 本地存储记录 Mapper
|
||||
@@ -31,5 +33,31 @@ import org.apache.ibatis.annotations.Param;
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemLocalStorageMapper extends BaseMapper<SystemLocalStorageTb> {
|
||||
IPage<SystemLocalStorageTb> selectLocalStorageByArgs(@Param("criteria") SystemQueryStorageArgs criteria, Page<SystemLocalStorageTb> page);
|
||||
default void injectQueryParams(SystemQueryStorageArgs criteria, LambdaQueryWrapper<SystemLocalStorageTb> wrapper) {
|
||||
if (criteria != null) {
|
||||
wrapper.and(StrUtil.isNotBlank(criteria.getBlurry()),
|
||||
c -> c.like(SystemLocalStorageTb::getName, criteria.getBlurry()).or()
|
||||
.like(SystemLocalStorageTb::getSuffix, criteria.getBlurry()).or()
|
||||
.like(SystemLocalStorageTb::getType, criteria.getBlurry()).or()
|
||||
.like(SystemLocalStorageTb::getCreateBy, criteria.getBlurry()));
|
||||
if (CollUtil.isNotEmpty(criteria.getCreateTime()) && criteria.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemLocalStorageTb::getUpdateTime, criteria.getCreateTime().get(0),
|
||||
criteria.getCreateTime().get(1));
|
||||
}
|
||||
}
|
||||
wrapper.orderByDesc(SystemLocalStorageTb::getId);
|
||||
}
|
||||
|
||||
default List<SystemLocalStorageTb> selectLocalStorageByArgs(SystemQueryStorageArgs criteria) {
|
||||
LambdaQueryWrapper<SystemLocalStorageTb> wrapper = new LambdaQueryWrapper<>();
|
||||
injectQueryParams(criteria, wrapper);
|
||||
return selectList(wrapper);
|
||||
}
|
||||
|
||||
default IPage<SystemLocalStorageTb> selectLocalStorageByArgs(SystemQueryStorageArgs criteria,
|
||||
Page<SystemLocalStorageTb> page) {
|
||||
LambdaQueryWrapper<SystemLocalStorageTb> wrapper = new LambdaQueryWrapper<>();
|
||||
injectQueryParams(criteria, wrapper);
|
||||
return selectPage(page, wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
+57
-17
@@ -13,18 +13,17 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
||||
import cn.odboy.system.dal.model.SystemQueryMenuArgs;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 菜单 Mapper
|
||||
@@ -33,20 +32,61 @@ import java.util.Set;
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemMenuMapper extends BaseMapper<SystemMenuTb> {
|
||||
default void updateMenuSubCntByMenuId(Long count, Long menuId) {
|
||||
if (count != null) {
|
||||
LambdaUpdateWrapper<SystemMenuTb> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.eq(SystemMenuTb::getId, menuId);
|
||||
wrapper.set(SystemMenuTb::getSubCount, count);
|
||||
update(wrapper);
|
||||
}
|
||||
}
|
||||
default SystemMenuTb getMenuByComponentName(String componentName) {
|
||||
LambdaQueryWrapper<SystemMenuTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemMenuTb::getComponentName, componentName);
|
||||
return selectOne(wrapper);
|
||||
}
|
||||
|
||||
List<SystemMenuTb> selectMenuByArgs(@Param("criteria") SystemQueryMenuArgs criteria);
|
||||
default SystemMenuTb getMenuByTitle(String title) {
|
||||
LambdaQueryWrapper<SystemMenuTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemMenuTb::getTitle, title);
|
||||
return selectOne(wrapper);
|
||||
}
|
||||
|
||||
LinkedHashSet<SystemMenuTb> selectMenuByRoleIdsAndType(@Param("roleIds") Set<Long> roleIds, @Param("type") Integer type);
|
||||
default Long countMenuByPid(Long pid) {
|
||||
LambdaQueryWrapper<SystemMenuTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemMenuTb::getPid, pid);
|
||||
return selectCount(wrapper);
|
||||
}
|
||||
|
||||
List<SystemMenuTb> selectMenuByPidIsNullOrderByMenuSort();
|
||||
default List<SystemMenuTb> selectMenuByArgs(SystemQueryMenuArgs criteria) {
|
||||
LambdaQueryWrapper<SystemMenuTb> wrapper = new LambdaQueryWrapper<>();
|
||||
if (criteria != null) {
|
||||
wrapper.isNull(criteria.getPidIsNull() != null, SystemMenuTb::getPid);
|
||||
wrapper.eq(criteria.getPid() != null, SystemMenuTb::getPid, criteria.getPid());
|
||||
wrapper.and(StrUtil.isNotBlank(criteria.getBlurry()),
|
||||
c -> c.like(SystemMenuTb::getTitle, criteria.getBlurry()).or()
|
||||
.like(SystemMenuTb::getComponentName, criteria.getBlurry()).or()
|
||||
.like(SystemMenuTb::getPermission, criteria.getBlurry()));
|
||||
if (CollUtil.isNotEmpty(criteria.getCreateTime()) && criteria.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemMenuTb::getCreateTime, criteria.getCreateTime().get(0),
|
||||
criteria.getCreateTime().get(1));
|
||||
}
|
||||
}
|
||||
wrapper.orderByAsc(SystemMenuTb::getMenuSort);
|
||||
return selectList(wrapper);
|
||||
}
|
||||
|
||||
List<SystemMenuTb> selectMenuByPidOrderByMenuSort(@Param("pid") Long pid);
|
||||
default List<SystemMenuTb> selectMenuByPid(Long pid) {
|
||||
LambdaQueryWrapper<SystemMenuTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemMenuTb::getPid, pid);
|
||||
wrapper.orderByAsc(SystemMenuTb::getMenuSort);
|
||||
return selectList(wrapper);
|
||||
}
|
||||
|
||||
SystemMenuTb getMenuByTitle(@Param("title") String title);
|
||||
|
||||
SystemMenuTb getMenuByComponentName(@Param("name") String name);
|
||||
|
||||
Integer countMenuByPid(@Param("pid") Long pid);
|
||||
|
||||
void updateMenuSubCntByMenuId(@Param("count") int count, @Param("menuId") Long menuId);
|
||||
default List<SystemMenuTb> selectMenuByPidIsNull() {
|
||||
LambdaQueryWrapper<SystemMenuTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.isNull(SystemMenuTb::getPid);
|
||||
wrapper.orderByAsc(SystemMenuTb::getMenuSort);
|
||||
return selectList(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-3
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemOperationLogTb;
|
||||
@@ -21,5 +20,4 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SystemOperationLogMapper extends BaseMapper<SystemOperationLogTb> {
|
||||
}
|
||||
public interface SystemOperationLogMapper extends BaseMapper<SystemOperationLogTb> {}
|
||||
|
||||
+1
-11
@@ -13,18 +13,12 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemOssStorageTb;
|
||||
import cn.odboy.system.dal.model.SystemQueryStorageArgs;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* OSS存储 Mapper 接口
|
||||
@@ -34,8 +28,4 @@ import java.util.List;
|
||||
* @since 2025-07-15
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemOssStorageMapper extends BaseMapper<SystemOssStorageTb> {
|
||||
IPage<SystemOssStorageTb> selectOssStorageByArgs(SystemQueryStorageArgs criteria, Page<SystemOssStorageTb> page);
|
||||
|
||||
List<SystemOssStorageTb> selectOssStorageByArgs(SystemQueryStorageArgs criteria);
|
||||
}
|
||||
public interface SystemOssStorageMapper extends BaseMapper<SystemOssStorageTb> {}
|
||||
|
||||
+1
-12
@@ -13,18 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemQuartzJobTb;
|
||||
import cn.odboy.system.dal.model.SystemQueryQuartzJobArgs;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 定时任务 Mapper
|
||||
@@ -32,8 +25,4 @@ import java.util.List;
|
||||
* @author odboy
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemQuartzJobMapper extends BaseMapper<SystemQuartzJobTb> {
|
||||
IPage<SystemQuartzJobTb> selectQuartzJobByArgs(@Param("criteria") SystemQueryQuartzJobArgs criteria, Page<SystemQuartzJobTb> page);
|
||||
|
||||
List<SystemQuartzJobTb> selectAllEnableQuartzJob();
|
||||
}
|
||||
public interface SystemQuartzJobMapper extends BaseMapper<SystemQuartzJobTb> {}
|
||||
|
||||
+1
-8
@@ -13,16 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemQuartzLogTb;
|
||||
import cn.odboy.system.dal.model.SystemQueryQuartzJobArgs;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 定时任务日志 Mapper
|
||||
@@ -30,6 +25,4 @@ import org.apache.ibatis.annotations.Param;
|
||||
* @author odboy
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemQuartzLogMapper extends BaseMapper<SystemQuartzLogTb> {
|
||||
IPage<SystemQuartzLogTb> selectQuartzLogByArgs(@Param("criteria") SystemQueryQuartzJobArgs criteria, Page<SystemQuartzLogTb> page);
|
||||
}
|
||||
public interface SystemQuartzLogMapper extends BaseMapper<SystemQuartzLogTb> {}
|
||||
|
||||
+3
-10
@@ -13,14 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleDeptTb;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 角色部门关联 Mapper
|
||||
@@ -28,8 +25,4 @@ import java.util.Set;
|
||||
* @author odboy
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemRoleDeptMapper {
|
||||
void batchInsertRoleDept(@Param("depts") Set<SystemDeptTb> depts, @Param("roleId") Long roleId);
|
||||
|
||||
void batchDeleteRoleDept(@Param("roleIds") Set<Long> roleIds);
|
||||
}
|
||||
public interface SystemRoleDeptMapper extends BaseMapper<SystemRoleDeptTb> {}
|
||||
|
||||
+20
-16
@@ -13,17 +13,18 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.model.SystemQueryRoleArgs;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 角色 Mapper
|
||||
@@ -32,19 +33,22 @@ import java.util.Set;
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemRoleMapper extends BaseMapper<SystemRoleTb> {
|
||||
List<SystemRoleTb> selectAllRole();
|
||||
|
||||
default Long countRoleByArgs(SystemQueryRoleArgs criteria) {
|
||||
LambdaQueryWrapper<SystemRoleTb> wrapper = new LambdaQueryWrapper<>();
|
||||
if (criteria != null) {
|
||||
wrapper.and(StrUtil.isNotBlank(criteria.getBlurry()),
|
||||
c -> c.like(SystemRoleTb::getName, criteria.getBlurry()).or()
|
||||
.like(SystemRoleTb::getDescription, criteria.getBlurry()));
|
||||
if (CollUtil.isNotEmpty(criteria.getCreateTime()) && criteria.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemRoleTb::getCreateTime, criteria.getCreateTime().get(0),
|
||||
criteria.getCreateTime().get(1));
|
||||
}
|
||||
}
|
||||
return selectCount(wrapper);
|
||||
}
|
||||
List<SystemRoleTb> selectRoleByArgs(@Param("criteria") SystemQueryRoleArgs criteria);
|
||||
|
||||
Long countRoleByArgs(@Param("criteria") SystemQueryRoleArgs criteria);
|
||||
|
||||
SystemRoleTb getRoleByName(@Param("name") String name);
|
||||
|
||||
SystemRoleTb getRoleById(@Param("roleId") Long roleId);
|
||||
|
||||
List<SystemRoleTb> selectRoleByUserId(@Param("userId") Long userId);
|
||||
|
||||
Integer countRoleByDeptIds(@Param("deptIds") Set<Long> deptIds);
|
||||
|
||||
List<SystemRoleTb> selectRoleByMenuId(@Param("menuId") Long menuId);
|
||||
SystemRoleTb getRoleById(@Param("roleId") Long roleId);
|
||||
Integer countRoleByDeptIds(@Param("deptIds") Set<Long> deptIds);
|
||||
}
|
||||
|
||||
+1
-12
@@ -13,16 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleMenuTb;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 角色菜单关联 Mapper
|
||||
@@ -30,10 +25,4 @@ import java.util.Set;
|
||||
* @author odboy
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemRoleMenuMapper extends BaseMapper<SystemRoleMenuTb> {
|
||||
void batchInsertRoleMenu(@Param("menus") Set<SystemMenuTb> menus, @Param("roleId") Long roleId);
|
||||
|
||||
void batchDeleteRoleMenu(@Param("roleIds") Set<Long> roleIds);
|
||||
|
||||
void deleteRoleMenuByRoleId(@Param("roleId") Long roleId);
|
||||
}
|
||||
public interface SystemRoleMenuMapper extends BaseMapper<SystemRoleMenuTb> {}
|
||||
|
||||
+3
-10
@@ -13,14 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserJobTb;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 用户职位关联 Mapper
|
||||
@@ -28,8 +25,4 @@ import java.util.Set;
|
||||
* @author odboy
|
||||
*/
|
||||
@Mapper
|
||||
public interface SystemUserJobMapper {
|
||||
void batchInsertUserJob(@Param("jobs") Set<SystemJobTb> jobs, @Param("userId") Long userId);
|
||||
|
||||
void batchDeleteUserJob(@Param("userIds") Set<Long> userIds);
|
||||
}
|
||||
public interface SystemUserJobMapper extends BaseMapper<SystemUserJobTb> {}
|
||||
|
||||
+40
-24
@@ -13,47 +13,63 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import cn.odboy.system.dal.model.SystemQueryUserArgs;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface SystemUserMapper extends BaseMapper<SystemUserTb> {
|
||||
List<SystemUserTb> selectUserByArgs(@Param("criteria") SystemQueryUserArgs criteria);
|
||||
|
||||
IPage<SystemUserTb> selectUserByArgs(@Param("criteria") SystemQueryUserArgs criteria, Page<SystemUserTb> page);
|
||||
|
||||
SystemUserTb getUserByUsername(@Param("username") String username);
|
||||
|
||||
SystemUserTb getUserByEmail(@Param("email") String email);
|
||||
|
||||
SystemUserTb getUserByPhone(@Param("phone") String phone);
|
||||
|
||||
List<SystemUserTb> selectUserByRoleId(@Param("roleId") Long roleId);
|
||||
|
||||
List<SystemUserTb> selectUserByDeptId(@Param("deptId") Long deptId);
|
||||
|
||||
List<SystemUserTb> selectUserByMenuId(@Param("menuId") Long menuId);
|
||||
|
||||
Long countUserByJobIds(@Param("jobIds") Set<Long> jobIds);
|
||||
|
||||
Long countUserByDeptIds(@Param("deptIds") Set<Long> deptIds);
|
||||
|
||||
Long countUserByRoleIds(@Param("roleIds") Set<Long> roleIds);
|
||||
|
||||
void updateUserPasswordByUsername(@Param("username") String username, @Param("password") String password);
|
||||
|
||||
void updateUserEmailByUsername(@Param("username") String username, @Param("email") String email);
|
||||
|
||||
void batchUpdatePassword(@Param("password") String password, @Param("userIds") Set<Long> userIds);
|
||||
SystemUserTb getUserByUsername(@Param("username") String username);
|
||||
default long countUserByDeptIds(Set<Long> deptIds) {
|
||||
LambdaQueryWrapper<SystemUserTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(SystemUserTb::getDeptId, deptIds);
|
||||
return selectCount(wrapper);
|
||||
}
|
||||
default SystemUserTb getUserByEmail(String email) {
|
||||
LambdaQueryWrapper<SystemUserTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemUserTb::getEmail, email);
|
||||
wrapper.eq(SystemUserTb::getEnabled, 1);
|
||||
return selectOne(wrapper);
|
||||
}
|
||||
default SystemUserTb getUserByPhone(String phone) {
|
||||
LambdaQueryWrapper<SystemUserTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemUserTb::getPhone, phone);
|
||||
wrapper.eq(SystemUserTb::getEnabled, 1);
|
||||
return selectOne(wrapper);
|
||||
}
|
||||
default void updateUserPasswordByUsername(String username, String password) {
|
||||
LambdaUpdateWrapper<SystemUserTb> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.eq(SystemUserTb::getUsername, username);
|
||||
wrapper.set(SystemUserTb::getPassword, password);
|
||||
update(null, wrapper);
|
||||
}
|
||||
default void updateUserEmailByUsername(String username, String email) {
|
||||
LambdaUpdateWrapper<SystemUserTb> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.eq(SystemUserTb::getUsername, username);
|
||||
wrapper.set(SystemUserTb::getEmail, email);
|
||||
update(null, wrapper);
|
||||
}
|
||||
default void updateUserPasswordByUserIds(String password, Set<Long> userIds) {
|
||||
LambdaUpdateWrapper<SystemUserTb> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.in(SystemUserTb::getId, userIds);
|
||||
wrapper.set(SystemUserTb::getPassword, password);
|
||||
update(null, wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-10
@@ -13,18 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.mysql;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserRoleTb;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Mapper
|
||||
public interface SystemUserRoleMapper {
|
||||
void batchInsertUserRole(@Param("roles") Set<SystemRoleTb> roles, @Param("userId") Long userId);
|
||||
|
||||
void batchDeleteUserRole(@Param("userIds") Set<Long> userIds);
|
||||
}
|
||||
public interface SystemUserRoleMapper extends BaseMapper<SystemUserRoleTb> {}
|
||||
|
||||
-12
@@ -13,66 +13,54 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.dal.redis;
|
||||
|
||||
/**
|
||||
* 关于缓存的Key集合
|
||||
*/
|
||||
public interface SystemCacheKey {
|
||||
|
||||
/**
|
||||
* 用户
|
||||
*/
|
||||
String USER_ID = "user::id:";
|
||||
|
||||
/**
|
||||
* 数据
|
||||
*/
|
||||
String DATA_USER = "data::user:";
|
||||
|
||||
/**
|
||||
* 菜单
|
||||
*/
|
||||
String MENU_ID = "menu::id:";
|
||||
String MENU_USER = "menu::user:";
|
||||
|
||||
/**
|
||||
* 角色授权
|
||||
*/
|
||||
String ROLE_AUTH = "role::auth:";
|
||||
String ROLE_USER = "role::user:";
|
||||
|
||||
/**
|
||||
* 角色信息
|
||||
*/
|
||||
String ROLE_ID = "role::id:";
|
||||
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
String DEPT_ID = "dept::id:";
|
||||
|
||||
/**
|
||||
* 岗位
|
||||
*/
|
||||
String JOB_ID = "job::id:";
|
||||
|
||||
/**
|
||||
* 数据字典
|
||||
*/
|
||||
String DICT_NAME = "dict::name:";
|
||||
|
||||
/**
|
||||
* 在线用户
|
||||
*/
|
||||
String ONLINE_USER = "online::token:";
|
||||
|
||||
/**
|
||||
* 登录验证码
|
||||
*/
|
||||
String CAPTCHA_LOGIN = "captcha::login:";
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*/
|
||||
|
||||
-11
@@ -4,59 +4,48 @@ package cn.odboy.system.dal.redis;
|
||||
* 关于缓存的Key集合
|
||||
*/
|
||||
public interface SystemRedisKey {
|
||||
|
||||
/**
|
||||
* 用户
|
||||
*/
|
||||
String USER_ID = "user::id:";
|
||||
|
||||
/**
|
||||
* 数据
|
||||
*/
|
||||
String DATA_USER = "data::user:";
|
||||
|
||||
/**
|
||||
* 菜单
|
||||
*/
|
||||
String MENU_ID = "menu::id:";
|
||||
String MENU_USER = "menu::user:";
|
||||
|
||||
/**
|
||||
* 角色授权
|
||||
*/
|
||||
String ROLE_AUTH = "role::auth:";
|
||||
String ROLE_USER = "role::user:";
|
||||
|
||||
/**
|
||||
* 角色信息
|
||||
*/
|
||||
String ROLE_ID = "role::id:";
|
||||
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
String DEPT_ID = "dept::id:";
|
||||
|
||||
/**
|
||||
* 岗位
|
||||
*/
|
||||
String JOB_ID = "job::id:";
|
||||
|
||||
/**
|
||||
* 数据字典
|
||||
*/
|
||||
String DICT_NAME = "dict::name:";
|
||||
|
||||
/**
|
||||
* 在线用户
|
||||
*/
|
||||
String ONLINE_USER = "online::token:";
|
||||
|
||||
/**
|
||||
* 登录验证码
|
||||
*/
|
||||
String CAPTCHA_LOGIN = "captcha::login:";
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*/
|
||||
|
||||
+1
-3
@@ -13,8 +13,7 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Component
|
||||
public class SystemUserInfoDAO {
|
||||
@Autowired
|
||||
private KitRedisHelper redisHelper;
|
||||
@Autowired private KitRedisHelper redisHelper;
|
||||
|
||||
/**
|
||||
* 添加缓存到Redis
|
||||
@@ -49,7 +48,6 @@ public class SystemUserInfoDAO {
|
||||
* @param username 用户名
|
||||
* @return UserJwtVo
|
||||
*/
|
||||
|
||||
public SystemUserJwtVo getUserLoginInfoByUserName(String username) {
|
||||
if (StrUtil.isNotEmpty(username)) {
|
||||
// 获取数据
|
||||
|
||||
+19
-15
@@ -7,18 +7,26 @@ import cn.odboy.framework.redis.KitRedisHelper;
|
||||
import cn.odboy.system.dal.model.SystemUserJwtVo;
|
||||
import cn.odboy.system.dal.model.SystemUserOnlineVo;
|
||||
import cn.odboy.system.framework.permission.core.handler.TokenProvider;
|
||||
import cn.odboy.util.*;
|
||||
import cn.odboy.util.KitBrowserUtil;
|
||||
import cn.odboy.util.KitDesEncryptUtil;
|
||||
import cn.odboy.util.KitFileUtil;
|
||||
import cn.odboy.util.KitIPUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
@@ -34,7 +42,6 @@ public class SystemUserOnlineInfoDAO {
|
||||
* @param token /
|
||||
* @param request /
|
||||
*/
|
||||
|
||||
public void saveUserJwtModelByToken(SystemUserJwtVo userJwtVo, String token, HttpServletRequest request) {
|
||||
String dept = userJwtVo.getUser().getDept().getName();
|
||||
String ip = KitBrowserUtil.getIp(request);
|
||||
@@ -65,7 +72,6 @@ public class SystemUserOnlineInfoDAO {
|
||||
*
|
||||
* @param token /
|
||||
*/
|
||||
|
||||
public void logoutByToken(String token) {
|
||||
String loginKey = tokenProvider.loginKey(token);
|
||||
redisHelper.del(loginKey);
|
||||
@@ -78,8 +84,8 @@ public class SystemUserOnlineInfoDAO {
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
|
||||
public void downloadUserOnlineModelExcel(List<SystemUserOnlineVo> all, HttpServletResponse response) throws IOException {
|
||||
public void downloadUserOnlineModelExcel(List<SystemUserOnlineVo> all, HttpServletResponse response)
|
||||
throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (SystemUserOnlineVo user : all) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
@@ -99,7 +105,6 @@ public class SystemUserOnlineInfoDAO {
|
||||
*
|
||||
* @param username /
|
||||
*/
|
||||
|
||||
public void kickOutByUsername(String username) {
|
||||
String loginKey = SystemRedisKey.ONLINE_USER + username + "*";
|
||||
redisHelper.scanDel(loginKey);
|
||||
@@ -112,14 +117,15 @@ public class SystemUserOnlineInfoDAO {
|
||||
* @param pageable /
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public KitPageResult<SystemUserOnlineVo> queryUserOnlineModelPage(SystemUserOnlineVo onlineVo, IPage<SystemUserOnlineVo> pageable) {
|
||||
public KitPageResult<SystemUserOnlineVo> queryUserOnlineModelPage(SystemUserOnlineVo onlineVo,
|
||||
IPage<SystemUserOnlineVo> pageable) {
|
||||
String username = null;
|
||||
if (onlineVo != null) {
|
||||
username = onlineVo.getUserName();
|
||||
}
|
||||
List<SystemUserOnlineVo> onlineUserList = queryUserOnlineModelListByUsername(username);
|
||||
List<SystemUserOnlineVo> paging = KitPageUtil.softPaging(pageable.getCurrent(), pageable.getSize(), onlineUserList);
|
||||
List<SystemUserOnlineVo> paging =
|
||||
KitPageUtil.softPaging(pageable.getCurrent(), pageable.getSize(), onlineUserList);
|
||||
return KitPageUtil.toPage(paging, onlineUserList.size());
|
||||
}
|
||||
|
||||
@@ -129,7 +135,6 @@ public class SystemUserOnlineInfoDAO {
|
||||
* @param username /
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public List<SystemUserOnlineVo> queryUserOnlineModelListByUsername(String username) {
|
||||
String loginKey = SystemRedisKey.ONLINE_USER + (StrUtil.isBlank(username) ? "" : "*" + username);
|
||||
List<String> keys = redisHelper.scan(loginKey + "*");
|
||||
@@ -148,7 +153,6 @@ public class SystemUserOnlineInfoDAO {
|
||||
* @param key /
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public SystemUserOnlineVo queryUserOnlineModelByKey(String key) {
|
||||
return redisHelper.get(key, SystemUserOnlineVo.class);
|
||||
}
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ public class UserDetailsHandler implements UserDetailsService {
|
||||
// 获取用户的权限
|
||||
List<SystemRoleCodeVo> authorities = systemRoleService.buildUserRolePermissions(user);
|
||||
// 初始化JwtUserDto
|
||||
userJwtVo = new SystemUserJwtVo(user, systemDataService.queryDeptIdListByArgs(user), authorities);
|
||||
userJwtVo = new SystemUserJwtVo(user, systemDataService.findDeptIdListByArgs(user), authorities);
|
||||
// 添加缓存数据
|
||||
systemUserInfoDAO.saveUserLoginInfoByUserName(username, userJwtVo);
|
||||
}
|
||||
|
||||
+5
-8
@@ -17,22 +17,19 @@
|
||||
package cn.odboy.system.framework.quartz;
|
||||
|
||||
import cn.odboy.system.dal.dataobject.SystemQuartzJobTb;
|
||||
import cn.odboy.system.dal.mysql.SystemQuartzJobMapper;
|
||||
import cn.odboy.system.service.SystemQuartzJobService;
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ActiveJobRegister implements ApplicationRunner {
|
||||
@Autowired
|
||||
private SystemQuartzJobMapper quartzJobMapper;
|
||||
@Autowired
|
||||
private QuartzManage quartzManage;
|
||||
@Autowired private SystemQuartzJobService systemQuartzJobService;
|
||||
@Autowired private QuartzManage quartzManage;
|
||||
|
||||
/**
|
||||
* 项目启动时重新激活启用的定时任务
|
||||
@@ -41,7 +38,7 @@ public class ActiveJobRegister implements ApplicationRunner {
|
||||
*/
|
||||
@Override
|
||||
public void run(ApplicationArguments applicationArguments) {
|
||||
List<SystemQuartzJobTb> quartzJobs = quartzJobMapper.selectAllEnableQuartzJob();
|
||||
List<SystemQuartzJobTb> quartzJobs = systemQuartzJobService.queryEnableQuartzJob();
|
||||
quartzJobs.forEach(quartzManage::addJob);
|
||||
log.info("Timing task injection complete");
|
||||
}
|
||||
|
||||
+17
-16
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
@@ -21,12 +20,12 @@ import cn.odboy.system.constant.SystemDataScopeEnum;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 数据权限 Service
|
||||
@@ -35,10 +34,9 @@ import java.util.Objects;
|
||||
*/
|
||||
@Service
|
||||
public class SystemDataService {
|
||||
@Autowired
|
||||
private SystemRoleService systemRoleService;
|
||||
@Autowired
|
||||
private SystemDeptService systemDeptService;
|
||||
@Autowired private SystemRoleService systemRoleService;
|
||||
@Autowired private SystemDeptService systemDeptService;
|
||||
@Autowired private SystemRoleDeptService systemRoleDeptService;
|
||||
|
||||
/**
|
||||
* 获取数据权限
|
||||
@@ -46,7 +44,7 @@ public class SystemDataService {
|
||||
* @param user /
|
||||
* @return /
|
||||
*/
|
||||
public List<Long> queryDeptIdListByArgs(SystemUserTb user) {
|
||||
public List<Long> findDeptIdListByArgs(SystemUserTb user) {
|
||||
List<Long> deptIds = new ArrayList<>();
|
||||
// 查询用户角色
|
||||
List<SystemRoleTb> roleList = systemRoleService.queryRoleByUsersId(user.getId());
|
||||
@@ -54,14 +52,17 @@ public class SystemDataService {
|
||||
for (SystemRoleTb role : roleList) {
|
||||
SystemDataScopeEnum dataScopeEnum = SystemDataScopeEnum.find(role.getDataScope());
|
||||
switch (Objects.requireNonNull(dataScopeEnum)) {
|
||||
case THIS_LEVEL -> deptIds.add(user.getDept().getId());
|
||||
case CUSTOMIZE -> deptIds.addAll(queryCustomDataPermissionList(deptIds, role));
|
||||
default -> {
|
||||
case THIS_LEVEL:
|
||||
deptIds.add(user.getDept().getId());
|
||||
break;
|
||||
case CUSTOMIZE:
|
||||
deptIds.addAll(this.findCustomDataPermissionList(deptIds, role));
|
||||
break;
|
||||
default:
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
}
|
||||
return deptIds.stream().distinct().toList();
|
||||
return deptIds.stream().distinct().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,8 +72,8 @@ public class SystemDataService {
|
||||
* @param role 角色
|
||||
* @return 数据权限ID
|
||||
*/
|
||||
private List<Long> queryCustomDataPermissionList(List<Long> deptIds, SystemRoleTb role) {
|
||||
List<SystemDeptTb> deptList = systemDeptService.queryDeptByRoleId(role.getId());
|
||||
private List<Long> findCustomDataPermissionList(List<Long> deptIds, SystemRoleTb role) {
|
||||
List<SystemDeptTb> deptList = systemRoleDeptService.selectDeptByRoleId(role.getId());
|
||||
for (SystemDeptTb dept : deptList) {
|
||||
deptIds.add(dept.getId());
|
||||
List<SystemDeptTb> deptChildren = systemDeptService.queryDeptByPid(dept.getId());
|
||||
|
||||
+34
-58
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
@@ -22,6 +21,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.framework.context.KitSpringBeanHolder;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.system.constant.SystemDataScopeEnum;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
@@ -35,33 +35,36 @@ import cn.odboy.system.dal.mysql.SystemUserMapper;
|
||||
import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
import cn.odboy.util.KitClassUtil;
|
||||
import cn.odboy.util.KitFileUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class SystemDeptService {
|
||||
@Autowired
|
||||
private SystemDeptMapper systemDeptMapper;
|
||||
@Autowired
|
||||
private SystemUserMapper systemUserMapper;
|
||||
@Autowired
|
||||
private SystemRoleMapper systemRoleMapper;
|
||||
@Autowired private SystemDeptMapper systemDeptMapper;
|
||||
@Autowired private SystemUserMapper systemUserMapper;
|
||||
@Autowired private SystemRoleMapper systemRoleMapper;
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveDept(SystemCreateDeptArgs args) {
|
||||
systemDeptMapper.insert(BeanUtil.copyProperties(args, SystemDeptTb.class));
|
||||
@@ -73,11 +76,10 @@ public class SystemDeptService {
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void modifyDept(SystemDeptTb args) {
|
||||
public void updateDept(SystemDeptTb args) {
|
||||
// 旧的部门
|
||||
Long oldPid = queryDeptById(args.getId()).getPid();
|
||||
Long oldPid = this.getDeptById(args.getId()).getPid();
|
||||
Long newPid = args.getPid();
|
||||
if (args.getPid() != null && args.getId().equals(args.getPid())) {
|
||||
throw new BadRequestException("上级不能为自己");
|
||||
@@ -94,7 +96,6 @@ public class SystemDeptService {
|
||||
*
|
||||
* @param deptSet /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void removeDeptByIds(Set<SystemDeptTb> deptSet) {
|
||||
for (SystemDeptTb dept : deptSet) {
|
||||
@@ -130,7 +131,7 @@ public class SystemDeptService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateDeptSubCnt(Long deptId) {
|
||||
if (deptId != null) {
|
||||
int count = systemDeptMapper.countDeptByPid(deptId);
|
||||
long count = systemDeptMapper.countDeptByPid(deptId);
|
||||
systemDeptMapper.updateDeptSubCountById(count, deptId);
|
||||
}
|
||||
}
|
||||
@@ -159,7 +160,6 @@ public class SystemDeptService {
|
||||
* @return /
|
||||
* @throws Exception /
|
||||
*/
|
||||
|
||||
public List<SystemDeptTb> queryAllDept(SystemQueryDeptArgs criteria, Boolean isQuery) throws Exception {
|
||||
String dataScopeType = KitSecurityHelper.getDataScopeType();
|
||||
if (isQuery) {
|
||||
@@ -186,10 +186,10 @@ public class SystemDeptService {
|
||||
}
|
||||
// 数据权限
|
||||
criteria.setIds(KitSecurityHelper.getCurrentUserDataScope());
|
||||
List<SystemDeptTb> list = systemDeptMapper.selectDeptByArgs(criteria);
|
||||
List<SystemDeptTb> list = systemDeptMapper.queryDeptByArgs(criteria);
|
||||
// 如果为空, 就代表为自定义权限或者本级权限, 就需要去重, 不理解可以注释掉,看查询结果
|
||||
if (StrUtil.isBlank(dataScopeType)) {
|
||||
return deduplication(list);
|
||||
return this.deduplication(list);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -200,8 +200,7 @@ public class SystemDeptService {
|
||||
* @param id /
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public SystemDeptTb queryDeptById(Long id) {
|
||||
public SystemDeptTb getDeptById(Long id) {
|
||||
return systemDeptMapper.selectById(id);
|
||||
}
|
||||
|
||||
@@ -211,22 +210,10 @@ public class SystemDeptService {
|
||||
* @param pid /
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public List<SystemDeptTb> queryDeptByPid(long pid) {
|
||||
return systemDeptMapper.selectDeptByPid(pid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色ID查询
|
||||
*
|
||||
* @param id /
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public List<SystemDeptTb> queryDeptByRoleId(Long id) {
|
||||
return systemDeptMapper.selectDeptByRoleId(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门下所有关联的部门
|
||||
*
|
||||
@@ -234,7 +221,6 @@ public class SystemDeptService {
|
||||
* @param depts /
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public Set<SystemDeptTb> queryRelationDeptSet(List<SystemDeptTb> deptTbList, Set<SystemDeptTb> depts) {
|
||||
for (SystemDeptTb dept : deptTbList) {
|
||||
depts.add(dept);
|
||||
@@ -252,7 +238,6 @@ public class SystemDeptService {
|
||||
* @param deptList 、
|
||||
* @return 、
|
||||
*/
|
||||
|
||||
public List<Long> queryChildDeptIdListByDeptIds(List<SystemDeptTb> deptList) {
|
||||
List<Long> list = new ArrayList<>();
|
||||
for (SystemDeptTb systemDeptTb : deptList) {
|
||||
@@ -274,14 +259,13 @@ public class SystemDeptService {
|
||||
* @param deptList /
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public List<SystemDeptTb> querySuperiorDeptListByPid(SystemDeptTb dept, List<SystemDeptTb> deptList) {
|
||||
if (dept.getPid() == null) {
|
||||
deptList.addAll(systemDeptMapper.selectDeptByPidIsNull());
|
||||
return deptList;
|
||||
}
|
||||
deptList.addAll(systemDeptMapper.selectDeptByPid(dept.getPid()));
|
||||
return querySuperiorDeptListByPid(queryDeptById(dept.getPid()), deptList);
|
||||
return querySuperiorDeptListByPid(this.getDeptById(dept.getPid()), deptList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -290,11 +274,10 @@ public class SystemDeptService {
|
||||
* @param deptList /
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public KitPageResult<SystemDeptTb> buildDeptTree(List<SystemDeptTb> deptList) {
|
||||
Set<SystemDeptTb> trees = new LinkedHashSet<>();
|
||||
Set<SystemDeptTb> deptSet = new LinkedHashSet<>();
|
||||
List<String> deptNames = deptList.stream().map(SystemDeptTb::getName).toList();
|
||||
List<String> deptNames = deptList.stream().map(SystemDeptTb::getName).collect(Collectors.toList());
|
||||
boolean isChild;
|
||||
for (SystemDeptTb dept : deptList) {
|
||||
isChild = false;
|
||||
@@ -312,7 +295,7 @@ public class SystemDeptService {
|
||||
}
|
||||
if (isChild) {
|
||||
deptSet.add(dept);
|
||||
} else if (dept.getPid() != null && !deptNames.contains(queryDeptById(dept.getPid()).getName())) {
|
||||
} else if (dept.getPid() != null && !deptNames.contains(this.getDeptById(dept.getPid()).getName())) {
|
||||
deptSet.add(dept);
|
||||
}
|
||||
}
|
||||
@@ -330,7 +313,6 @@ public class SystemDeptService {
|
||||
*
|
||||
* @param deptSet /
|
||||
*/
|
||||
|
||||
public void verifyBindRelationByIds(Set<SystemDeptTb> deptSet) {
|
||||
Set<Long> deptIds = deptSet.stream().map(SystemDeptTb::getId).collect(Collectors.toSet());
|
||||
if (systemUserMapper.countUserByDeptIds(deptIds) > 0) {
|
||||
@@ -346,12 +328,11 @@ public class SystemDeptService {
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
|
||||
public Set<SystemDeptTb> traverseDeptByIdWithPids(Set<Long> ids) {
|
||||
Set<SystemDeptTb> depts = new HashSet<>();
|
||||
for (Long id : ids) {
|
||||
// 根部门
|
||||
depts.add(queryDeptById(id));
|
||||
depts.add(this.getDeptById(id));
|
||||
// 子部门
|
||||
List<SystemDeptTb> deptList = queryDeptByPid(id);
|
||||
if (CollectionUtil.isNotEmpty(deptList)) {
|
||||
@@ -362,22 +343,21 @@ public class SystemDeptService {
|
||||
}
|
||||
|
||||
public List<SystemProductLineVo> queryDeptSelectDataSource() {
|
||||
List<SystemDeptTb> depts = findEnabledDepts();
|
||||
List<SystemDeptTb> depts = systemDeptMapper.selectEnabledDepts();
|
||||
return buildDeptSelectOptions(depts);
|
||||
}
|
||||
|
||||
private List<SystemProductLineVo> buildDeptSelectOptions(List<SystemDeptTb> depts) {
|
||||
// 获取所有部门并按父子关系组织
|
||||
Map<Long, SystemDeptTb> deptMap = depts.stream().collect(Collectors.toMap(SystemDeptTb::getId, Function.identity()));
|
||||
Map<Long, SystemDeptTb> deptMap =
|
||||
depts.stream().collect(Collectors.toMap(SystemDeptTb::getId, Function.identity()));
|
||||
List<SystemProductLineVo> options = new ArrayList<>();
|
||||
for (SystemDeptTb dept : depts) {
|
||||
// 构建部门ID路径
|
||||
List<Long> pathIds = new ArrayList<>();
|
||||
buildDeptIdPath(dept, deptMap, pathIds);
|
||||
|
||||
// 反转路径,从顶级部门到当前部门
|
||||
Collections.reverse(pathIds);
|
||||
|
||||
SystemProductLineVo dto = new SystemProductLineVo();
|
||||
dto.setValue(dept.getId());
|
||||
dto.setIdPath(pathIds.stream().map(String::valueOf).collect(Collectors.joining("-")));
|
||||
@@ -385,7 +365,6 @@ public class SystemDeptService {
|
||||
dto.setLabel(buildNamePath(dept, deptMap));
|
||||
options.add(dto);
|
||||
}
|
||||
|
||||
// 按部门名称路径排序
|
||||
options.sort(Comparator.comparing(SystemProductLineVo::getLabel));
|
||||
return options;
|
||||
@@ -412,14 +391,11 @@ public class SystemDeptService {
|
||||
}
|
||||
}
|
||||
|
||||
private List<SystemDeptTb> findEnabledDepts() {
|
||||
return systemDeptMapper.selectList(new LambdaQueryWrapper<SystemDeptTb>().eq(SystemDeptTb::getEnabled, 1));
|
||||
}
|
||||
|
||||
public List<SystemProductLineTreeVo> queryDeptSelectProDataSource() {
|
||||
List<SystemDeptTb> depts = findEnabledDepts();
|
||||
List<SystemDeptTb> depts = systemDeptMapper.selectEnabledDepts();
|
||||
// 获取所有部门并按父子关系组织
|
||||
Map<Long, SystemDeptTb> deptMap = depts.stream().collect(Collectors.toMap(SystemDeptTb::getId, Function.identity()));
|
||||
Map<Long, SystemDeptTb> deptMap =
|
||||
depts.stream().collect(Collectors.toMap(SystemDeptTb::getId, Function.identity()));
|
||||
List<SystemProductLineTreeVo> options = new ArrayList<>();
|
||||
// 构建树形结构
|
||||
for (SystemDeptTb dept : depts) {
|
||||
|
||||
+15
-9
@@ -13,27 +13,27 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.system.dal.dataobject.SystemDictDetailTb;
|
||||
import cn.odboy.system.dal.model.SystemCreateDictDetailArgs;
|
||||
import cn.odboy.system.dal.model.SystemQueryDictDetailArgs;
|
||||
import cn.odboy.system.dal.mysql.SystemDictDetailMapper;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SystemDictDetailService {
|
||||
@Autowired
|
||||
private SystemDictDetailMapper systemDictDetailMapper;
|
||||
@Autowired private SystemDictDetailMapper systemDictDetailMapper;
|
||||
|
||||
/**
|
||||
* 创建
|
||||
@@ -64,7 +64,6 @@ public class SystemDictDetailService {
|
||||
*
|
||||
* @param id /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void removeDictDetailById(Long id) {
|
||||
systemDictDetailMapper.deleteById(id);
|
||||
@@ -77,8 +76,7 @@ public class SystemDictDetailService {
|
||||
* @param page 分页参数
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public KitPageResult<SystemDictDetailTb> queryDictDetailByArgs(SystemQueryDictDetailArgs args, Page<Object> page) {
|
||||
public KitPageResult<SystemDictDetailTb> queryDictDetailByArgs(SystemQueryDictDetailArgs args, Page<SystemDictDetailTb> page) {
|
||||
return KitPageUtil.toPage(systemDictDetailMapper.selectDictDetailByArgs(args, page));
|
||||
}
|
||||
|
||||
@@ -88,10 +86,18 @@ public class SystemDictDetailService {
|
||||
* @param name 字典名称
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public List<SystemDictDetailTb> queryDictDetailByName(String name) {
|
||||
SystemQueryDictDetailArgs args = new SystemQueryDictDetailArgs();
|
||||
args.setDictName(name);
|
||||
return systemDictDetailMapper.selectDictDetailByArgs(args);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteDictDetailByDictIds(Set<Long> ids) {
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
LambdaQueryWrapper<SystemDictDetailTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(SystemDictDetailTb::getDictId, ids);
|
||||
systemDictDetailMapper.delete(wrapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-15
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
@@ -30,26 +29,27 @@ import cn.odboy.util.KitFileUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class SystemDictService {
|
||||
@Autowired
|
||||
private SystemDictMapper systemDictMapper;
|
||||
@Autowired
|
||||
private SystemDictDetailMapper systemDictDetailMapper;
|
||||
@Autowired private SystemDictMapper systemDictMapper;
|
||||
@Autowired private SystemDictDetailMapper systemDictDetailMapper;
|
||||
@Autowired private SystemDictDetailService systemDictDetailService;
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveDict(SystemCreateDictArgs args) {
|
||||
systemDictMapper.insert(BeanUtil.copyProperties(args, SystemDictTb.class));
|
||||
@@ -60,7 +60,6 @@ public class SystemDictService {
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void modifyDictById(SystemDictTb args) {
|
||||
SystemDictTb dict = systemDictMapper.selectById(args.getId());
|
||||
@@ -74,13 +73,12 @@ public class SystemDictService {
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void removeDictByIds(Set<Long> ids) {
|
||||
// 删除字典
|
||||
systemDictMapper.deleteByIds(ids);
|
||||
// 删除字典详情
|
||||
systemDictDetailMapper.deleteDictDetailByDictIds(ids);
|
||||
systemDictDetailService.deleteDictDetailByDictIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,7 +88,6 @@ public class SystemDictService {
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
|
||||
public void exportDictExcel(List<SystemDictTb> dicts, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (SystemDictTb dict : dicts) {
|
||||
@@ -127,7 +124,6 @@ public class SystemDictService {
|
||||
* @param page 分页参数
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public KitPageResult<SystemDictTb> queryDictByArgs(SystemQueryDictArgs args, Page<SystemDictTb> page) {
|
||||
return KitPageUtil.toPage(systemDictMapper.selectDictByArgs(args, page));
|
||||
}
|
||||
@@ -138,7 +134,6 @@ public class SystemDictService {
|
||||
* @param args /
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public List<SystemDictTb> queryDictByArgs(SystemQueryDictArgs args) {
|
||||
return systemDictMapper.selectDictByArgs(args);
|
||||
}
|
||||
|
||||
+11
-19
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.lang.Dict;
|
||||
@@ -29,32 +28,26 @@ import cn.odboy.system.dal.model.SystemSendEmailArgs;
|
||||
import cn.odboy.system.dal.mysql.SystemEmailConfigMapper;
|
||||
import cn.odboy.util.KitDesEncryptUtil;
|
||||
import cn.odboy.util.KitResourceTemplateUtil;
|
||||
import java.util.Collections;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SystemEmailService {
|
||||
@Autowired
|
||||
private SystemEmailConfigMapper systemEmailConfigMapper;
|
||||
@Autowired
|
||||
private KitRedisHelper redisHelper;
|
||||
@Autowired
|
||||
private AppProperties properties;
|
||||
@Value("${spring.application.title}")
|
||||
private String applicationTitle;
|
||||
@Autowired private SystemEmailConfigMapper systemEmailConfigMapper;
|
||||
@Autowired private KitRedisHelper redisHelper;
|
||||
@Autowired private AppProperties properties;
|
||||
@Value("${spring.application.title}") private String applicationTitle;
|
||||
|
||||
/**
|
||||
* 更新邮件配置
|
||||
*
|
||||
* @param emailConfig 邮箱配置
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void modifyEmailConfig(SystemEmailConfigTb emailConfig) throws Exception {
|
||||
SystemEmailConfigTb systemEmailConfigTb = getLastEmailConfig();
|
||||
@@ -71,7 +64,6 @@ public class SystemEmailService {
|
||||
*
|
||||
* @param sendEmailRequest 邮件发送的内容
|
||||
*/
|
||||
|
||||
public void sendEmail(SystemSendEmailArgs sendEmailRequest) {
|
||||
SystemEmailConfigTb systemEmailConfigTb = getLastEmailConfig();
|
||||
if (systemEmailConfigTb.getId() == null) {
|
||||
@@ -102,8 +94,8 @@ public class SystemEmailService {
|
||||
// 发送
|
||||
try {
|
||||
int size = sendEmailRequest.getTos().size();
|
||||
Mail.create(account).setTos(sendEmailRequest.getTos().toArray(new String[size])).setTitle(sendEmailRequest.getSubject()).setContent(content)
|
||||
.setHtml(true)
|
||||
Mail.create(account).setTos(sendEmailRequest.getTos().toArray(new String[size]))
|
||||
.setTitle(sendEmailRequest.getSubject()).setContent(content).setHtml(true)
|
||||
// 关闭session
|
||||
.setUseGlobalSession(false).send();
|
||||
} catch (Exception e) {
|
||||
@@ -115,7 +107,6 @@ public class SystemEmailService {
|
||||
/**
|
||||
* 校验邮箱验证码
|
||||
*/
|
||||
|
||||
public void checkEmailCaptcha(SystemCaptchaBizEnum biEnum, String email, String code) {
|
||||
String redisKey = biEnum.getRedisKey() + email;
|
||||
String value = redisHelper.get(redisKey, String.class);
|
||||
@@ -129,7 +120,6 @@ public class SystemEmailService {
|
||||
/**
|
||||
* 发送给邮箱验证码
|
||||
*/
|
||||
|
||||
public void sendCaptcha(SystemCaptchaBizEnum biEnum, String email) {
|
||||
if (biEnum == null) {
|
||||
throw new BadRequestException("biEnum必填");
|
||||
@@ -146,9 +136,11 @@ public class SystemEmailService {
|
||||
// 存在就再次发送原来的验证码
|
||||
content = KitResourceTemplateUtil.render(null, biEnum.getTemplateName(), Dict.create().set("code", code));
|
||||
} else {
|
||||
content = KitResourceTemplateUtil.render(null, biEnum.getTemplateName(), Dict.create().set("code", oldCode));
|
||||
content =
|
||||
KitResourceTemplateUtil.render(null, biEnum.getTemplateName(), Dict.create().set("code", oldCode));
|
||||
}
|
||||
SystemSendEmailArgs sendEmailRequest = new SystemSendEmailArgs(Collections.singletonList(email), applicationTitle, content);
|
||||
SystemSendEmailArgs sendEmailRequest =
|
||||
new SystemSendEmailArgs(Collections.singletonList(email), applicationTitle, content);
|
||||
sendEmail(sendEmailRequest);
|
||||
}
|
||||
|
||||
|
||||
+9
-16
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
@@ -28,26 +27,26 @@ import cn.odboy.util.KitFileUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class SystemJobService {
|
||||
@Autowired
|
||||
private SystemJobMapper systemJobMapper;
|
||||
@Autowired
|
||||
private SystemUserMapper systemUserMapper;
|
||||
@Autowired private SystemJobMapper systemJobMapper;
|
||||
@Autowired private SystemUserMapper systemUserMapper;
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveJob(SystemCreateJobArgs args) {
|
||||
SystemJobTb job = systemJobMapper.getJobByName(args.getName());
|
||||
@@ -62,7 +61,6 @@ public class SystemJobService {
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void modifyJobById(SystemJobTb args) {
|
||||
SystemJobTb job = systemJobMapper.selectById(args.getId());
|
||||
@@ -79,7 +77,6 @@ public class SystemJobService {
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void removeJobByIds(Set<Long> ids) {
|
||||
systemJobMapper.deleteByIds(ids);
|
||||
@@ -92,7 +89,6 @@ public class SystemJobService {
|
||||
* @param response /
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
public void exportJobExcel(List<SystemJobTb> jobs, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (SystemJobTb job : jobs) {
|
||||
@@ -112,7 +108,6 @@ public class SystemJobService {
|
||||
* @param page 分页参数
|
||||
* @return
|
||||
*/
|
||||
|
||||
public KitPageResult<SystemJobTb> queryJobByArgs(SystemQueryJobArgs args, Page<SystemJobTb> page) {
|
||||
return KitPageUtil.toPage(systemJobMapper.selectJobByArgs(args, page));
|
||||
}
|
||||
@@ -123,9 +118,8 @@ public class SystemJobService {
|
||||
* @param args /
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public List<SystemJobTb> queryJobByArgs(SystemQueryJobArgs args) {
|
||||
return systemJobMapper.selectJobByArgs(args, KitPageUtil.getCount(systemJobMapper)).getRecords();
|
||||
return systemJobMapper.selectJobByArgs(args);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,7 +127,6 @@ public class SystemJobService {
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
|
||||
public void verifyBindRelationByIds(Set<Long> ids) {
|
||||
if (systemUserMapper.countUserByJobIds(ids) > 0) {
|
||||
throw new BadRequestException("所选的岗位中存在用户关联, 请解除关联再试!");
|
||||
|
||||
+17
-15
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
@@ -31,23 +30,23 @@ import cn.odboy.util.KitFileUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class SystemLocalStorageService {
|
||||
@Autowired
|
||||
private SystemLocalStorageMapper systemLocalStorageMapper;
|
||||
@Autowired
|
||||
private KitFileLocalUploadHelper fileUploadPathHelper;
|
||||
@Autowired
|
||||
private AppProperties properties;
|
||||
@Autowired private SystemLocalStorageMapper systemLocalStorageMapper;
|
||||
@Autowired private KitFileLocalUploadHelper fileUploadPathHelper;
|
||||
@Autowired private AppProperties properties;
|
||||
|
||||
/**
|
||||
* 上传
|
||||
@@ -69,7 +68,8 @@ public class SystemLocalStorageService {
|
||||
}
|
||||
try {
|
||||
String formatSize = KitFileUtil.getSize(size);
|
||||
String prefixName = StrUtil.isBlank(name) ? KitFileUtil.getPrefix(multipartFile.getOriginalFilename()) : name;
|
||||
String prefixName =
|
||||
StrUtil.isBlank(name) ? KitFileUtil.getPrefix(multipartFile.getOriginalFilename()) : name;
|
||||
SystemLocalStorageTb localStorage = new SystemLocalStorageTb();
|
||||
localStorage.setRealName(file.getName());
|
||||
localStorage.setName(prefixName);
|
||||
@@ -123,7 +123,8 @@ public class SystemLocalStorageService {
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
public void exportLocalStorageExcel(List<SystemLocalStorageTb> localStorages, HttpServletResponse response) throws IOException {
|
||||
public void exportLocalStorageExcel(List<SystemLocalStorageTb> localStorages, HttpServletResponse response)
|
||||
throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (SystemLocalStorageTb localStorage : localStorages) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
@@ -145,7 +146,8 @@ public class SystemLocalStorageService {
|
||||
* @param page 分页参数
|
||||
* @return /
|
||||
*/
|
||||
public KitPageResult<SystemLocalStorageTb> queryLocalStorage(SystemQueryStorageArgs criteria, Page<SystemLocalStorageTb> page) {
|
||||
public KitPageResult<SystemLocalStorageTb> queryLocalStorage(SystemQueryStorageArgs criteria,
|
||||
Page<SystemLocalStorageTb> page) {
|
||||
return KitPageUtil.toPage(systemLocalStorageMapper.selectLocalStorageByArgs(criteria, page));
|
||||
}
|
||||
|
||||
@@ -156,6 +158,6 @@ public class SystemLocalStorageService {
|
||||
* @return /
|
||||
*/
|
||||
public List<SystemLocalStorageTb> queryLocalStorage(SystemQueryStorageArgs criteria) {
|
||||
return systemLocalStorageMapper.selectLocalStorageByArgs(criteria, KitPageUtil.getCount(systemLocalStorageMapper)).getRecords();
|
||||
return systemLocalStorageMapper.selectLocalStorageByArgs(criteria);
|
||||
}
|
||||
}
|
||||
|
||||
+36
-40
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
@@ -35,25 +34,29 @@ import cn.odboy.util.KitClassUtil;
|
||||
import cn.odboy.util.KitFileUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class SystemMenuService {
|
||||
private static final String YES_STR = "是";
|
||||
private static final String NO_STR = "否";
|
||||
@Autowired
|
||||
private SystemMenuMapper systemMenuMapper;
|
||||
@Autowired
|
||||
private SystemRoleMenuMapper systemRoleMenuMapper;
|
||||
@Autowired
|
||||
private SystemRoleService systemRoleService;
|
||||
@Autowired private SystemMenuMapper systemMenuMapper;
|
||||
@Autowired private SystemRoleMenuMapper systemRoleMenuMapper;
|
||||
@Autowired private SystemRoleService systemRoleService;
|
||||
@Autowired private SystemRoleMenuService systemRoleMenuService;
|
||||
|
||||
/**
|
||||
* 创建
|
||||
@@ -74,8 +77,8 @@ public class SystemMenuService {
|
||||
args.setPid(null);
|
||||
}
|
||||
if (args.getIFrame()) {
|
||||
if (!(args.getPath().toLowerCase().startsWith(TransferProtocolConst.PREFIX_HTTP) || args.getPath().toLowerCase()
|
||||
.startsWith(TransferProtocolConst.PREFIX_HTTPS))) {
|
||||
if (!(args.getPath().toLowerCase().startsWith(TransferProtocolConst.PREFIX_HTTP) ||
|
||||
args.getPath().toLowerCase().startsWith(TransferProtocolConst.PREFIX_HTTPS))) {
|
||||
throw new BadRequestException(TransferProtocolConst.PREFIX_HTTPS_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
@@ -91,7 +94,6 @@ public class SystemMenuService {
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void modifyMenuById(SystemMenuTb args) {
|
||||
if (args.getId().equals(args.getPid())) {
|
||||
@@ -99,25 +101,21 @@ public class SystemMenuService {
|
||||
}
|
||||
SystemMenuTb menu = systemMenuMapper.selectById(args.getId());
|
||||
if (args.getIFrame()) {
|
||||
if (!(args.getPath().toLowerCase().startsWith(TransferProtocolConst.PREFIX_HTTP) || args.getPath().toLowerCase()
|
||||
.startsWith(TransferProtocolConst.PREFIX_HTTPS))) {
|
||||
if (!(args.getPath().toLowerCase().startsWith(TransferProtocolConst.PREFIX_HTTP) ||
|
||||
args.getPath().toLowerCase().startsWith(TransferProtocolConst.PREFIX_HTTPS))) {
|
||||
throw new BadRequestException(TransferProtocolConst.PREFIX_HTTPS_BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
SystemMenuTb menu1 = systemMenuMapper.getMenuByTitle(args.getTitle());
|
||||
|
||||
if (menu1 != null && !menu1.getId().equals(menu.getId())) {
|
||||
throw new BadRequestException("菜单标题已存在");
|
||||
}
|
||||
|
||||
if (args.getPid().equals(0L)) {
|
||||
args.setPid(null);
|
||||
}
|
||||
|
||||
// 记录的父节点ID
|
||||
Long oldPid = menu.getPid();
|
||||
Long newPid = args.getPid();
|
||||
|
||||
if (StrUtil.isNotBlank(args.getComponentName())) {
|
||||
menu1 = systemMenuMapper.getMenuByComponentName(args.getComponentName());
|
||||
if (menu1 != null && !menu1.getId().equals(menu.getId())) {
|
||||
@@ -156,7 +154,8 @@ public class SystemMenuService {
|
||||
menuSet.add(systemMenuMapper.selectById(id));
|
||||
menuSet = this.queryChildMenu(menuList, menuSet);
|
||||
}
|
||||
List<Long> menuIds = menuSet.stream().map(SystemMenuTb::getId).filter(Objects::nonNull).distinct().toList();
|
||||
List<Long> menuIds =
|
||||
menuSet.stream().map(SystemMenuTb::getId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(menuIds)) {
|
||||
KitSpringBeanHolder.getBean(SystemMenuService.class).removeRoleMenuByMenuIds(menuIds);
|
||||
systemMenuMapper.deleteByIds(menuIds);
|
||||
@@ -168,7 +167,11 @@ public class SystemMenuService {
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void removeRoleMenuByMenuIds(List<Long> menuIds) {
|
||||
systemRoleMenuMapper.delete(new LambdaQueryWrapper<SystemRoleMenuTb>().in(SystemRoleMenuTb::getMenuId, menuIds));
|
||||
if (CollUtil.isNotEmpty(menuIds)) {
|
||||
LambdaQueryWrapper<SystemRoleMenuTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(SystemRoleMenuTb::getMenuId, menuIds);
|
||||
systemRoleMenuMapper.delete(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,7 +181,6 @@ public class SystemMenuService {
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
|
||||
public void exportMenuExcel(List<SystemMenuTb> menus, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (SystemMenuTb menu : menus) {
|
||||
@@ -198,7 +200,7 @@ public class SystemMenuService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateMenuSubCnt(Long menuId) {
|
||||
if (menuId != null) {
|
||||
int count = systemMenuMapper.countMenuByPid(menuId);
|
||||
long count = systemMenuMapper.countMenuByPid(menuId);
|
||||
systemMenuMapper.updateMenuSubCntByMenuId(count, menuId);
|
||||
}
|
||||
}
|
||||
@@ -211,7 +213,6 @@ public class SystemMenuService {
|
||||
* @return /
|
||||
* @throws Exception /
|
||||
*/
|
||||
|
||||
public List<SystemMenuTb> queryAllMenu(SystemQueryMenuArgs criteria, Boolean isQuery) throws Exception {
|
||||
if (Boolean.TRUE.equals(isQuery)) {
|
||||
criteria.setPidIsNull(true);
|
||||
@@ -239,11 +240,10 @@ public class SystemMenuService {
|
||||
* @param currentUserId /
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public List<SystemMenuTb> queryMenuListByUserId(Long currentUserId) {
|
||||
List<SystemRoleTb> roles = systemRoleService.queryRoleByUsersId(currentUserId);
|
||||
Set<Long> roleIds = roles.stream().map(SystemRoleTb::getId).collect(Collectors.toSet());
|
||||
return new ArrayList<>(systemMenuMapper.selectMenuByRoleIdsAndType(roleIds, 2));
|
||||
return new ArrayList<>(systemRoleMenuService.queryMenuByRoleIdsAndType(roleIds, 2));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -253,11 +253,10 @@ public class SystemMenuService {
|
||||
* @param menuSet /
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public Set<SystemMenuTb> queryChildMenu(List<SystemMenuTb> menuList, Set<SystemMenuTb> menuSet) {
|
||||
for (SystemMenuTb menu : menuList) {
|
||||
menuSet.add(menu);
|
||||
List<SystemMenuTb> menus = systemMenuMapper.selectMenuByPidOrderByMenuSort(menu.getId());
|
||||
List<SystemMenuTb> menus = systemMenuMapper.selectMenuByPid(menu.getId());
|
||||
if (CollUtil.isNotEmpty(menus)) {
|
||||
queryChildMenu(menus, menuSet);
|
||||
}
|
||||
@@ -271,13 +270,12 @@ public class SystemMenuService {
|
||||
* @param pid /
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public List<SystemMenuTb> queryMenuByPid(Long pid) {
|
||||
List<SystemMenuTb> menus;
|
||||
if (pid != null && !pid.equals(0L)) {
|
||||
menus = systemMenuMapper.selectMenuByPidOrderByMenuSort(pid);
|
||||
menus = systemMenuMapper.selectMenuByPid(pid);
|
||||
} else {
|
||||
menus = systemMenuMapper.selectMenuByPidIsNullOrderByMenuSort();
|
||||
menus = systemMenuMapper.selectMenuByPidIsNull();
|
||||
}
|
||||
return menus;
|
||||
}
|
||||
@@ -289,13 +287,12 @@ public class SystemMenuService {
|
||||
* @param menus /
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public List<SystemMenuTb> querySuperiorMenuList(SystemMenuTb menu, List<SystemMenuTb> menus) {
|
||||
if (menu.getPid() == null) {
|
||||
menus.addAll(systemMenuMapper.selectMenuByPidIsNullOrderByMenuSort());
|
||||
menus.addAll(systemMenuMapper.selectMenuByPidIsNull());
|
||||
return menus;
|
||||
}
|
||||
menus.addAll(systemMenuMapper.selectMenuByPidOrderByMenuSort(menu.getPid()));
|
||||
menus.addAll(systemMenuMapper.selectMenuByPid(menu.getPid()));
|
||||
return querySuperiorMenuList(systemMenuMapper.selectById(menu.getPid()), menus);
|
||||
}
|
||||
|
||||
@@ -305,7 +302,6 @@ public class SystemMenuService {
|
||||
* @param menus 原始数据
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public List<SystemMenuTb> buildMenuTree(List<SystemMenuTb> menus) {
|
||||
List<SystemMenuTb> trees = new ArrayList<>();
|
||||
Set<Long> ids = new HashSet<>();
|
||||
@@ -324,7 +320,7 @@ public class SystemMenuService {
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(trees)) {
|
||||
trees = menus.stream().filter(s -> !ids.contains(s.getId())).toList();
|
||||
trees = menus.stream().filter(s -> !ids.contains(s.getId())).collect(Collectors.toList());
|
||||
}
|
||||
return trees;
|
||||
}
|
||||
@@ -335,14 +331,14 @@ public class SystemMenuService {
|
||||
* @param menus /
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public List<SystemMenuVo> buildMenuVo(List<SystemMenuTb> menus) {
|
||||
List<SystemMenuVo> list = new LinkedList<>();
|
||||
menus.forEach(menu -> {
|
||||
if (menu != null) {
|
||||
List<SystemMenuTb> menuList = menu.getChildren();
|
||||
SystemMenuVo menuVo = new SystemMenuVo();
|
||||
menuVo.setName(ObjectUtil.isNotEmpty(menu.getComponentName()) ? menu.getComponentName() : menu.getTitle());
|
||||
menuVo.setName(
|
||||
ObjectUtil.isNotEmpty(menu.getComponentName()) ? menu.getComponentName() : menu.getTitle());
|
||||
// 一级目录需要加斜杠, 不然会报警告
|
||||
menuVo.setPath(menu.getPid() == null ? "/" + menu.getPath() : menu.getPath());
|
||||
menuVo.setHidden(menu.getHidden());
|
||||
|
||||
+25
-14
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.date.BetweenFormatter.Level;
|
||||
@@ -21,6 +20,13 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.odboy.constant.SystemConst;
|
||||
import cn.odboy.util.KitFileUtil;
|
||||
import cn.odboy.util.KitIPUtil;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import oshi.SystemInfo;
|
||||
@@ -34,10 +40,6 @@ import oshi.software.os.OperatingSystem;
|
||||
import oshi.util.FormatUtil;
|
||||
import oshi.util.Util;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class SystemMonitorService {
|
||||
@@ -138,7 +140,8 @@ public class SystemMonitorService {
|
||||
memoryInfo.put("total", FormatUtil.formatBytes(memory.getTotal()));
|
||||
memoryInfo.put("available", FormatUtil.formatBytes(memory.getAvailable()));
|
||||
memoryInfo.put("used", FormatUtil.formatBytes(memory.getTotal() - memory.getAvailable()));
|
||||
memoryInfo.put("usageRate", df.format((memory.getTotal() - memory.getAvailable()) / (double)memory.getTotal() * 100));
|
||||
memoryInfo.put("usageRate",
|
||||
df.format((memory.getTotal() - memory.getAvailable()) / (double)memory.getTotal() * 100));
|
||||
return memoryInfo;
|
||||
}
|
||||
|
||||
@@ -167,14 +170,22 @@ public class SystemMonitorService {
|
||||
Util.sleep(25);
|
||||
ticks = processor.getSystemCpuLoadTicks();
|
||||
}
|
||||
long user = ticks[CentralProcessor.TickType.USER.getIndex()] - prevTicks[CentralProcessor.TickType.USER.getIndex()];
|
||||
long nice = ticks[CentralProcessor.TickType.NICE.getIndex()] - prevTicks[CentralProcessor.TickType.NICE.getIndex()];
|
||||
long sys = ticks[CentralProcessor.TickType.SYSTEM.getIndex()] - prevTicks[CentralProcessor.TickType.SYSTEM.getIndex()];
|
||||
long idle = ticks[CentralProcessor.TickType.IDLE.getIndex()] - prevTicks[CentralProcessor.TickType.IDLE.getIndex()];
|
||||
long ioWait = ticks[CentralProcessor.TickType.IOWAIT.getIndex()] - prevTicks[CentralProcessor.TickType.IOWAIT.getIndex()];
|
||||
long irq = ticks[CentralProcessor.TickType.IRQ.getIndex()] - prevTicks[CentralProcessor.TickType.IRQ.getIndex()];
|
||||
long softIrq = ticks[CentralProcessor.TickType.SOFTIRQ.getIndex()] - prevTicks[CentralProcessor.TickType.SOFTIRQ.getIndex()];
|
||||
long steal = ticks[CentralProcessor.TickType.STEAL.getIndex()] - prevTicks[CentralProcessor.TickType.STEAL.getIndex()];
|
||||
long user =
|
||||
ticks[CentralProcessor.TickType.USER.getIndex()] - prevTicks[CentralProcessor.TickType.USER.getIndex()];
|
||||
long nice =
|
||||
ticks[CentralProcessor.TickType.NICE.getIndex()] - prevTicks[CentralProcessor.TickType.NICE.getIndex()];
|
||||
long sys =
|
||||
ticks[CentralProcessor.TickType.SYSTEM.getIndex()] - prevTicks[CentralProcessor.TickType.SYSTEM.getIndex()];
|
||||
long idle =
|
||||
ticks[CentralProcessor.TickType.IDLE.getIndex()] - prevTicks[CentralProcessor.TickType.IDLE.getIndex()];
|
||||
long ioWait =
|
||||
ticks[CentralProcessor.TickType.IOWAIT.getIndex()] - prevTicks[CentralProcessor.TickType.IOWAIT.getIndex()];
|
||||
long irq =
|
||||
ticks[CentralProcessor.TickType.IRQ.getIndex()] - prevTicks[CentralProcessor.TickType.IRQ.getIndex()];
|
||||
long softIrq = ticks[CentralProcessor.TickType.SOFTIRQ.getIndex()] -
|
||||
prevTicks[CentralProcessor.TickType.SOFTIRQ.getIndex()];
|
||||
long steal =
|
||||
ticks[CentralProcessor.TickType.STEAL.getIndex()] - prevTicks[CentralProcessor.TickType.STEAL.getIndex()];
|
||||
long totalCpu = user + nice + sys + idle + ioWait + irq + softIrq + steal;
|
||||
cpuInfo.put("used", df.format(100d * user / totalCpu + 100d * sys / totalCpu));
|
||||
cpuInfo.put("idle", df.format(100d * idle / totalCpu));
|
||||
|
||||
+1
-9
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.odboy.base.KitPageResult;
|
||||
@@ -23,10 +22,9 @@ import cn.odboy.system.dal.model.SystemQueryStorageArgs;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -38,14 +36,8 @@ import java.util.List;
|
||||
*/
|
||||
public interface SystemOssStorageService extends IService<SystemOssStorageTb> {
|
||||
KitPageResult<SystemOssStorageVo> queryOssStorage(SystemQueryStorageArgs criteria, Page<SystemOssStorageTb> page);
|
||||
|
||||
List<SystemOssStorageVo> queryOssStorage(SystemQueryStorageArgs criteria);
|
||||
|
||||
void exportOssStorageExcel(List<SystemOssStorageVo> list, HttpServletResponse response) throws IOException;
|
||||
|
||||
String uploadFile(MultipartFile file);
|
||||
|
||||
void removeFileByIds(Long[] ids);
|
||||
|
||||
SystemOssStorageTb getByMd5(String md5);
|
||||
}
|
||||
|
||||
+65
-31
@@ -13,10 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
@@ -31,33 +31,33 @@ import cn.odboy.system.dal.mysql.SystemQuartzLogMapper;
|
||||
import cn.odboy.system.framework.quartz.QuartzManage;
|
||||
import cn.odboy.util.KitFileUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.quartz.CronExpression;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class SystemQuartzJobService {
|
||||
@Autowired
|
||||
private SystemQuartzJobMapper systemQuartzJobMapper;
|
||||
@Autowired
|
||||
private SystemQuartzLogMapper systemQuartzLogMapper;
|
||||
@Autowired
|
||||
private QuartzManage quartzManage;
|
||||
@Autowired
|
||||
private KitRedisHelper redisHelper;
|
||||
@Autowired private SystemQuartzJobMapper systemQuartzJobMapper;
|
||||
@Autowired private SystemQuartzLogMapper systemQuartzLogMapper;
|
||||
@Autowired private QuartzManage quartzManage;
|
||||
@Autowired private KitRedisHelper redisHelper;
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createJob(SystemQuartzJobTb args) {
|
||||
if (!CronExpression.isValidExpression(args.getCronExpression())) {
|
||||
@@ -72,7 +72,6 @@ public class SystemQuartzJobService {
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void modifyQuartzJobResumeCron(SystemUpdateQuartzJobArgs args) {
|
||||
if (!CronExpression.isValidExpression(args.getCronExpression())) {
|
||||
@@ -94,7 +93,6 @@ public class SystemQuartzJobService {
|
||||
*
|
||||
* @param quartzJob /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void switchQuartzJobStatus(SystemQuartzJobTb quartzJob) {
|
||||
// 置换暂停状态
|
||||
@@ -113,7 +111,6 @@ public class SystemQuartzJobService {
|
||||
*
|
||||
* @param quartzJob /
|
||||
*/
|
||||
|
||||
public void startQuartzJob(SystemQuartzJobTb quartzJob) {
|
||||
quartzManage.runJobNow(quartzJob);
|
||||
}
|
||||
@@ -123,7 +120,6 @@ public class SystemQuartzJobService {
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void removeJobByIds(Set<Long> ids) {
|
||||
for (Long id : ids) {
|
||||
@@ -139,7 +135,6 @@ public class SystemQuartzJobService {
|
||||
* @param tasks /
|
||||
* @throws InterruptedException /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void startSubQuartJob(String[] tasks) throws InterruptedException {
|
||||
for (String id : tasks) {
|
||||
@@ -178,8 +173,8 @@ public class SystemQuartzJobService {
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
|
||||
public void exportQuartzJobExcel(List<SystemQuartzJobTb> quartzJobs, HttpServletResponse response) throws IOException {
|
||||
public void exportQuartzJobExcel(List<SystemQuartzJobTb> quartzJobs, HttpServletResponse response)
|
||||
throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (SystemQuartzJobTb quartzJob : quartzJobs) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
@@ -203,8 +198,8 @@ public class SystemQuartzJobService {
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
|
||||
public void exportQuartzLogExcel(List<SystemQuartzLogTb> queryAllLog, HttpServletResponse response) throws IOException {
|
||||
public void exportQuartzLogExcel(List<SystemQuartzLogTb> queryAllLog, HttpServletResponse response)
|
||||
throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (SystemQuartzLogTb quartzLog : queryAllLog) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
@@ -229,9 +224,38 @@ public class SystemQuartzJobService {
|
||||
* @param page 分页参数
|
||||
* @return /
|
||||
*/
|
||||
public KitPageResult<SystemQuartzJobTb> queryQuartzJobByArgs(SystemQueryQuartzJobArgs criteria,
|
||||
Page<SystemQuartzJobTb> page) {
|
||||
LambdaQueryWrapper<SystemQuartzJobTb> wrapper = new LambdaQueryWrapper<>();
|
||||
this.injectQuartzJobQueryParams(criteria, wrapper);
|
||||
return KitPageUtil.toPage(systemQuartzJobMapper.selectPage(page, wrapper));
|
||||
}
|
||||
|
||||
public KitPageResult<SystemQuartzJobTb> queryQuartzJobByArgs(SystemQueryQuartzJobArgs criteria, Page<SystemQuartzJobTb> page) {
|
||||
return KitPageUtil.toPage(systemQuartzJobMapper.selectQuartzJobByArgs(criteria, page));
|
||||
private void injectQuartzJobQueryParams(SystemQueryQuartzJobArgs criteria,
|
||||
LambdaQueryWrapper<SystemQuartzJobTb> wrapper) {
|
||||
if (criteria != null) {
|
||||
wrapper.like(StrUtil.isNotBlank(criteria.getJobName()), SystemQuartzJobTb::getJobName,
|
||||
criteria.getJobName());
|
||||
if (CollUtil.isNotEmpty(criteria.getCreateTime()) && criteria.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemQuartzJobTb::getUpdateTime, criteria.getCreateTime().get(0),
|
||||
criteria.getCreateTime().get(1));
|
||||
}
|
||||
}
|
||||
wrapper.orderByDesc(SystemQuartzJobTb::getId);
|
||||
}
|
||||
|
||||
private void injectQuartzLogQueryParams(SystemQueryQuartzJobArgs criteria,
|
||||
LambdaQueryWrapper<SystemQuartzLogTb> wrapper) {
|
||||
if (criteria != null) {
|
||||
wrapper.like(StrUtil.isNotBlank(criteria.getJobName()), SystemQuartzLogTb::getJobName,
|
||||
criteria.getJobName());
|
||||
wrapper.eq(criteria.getIsSuccess() != null, SystemQuartzLogTb::getIsSuccess, criteria.getIsSuccess());
|
||||
if (CollUtil.isNotEmpty(criteria.getCreateTime()) && criteria.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemQuartzLogTb::getCreateTime, criteria.getCreateTime().get(0),
|
||||
criteria.getCreateTime().get(1));
|
||||
}
|
||||
}
|
||||
wrapper.orderByDesc(SystemQuartzLogTb::getId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -241,9 +265,11 @@ public class SystemQuartzJobService {
|
||||
* @param page 分页参数
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public KitPageResult<SystemQuartzLogTb> queryQuartzLogByArgs(SystemQueryQuartzJobArgs criteria, Page<SystemQuartzLogTb> page) {
|
||||
return KitPageUtil.toPage(systemQuartzLogMapper.selectQuartzLogByArgs(criteria, page));
|
||||
public KitPageResult<SystemQuartzLogTb> queryQuartzLogByArgs(SystemQueryQuartzJobArgs criteria,
|
||||
Page<SystemQuartzLogTb> page) {
|
||||
LambdaQueryWrapper<SystemQuartzLogTb> wrapper = new LambdaQueryWrapper<>();
|
||||
this.injectQuartzLogQueryParams(criteria, wrapper);
|
||||
return KitPageUtil.toPage(systemQuartzLogMapper.selectPage(page, wrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -252,9 +278,10 @@ public class SystemQuartzJobService {
|
||||
* @param criteria 条件
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public List<SystemQuartzJobTb> queryQuartzJobByArgs(SystemQueryQuartzJobArgs criteria) {
|
||||
return systemQuartzJobMapper.selectQuartzJobByArgs(criteria, KitPageUtil.getCount(systemQuartzJobMapper)).getRecords();
|
||||
LambdaQueryWrapper<SystemQuartzJobTb> wrapper = new LambdaQueryWrapper<>();
|
||||
this.injectQuartzJobQueryParams(criteria, wrapper);
|
||||
return systemQuartzJobMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -263,12 +290,19 @@ public class SystemQuartzJobService {
|
||||
* @param criteria 条件
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public List<SystemQuartzLogTb> queryQuartzLogByArgs(SystemQueryQuartzJobArgs criteria) {
|
||||
return systemQuartzLogMapper.selectQuartzLogByArgs(criteria, KitPageUtil.getCount(systemQuartzLogMapper)).getRecords();
|
||||
LambdaQueryWrapper<SystemQuartzLogTb> wrapper = new LambdaQueryWrapper<>();
|
||||
this.injectQuartzLogQueryParams(criteria, wrapper);
|
||||
return systemQuartzLogMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
public SystemQuartzJobTb getQuartzJobById(Long id) {
|
||||
return systemQuartzJobMapper.selectById(id);
|
||||
}
|
||||
|
||||
public List<SystemQuartzJobTb> queryEnableQuartzJob() {
|
||||
LambdaQueryWrapper<SystemQuartzJobTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemQuartzJobTb::getIsPause, 0);
|
||||
return systemQuartzJobMapper.selectList(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright 2021-2025 Odboy
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.system.dal.dataobject.SystemDeptTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleDeptTb;
|
||||
import cn.odboy.system.dal.mysql.SystemDeptMapper;
|
||||
import cn.odboy.system.dal.mysql.SystemRoleDeptMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class SystemRoleDeptService {
|
||||
@Autowired private SystemRoleDeptMapper systemRoleDeptMapper;
|
||||
@Autowired private SystemDeptMapper systemDeptMapper;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void batchDeleteRoleDept(Set<Long> roleIds) {
|
||||
if (CollUtil.isNotEmpty(roleIds)) {
|
||||
LambdaQueryWrapper<SystemRoleDeptTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(SystemRoleDeptTb::getRoleId, roleIds);
|
||||
systemRoleDeptMapper.delete(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void batchInsertRoleDept(Set<SystemDeptTb> depts, Long id) {
|
||||
if (CollUtil.isNotEmpty(depts)) {
|
||||
List<SystemRoleDeptTb> records = new ArrayList<>();
|
||||
for (SystemDeptTb dept : depts) {
|
||||
SystemRoleDeptTb record = new SystemRoleDeptTb();
|
||||
record.setRoleId(id);
|
||||
record.setDeptId(dept.getId());
|
||||
records.add(record);
|
||||
}
|
||||
systemRoleDeptMapper.insert(records);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色id查询
|
||||
*
|
||||
* @param roleId /
|
||||
* @return /
|
||||
*/
|
||||
public List<SystemDeptTb> selectDeptByRoleId(Long roleId) {
|
||||
LambdaQueryWrapper<SystemRoleDeptTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemRoleDeptTb::getRoleId, roleId);
|
||||
List<SystemRoleDeptTb> systemRoleDeptTbs = systemRoleDeptMapper.selectList(wrapper);
|
||||
if (systemRoleDeptTbs.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<Long> deptIds = systemRoleDeptTbs.stream().map(SystemRoleDeptTb::getDeptId).collect(Collectors.toList());
|
||||
return systemDeptMapper.selectByIds(deptIds);
|
||||
}
|
||||
}
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright 2021-2025 Odboy
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.system.dal.dataobject.SystemMenuTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleMenuTb;
|
||||
import cn.odboy.system.dal.mysql.SystemMenuMapper;
|
||||
import cn.odboy.system.dal.mysql.SystemRoleMenuMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class SystemRoleMenuService {
|
||||
@Autowired private SystemRoleMenuMapper systemRoleMenuMapper;
|
||||
@Autowired private SystemMenuMapper systemMenuMapper;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteRoleMenuByRoleId(Long roleId) {
|
||||
LambdaQueryWrapper<SystemRoleMenuTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemRoleMenuTb::getRoleId, roleId);
|
||||
systemRoleMenuMapper.delete(wrapper);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void batchInsertRoleMenu(Set<SystemMenuTb> menus, Long roleId) {
|
||||
if (CollUtil.isNotEmpty(menus)) {
|
||||
List<SystemRoleMenuTb> records = new ArrayList<>();
|
||||
for (SystemMenuTb menu : menus) {
|
||||
SystemRoleMenuTb record = new SystemRoleMenuTb();
|
||||
record.setMenuId(menu.getId());
|
||||
record.setRoleId(roleId);
|
||||
records.add(record);
|
||||
}
|
||||
systemRoleMenuMapper.insert(records);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void batchDeleteRoleMenu(Set<Long> roleIds) {
|
||||
if (CollUtil.isNotEmpty(roleIds)) {
|
||||
LambdaQueryWrapper<SystemRoleMenuTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(SystemRoleMenuTb::getRoleId, roleIds);
|
||||
systemRoleMenuMapper.delete(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
public LinkedHashSet<SystemMenuTb> queryMenuByRoleIdsAndType(Set<Long> roleIds, int menuType) {
|
||||
if (CollUtil.isEmpty(roleIds)) {
|
||||
return new LinkedHashSet<>();
|
||||
}
|
||||
LambdaQueryWrapper<SystemRoleMenuTb> roleMenuWrapper = new LambdaQueryWrapper<>();
|
||||
roleMenuWrapper.in(SystemRoleMenuTb::getRoleId, roleIds);
|
||||
List<Long> menuIds = systemRoleMenuMapper.selectList(roleMenuWrapper).stream().map(SystemRoleMenuTb::getMenuId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(menuIds)) {
|
||||
return new LinkedHashSet<>();
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<SystemMenuTb> menuWrapper = new LambdaQueryWrapper<>();
|
||||
menuWrapper.in(SystemMenuTb::getId, menuIds);
|
||||
// 排除"按钮"
|
||||
menuWrapper.ne(SystemMenuTb::getType, 2);
|
||||
menuWrapper.orderByAsc(SystemMenuTb::getMenuSort);
|
||||
return new LinkedHashSet<>(systemMenuMapper.selectList(menuWrapper));
|
||||
}
|
||||
}
|
||||
+41
-42
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
@@ -28,61 +27,65 @@ import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import cn.odboy.system.dal.model.SystemCreateRoleArgs;
|
||||
import cn.odboy.system.dal.model.SystemQueryRoleArgs;
|
||||
import cn.odboy.system.dal.model.SystemRoleCodeVo;
|
||||
import cn.odboy.system.dal.mysql.SystemRoleDeptMapper;
|
||||
import cn.odboy.system.dal.mysql.SystemRoleMapper;
|
||||
import cn.odboy.system.dal.mysql.SystemRoleMenuMapper;
|
||||
import cn.odboy.system.dal.mysql.SystemUserMapper;
|
||||
import cn.odboy.util.KitFileUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class SystemRoleService {
|
||||
@Autowired
|
||||
private SystemRoleMapper systemRoleMapper;
|
||||
@Autowired
|
||||
private SystemRoleDeptMapper systemRoleDeptMapper;
|
||||
@Autowired
|
||||
private SystemRoleMenuMapper systemRoleMenuMapper;
|
||||
@Autowired
|
||||
private SystemUserMapper systemUserMapper;
|
||||
@Autowired private SystemRoleMapper systemRoleMapper;
|
||||
@Autowired private SystemRoleMenuService systemRoleMenuService;
|
||||
@Autowired private SystemUserMapper systemUserMapper;
|
||||
@Autowired private SystemRoleDeptService systemRoleDeptService;
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveRole(SystemCreateRoleArgs args) {
|
||||
if (systemRoleMapper.getRoleByName(args.getName()) != null) {
|
||||
if (this.getRoleByName(args.getName()) != null) {
|
||||
throw new BadRequestException("角色名称已存在");
|
||||
}
|
||||
systemRoleMapper.insert(BeanUtil.copyProperties(args, SystemRoleTb.class));
|
||||
// 判断是否有部门数据, 若有, 则需创建关联
|
||||
if (CollectionUtil.isNotEmpty(args.getDepts())) {
|
||||
systemRoleDeptMapper.batchInsertRoleDept(args.getDepts(), args.getId());
|
||||
systemRoleDeptService.batchInsertRoleDept(args.getDepts(), args.getId());
|
||||
}
|
||||
}
|
||||
|
||||
private SystemRoleTb getRoleByName(String name) {
|
||||
LambdaQueryWrapper<SystemRoleTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(SystemRoleTb::getName, name);
|
||||
return systemRoleMapper.selectOne(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void modifyRoleById(SystemRoleTb args) {
|
||||
SystemRoleTb role = systemRoleMapper.selectById(args.getId());
|
||||
SystemRoleTb role1 = systemRoleMapper.getRoleByName(args.getName());
|
||||
SystemRoleTb role1 = this.getRoleByName(args.getName());
|
||||
if (role1 != null && !role1.getId().equals(role.getId())) {
|
||||
throw new BadRequestException("角色名称已存在");
|
||||
}
|
||||
@@ -94,10 +97,10 @@ public class SystemRoleService {
|
||||
// 更新
|
||||
systemRoleMapper.insertOrUpdate(role);
|
||||
// 删除关联部门数据
|
||||
systemRoleDeptMapper.batchDeleteRoleDept(Collections.singleton(args.getId()));
|
||||
systemRoleDeptService.batchDeleteRoleDept(Collections.singleton(args.getId()));
|
||||
// 判断是否有部门数据, 若有, 则需更新关联
|
||||
if (CollectionUtil.isNotEmpty(args.getDepts())) {
|
||||
systemRoleDeptMapper.batchInsertRoleDept(args.getDepts(), args.getId());
|
||||
systemRoleDeptService.batchInsertRoleDept(args.getDepts(), args.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,13 +109,12 @@ public class SystemRoleService {
|
||||
*
|
||||
* @param role /
|
||||
*/
|
||||
|
||||
public void modifyBindMenuById(SystemRoleTb role) {
|
||||
// 更新菜单
|
||||
systemRoleMenuMapper.deleteRoleMenuByRoleId(role.getId());
|
||||
systemRoleMenuService.deleteRoleMenuByRoleId(role.getId());
|
||||
// 判断是否为空
|
||||
if (CollUtil.isNotEmpty(role.getMenus())) {
|
||||
systemRoleMenuMapper.batchInsertRoleMenu(role.getMenus(), role.getId());
|
||||
systemRoleMenuService.batchInsertRoleMenu(role.getMenus(), role.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,13 +123,12 @@ public class SystemRoleService {
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void removeRoleByIds(Set<Long> ids) {
|
||||
systemRoleMapper.deleteByIds(ids);
|
||||
// 删除角色部门关联数据、角色菜单关联数据
|
||||
systemRoleDeptMapper.batchDeleteRoleDept(ids);
|
||||
systemRoleMenuMapper.batchDeleteRoleMenu(ids);
|
||||
systemRoleDeptService.batchDeleteRoleDept(ids);
|
||||
systemRoleMenuService.batchDeleteRoleMenu(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,7 +138,6 @@ public class SystemRoleService {
|
||||
* @param response /
|
||||
* @throws IOException
|
||||
*/
|
||||
|
||||
public void exportRoleExcel(List<SystemRoleTb> roles, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (SystemRoleTb role : roles) {
|
||||
@@ -156,9 +156,14 @@ public class SystemRoleService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
public List<SystemRoleTb> queryAllRole() {
|
||||
return systemRoleMapper.selectAllRole();
|
||||
return this.selectAllRole();
|
||||
}
|
||||
|
||||
private List<SystemRoleTb> selectAllRole() {
|
||||
LambdaQueryWrapper<SystemRoleTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.orderByAsc(SystemRoleTb::getLevel);
|
||||
return systemRoleMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,7 +172,6 @@ public class SystemRoleService {
|
||||
* @param criteria 条件
|
||||
* @return
|
||||
*/
|
||||
|
||||
public List<SystemRoleTb> queryRoleByArgs(SystemQueryRoleArgs criteria) {
|
||||
return systemRoleMapper.selectRoleByArgs(criteria);
|
||||
}
|
||||
@@ -179,7 +183,6 @@ public class SystemRoleService {
|
||||
* @param page 分页参数
|
||||
* @return
|
||||
*/
|
||||
|
||||
public KitPageResult<SystemRoleTb> queryRoleByArgs(SystemQueryRoleArgs criteria, Page<Object> page) {
|
||||
criteria.setOffset(page.offset());
|
||||
List<SystemRoleTb> roles = systemRoleMapper.selectRoleByArgs(criteria);
|
||||
@@ -193,7 +196,6 @@ public class SystemRoleService {
|
||||
* @param userId 用户ID
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public List<SystemRoleTb> queryRoleByUsersId(Long userId) {
|
||||
return systemRoleMapper.selectRoleByUserId(userId);
|
||||
}
|
||||
@@ -204,7 +206,6 @@ public class SystemRoleService {
|
||||
* @param roles /
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public Integer getDeptLevelByRoles(Set<SystemRoleTb> roles) {
|
||||
if (CollUtil.isEmpty(roles)) {
|
||||
return Integer.MAX_VALUE;
|
||||
@@ -213,7 +214,7 @@ public class SystemRoleService {
|
||||
for (SystemRoleTb role : roles) {
|
||||
roleSet.add(getRoleById(role.getId()));
|
||||
}
|
||||
return Collections.min(roleSet.stream().map(SystemRoleTb::getLevel).toList());
|
||||
return Collections.min(roleSet.stream().map(SystemRoleTb::getLevel).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -222,18 +223,17 @@ public class SystemRoleService {
|
||||
* @param user 用户信息
|
||||
* @return 权限信息
|
||||
*/
|
||||
|
||||
public List<SystemRoleCodeVo> buildUserRolePermissions(SystemUserTb user) {
|
||||
Set<String> permissions = new HashSet<>();
|
||||
// 如果是管理员直接返回
|
||||
if (user.getIsAdmin()) {
|
||||
permissions.add("admin");
|
||||
return permissions.stream().map(SystemRoleCodeVo::new).toList();
|
||||
return permissions.stream().map(SystemRoleCodeVo::new).collect(Collectors.toList());
|
||||
}
|
||||
List<SystemRoleTb> roles = systemRoleMapper.selectRoleByUserId(user.getId());
|
||||
permissions =
|
||||
roles.stream().flatMap(role -> role.getMenus().stream()).map(SystemMenuTb::getPermission).filter(StrUtil::isNotBlank).collect(Collectors.toSet());
|
||||
return permissions.stream().map(SystemRoleCodeVo::new).toList();
|
||||
permissions = roles.stream().flatMap(role -> role.getMenus().stream()).map(SystemMenuTb::getPermission)
|
||||
.filter(StrUtil::isNotBlank).collect(Collectors.toSet());
|
||||
return permissions.stream().map(SystemRoleCodeVo::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -241,7 +241,6 @@ public class SystemRoleService {
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
|
||||
public void verifyBindRelationByIds(Set<Long> ids) {
|
||||
if (systemUserMapper.countUserByRoleIds(ids) > 0) {
|
||||
throw new BadRequestException("所选角色存在用户关联, 请解除关联再试!");
|
||||
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright 2021-2025 Odboy
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserJobTb;
|
||||
import cn.odboy.system.dal.mysql.SystemUserJobMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class SystemUserJobService {
|
||||
@Autowired private SystemUserJobMapper systemUserJobMapper;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void batchInsertUserJob(Set<SystemJobTb> jobs, Long userId) {
|
||||
if (CollUtil.isNotEmpty(jobs)) {
|
||||
List<SystemUserJobTb> records = new ArrayList<>();
|
||||
for (SystemJobTb job : jobs) {
|
||||
SystemUserJobTb record = new SystemUserJobTb();
|
||||
record.setUserId(userId);
|
||||
record.setJobId(job.getId());
|
||||
records.add(record);
|
||||
}
|
||||
systemUserJobMapper.insert(records);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void batchDeleteUserJob(Set<Long> userIds) {
|
||||
if (CollUtil.isNotEmpty(userIds)) {
|
||||
LambdaQueryWrapper<SystemUserJobTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(SystemUserJobTb::getUserId, userIds);
|
||||
systemUserJobMapper.delete(wrapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright 2021-2025 Odboy
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserRoleTb;
|
||||
import cn.odboy.system.dal.mysql.SystemUserRoleMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class SystemUserRoleService {
|
||||
@Autowired private SystemUserRoleMapper systemUserRoleMapper;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void batchInsertUserRole(Set<SystemRoleTb> roles, Long userId) {
|
||||
if (CollUtil.isNotEmpty(roles)) {
|
||||
List<SystemUserRoleTb> records = new ArrayList<>();
|
||||
for (SystemRoleTb role : roles) {
|
||||
SystemUserRoleTb record = new SystemUserRoleTb();
|
||||
record.setUserId(userId);
|
||||
record.setRoleId(role.getId());
|
||||
records.add(record);
|
||||
}
|
||||
systemUserRoleMapper.insert(records);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void batchDeleteUserRole(Set<Long> userIds) {
|
||||
if (CollUtil.isNotEmpty(userIds)) {
|
||||
LambdaQueryWrapper<SystemUserRoleTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(SystemUserRoleTb::getUserId, userIds);
|
||||
systemUserRoleMapper.delete(wrapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
+51
-55
@@ -13,20 +13,19 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.service;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.base.KitPageArgs;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.base.KitSelectOptionVo;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.framework.server.core.KitFileLocalUploadHelper;
|
||||
import cn.odboy.system.dal.dataobject.SystemJobTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemRoleTb;
|
||||
import cn.odboy.system.dal.dataobject.SystemUserTb;
|
||||
import cn.odboy.system.dal.model.SystemQueryUserArgs;
|
||||
import cn.odboy.system.dal.mysql.SystemUserJobMapper;
|
||||
import cn.odboy.system.dal.mysql.SystemUserMapper;
|
||||
import cn.odboy.system.dal.mysql.SystemUserRoleMapper;
|
||||
import cn.odboy.system.dal.redis.SystemUserInfoDAO;
|
||||
import cn.odboy.system.dal.redis.SystemUserOnlineInfoDAO;
|
||||
import cn.odboy.system.framework.permission.core.KitSecurityHelper;
|
||||
@@ -36,36 +35,36 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class SystemUserService {
|
||||
@Autowired
|
||||
private SystemUserMapper systemUserMapper;
|
||||
@Autowired
|
||||
private SystemUserJobMapper systemUserJobMapper;
|
||||
@Autowired
|
||||
private SystemUserRoleMapper systemUserRoleMapper;
|
||||
@Autowired
|
||||
private SystemUserInfoDAO systemUserInfoDAO;
|
||||
@Autowired
|
||||
private SystemUserOnlineInfoDAO systemUserOnlineInfoDAO;
|
||||
@Autowired
|
||||
private KitFileLocalUploadHelper fileUploadPathHelper;
|
||||
@Autowired private SystemUserMapper systemUserMapper;
|
||||
@Autowired private SystemUserJobService systemUserJobService;
|
||||
@Autowired private SystemUserRoleService systemUserRoleService;
|
||||
@Autowired private SystemUserInfoDAO systemUserInfoDAO;
|
||||
@Autowired private SystemUserOnlineInfoDAO systemUserOnlineInfoDAO;
|
||||
@Autowired private KitFileLocalUploadHelper fileUploadPathHelper;
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveUser(SystemUserTb args) {
|
||||
args.setDeptId(args.getDept().getId());
|
||||
@@ -80,9 +79,9 @@ public class SystemUserService {
|
||||
}
|
||||
systemUserMapper.insert(args);
|
||||
// 保存用户岗位
|
||||
systemUserJobMapper.batchInsertUserJob(args.getJobs(), args.getId());
|
||||
systemUserJobService.batchInsertUserJob(args.getJobs(), args.getId());
|
||||
// 保存用户角色
|
||||
systemUserRoleMapper.batchInsertUserRole(args.getRoles(), args.getId());
|
||||
systemUserRoleService.batchInsertUserRole(args.getRoles(), args.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,7 +90,6 @@ public class SystemUserService {
|
||||
* @param args /
|
||||
* @throws Exception /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void modifyUserById(SystemUserTb args) {
|
||||
SystemUserTb user = systemUserMapper.selectById(args.getId());
|
||||
@@ -125,11 +123,11 @@ public class SystemUserService {
|
||||
// 清除用户登录缓存
|
||||
systemUserInfoDAO.deleteUserLoginInfoByUserName(user.getUsername());
|
||||
// 更新用户岗位
|
||||
systemUserJobMapper.batchDeleteUserJob(Collections.singleton(args.getId()));
|
||||
systemUserJobMapper.batchInsertUserJob(args.getJobs(), args.getId());
|
||||
systemUserJobService.batchDeleteUserJob(Collections.singleton(args.getId()));
|
||||
systemUserJobService.batchInsertUserJob(args.getJobs(), args.getId());
|
||||
// 更新用户角色
|
||||
systemUserRoleMapper.batchDeleteUserRole(Collections.singleton(args.getId()));
|
||||
systemUserRoleMapper.batchInsertUserRole(args.getRoles(), args.getId());
|
||||
systemUserRoleService.batchDeleteUserRole(Collections.singleton(args.getId()));
|
||||
systemUserRoleService.batchInsertUserRole(args.getRoles(), args.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,7 +135,6 @@ public class SystemUserService {
|
||||
*
|
||||
* @param args /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void modifyUserCenterInfoById(SystemUserTb args) {
|
||||
SystemUserTb user = systemUserMapper.selectById(args.getId());
|
||||
@@ -157,7 +154,6 @@ public class SystemUserService {
|
||||
*
|
||||
* @param ids /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void removeUserByIds(Set<Long> ids) {
|
||||
for (Long id : ids) {
|
||||
@@ -167,9 +163,9 @@ public class SystemUserService {
|
||||
}
|
||||
systemUserMapper.deleteByIds(ids);
|
||||
// 删除用户岗位
|
||||
systemUserJobMapper.batchDeleteUserJob(ids);
|
||||
systemUserJobService.batchDeleteUserJob(ids);
|
||||
// 删除用户角色
|
||||
systemUserRoleMapper.batchDeleteUserRole(ids);
|
||||
systemUserRoleService.batchDeleteUserRole(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,7 +174,6 @@ public class SystemUserService {
|
||||
* @param username 用户名
|
||||
* @param encryptPassword 密码
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void modifyUserPasswordByUsername(String username, String encryptPassword) {
|
||||
systemUserMapper.updateUserPasswordByUsername(username, encryptPassword);
|
||||
@@ -191,7 +186,6 @@ public class SystemUserService {
|
||||
* @param ids 用户id
|
||||
* @param password 密码
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void resetUserPasswordByIds(Set<Long> ids, String password) {
|
||||
List<SystemUserTb> users = systemUserMapper.selectByIds(ids);
|
||||
@@ -203,7 +197,7 @@ public class SystemUserService {
|
||||
systemUserOnlineInfoDAO.kickOutByUsername(user.getUsername());
|
||||
});
|
||||
// 重置密码
|
||||
systemUserMapper.batchUpdatePassword(password, ids);
|
||||
systemUserMapper.updateUserPasswordByUserIds(password, ids);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -212,7 +206,6 @@ public class SystemUserService {
|
||||
* @param multipartFile 文件
|
||||
* @return /
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Map<String, String> modifyUserAvatar(MultipartFile multipartFile) {
|
||||
SystemUserTb user = systemUserMapper.getUserByUsername(KitSecurityHelper.getCurrentUsername());
|
||||
@@ -248,7 +241,6 @@ public class SystemUserService {
|
||||
* @param username 用户名
|
||||
* @param email 邮箱
|
||||
*/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void modifyUserEmailByUsername(String username, String email) {
|
||||
systemUserMapper.updateUserEmailByUsername(username, email);
|
||||
@@ -262,16 +254,15 @@ public class SystemUserService {
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
|
||||
public void exportUserExcel(List<SystemUserTb> users, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (SystemUserTb user : users) {
|
||||
List<String> roles = user.getRoles().stream().map(SystemRoleTb::getName).toList();
|
||||
List<String> roles = user.getRoles().stream().map(SystemRoleTb::getName).collect(Collectors.toList());
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("用户名", user.getUsername());
|
||||
map.put("角色", roles);
|
||||
map.put("部门", user.getDept().getName());
|
||||
map.put("岗位", user.getJobs().stream().map(SystemJobTb::getName).toList());
|
||||
map.put("岗位", user.getJobs().stream().map(SystemJobTb::getName).collect(Collectors.toList()));
|
||||
map.put("邮箱", user.getEmail());
|
||||
map.put("状态", user.getEnabled() ? "启用" : "禁用");
|
||||
map.put("手机号码", user.getPhone());
|
||||
@@ -289,7 +280,6 @@ public class SystemUserService {
|
||||
* @param page 分页参数
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public KitPageResult<SystemUserTb> queryUserByArgs(SystemQueryUserArgs criteria, Page<SystemUserTb> page) {
|
||||
IPage<SystemUserTb> users = systemUserMapper.selectUserByArgs(criteria, page);
|
||||
return KitPageUtil.toPage(users);
|
||||
@@ -301,7 +291,6 @@ public class SystemUserService {
|
||||
* @param criteria 条件
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public List<SystemUserTb> queryUserByArgs(SystemQueryUserArgs criteria) {
|
||||
return systemUserMapper.selectUserByArgs(criteria);
|
||||
}
|
||||
@@ -312,7 +301,6 @@ public class SystemUserService {
|
||||
* @param id ID
|
||||
* @return /
|
||||
*/
|
||||
|
||||
public SystemUserTb getUserById(long id) {
|
||||
return systemUserMapper.selectById(id);
|
||||
}
|
||||
@@ -327,18 +315,26 @@ public class SystemUserService {
|
||||
return systemUserMapper.getUserByUsername(username);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页模糊查询
|
||||
*
|
||||
* @param wrapper
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
public IPage<SystemUserTb> queryUserByBlurry(LambdaQueryWrapper<SystemUserTb> wrapper, Page<SystemUserTb> page) {
|
||||
return systemUserMapper.selectPage(page, wrapper);
|
||||
}
|
||||
|
||||
public List<SystemUserTb> queryUserByUserIds(List<Long> userIds) {
|
||||
return systemUserMapper.selectByIds(userIds);
|
||||
public List<KitSelectOptionVo> queryUserMetadataOptions(KitPageArgs<SystemQueryUserArgs> args) {
|
||||
SystemQueryUserArgs criteria = args.getArgs();
|
||||
LambdaQueryWrapper<SystemUserTb> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.select(SystemUserTb::getId, SystemUserTb::getDeptId, SystemUserTb::getEmail, SystemUserTb::getPhone);
|
||||
wrapper.and(c -> {
|
||||
c.eq(SystemUserTb::getPhone, criteria.getBlurry());
|
||||
c.or();
|
||||
c.eq(SystemUserTb::getEmail, criteria.getBlurry());
|
||||
c.or();
|
||||
c.like(SystemUserTb::getUsername, criteria.getBlurry());
|
||||
c.or();
|
||||
c.like(SystemUserTb::getNickName, criteria.getBlurry());
|
||||
});
|
||||
return systemUserMapper.selectPage(new Page<>(criteria.getPage(), 50), wrapper).getRecords().stream().map(m -> {
|
||||
Map<String, Object> ext = new HashMap<>(1);
|
||||
ext.put("id", m.getId());
|
||||
ext.put("deptId", m.getDeptId());
|
||||
ext.put("email", m.getEmail());
|
||||
ext.put("phone", m.getPhone());
|
||||
return KitSelectOptionVo.builder().label(m.getNickName()).value(String.valueOf(m.getId())).ext(ext).build();
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
+37
-19
@@ -13,10 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cn.odboy.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
@@ -32,21 +32,21 @@ import cn.odboy.system.service.SystemOssStorageService;
|
||||
import cn.odboy.util.KitDateUtil;
|
||||
import cn.odboy.util.KitFileUtil;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -57,17 +57,17 @@ import java.util.Map;
|
||||
* @since 2025-07-15
|
||||
*/
|
||||
@Service
|
||||
public class SystemOssStorageServiceImpl extends ServiceImpl<SystemOssStorageMapper, SystemOssStorageTb> implements SystemOssStorageService {
|
||||
@Autowired
|
||||
private MinioRepository minioRepository;
|
||||
@Autowired
|
||||
private AppProperties properties;
|
||||
@Autowired
|
||||
private KitFileLocalUploadHelper fileLocalUploadHelper;
|
||||
public class SystemOssStorageServiceImpl extends ServiceImpl<SystemOssStorageMapper, SystemOssStorageTb>
|
||||
implements SystemOssStorageService {
|
||||
@Autowired private MinioRepository minioRepository;
|
||||
@Autowired private AppProperties properties;
|
||||
@Autowired private KitFileLocalUploadHelper fileLocalUploadHelper;
|
||||
@Autowired private SystemOssStorageMapper systemOssStorageMapper;
|
||||
|
||||
@Override
|
||||
public KitPageResult<SystemOssStorageVo> queryOssStorage(SystemQueryStorageArgs criteria, Page<SystemOssStorageTb> page) {
|
||||
IPage<SystemOssStorageTb> ossStorageTbs = baseMapper.selectOssStorageByArgs(criteria, page);
|
||||
public KitPageResult<SystemOssStorageVo> queryOssStorage(SystemQueryStorageArgs criteria,
|
||||
Page<SystemOssStorageTb> page) {
|
||||
IPage<SystemOssStorageTb> ossStorageTbs = this.selectOssStorageByArgs(criteria, page);
|
||||
IPage<SystemOssStorageVo> convert = ossStorageTbs.convert(c -> {
|
||||
SystemOssStorageVo storageVo = BeanUtil.copyProperties(c, SystemOssStorageVo.class);
|
||||
storageVo.setFileSizeDesc(KitFileUtil.getSize(storageVo.getFileSize()));
|
||||
@@ -76,6 +76,24 @@ public class SystemOssStorageServiceImpl extends ServiceImpl<SystemOssStorageMap
|
||||
return KitPageUtil.toPage(convert);
|
||||
}
|
||||
|
||||
private IPage<SystemOssStorageTb> selectOssStorageByArgs(SystemQueryStorageArgs criteria,
|
||||
Page<SystemOssStorageTb> page) {
|
||||
LambdaQueryWrapper<SystemOssStorageTb> wrapper = new LambdaQueryWrapper<>();
|
||||
if (criteria != null) {
|
||||
wrapper.and(StrUtil.isNotBlank(criteria.getBlurry()),
|
||||
c -> c.like(SystemOssStorageTb::getFileName, criteria.getBlurry()).or()
|
||||
.like(SystemOssStorageTb::getFilePrefix, criteria.getBlurry()).or()
|
||||
.like(SystemOssStorageTb::getFileMime, criteria.getBlurry()).or()
|
||||
.like(SystemOssStorageTb::getFileMd5, criteria.getBlurry()));
|
||||
if (CollUtil.isNotEmpty(criteria.getCreateTime()) && criteria.getCreateTime().size() >= 2) {
|
||||
wrapper.between(SystemOssStorageTb::getUpdateTime, criteria.getCreateTime().get(0),
|
||||
criteria.getCreateTime().get(1));
|
||||
}
|
||||
}
|
||||
wrapper.orderByAsc(SystemOssStorageTb::getId);
|
||||
return systemOssStorageMapper.selectPage(page, wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SystemOssStorageVo> queryOssStorage(SystemQueryStorageArgs criteria) {
|
||||
// 防止刷数据
|
||||
@@ -84,7 +102,8 @@ public class SystemOssStorageServiceImpl extends ServiceImpl<SystemOssStorageMap
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportOssStorageExcel(List<SystemOssStorageVo> ossStorages, HttpServletResponse response) throws IOException {
|
||||
public void exportOssStorageExcel(List<SystemOssStorageVo> ossStorages, HttpServletResponse response)
|
||||
throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (SystemOssStorageVo ossStorage : ossStorages) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
@@ -121,7 +140,7 @@ public class SystemOssStorageServiceImpl extends ServiceImpl<SystemOssStorageMap
|
||||
}
|
||||
// 校验文件md5, 看是否已存在云端(不确定, 可能云端已经删除, 但是正常来说云端是不允许私自删除的, 所以这里忽略云端不存在的情况)
|
||||
String md5 = KitFileUtil.getMd5(tempFile);
|
||||
SystemOssStorageTb systemOssStorageTb = getByMd5(md5);
|
||||
SystemOssStorageTb systemOssStorageTb = this.getByMd5(md5);
|
||||
if (systemOssStorageTb != null) {
|
||||
// 重新生成7天链接
|
||||
return minioRepository.generatePreviewUrl(systemOssStorageTb.getObjectName());
|
||||
@@ -150,8 +169,7 @@ public class SystemOssStorageServiceImpl extends ServiceImpl<SystemOssStorageMap
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemOssStorageTb getByMd5(String md5) {
|
||||
private SystemOssStorageTb getByMd5(String md5) {
|
||||
return lambdaQuery().eq(SystemOssStorageTb::getFileMd5, md5).one();
|
||||
}
|
||||
}
|
||||
|
||||
-109
@@ -1,109 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="cn.odboy.system.dal.mysql.SystemDeptMapper">
|
||||
<resultMap id="BaseResultMap" type="cn.odboy.system.dal.dataobject.SystemDeptTb">
|
||||
<id column="dept_id" property="id"/>
|
||||
<result column="dept_sort" property="deptSort"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="enabled" property="enabled"/>
|
||||
<result column="pid" property="pid"/>
|
||||
<result column="sub_count" property="subCount"/>
|
||||
<result column="create_by" property="createBy"/>
|
||||
<result column="update_by" property="updateBy"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
</resultMap>
|
||||
<select id="selectDeptByArgs" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
dept_id,
|
||||
`name`,
|
||||
pid,
|
||||
sub_count,
|
||||
create_time,
|
||||
update_time,
|
||||
create_by,
|
||||
update_by,
|
||||
enabled,
|
||||
dept_sort
|
||||
FROM
|
||||
system_dept
|
||||
<where>
|
||||
<if test="criteria.ids != null and criteria.ids.size() > 0">
|
||||
AND dept_id in
|
||||
<foreach collection="criteria.ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="criteria.name != null and criteria.name != ''">
|
||||
AND `name` LIKE concat('%', #{criteria.name}, '%')
|
||||
</if>
|
||||
<if test="criteria.enabled != null">
|
||||
AND enabled = #{criteria.enabled}
|
||||
</if>
|
||||
<if test="criteria.pid != null">
|
||||
AND pid = #{criteria.pid}
|
||||
</if>
|
||||
<if test="criteria.pidIsNull != null">
|
||||
AND pid IS NULL
|
||||
</if>
|
||||
<if test="criteria.createTime != null and criteria.createTime.size() != 0">
|
||||
AND create_time BETWEEN #{criteria.createTime[0]} AND #{criteria.createTime[1]}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY dept_sort
|
||||
</select>
|
||||
<select id="selectDeptByPid" resultMap="BaseResultMap">
|
||||
select dept_id,
|
||||
name,
|
||||
pid,
|
||||
sub_count,
|
||||
create_time,
|
||||
update_time,
|
||||
create_by,
|
||||
update_by,
|
||||
enabled,
|
||||
dept_sort
|
||||
from system_dept
|
||||
where pid = #{pid}
|
||||
</select>
|
||||
<select id="countDeptByPid" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
from system_dept
|
||||
where pid = #{pid}
|
||||
</select>
|
||||
<select id="selectDeptByPidIsNull" resultMap="BaseResultMap">
|
||||
select dept_id,
|
||||
name,
|
||||
pid,
|
||||
sub_count,
|
||||
create_time,
|
||||
update_time,
|
||||
create_by,
|
||||
update_by,
|
||||
enabled,
|
||||
dept_sort
|
||||
from system_dept
|
||||
where pid is null
|
||||
</select>
|
||||
<select id="selectDeptByRoleId" resultType="cn.odboy.system.dal.dataobject.SystemDeptTb">
|
||||
SELECT d.dept_id AS id,
|
||||
d.NAME,
|
||||
d.pid,
|
||||
d.sub_count,
|
||||
d.create_time,
|
||||
d.update_time,
|
||||
d.create_by,
|
||||
d.update_by,
|
||||
d.enabled,
|
||||
d.dept_sort
|
||||
FROM system_dept d,
|
||||
system_roles_depts rd
|
||||
WHERE d.dept_id = rd.dept_id
|
||||
AND rd.role_id = #{roleId}
|
||||
</select>
|
||||
<update id="updateDeptSubCountById">
|
||||
update system_dept
|
||||
set sub_count = #{count}
|
||||
where dept_id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
-7
@@ -30,11 +30,4 @@
|
||||
</if>
|
||||
order by dd.dict_sort
|
||||
</select>
|
||||
<delete id="deleteDictDetailByDictIds">
|
||||
delete from system_dict_detail
|
||||
where dict_id in
|
||||
<foreach collection="dictIds" item="item" index="index" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="cn.odboy.system.dal.mysql.SystemDictMapper">
|
||||
<select id="selectDictByArgs" resultType="cn.odboy.system.dal.dataobject.SystemDictTb">
|
||||
SELECT
|
||||
*
|
||||
from system_dict d
|
||||
<where>
|
||||
<if test="criteria.blurry != null and criteria.blurry != ''">
|
||||
and (
|
||||
d.name like concat('%', #{criteria.blurry}, '%')
|
||||
or d.description like concat('%', #{criteria.blurry}, '%')
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
order by d.id desc
|
||||
</select>
|
||||
</mapper>
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="cn.odboy.system.dal.mysql.SystemJobMapper">
|
||||
<select id="getJobByName" resultType="cn.odboy.system.dal.dataobject.SystemJobTb">
|
||||
select id
|
||||
from system_job
|
||||
where name = #{name}
|
||||
</select>
|
||||
<select id="selectJobByArgs" resultType="cn.odboy.system.dal.dataobject.SystemJobTb">
|
||||
select
|
||||
*
|
||||
from system_job
|
||||
<where>
|
||||
<if test="criteria.name != null and criteria.name != ''">
|
||||
and name like concat('%', #{criteria.name}, '%')
|
||||
</if>
|
||||
<if test="criteria.enabled != null">
|
||||
and enabled = #{criteria.enabled}
|
||||
</if>
|
||||
<if test="criteria.createTime != null and criteria.createTime.size() != 0">
|
||||
and create_time between #{criteria.createTime[0]} and #{criteria.createTime[1]}
|
||||
</if>
|
||||
</where>
|
||||
order by job_sort, id desc
|
||||
</select>
|
||||
</mapper>
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="cn.odboy.system.dal.mysql.SystemLocalStorageMapper">
|
||||
<select id="selectLocalStorageByArgs" resultType="cn.odboy.system.dal.dataobject.SystemLocalStorageTb">
|
||||
select
|
||||
*
|
||||
from system_local_storage
|
||||
<where>
|
||||
<if test="criteria.blurry != null and criteria.blurry != ''">
|
||||
AND (
|
||||
name LIKE CONCAT('%',#{criteria.blurry},'%')
|
||||
OR suffix LIKE CONCAT('%',#{criteria.blurry},'%')
|
||||
OR type LIKE CONCAT('%',#{criteria.blurry},'%')
|
||||
OR create_by LIKE CONCAT('%',#{criteria.blurry},'%')
|
||||
)
|
||||
</if>
|
||||
<if test="criteria.createTime != null and criteria.createTime.size() > 0">
|
||||
AND update_time BETWEEN #{criteria.createTime[0]} AND #{criteria.createTime[1]}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
</mapper>
|
||||
-124
@@ -1,124 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="cn.odboy.system.dal.mysql.SystemMenuMapper">
|
||||
<resultMap id="BaseResultMap" type="cn.odboy.system.dal.dataobject.SystemMenuTb">
|
||||
<id column="menu_id" property="id"/>
|
||||
<result column="title" property="title"/>
|
||||
<result column="name" property="componentName"/>
|
||||
<result column="menu_sort" property="menuSort"/>
|
||||
<result column="component" property="component"/>
|
||||
<result column="path" property="path"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="permission" property="permission"/>
|
||||
<result column="icon" property="icon"/>
|
||||
<result column="cache" property="cache"/>
|
||||
<result column="hidden" property="hidden"/>
|
||||
<result column="pid" property="pid"/>
|
||||
<result column="sub_count" property="subCount"/>
|
||||
<result column="i_frame" property="iFrame"/>
|
||||
<result column="create_by" property="createBy"/>
|
||||
<result column="update_by" property="updateBy"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
</resultMap>
|
||||
<select id="selectMenuByArgs" resultMap="BaseResultMap">
|
||||
select
|
||||
menu_id, title, name, menu_sort, component, path, type, permission, icon, cache, hidden, pid, sub_count,
|
||||
i_frame, create_by, update_by, create_time, update_time
|
||||
from system_menu
|
||||
<where>
|
||||
<if test="criteria.blurry != null and criteria.blurry != ''">
|
||||
and (
|
||||
title like concat('%',#{criteria.blurry},'%')
|
||||
or name like concat('%',#{criteria.blurry},'%')
|
||||
or permission like concat('%',#{criteria.blurry},'%')
|
||||
)
|
||||
</if>
|
||||
<if test="criteria.pidIsNull != null">
|
||||
and pid is null
|
||||
</if>
|
||||
<if test="criteria.pid != null">
|
||||
and pid = #{criteria.pid}
|
||||
</if>
|
||||
<if test="criteria.createTime != null and criteria.createTime.size() != 0">
|
||||
and create_time between #{criteria.createTime[0]} and #{criteria.createTime[1]}
|
||||
</if>
|
||||
</where>
|
||||
order by menu_sort
|
||||
</select>
|
||||
<select id="selectMenuByRoleIdsAndType" resultMap="BaseResultMap">
|
||||
SELECT m.* FROM system_menu m, system_roles_menus r
|
||||
WHERE m.menu_id = r.menu_id AND r.role_id IN
|
||||
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
AND type != #{type}
|
||||
order by m.menu_sort
|
||||
</select>
|
||||
<select id="selectMenuByPidIsNullOrderByMenuSort" resultMap="BaseResultMap">
|
||||
SELECT menu_id,
|
||||
title,
|
||||
name,
|
||||
menu_sort,
|
||||
component,
|
||||
path,
|
||||
type,
|
||||
permission,
|
||||
icon,
|
||||
cache,
|
||||
hidden,
|
||||
pid,
|
||||
sub_count,
|
||||
i_frame,
|
||||
create_by,
|
||||
update_by,
|
||||
create_time,
|
||||
update_time
|
||||
from system_menu
|
||||
where pid is null
|
||||
order by menu_sort
|
||||
</select>
|
||||
<select id="selectMenuByPidOrderByMenuSort" resultMap="BaseResultMap">
|
||||
SELECT menu_id,
|
||||
title,
|
||||
name,
|
||||
menu_sort,
|
||||
component,
|
||||
path,
|
||||
type,
|
||||
permission,
|
||||
icon,
|
||||
cache,
|
||||
hidden,
|
||||
pid,
|
||||
sub_count,
|
||||
i_frame,
|
||||
create_by,
|
||||
update_by,
|
||||
create_time,
|
||||
update_time
|
||||
from system_menu
|
||||
WHERE pid = #{pid}
|
||||
ORDER BY menu_sort
|
||||
</select>
|
||||
<select id="getMenuByTitle" resultType="cn.odboy.system.dal.dataobject.SystemMenuTb">
|
||||
SELECT menu_id id
|
||||
FROM system_menu
|
||||
WHERE title = #{title}
|
||||
</select>
|
||||
<select id="getMenuByComponentName" resultType="cn.odboy.system.dal.dataobject.SystemMenuTb">
|
||||
SELECT menu_id id
|
||||
FROM system_menu
|
||||
WHERE name = #{name}
|
||||
</select>
|
||||
<select id="countMenuByPid" resultType="java.lang.Integer">
|
||||
SELECT count(*)
|
||||
FROM system_menu
|
||||
WHERE pid = #{pid}
|
||||
</select>
|
||||
<update id="updateMenuSubCntByMenuId">
|
||||
update system_menu
|
||||
set sub_count = #{count}
|
||||
where menu_id = #{menuId}
|
||||
</update>
|
||||
</mapper>
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="cn.odboy.system.dal.mysql.SystemOssStorageMapper">
|
||||
<select id="selectOssStorageByArgs" resultType="cn.odboy.system.dal.dataobject.SystemOssStorageTb">
|
||||
select
|
||||
*
|
||||
from system_oss_storage
|
||||
<where>
|
||||
<if test="criteria.blurry != null and criteria.blurry != ''">
|
||||
AND (
|
||||
file_name LIKE CONCAT('%',#{criteria.blurry},'%')
|
||||
OR file_prefix LIKE CONCAT('%',#{criteria.blurry},'%')
|
||||
OR file_mime LIKE CONCAT('%',#{criteria.blurry},'%')
|
||||
OR file_md5 LIKE CONCAT('%',#{criteria.blurry},'%')
|
||||
)
|
||||
</if>
|
||||
<if test="criteria.createTime != null and criteria.createTime.size() > 0">
|
||||
AND update_time BETWEEN #{criteria.createTime[0]} AND #{criteria.createTime[1]}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
</mapper>
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="cn.odboy.system.dal.mysql.SystemQuartzJobMapper">
|
||||
<select id="selectQuartzJobByArgs" resultType="cn.odboy.system.dal.dataobject.SystemQuartzJobTb">
|
||||
SELECT
|
||||
*
|
||||
FROM system_quartz_job
|
||||
<where>
|
||||
<if test="criteria.jobName != null and criteria.jobName != ''">
|
||||
AND job_name LIKE CONCAT('%',#{criteria.jobName},'%')
|
||||
</if>
|
||||
<if test="criteria.createTime != null and criteria.createTime.size() > 0">
|
||||
AND update_time BETWEEN #{criteria.createTime[0]} AND #{criteria.createTime[1]}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
<select id="selectAllEnableQuartzJob" resultType="cn.odboy.system.dal.dataobject.SystemQuartzJobTb">
|
||||
SELECT *
|
||||
FROM system_quartz_job
|
||||
WHERE is_pause = 0
|
||||
</select>
|
||||
</mapper>
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="cn.odboy.system.dal.mysql.SystemQuartzLogMapper">
|
||||
<select id="selectQuartzLogByArgs" resultType="cn.odboy.system.dal.dataobject.SystemQuartzLogTb">
|
||||
SELECT
|
||||
*
|
||||
FROM system_quartz_log
|
||||
<where>
|
||||
<if test="criteria.jobName != null and criteria.jobName != ''">
|
||||
AND job_name LIKE CONCAT('%',#{criteria.jobName},'%')
|
||||
</if>
|
||||
<if test="criteria.isSuccess != null">
|
||||
AND is_success = #{criteria.isSuccess}
|
||||
</if>
|
||||
<if test="criteria.createTime != null and criteria.createTime.size() > 0">
|
||||
AND create_time BETWEEN #{criteria.createTime[0]} AND #{criteria.createTime[1]}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
</mapper>
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="cn.odboy.system.dal.mysql.SystemRoleDeptMapper">
|
||||
<insert id="batchInsertRoleDept">
|
||||
insert into system_roles_depts (role_id, dept_id)
|
||||
values
|
||||
<foreach collection="depts" item="item" open="(" separator="),(" close=")">
|
||||
#{roleId}, #{item.id}
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="batchDeleteRoleDept">
|
||||
delete from system_roles_depts
|
||||
where role_id in
|
||||
<foreach collection="roleIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user