diff --git a/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/config/AuthorizationServerConfig.java b/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/config/AuthorizationServerConfig.java index fa2b04083..d03dd0134 100644 --- a/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/config/AuthorizationServerConfig.java +++ b/pigx-auth/src/main/java/com/pig4cloud/pigx/auth/config/AuthorizationServerConfig.java @@ -119,11 +119,11 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap final Map additionalInfo = new HashMap<>(8); PigxUser pigxUser = (PigxUser) authentication.getUserAuthentication().getPrincipal(); - additionalInfo.put("user_id", pigxUser.getId()); - additionalInfo.put("username", pigxUser.getUsername()); - additionalInfo.put("dept_id", pigxUser.getDeptId()); - additionalInfo.put("tenant_id", pigxUser.getTenantId()); - additionalInfo.put("license", SecurityConstants.PIGX_LICENSE); + additionalInfo.put(SecurityConstants.DETAILS_USER_ID, pigxUser.getId()); + additionalInfo.put(SecurityConstants.DETAILS_USERNAME, pigxUser.getUsername()); + additionalInfo.put(SecurityConstants.DETAILS_DEPT_ID, pigxUser.getDeptId()); + additionalInfo.put(SecurityConstants.DETAILS_TENANT_ID, pigxUser.getTenantId()); + additionalInfo.put(SecurityConstants.DETAILS_LICENSE, SecurityConstants.PIGX_LICENSE); ((DefaultOAuth2AccessToken) accessToken).setAdditionalInformation(additionalInfo); return accessToken; }; diff --git a/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/SecurityConstants.java b/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/SecurityConstants.java index bdc0a4a54..75a18f63c 100644 --- a/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/SecurityConstants.java +++ b/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/SecurityConstants.java @@ -130,4 +130,29 @@ public interface SecurityConstants { */ String CLIENT_CREDENTIALS = "client_credentials"; + /** + * 用户ID字段 + */ + String DETAILS_USER_ID = "user_id"; + + /** + * 用户名字段 + */ + String DETAILS_USERNAME = "username"; + + /** + * 用户部门字段 + */ + String DETAILS_DEPT_ID = "dept_id"; + + /** + * 租户ID 字段 + */ + String DETAILS_TENANT_ID = "tenant_id"; + + /** + * 协议字段 + */ + String DETAILS_LICENSE = "license"; + } diff --git a/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigxUserAuthenticationConverter.java b/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigxUserAuthenticationConverter.java index 16de777b3..cac995c21 100644 --- a/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigxUserAuthenticationConverter.java +++ b/pigx-common/pigx-common-security/src/main/java/com/pig4cloud/pigx/common/security/component/PigxUserAuthenticationConverter.java @@ -17,6 +17,7 @@ package com.pig4cloud.pigx.common.security.component; +import com.pig4cloud.pigx.common.core.constant.SecurityConstants; import com.pig4cloud.pigx.common.security.service.PigxUser; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; @@ -36,9 +37,6 @@ import java.util.Map; * 根据checktoken 的结果转化用户信息 */ public class PigxUserAuthenticationConverter implements UserAuthenticationConverter { - private static final String USER_ID = "user_id"; - private static final String DEPT_ID = "dept_id"; - private static final String TENANT_ID = "tenant_id"; private static final String N_A = "N/A"; /** @@ -69,9 +67,9 @@ public class PigxUserAuthenticationConverter implements UserAuthenticationConver Collection authorities = getAuthorities(map); String username = (String) map.get(USERNAME); - Integer id = (Integer) map.get(USER_ID); - Integer deptId = (Integer) map.get(DEPT_ID); - Integer tenantId = (Integer) map.get(TENANT_ID); + Integer id = (Integer) map.get(SecurityConstants.DETAILS_USER_ID); + Integer deptId = (Integer) map.get(SecurityConstants.DETAILS_DEPT_ID); + Integer tenantId = (Integer) map.get(SecurityConstants.DETAILS_TENANT_ID); PigxUser user = new PigxUser(id, deptId, tenantId, username, N_A, true , true, true, true, authorities); return new UsernamePasswordAuthenticationToken(user, N_A, authorities); diff --git a/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/entity/SysDict.java b/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/entity/SysDict.java old mode 100644 new mode 100755 index 8e87bc4b1..c35df263c --- a/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/entity/SysDict.java +++ b/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/entity/SysDict.java @@ -1,92 +1,75 @@ /* + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - * + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ - package com.pig4cloud.pigx.admin.api.entity; -import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.activerecord.Model; import lombok.Data; import lombok.EqualsAndHashCode; -import javax.validation.constraints.NotBlank; import java.time.LocalDateTime; /** - *

* 字典表 - *

* - * @author lengleng - * @since 2017-11-19 + * @author pigx code generator + * @date 2019-03-19 09:52:47 */ @Data +@TableName("sys_dict") @EqualsAndHashCode(callSuper = true) public class SysDict extends Model { +private static final long serialVersionUID = 1L; - private static final long serialVersionUID = 1L; - - /** - * 编号 - */ - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - /** - * 数据值 - */ - @NotBlank(message = "字典项数据值不能为空") - private String value; - /** - * 标签名 - */ - @NotBlank(message = "字典项标签不能为空") - private String label; - /** - * 类型 - */ - @NotBlank(message = "字典项数据类型不能为空") - private String type; - /** - * 描述 - */ - private String description; - /** - * 排序(升序) - */ - private Integer sort; - /** - * 创建时间 - */ - private LocalDateTime createTime; - /** - * 更新时间 - */ - private LocalDateTime updateTime; - /** - * 备注信息 - */ - private String remarks; - /** - * 删除标记 - */ + /** + * 编号 + */ + @TableId + private Integer id; + /** + * 类型 + */ + private String type; + /** + * 描述 + */ + private String description; + /** + * 创建时间 + */ + private LocalDateTime createTime; + /** + * 更新时间 + */ + private LocalDateTime updateTime; + /** + * 备注信息 + */ + private String remarks; + /** + * 删除标记 + */ @TableLogic - private String delFlag; - + private String delFlag; + /** + * 所属租户 + */ + private Integer tenantId; + } diff --git a/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/entity/SysDictItem.java b/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/entity/SysDictItem.java new file mode 100755 index 000000000..5322c3b90 --- /dev/null +++ b/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/entity/SysDictItem.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ +package com.pig4cloud.pigx.admin.api.entity; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; + +/** + * 字典项 + * + * @author pigx code generator + * @date 2019-03-19 09:46:46 + */ +@Data +@TableName("sys_dict_item") +@EqualsAndHashCode(callSuper = true) +public class SysDictItem extends Model { + private static final long serialVersionUID = 1L; + + /** + * 编号 + */ + @TableId + private Integer id; + /** + * + */ + private Integer dictId; + /** + * 数据值 + */ + private String value; + /** + * 标签名 + */ + private String label; + /** + * 类型 + */ + private String type; + /** + * 描述 + */ + private String description; + /** + * 排序(升序) + */ + private Integer sort; + /** + * 创建时间 + */ + private LocalDateTime createTime; + /** + * 更新时间 + */ + private LocalDateTime updateTime; + /** + * 备注信息 + */ + private String remarks; + /** + * 删除标记 + */ + @TableLogic + private String delFlag; + /** + * 所属租户 + */ + private Integer tenantId; + +} diff --git a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/controller/DictController.java b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/controller/DictController.java index f8a719d50..183978da8 100644 --- a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/controller/DictController.java +++ b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/controller/DictController.java @@ -24,6 +24,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.pig4cloud.pigx.admin.api.entity.SysDict; +import com.pig4cloud.pigx.admin.api.entity.SysDictItem; +import com.pig4cloud.pigx.admin.service.SysDictItemService; import com.pig4cloud.pigx.admin.service.SysDictService; import com.pig4cloud.pigx.common.core.util.R; import com.pig4cloud.pigx.common.log.annotation.SysLog; @@ -42,7 +44,7 @@ import javax.validation.Valid; *

* * @author lengleng - * @since 2017-11-19 + * @since 2019-03-19 */ @RestController @AllArgsConstructor @@ -50,6 +52,7 @@ import javax.validation.Valid; @Api(value = "dict", description = "字典管理模块") public class DictController { private final SysDictService sysDictService; + private final SysDictItemService sysDictItemService; /** * 通过ID查询字典信息 @@ -82,9 +85,9 @@ public class DictController { @GetMapping("/type/{type}") @Cacheable(value = "dict_details", key = "#type") public R getDictByType(@PathVariable String type) { - return new R<>(sysDictService.list(Wrappers - .query().lambda() - .eq(SysDict::getType, type))); + return new R<>(sysDictItemService.list(Wrappers + .query().lambda() + .eq(SysDictItem::getType, type))); } /** @@ -95,7 +98,6 @@ public class DictController { */ @SysLog("添加字典") @PostMapping - @CacheEvict(value = "dict_details", key = "#sysDict.type") @PreAuthorize("@pms.hasPermission('sys_dict_add')") public R save(@Valid @RequestBody SysDict sysDict) { return new R<>(sysDictService.save(sysDict)); @@ -104,16 +106,14 @@ public class DictController { /** * 删除字典,并且清除字典缓存 * - * @param id ID - * @param type 类型 + * @param id ID * @return R */ @SysLog("删除字典") - @DeleteMapping("/{id}/{type}") - @CacheEvict(value = "dict_details", key = "#type") + @DeleteMapping("/{id}") @PreAuthorize("@pms.hasPermission('sys_dict_del')") - public R removeById(@PathVariable Integer id, @PathVariable String type) { - return new R<>(sysDictService.removeById(id)); + public R removeById(@PathVariable Integer id) { + return new R<>(sysDictService.removeDict(id)); } /** @@ -124,9 +124,71 @@ public class DictController { */ @PutMapping @SysLog("修改字典") - @CacheEvict(value = "dict_details", key = "#sysDict.type") @PreAuthorize("@pms.hasPermission('sys_dict_edit')") public R updateById(@Valid @RequestBody SysDict sysDict) { return new R<>(sysDictService.updateById(sysDict)); } + + /** + * 分页查询 + * + * @param page 分页对象 + * @param sysDictItem 字典项 + * @return + */ + @GetMapping("/item/page") + public R getSysDictItemPage(Page page, SysDictItem sysDictItem) { + return new R<>(sysDictItemService.page(page, Wrappers.query(sysDictItem))); + } + + + /** + * 通过id查询字典项 + * + * @param id id + * @return R + */ + @GetMapping("/item/{id}") + public R getDictItemById(@PathVariable("id") Integer id) { + return new R<>(sysDictItemService.getById(id)); + } + + /** + * 新增字典项 + * + * @param sysDictItem 字典项 + * @return R + */ + @SysLog("新增字典项") + @PostMapping("/item") + @CacheEvict(value = "dict_details", allEntries = true) + public R save(@RequestBody SysDictItem sysDictItem) { + return new R<>(sysDictItemService.save(sysDictItem)); + } + + /** + * 修改字典项 + * + * @param sysDictItem 字典项 + * @return R + */ + @SysLog("修改字典项") + @PutMapping("/item") + @CacheEvict(value = "dict_details", allEntries = true) + public R updateById(@RequestBody SysDictItem sysDictItem) { + return new R<>(sysDictItemService.updateById(sysDictItem)); + } + + /** + * 通过id删除字典项 + * + * @param id id + * @return R + */ + @SysLog("删除字典项") + @DeleteMapping("/item/{id}") + @CacheEvict(value = "dict_details", allEntries = true) + public R removeDictItemById(@PathVariable Integer id) { + return new R<>(sysDictItemService.removeById(id)); + } } diff --git a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/mapper/SysDictItemMapper.java b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/mapper/SysDictItemMapper.java new file mode 100755 index 000000000..e4311f319 --- /dev/null +++ b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/mapper/SysDictItemMapper.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ +package com.pig4cloud.pigx.admin.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.pig4cloud.pigx.admin.api.entity.SysDictItem; + +/** + * 字典项 + * + * @author pigx code generator + * @date 2019-03-19 09:46:46 + */ +public interface SysDictItemMapper extends BaseMapper { + +} diff --git a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/SysDictItemService.java b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/SysDictItemService.java new file mode 100755 index 000000000..be945ea15 --- /dev/null +++ b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/SysDictItemService.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ +package com.pig4cloud.pigx.admin.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.pig4cloud.pigx.admin.api.entity.SysDictItem; + +/** + * 字典项 + * + * @author pigx code generator + * @date 2019-03-19 09:46:46 + */ +public interface SysDictItemService extends IService { + +} diff --git a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/SysDictService.java b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/SysDictService.java old mode 100644 new mode 100755 index 777d32d04..3218b7c9b --- a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/SysDictService.java +++ b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/SysDictService.java @@ -1,34 +1,37 @@ /* + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - * + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ - package com.pig4cloud.pigx.admin.service; import com.baomidou.mybatisplus.extension.service.IService; import com.pig4cloud.pigx.admin.api.entity.SysDict; /** - *

- * 字典表 服务类 - *

+ * 字典表 * - * @author lengleng - * @since 2017-11-19 + * @author pigx code generator + * @date 2019-03-19 09:52:47 */ public interface SysDictService extends IService { + + /** + * 根据ID 删除字典 + * + * @param id + * @return + */ + Boolean removeDict(Integer id); } diff --git a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysDictItemServiceImpl.java b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysDictItemServiceImpl.java new file mode 100755 index 000000000..bb6937517 --- /dev/null +++ b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysDictItemServiceImpl.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ +package com.pig4cloud.pigx.admin.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.pig4cloud.pigx.admin.api.entity.SysDictItem; +import com.pig4cloud.pigx.admin.mapper.SysDictItemMapper; +import com.pig4cloud.pigx.admin.service.SysDictItemService; +import org.springframework.stereotype.Service; + +/** + * 字典项 + * + * @author pigx code generator + * @date 2019-03-19 09:46:46 + */ +@Service +public class SysDictItemServiceImpl extends ServiceImpl implements SysDictItemService { + +} diff --git a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysDictServiceImpl.java b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysDictServiceImpl.java old mode 100644 new mode 100755 index 0ec8b6fd6..61001b28a --- a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysDictServiceImpl.java +++ b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/service/impl/SysDictServiceImpl.java @@ -1,39 +1,58 @@ /* + * Copyright (c) 2018-2025, lengleng All rights reserved. * - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - * + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) */ - package com.pig4cloud.pigx.admin.service.impl; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.pig4cloud.pigx.admin.api.entity.SysDict; +import com.pig4cloud.pigx.admin.api.entity.SysDictItem; +import com.pig4cloud.pigx.admin.mapper.SysDictItemMapper; import com.pig4cloud.pigx.admin.mapper.SysDictMapper; import com.pig4cloud.pigx.admin.service.SysDictService; +import lombok.AllArgsConstructor; +import org.springframework.cache.annotation.CacheEvict; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; /** - *

- * 字典表 服务实现类 - *

+ * 字典表 * - * @author lengleng - * @since 2017-11-19 + * @author pigx code generator + * @date 2019-03-19 09:52:47 */ @Service +@AllArgsConstructor public class SysDictServiceImpl extends ServiceImpl implements SysDictService { + private final SysDictItemMapper dictItemMapper; + /** + * 根据ID 删除字典 + * + * @param id + * @return + */ + @Override + @CacheEvict(value = "dict_details", allEntries = true) + @Transactional(rollbackFor = Exception.class) + public Boolean removeDict(Integer id) { + baseMapper.deleteById(id); + + dictItemMapper.delete(Wrappers.lambdaQuery() + .eq(SysDictItem::getDictId, id)); + return Boolean.TRUE; + } } diff --git a/pigx-upms/pigx-upms-biz/src/main/resources/mapper/SysDictItemMapper.xml b/pigx-upms/pigx-upms-biz/src/main/resources/mapper/SysDictItemMapper.xml new file mode 100755 index 000000000..7f4833308 --- /dev/null +++ b/pigx-upms/pigx-upms-biz/src/main/resources/mapper/SysDictItemMapper.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pigx-upms/pigx-upms-biz/src/main/resources/mapper/SysDictMapper.xml b/pigx-upms/pigx-upms-biz/src/main/resources/mapper/SysDictMapper.xml index 362b17322..9e1c8625e 100644 --- a/pigx-upms/pigx-upms-biz/src/main/resources/mapper/SysDictMapper.xml +++ b/pigx-upms/pigx-upms-biz/src/main/resources/mapper/SysDictMapper.xml @@ -25,14 +25,12 @@ - - - + diff --git a/pigx-visual/pigx-daemon-quartz/src/main/java/com/pig4cloud/pigx/daemon/event/EventAutoConfiguration.java b/pigx-visual/pigx-daemon-quartz/src/main/java/com/pig4cloud/pigx/daemon/event/EventAutoConfiguration.java index 1cb1c82c8..14a6a32d7 100644 --- a/pigx-visual/pigx-daemon-quartz/src/main/java/com/pig4cloud/pigx/daemon/event/EventAutoConfiguration.java +++ b/pigx-visual/pigx-daemon-quartz/src/main/java/com/pig4cloud/pigx/daemon/event/EventAutoConfiguration.java @@ -20,7 +20,7 @@ package com.pig4cloud.pigx.daemon.event; import com.pig4cloud.pigx.daemon.config.PigxQuartzInvokeFactory; import com.pig4cloud.pigx.daemon.service.SysJobLogService; import com.pig4cloud.pigx.daemon.util.TaskInvokUtil; -import lombok.AllArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.annotation.Bean; @@ -35,12 +35,11 @@ import org.springframework.scheduling.annotation.EnableAsync; */ @EnableAsync @Configuration -@AllArgsConstructor @ConditionalOnWebApplication public class EventAutoConfiguration { - + @Autowired private TaskInvokUtil taskInvokUtil; - + @Autowired private SysJobLogService sysJobLogService; @Bean diff --git a/pom.xml b/pom.xml index 78ad7cf48..bb304c1ca 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,7 @@ 2.10.2 6.0.2 2.1.5 - 2.3.4.RELEASE + 2.3.5.RELEASE 2.1.2.RELEASE 5.22.0 2.12.2