Showing
75 changed files
with
546 additions
and
234 deletions
... | ... | @@ -74,10 +74,10 @@ public class YtAdminController extends BaseController { |
74 | 74 | return ytTenantService.updateTenant(tenantDTO); |
75 | 75 | } |
76 | 76 | |
77 | - @GetMapping("/tenant/roles/{tenantCode}") | |
78 | - public ResponseEntity<List<String>> getTenantRolesByTenantCode( | |
79 | - @PathVariable("tenantCode") String tenantCode) { | |
80 | - return ResponseEntity.ok(ytTenantService.getTenantRolesByTenantCode(tenantCode)); | |
77 | + @GetMapping("/tenant/roles/{tenantId}") | |
78 | + public ResponseEntity<List<String>> getTenantRolesByTenantId( | |
79 | + @PathVariable("tenantId") String tenantId) { | |
80 | + return ResponseEntity.ok(ytTenantService.getTenantRolesByTenantId(tenantId)); | |
81 | 81 | } |
82 | 82 | |
83 | 83 | @DeleteMapping("/tenant") |
... | ... | @@ -139,9 +139,9 @@ public class YtAdminController extends BaseController { |
139 | 139 | getCurrentUser().isPtSysadmin(), getCurrentUser().isPtTenantAdmin())); |
140 | 140 | } |
141 | 141 | |
142 | - @PutMapping("/menu/assign/{tenantCode}") | |
142 | + @PutMapping("/menu/assign/{tenantId}") | |
143 | 143 | public void assignMenuToTenant( |
144 | - @RequestBody String[] menuIds, @PathVariable("tenantCode") String tenantCode) throws ThingsboardException { | |
144 | + @RequestBody String[] menuIds, @PathVariable("tenantId") String tenantId) throws ThingsboardException { | |
145 | 145 | menuService.assignMenuToTenant(getCurrentUser().getCurrentTenantId(), menuIds); |
146 | 146 | } |
147 | 147 | ... | ... |
... | ... | @@ -28,9 +28,9 @@ public class YtDeviceTypeController extends BaseController { |
28 | 28 | |
29 | 29 | @GetMapping |
30 | 30 | @ApiOperation(value = "获取当前用户的设备类型树形") |
31 | - @ApiParam(name = "tenantCode",value = "租户Code") | |
32 | - public ResponseEntity<List<DeviceTypeDTO>> getDeviceTypeTree(String tenantCode){ | |
33 | - return ResponseEntity.ok(deviceTypeService.getDeviceTypeTree(tenantCode)); | |
31 | + @ApiParam(name = "tenantId",value = "租户Code") | |
32 | + public ResponseEntity<List<DeviceTypeDTO>> getDeviceTypeTree(String tenantId){ | |
33 | + return ResponseEntity.ok(deviceTypeService.getDeviceTypeTree(tenantId)); | |
34 | 34 | } |
35 | 35 | |
36 | 36 | @PostMapping | ... | ... |
... | ... | @@ -48,7 +48,7 @@ public class YtNoticeController extends BaseController { |
48 | 48 | queryMap.put(PAGE_SIZE, pageSize); |
49 | 49 | queryMap.put(PAGE, page); |
50 | 50 | queryMap.put(ORDER_FILED, orderBy); |
51 | - queryMap.put("tenantCode", getCurrentUser().getCurrentTenantId()); | |
51 | + queryMap.put("tenantId", getCurrentUser().getCurrentTenantId()); | |
52 | 52 | if (orderType != null) { |
53 | 53 | queryMap.put(ORDER_TYPE, orderType.name()); |
54 | 54 | } | ... | ... |
... | ... | @@ -77,7 +77,7 @@ public class YtNoticeUserController extends BaseController { |
77 | 77 | queryMap.put(PAGE_SIZE, pageSize); |
78 | 78 | queryMap.put(PAGE, page); |
79 | 79 | queryMap.put(ORDER_FILED, orderBy); |
80 | - queryMap.put("tenantCode", getCurrentUser().getCurrentUserId()); | |
80 | + queryMap.put("tenantId", getCurrentUser().getCurrentUserId()); | |
81 | 81 | if (orderType != null) { |
82 | 82 | queryMap.put(ORDER_TYPE, orderType.name()); |
83 | 83 | } | ... | ... |
... | ... | @@ -12,7 +12,7 @@ import org.thingsboard.server.common.data.yunteng.core.exception.FastIotExceptio |
12 | 12 | import org.thingsboard.server.common.data.yunteng.dto.DeleteDTO; |
13 | 13 | import org.thingsboard.server.common.data.yunteng.dto.OrganizationDTO; |
14 | 14 | import org.thingsboard.server.controller.BaseController; |
15 | -import org.thingsboard.server.dao.yunteng.service.OrganizationService; | |
15 | +import org.thingsboard.server.dao.yunteng.service.YtOrganizationService; | |
16 | 16 | |
17 | 17 | import java.net.URI; |
18 | 18 | import java.util.List; |
... | ... | @@ -23,7 +23,7 @@ import java.util.Optional; |
23 | 23 | @RequiredArgsConstructor |
24 | 24 | public class YtOrganizationController extends BaseController { |
25 | 25 | |
26 | - private final OrganizationService organizationService; | |
26 | + private final YtOrganizationService organizationService; | |
27 | 27 | |
28 | 28 | @PostMapping |
29 | 29 | public ResponseEntity<OrganizationDTO> saveGroup(@RequestBody OrganizationDTO groupDTO) | ... | ... |
... | ... | @@ -72,7 +72,7 @@ public class YtUserController extends BaseController { |
72 | 72 | @RequestParam(PAGE) int page, |
73 | 73 | @RequestParam(value = "realName", required = false) String realName, |
74 | 74 | @RequestParam(value = "username", required = false) String username, |
75 | - @RequestParam(value = "tenantCode", required = false) String tenantCode, | |
75 | + @RequestParam(value = "tenantId", required = false) String tenantId, | |
76 | 76 | @RequestParam(value = "roleType", required = false) RoleEnum roleType, |
77 | 77 | @RequestParam(value = ORDER_FILED, required = false) String orderBy, |
78 | 78 | @RequestParam(value = ORDER_TYPE, required = false) OrderTypeEnum orderType) |
... | ... | @@ -84,10 +84,10 @@ public class YtUserController extends BaseController { |
84 | 84 | queryMap.put("realName", realName); |
85 | 85 | queryMap.put("username", username); |
86 | 86 | if (getCurrentUser().isPtSysadmin()) { |
87 | - if (StringUtils.isEmpty(tenantCode)) { | |
88 | - tenantCode = getCurrentUser().getCurrentTenantId(); | |
87 | + if (StringUtils.isEmpty(tenantId)) { | |
88 | + tenantId = getCurrentUser().getCurrentTenantId(); | |
89 | 89 | } |
90 | - queryMap.put("tenantCode", tenantCode); | |
90 | + queryMap.put("tenantId", tenantId); | |
91 | 91 | } |
92 | 92 | if (null != roleType) { |
93 | 93 | queryMap.put("roleType", roleType.name()); |
... | ... | @@ -134,7 +134,7 @@ public class YtUserController extends BaseController { |
134 | 134 | @PreAuthorize("hasRole('SYS_ADMIN')") |
135 | 135 | @PostMapping("saveTenantAdmin") |
136 | 136 | public UserDTO saveTenantAdmin(@RequestBody UserDTO userDTO) throws ThingsboardException { |
137 | - Assert.isTrue(StringUtils.isNotBlank(userDTO.getTenantCode()), "tenant code must exist"); | |
137 | + Assert.isTrue(StringUtils.isNotBlank(userDTO.getTenantId()), "tenant code must exist"); | |
138 | 138 | Assert.notNull(userDTO.getUsername(), "username must exist"); |
139 | 139 | Assert.notNull(userDTO.getRealName(), "real name must exist"); |
140 | 140 | return userService.saveTenantAdmin( | ... | ... |
... | ... | @@ -1093,3 +1093,19 @@ management: |
1093 | 1093 | exposure: |
1094 | 1094 | # Expose metrics endpoint (use value 'prometheus' to enable prometheus metrics). |
1095 | 1095 | include: '${METRICS_ENDPOINTS_EXPOSE:info}' |
1096 | +file: | |
1097 | + storage: | |
1098 | + type: minio #local, minio, or other to be implemented | |
1099 | + randomFileName: true #是否重命名文件名字,防止冲突 | |
1100 | + local: | |
1101 | + uploadDir: /Users/xiaoyus/upload/ #文件上传地址 只有type = local需要 | |
1102 | + downloadPath: /downloadFile/ #与controller里面下载文件GetMapping的path一致, 只有type = local需要 | |
1103 | + uploadPath: /upload #与controller里面下载文件GetMapping的path一致, 只有type = local需要 | |
1104 | + staticUrl: /oss/files/** #oss静态访问路径 只有type = local需要 | |
1105 | + randomFileName: ${file.storage.randomFileName} | |
1106 | + minio: | |
1107 | + minioUrl: http://101.133.234.90:9000 #minio储存地址 | |
1108 | + minioName: YunTeng #minio账户 | |
1109 | + minioPass: YunTeng123456 #minio访问密码 | |
1110 | + bucketName: yunteng #minio储存桶名称 | |
1111 | + randomFileName: ${file.storage.randomFileName} | ... | ... |
... | ... | @@ -73,7 +73,7 @@ public final class ModelConstants { |
73 | 73 | public static final String CREATOR = "creator"; |
74 | 74 | public static final String UPDATER = "updater"; |
75 | 75 | public static final String UPDATE = "update"; |
76 | - public static final String TENANT_CODE = "tenantCode"; | |
76 | + public static final String TENANT_CODE = "tenantId"; | |
77 | 77 | public static final String PASSWORD = "password"; |
78 | 78 | public static final String ACTIVATE_TOKEN = "activateToken"; |
79 | 79 | public static final String TB_DEVICE_ID = "tbDeviceId"; | ... | ... |
... | ... | @@ -5,7 +5,7 @@ public final class SecurityConstant { |
5 | 5 | public static final String USER_ID="userId"; |
6 | 6 | public static final String USER_NAME="username"; |
7 | 7 | public static final String DISPLAY_NAME="displayName"; |
8 | - public static final String TENANT_CODE ="tenantCode"; | |
8 | + public static final String TENANT_CODE ="tenantId"; | |
9 | 9 | public static final String TENANT_NAME="tenantName"; |
10 | 10 | public static final String JWT_TOKEN_HEADER_PARAM="X-Authorization"; |
11 | 11 | } | ... | ... |
... | ... | @@ -31,7 +31,7 @@ public class MenuDTO extends BaseDTO implements Comparable<MenuDTO> { |
31 | 31 | private MenuTypeEnum type; |
32 | 32 | private String permission; |
33 | 33 | private Integer sort; |
34 | - @JsonIgnore private String tenantCode; | |
34 | + @JsonIgnore private String tenantId; | |
35 | 35 | private String component; |
36 | 36 | private JsonNode meta; |
37 | 37 | @JsonIgnore private String alias; | ... | ... |
... | ... | @@ -45,7 +45,7 @@ public class UserDTO extends BaseDTO { |
45 | 45 | private boolean hasPassword; |
46 | 46 | |
47 | 47 | @JsonInclude(JsonInclude.Include.NON_NULL) |
48 | - private String tenantCode; | |
48 | + private String tenantId; | |
49 | 49 | |
50 | 50 | @JsonInclude(JsonInclude.Include.NON_NULL) |
51 | 51 | private String tenantName; | ... | ... |
... | ... | @@ -27,7 +27,7 @@ public class TenantReqDTO { |
27 | 27 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
28 | 28 | private LocalDateTime tenantExpireTime; |
29 | 29 | |
30 | - private String tenantCode; | |
30 | + private String tenantId; | |
31 | 31 | private String defaultConfig; |
32 | 32 | |
33 | 33 | @JsonInclude(JsonInclude.Include.NON_NULL) | ... | ... |
... | ... | @@ -18,7 +18,6 @@ public class YtDeviceProfile extends TenantBaseEntity { |
18 | 18 | private String convertJs; |
19 | 19 | |
20 | 20 | private TransportTypeEnum transportType; |
21 | - private String tenantCode; | |
22 | 21 | /** TB的设备配置文件 */ |
23 | 22 | @TableField(updateStrategy = FieldStrategy.IGNORED) |
24 | 23 | private String tbProfileId; | ... | ... |
... | ... | @@ -98,7 +98,7 @@ public class MenuServiceImpl extends AbstractBaseService<MenuMapper, Menu> imple |
98 | 98 | if (count > 0) { |
99 | 99 | throw new DataValidationException("menu with path " + menuDTO + " already exist"); |
100 | 100 | } |
101 | - menuDTO.setTenantCode(tenantId); | |
101 | + menuDTO.setTenantId(tenantId); | |
102 | 102 | Menu menu = menuDTO.getEntity(Menu.class); |
103 | 103 | int insertCount = baseMapper.insert(menu); |
104 | 104 | if (insertCount > 0) { |
... | ... | @@ -121,7 +121,7 @@ public class MenuServiceImpl extends AbstractBaseService<MenuMapper, Menu> imple |
121 | 121 | throw new DataValidationException("cannot find menu to update"); |
122 | 122 | } else { |
123 | 123 | if (!isSysAdmin) { |
124 | - if (!tenantId.equals(menuDTO.getTenantCode())) { | |
124 | + if (!tenantId.equals(menuDTO.getTenantId())) { | |
125 | 125 | throw new AccessDeniedException("You don't have permission to update this menu"); |
126 | 126 | } |
127 | 127 | } | ... | ... |
... | ... | @@ -121,7 +121,7 @@ public class RoleServiceImpl extends AbstractBaseService<RoleMapper, Role> imple |
121 | 121 | allPermission = |
122 | 122 | optionalPermission.orElseGet( |
123 | 123 | () -> |
124 | - menuMapper.getAllPermissionsByTenantCode(tenantId)); | |
124 | + menuMapper.getAllPermissionsByTenantId(tenantId)); | |
125 | 125 | } else { |
126 | 126 | cacheKey = |
127 | 127 | FastIotConstants.CacheConfigKey.USER_PERMISSION_PREFIX |
... | ... | @@ -222,18 +222,18 @@ public class RoleServiceImpl extends AbstractBaseService<RoleMapper, Role> imple |
222 | 222 | new QueryWrapper<TenantRole>().lambda().eq(TenantRole::getRoleId, role.getId())); |
223 | 223 | tenantRoles.forEach( |
224 | 224 | tenantRole -> { |
225 | - String updateTenantCode = tenantRole.getTenantCode(); | |
225 | + String updateTenantId = tenantRole.getTenantId(); | |
226 | 226 | int deleteCount = |
227 | 227 | tenantMenuMapper.delete( |
228 | 228 | new QueryWrapper<TenantMenu>() |
229 | 229 | .lambda() |
230 | - .eq(TenantMenu::getTenantCode, updateTenantCode)); | |
230 | + .eq(TenantMenu::getTenantId, updateTenantId)); | |
231 | 231 | if (deleteCount > 0) { |
232 | 232 | menus.forEach( |
233 | 233 | menu -> { |
234 | 234 | TenantMenu tenantMenu = new TenantMenu(); |
235 | 235 | tenantMenu.setMenuId(menu); |
236 | - tenantMenu.setTenantCode(updateTenantCode); | |
236 | + tenantMenu.setTenantId(updateTenantId); | |
237 | 237 | tenantMenuMapper.insert(tenantMenu); |
238 | 238 | }); |
239 | 239 | } | ... | ... |
... | ... | @@ -28,7 +28,7 @@ public class SmsLogServiceImpl extends AbstractBaseService<SmsLogMapper, SmsLog> |
28 | 28 | getPage(queryMap, "send_time", false), |
29 | 29 | new QueryWrapper<SmsLog>() |
30 | 30 | .lambda() |
31 | - .eq(SmsLog::getTenantCode,tenantId) | |
31 | + .eq(SmsLog::getTenantId,tenantId) | |
32 | 32 | .like( |
33 | 33 | queryMap.get("toPhone") != null, |
34 | 34 | SmsLog::getToPhone, | ... | ... |
... | ... | @@ -26,7 +26,7 @@ public class SysAppDesignServiceImpl extends AbstractBaseService<SysAppDesignMap |
26 | 26 | return false; |
27 | 27 | } |
28 | 28 | SysAppDesign entity = sysAppDesignDTO.getEntity(SysAppDesign.class); |
29 | - entity.setTenantCode(tenantId); | |
29 | + entity.setTenantId(tenantId); | |
30 | 30 | return baseMapper.insert(entity) > 0; |
31 | 31 | } |
32 | 32 | |
... | ... | @@ -35,7 +35,7 @@ public class SysAppDesignServiceImpl extends AbstractBaseService<SysAppDesignMap |
35 | 35 | SysAppDesign sysAppDesign = baseMapper |
36 | 36 | .selectOne( |
37 | 37 | new LambdaQueryWrapper<SysAppDesign>() |
38 | - .eq(SysAppDesign::getTenantCode, tenantId)); | |
38 | + .eq(SysAppDesign::getTenantId, tenantId)); | |
39 | 39 | return sysAppDesign == null ? null : sysAppDesign.getDTO(SysAppDesignDTO.class); |
40 | 40 | } |
41 | 41 | |
... | ... | @@ -45,7 +45,7 @@ public class SysAppDesignServiceImpl extends AbstractBaseService<SysAppDesignMap |
45 | 45 | return baseMapper.update( |
46 | 46 | sysAppDesignDTO.getEntity(SysAppDesign.class), |
47 | 47 | new LambdaQueryWrapper<SysAppDesign>() |
48 | - .eq(SysAppDesign::getTenantCode, tenantId)) | |
48 | + .eq(SysAppDesign::getTenantId, tenantId)) | |
49 | 49 | > 0; |
50 | 50 | }else { |
51 | 51 | return save(sysAppDesignDTO,tenantId); | ... | ... |
... | ... | @@ -51,7 +51,7 @@ public class SysDictItemServiceImpl extends AbstractBaseService<SysDictItemMappe |
51 | 51 | public SysDictItemDTO saveSysDictItem(SysDictItemDTO sysDictItemDTO,String tenantId) { |
52 | 52 | SysDictItem sysDictItem = new SysDictItem(); |
53 | 53 | sysDictItemDTO.copyToEntity(sysDictItem); |
54 | - sysDictItem.setTenantCode(tenantId); | |
54 | + sysDictItem.setTenantId(tenantId); | |
55 | 55 | baseMapper.insert(sysDictItem); |
56 | 56 | sysDictItem.copyToDTO(sysDictItemDTO); |
57 | 57 | return sysDictItemDTO; |
... | ... | @@ -68,7 +68,7 @@ public class SysDictItemServiceImpl extends AbstractBaseService<SysDictItemMappe |
68 | 68 | public SysDictItemDTO updateSysDictItem(SysDictItemDTO sysDictItemDTO,String tenantId) { |
69 | 69 | SysDictItem sysDictItem = baseMapper.selectById(sysDictItemDTO.getId()); |
70 | 70 | sysDictItemDTO.copyToEntity(sysDictItem); |
71 | - sysDictItem.setTenantCode(tenantId); | |
71 | + sysDictItem.setTenantId(tenantId); | |
72 | 72 | baseMapper.updateById(sysDictItem); |
73 | 73 | sysDictItem.copyToDTO(sysDictItemDTO); |
74 | 74 | return sysDictItemDTO; | ... | ... |
... | ... | @@ -56,7 +56,7 @@ public class SysDictServiceImpl extends AbstractBaseService<SysDictMapper, SysDi |
56 | 56 | } |
57 | 57 | SysDict sysDict = new SysDict(); |
58 | 58 | sysDictDTO.copyToEntity(sysDict); |
59 | - sysDict.setTenantCode(tenantId); | |
59 | + sysDict.setTenantId(tenantId); | |
60 | 60 | baseMapper.insert(sysDict); |
61 | 61 | sysDict.copyToDTO(sysDictDTO); |
62 | 62 | return sysDictDTO; |
... | ... | @@ -81,7 +81,7 @@ public class SysDictServiceImpl extends AbstractBaseService<SysDictMapper, SysDi |
81 | 81 | public SysDictDTO updateSysDict(SysDictDTO sysDictDTO,String tenantId) { |
82 | 82 | SysDict sysDict = baseMapper.selectById(sysDictDTO.getId()); |
83 | 83 | sysDictDTO.copyToEntity(sysDict); |
84 | - sysDict.setTenantCode(tenantId); | |
84 | + sysDict.setTenantId(tenantId); | |
85 | 85 | baseMapper.updateById(sysDict); |
86 | 86 | sysDict.copyToDTO(sysDictDTO); |
87 | 87 | return sysDictDTO; | ... | ... |
... | ... | @@ -24,7 +24,7 @@ public class SysEnterpriseServiceImpl |
24 | 24 | @Override |
25 | 25 | public boolean save(SysEnterpriseDTO sysAppDesignDTO,String tenantId) { |
26 | 26 | SysEnterprise entity = sysAppDesignDTO.getEntity(SysEnterprise.class); |
27 | - entity.setTenantCode(tenantId); | |
27 | + entity.setTenantId(tenantId); | |
28 | 28 | return baseMapper.insert(entity) > 0; |
29 | 29 | } |
30 | 30 | |
... | ... | @@ -40,7 +40,7 @@ public class SysEnterpriseServiceImpl |
40 | 40 | return baseMapper.update( |
41 | 41 | sysAppDesignDTO.getEntity(SysEnterprise.class), |
42 | 42 | new LambdaQueryWrapper<SysEnterprise>() |
43 | - .eq(SysEnterprise::getTenantCode,tenantId)) | |
43 | + .eq(SysEnterprise::getTenantId,tenantId)) | |
44 | 44 | > 0; |
45 | 45 | }else { |
46 | 46 | return save(sysAppDesignDTO,tenantId); | ... | ... |
... | ... | @@ -63,7 +63,7 @@ public class SysNoticeServiceImpl extends AbstractBaseService<SysNoticeMapper, S |
63 | 63 | return baseMapper.delete( |
64 | 64 | new LambdaQueryWrapper<SysNotice>() |
65 | 65 | .in(SysNotice::getId, ids) |
66 | - .eq(SysNotice::getTenantCode, tenantId)) | |
66 | + .eq(SysNotice::getTenantId, tenantId)) | |
67 | 67 | > 0; |
68 | 68 | } |
69 | 69 | |
... | ... | @@ -72,13 +72,13 @@ public class SysNoticeServiceImpl extends AbstractBaseService<SysNoticeMapper, S |
72 | 72 | SysNotice entity = sysNoticeDTO.getEntity(SysNotice.class); |
73 | 73 | // 设置为草稿 |
74 | 74 | entity.setStatus(FastIotConstants.DraftStatus.DRAFT); |
75 | - entity.setTenantCode(tenantId); | |
75 | + entity.setTenantId(tenantId); | |
76 | 76 | // 拼接需要发送的名单 |
77 | 77 | if (sysNoticeDTO.getReceiverType() == null || sysNoticeDTO.getPointId() == null) { |
78 | 78 | throw new EntityCreationException(ErrorMessage.SEND_DESTINATION_NOT_FOUND.name()); |
79 | 79 | } |
80 | 80 | LambdaQueryWrapper<User> wrapper = |
81 | - new LambdaQueryWrapper<User>().eq(User::getTenantCode, entity.getTenantCode()); | |
81 | + new LambdaQueryWrapper<User>().eq(User::getTenantId, entity.getTenantId()); | |
82 | 82 | switch (entity.getReceiverType()) { |
83 | 83 | case FastIotConstants.ReceiverType.ALL: |
84 | 84 | // 全部 |
... | ... | @@ -142,7 +142,7 @@ public class SysNoticeServiceImpl extends AbstractBaseService<SysNoticeMapper, S |
142 | 142 | save, |
143 | 143 | new LambdaQueryWrapper<SysNotice>() |
144 | 144 | .eq(SysNotice::getId, save.getId()) |
145 | - .eq(SysNotice::getTenantCode,tenantId)); | |
145 | + .eq(SysNotice::getTenantId,tenantId)); | |
146 | 146 | if (update > 0) { |
147 | 147 | // 发送消息 |
148 | 148 | String[] split = save.getReceiverTypeIds().split(","); |
... | ... | @@ -151,7 +151,7 @@ public class SysNoticeServiceImpl extends AbstractBaseService<SysNoticeMapper, S |
151 | 151 | SysNoticeUser sysNoticeUser = new SysNoticeUser(); |
152 | 152 | sysNoticeUser.setReceiverId(split[i]); |
153 | 153 | sysNoticeUser.setNoticeId(save.getId()); |
154 | - sysNoticeUser.setTenantCode(save.getTenantCode()); | |
154 | + sysNoticeUser.setTenantId(save.getTenantId()); | |
155 | 155 | sysNoticeUser.setReadStatus(FastIotConstants.ReadState.UNREAD); |
156 | 156 | list.add(sysNoticeUser); |
157 | 157 | } | ... | ... |
... | ... | @@ -24,7 +24,7 @@ public class SysPlatformDesignServiceImpl |
24 | 24 | @Override |
25 | 25 | public boolean save(SysPlatformDesignDTO sysAppDesignDTO,String tenantId) { |
26 | 26 | SysPlatformDesign entity = sysAppDesignDTO.getEntity(SysPlatformDesign.class); |
27 | - entity.setTenantCode(tenantId); | |
27 | + entity.setTenantId(tenantId); | |
28 | 28 | return baseMapper.insert(entity) > 0; |
29 | 29 | } |
30 | 30 | |
... | ... | @@ -33,7 +33,7 @@ public class SysPlatformDesignServiceImpl |
33 | 33 | SysPlatformDesign sysPlatformDesign = baseMapper |
34 | 34 | .selectOne( |
35 | 35 | new LambdaQueryWrapper<SysPlatformDesign>() |
36 | - .eq(SysPlatformDesign::getTenantCode, tenantId)); | |
36 | + .eq(SysPlatformDesign::getTenantId, tenantId)); | |
37 | 37 | return sysPlatformDesign == null ? null : sysPlatformDesign.getDTO(SysPlatformDesignDTO.class); |
38 | 38 | } |
39 | 39 | |
... | ... | @@ -43,7 +43,7 @@ public class SysPlatformDesignServiceImpl |
43 | 43 | return baseMapper.update( |
44 | 44 | sysAppDesignDTO.getEntity(SysPlatformDesign.class), |
45 | 45 | new LambdaQueryWrapper<SysPlatformDesign>() |
46 | - .eq(SysPlatformDesign::getTenantCode, tenantId)) | |
46 | + .eq(SysPlatformDesign::getTenantId, tenantId)) | |
47 | 47 | > 0; |
48 | 48 | }else { |
49 | 49 | return save(sysAppDesignDTO,tenantId); | ... | ... |
... | ... | @@ -58,11 +58,11 @@ public class YtAlarmContactServiceImpl extends AbstractBaseService<AlarmContactM |
58 | 58 | /** |
59 | 59 | * 新增租户 |
60 | 60 | * |
61 | - * @param tenantCode 租户编码 | |
61 | + * @param tenantId 租户编码 | |
62 | 62 | * @return alarmContactDTO |
63 | 63 | */ |
64 | - private LambdaQueryWrapper<AlarmContact> tenantWapper(String tenantCode) { | |
65 | - return new QueryWrapper<AlarmContact>().lambda().eq(AlarmContact::getTenantId, tenantCode); | |
64 | + private LambdaQueryWrapper<AlarmContact> tenantWapper(String tenantId) { | |
65 | + return new QueryWrapper<AlarmContact>().lambda().eq(AlarmContact::getTenantId, tenantId); | |
66 | 66 | } |
67 | 67 | |
68 | 68 | @Override | ... | ... |
... | ... | @@ -25,7 +25,7 @@ public class YtAlarmInfoServiceImpl implements YtAlarmInfoService { |
25 | 25 | // |
26 | 26 | // |
27 | 27 | // private LambdaQueryWrapper<YtAlarmInfo> tenantWapper(String tenantCode) { |
28 | -// return new QueryWrapper<AlarmInfo>().lambda().eq(AlarmInfo::getTenantCode, tenantCode); | |
28 | +// return new QueryWrapper<AlarmInfo>().lambda().eq(AlarmInfo::getTenantId, tenantCode); | |
29 | 29 | // } |
30 | 30 | |
31 | 31 | /** |
... | ... | @@ -36,7 +36,7 @@ public class YtAlarmInfoServiceImpl implements YtAlarmInfoService { |
36 | 36 | */ |
37 | 37 | /* private AlarmInfoDTO update(AlarmInfoDTO alarmInfoDto) { |
38 | 38 | AlarmInfo alarmInfo = baseMapper.selectById(alarmInfoDto.getId()); |
39 | - if (!alarmInfo.getTenantCode().equals(SecurityContext.getCurrentUser().getTenantCode())) { | |
39 | + if (!alarmInfo.getTenantId().equals(SecurityContext.getCurrentUser().getTenantId())) { | |
40 | 40 | return null; |
41 | 41 | } |
42 | 42 | alarmInfoDto.copyToEntity(alarmInfo); |
... | ... | @@ -51,7 +51,7 @@ public class YtAlarmInfoServiceImpl implements YtAlarmInfoService { |
51 | 51 | * @return alarmInfoDto |
52 | 52 | */ |
53 | 53 | /*private AlarmInfoDTO insert(AlarmInfoDTO alarmInfoDto) { |
54 | - String tenantCode = SecurityContext.getCurrentUser().getTenantCode(); | |
54 | + String tenantCode = SecurityContext.getCurrentUser().getTenantId(); | |
55 | 55 | LambdaQueryWrapper<AlarmInfo> Wrapper = |
56 | 56 | tenantWapper(tenantCode) |
57 | 57 | .eq(AlarmInfo::getStatus, alarmInfoDto.getStatus()) |
... | ... | @@ -61,7 +61,7 @@ public class YtAlarmInfoServiceImpl implements YtAlarmInfoService { |
61 | 61 | throw new DataValidationException("告警中心数据已经存在"); |
62 | 62 | } |
63 | 63 | // 保存租户编码 |
64 | - alarmInfoDto.setTenantCode(tenantCode); | |
64 | + alarmInfoDto.setTenantId(tenantCode); | |
65 | 65 | AlarmInfo alarmInfo = alarmInfoDto.getEntity(AlarmInfo.class); |
66 | 66 | |
67 | 67 | int insertCount = baseMapper.insert(alarmInfo); |
... | ... | @@ -102,7 +102,7 @@ public class YtAlarmInfoServiceImpl implements YtAlarmInfoService { |
102 | 102 | LambdaQueryWrapper<AlarmInfo> queryWrapper = |
103 | 103 | new QueryWrapper<AlarmInfo>() |
104 | 104 | .lambda() |
105 | - .eq(AlarmInfo::getTenantCode, SecurityContext.getCurrentUser().getTenantCode()) | |
105 | + .eq(AlarmInfo::getTenantId, SecurityContext.getCurrentUser().getTenantId()) | |
106 | 106 | .in(AlarmInfo::getId, alarmIds); |
107 | 107 | baseMapper.delete(queryWrapper); |
108 | 108 | return true; |
... | ... | @@ -116,7 +116,7 @@ public class YtAlarmInfoServiceImpl implements YtAlarmInfoService { |
116 | 116 | */ |
117 | 117 | @Override |
118 | 118 | public PageData<AlarmInfoDTO> page(Map<String, Object> queryMap) { |
119 | - /* queryMap.put("tenantCode", SecurityContext.getCurrentUser().getTenantCode()); | |
119 | + /* queryMap.put("tenantCode", SecurityContext.getCurrentUser().getTenantId()); | |
120 | 120 | IPage<AlarmInfo> page = getPage(queryMap, FastIotConstants.DefaultOrder.CREATE_TIME,false); |
121 | 121 | IPage<AlarmInfo> alarmInfoIPage = alarmInfoBaseMapper.selectPage(page,queryMap);*/ |
122 | 122 | |
... | ... | @@ -150,7 +150,7 @@ public class YtAlarmInfoServiceImpl implements YtAlarmInfoService { |
150 | 150 | baseMapper.selectList( |
151 | 151 | new QueryWrapper<AlarmInfo>() |
152 | 152 | .lambda() |
153 | - .eq(AlarmInfo::getTenantCode, SecurityContext.getCurrentUser().getTenantCode()) | |
153 | + .eq(AlarmInfo::getTenantId, SecurityContext.getCurrentUser().getTenantId()) | |
154 | 154 | .like( |
155 | 155 | StringUtils.isNotBlank(alarmInfoDto.getStatus()), |
156 | 156 | AlarmInfo::getStatus, | ... | ... |
... | ... | @@ -60,9 +60,9 @@ public class YtAlarmServiceImpl extends AbstractBaseService<AlarmContactMapper, |
60 | 60 | * @param tenantCode |
61 | 61 | * @return alarmContactDTO |
62 | 62 | */ |
63 | - private LambdaQueryWrapper<AlarmContact> tenantWapper(String tenantCode) { | |
63 | + private LambdaQueryWrapper<AlarmContact> tenantWapper(String tenantId) { | |
64 | 64 | return new QueryWrapper<AlarmContact>().lambda() |
65 | - .eq(AlarmContact::getTenantId, tenantCode); | |
65 | + .eq(AlarmContact::getTenantId, tenantId); | |
66 | 66 | } |
67 | 67 | @Override |
68 | 68 | @Transactional | ... | ... |
... | ... | @@ -263,7 +263,7 @@ public class YtDeviceProfileServiceImpl |
263 | 263 | // cacheUtils |
264 | 264 | // .get( |
265 | 265 | // FastIotConstants.CacheConfigKey.DEFAULT_RULE_CHAIN, |
266 | -// SecurityContext.getCurrentUser().getTenantCode()); | |
266 | +// SecurityContext.getCurrentUser().getTenantId()); | |
267 | 267 | // if (null != result && result.isPresent()) { |
268 | 268 | // return result.get(); |
269 | 269 | // } |
... | ... | @@ -280,7 +280,7 @@ public class YtDeviceProfileServiceImpl |
280 | 280 | // defaultId = tbRuleChain.getId().getId(); |
281 | 281 | // cacheUtils.put( |
282 | 282 | // FastIotConstants.CacheConfigKey.DEFAULT_RULE_CHAIN, |
283 | -// SecurityContext.getCurrentUser().getTenantCode(), | |
283 | +// SecurityContext.getCurrentUser().getTenantId(), | |
284 | 284 | // defaultId); |
285 | 285 | // return defaultId; |
286 | 286 | // } | ... | ... |
... | ... | @@ -343,7 +343,7 @@ public class YtDeviceServiceImpl extends AbstractBaseService<DeviceMapper, YtDev |
343 | 343 | |
344 | 344 | @Override |
345 | 345 | public PageData<DeviceDTO> page(String tenantId,Map<String, Object> queryMap) { |
346 | - queryMap.put("tenantCode", tenantId); | |
346 | + queryMap.put("tenantId", tenantId); | |
347 | 347 | String organizationId = (String) queryMap.get("organizationId"); |
348 | 348 | if (!StringUtils.isEmpty(organizationId)) { |
349 | 349 | List<String> organizationIds = new ArrayList<>(); | ... | ... |
... | ... | @@ -94,13 +94,13 @@ public class YtMessageConfigServiceImpl |
94 | 94 | * |
95 | 95 | * @param messageType 消息类型 |
96 | 96 | * @param platform 平台类型 |
97 | - * @param tenantCode 租户Code | |
97 | + * @param tenantId 租户Code | |
98 | 98 | * @return 启用的配置信息 |
99 | 99 | */ |
100 | 100 | @Override |
101 | 101 | public MessageConfigDTO getEnableConfigByMessageAndPlatform( |
102 | - String messageType, String platform, String tenantCode) { | |
103 | - return baseMapper.getEnableConfigByMessageAndPlatform(messageType, platform, tenantCode); | |
102 | + String messageType, String platform, String tenantId) { | |
103 | + return baseMapper.getEnableConfigByMessageAndPlatform(messageType, platform, tenantId); | |
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
... | ... | @@ -137,13 +137,13 @@ public class YtMessageConfigServiceImpl |
137 | 137 | * 检查MessageConfig状态 |
138 | 138 | * |
139 | 139 | * @param configDTO MessageConfig配置 |
140 | - * @param tenantCode 租户Code | |
140 | + * @param tenantId 租户Code | |
141 | 141 | */ |
142 | - private void checkMessageConfig(MessageConfigDTO configDTO, String tenantCode) { | |
142 | + private void checkMessageConfig(MessageConfigDTO configDTO, String tenantId) { | |
143 | 143 | // 查询该租户下是否有相同消息类型和平台的配置已经启用 |
144 | 144 | MessageConfigDTO enableConfig = |
145 | 145 | getEnableConfigByMessageAndPlatform( |
146 | - configDTO.getMessageType(), configDTO.getPlatformType(), tenantCode); | |
146 | + configDTO.getMessageType(), configDTO.getPlatformType(), tenantId); | |
147 | 147 | if (null != enableConfig && !enableConfig.getId().equalsIgnoreCase(configDTO.getId())) { |
148 | 148 | throw new DataValidationException("enabled config is existed"); |
149 | 149 | } | ... | ... |
... | ... | @@ -27,7 +27,7 @@ public class YtMessageTemplateServiceImpl |
27 | 27 | implements YtMessageTemplateService { |
28 | 28 | @Override |
29 | 29 | public PageData<MessageTemplateDTO> page(Map<String, Object> queryMap) { |
30 | -// queryMap.put("tenantCode",SecurityContext.getCurrentUser().getTenantCode()); | |
30 | +// queryMap.put("tenantCode",SecurityContext.getCurrentUser().getTenantId()); | |
31 | 31 | IPage<MessageTemplate> configIPage = getPage(queryMap, FastIotConstants.DefaultOrder.CREATE_TIME,false); |
32 | 32 | IPage<MessageTemplateDTO> iPage = baseMapper.getTemplatePage(configIPage,queryMap); |
33 | 33 | return getPageData(iPage, MessageTemplateDTO.class); |
... | ... | @@ -38,7 +38,7 @@ public class YtMessageTemplateServiceImpl |
38 | 38 | public MessageTemplateDTO saveMessageTemplate(MessageTemplateDTO templateDTO) { |
39 | 39 | MessageTemplate messageTemplate = new MessageTemplate(); |
40 | 40 | templateDTO.copyToEntity(messageTemplate); |
41 | -// messageTemplate.setTenantCode(SecurityContext.getCurrentUser().getTenantCode()); | |
41 | +// messageTemplate.setTenantId(SecurityContext.getCurrentUser().getTenantId()); | |
42 | 42 | baseMapper.insert(messageTemplate); |
43 | 43 | messageTemplate.copyToDTO(templateDTO); |
44 | 44 | return templateDTO; |
... | ... | @@ -54,7 +54,7 @@ public class YtMessageTemplateServiceImpl |
54 | 54 | @Transactional |
55 | 55 | public MessageTemplateDTO updateMessageTemplate(MessageTemplateDTO templateDTO) { |
56 | 56 | |
57 | -// String tenantCode = SecurityContext.getCurrentUser().getTenantCode(); | |
57 | +// String tenantCode = SecurityContext.getCurrentUser().getTenantId(); | |
58 | 58 | //查询该租户下 是否已经启用相同消息类型、相同用途的模板 |
59 | 59 | MessageTemplateDTO queryTemplate = new MessageTemplateDTO(); |
60 | 60 | queryTemplate.setTemplatePurpose(templateDTO.getTemplatePurpose()); |
... | ... | @@ -69,7 +69,7 @@ public class YtMessageTemplateServiceImpl |
69 | 69 | } |
70 | 70 | MessageTemplate messageTemplate = baseMapper.selectById(templateDTO.getId()); |
71 | 71 | templateDTO.copyToEntity(messageTemplate); |
72 | -// messageTemplate.setTenantCode(tenantCode); | |
72 | +// messageTemplate.setTenantId(tenantCode); | |
73 | 73 | baseMapper.updateById(messageTemplate); |
74 | 74 | messageTemplate.copyToDTO(templateDTO); |
75 | 75 | return templateDTO; |
... | ... | @@ -77,7 +77,7 @@ public class YtMessageTemplateServiceImpl |
77 | 77 | |
78 | 78 | @Override |
79 | 79 | public List<MessageTemplateDTO> findMessageTemplate(MessageTemplateDTO templateDTO) { |
80 | -// templateDTO.setTenantCode(SecurityContext.getCurrentUser().getTenantCode()); | |
80 | +// templateDTO.setTenantId(SecurityContext.getCurrentUser().getTenantId()); | |
81 | 81 | return baseMapper.findMessageTemplate(templateDTO); |
82 | 82 | } |
83 | 83 | } | ... | ... |
... | ... | @@ -91,7 +91,7 @@ public class YtNoticeServiceImpl implements YtNoticeService { |
91 | 91 | Optional.ofNullable(alarmContactList).ifPresent(contacts ->{ |
92 | 92 | QueryWrapper<MessageTemplate> messageTemplateQueryWrapper=new QueryWrapper<MessageTemplate>(); |
93 | 93 | messageTemplateQueryWrapper.lambda() |
94 | -// .eq(MessageTemplate::getTenantCode, SecurityContext.getCurrentUser().getTenantCode()) | |
94 | +// .eq(MessageTemplate::getTenantId, SecurityContext.getCurrentUser().getTenantId()) | |
95 | 95 | .eq(MessageTemplate::getTemplatePurpose, MsgTemplatePurposeEnum.FOR_ALARM_NOTICE.name()) |
96 | 96 | .eq(MessageTemplate::getStatus, AssetStatusEnum.ENABLE.ordinal()); |
97 | 97 | List<MessageTemplate>templateList = messageTemplateMapper.selectList(messageTemplateQueryWrapper); | ... | ... |
... | ... | @@ -45,13 +45,13 @@ public class YtOrganizationServiceImpl extends AbstractBaseService<OrganizationM |
45 | 45 | } else { |
46 | 46 | if (!organization |
47 | 47 | .getTenantId() |
48 | - .equals(null)) {//TODO getCurrentUser().getTenantCode() | |
48 | + .equals(null)) {//TODO getCurrentUser().getTenantId() | |
49 | 49 | throw new DataValidationException("parent organization not exist."); |
50 | 50 | } |
51 | 51 | } |
52 | 52 | } |
53 | 53 | Organization organization = new Organization(); |
54 | - organizationDTO.setTenantCode(tenantId); | |
54 | + organizationDTO.setTenantId(tenantId); | |
55 | 55 | organizationDTO.copyToEntity(organization, "id"); |
56 | 56 | baseMapper.insert(organization); |
57 | 57 | organization.copyToDTO(organizationDTO); |
... | ... | @@ -68,7 +68,7 @@ public class YtOrganizationServiceImpl extends AbstractBaseService<OrganizationM |
68 | 68 | Set<String> idToDelete = |
69 | 69 | baseMapper |
70 | 70 | .findOrganizationTreeList( |
71 | - null, Arrays.asList(ids))//TODO getCurrentUser().getTenantCode() | |
71 | + null, Arrays.asList(ids))//TODO getCurrentUser().getTenantId() | |
72 | 72 | .stream() |
73 | 73 | .map(OrganizationDTO::getId) |
74 | 74 | .collect(Collectors.toSet()); |
... | ... | @@ -87,7 +87,7 @@ public class YtOrganizationServiceImpl extends AbstractBaseService<OrganizationM |
87 | 87 | // List<Device> deviceList = deviceMapper.selectList( |
88 | 88 | // new QueryWrapper<Device>() |
89 | 89 | // .lambda() |
90 | -// .eq(Device::getTenantCode, getCurrentUser().getTenantCode()) | |
90 | +// .eq(Device::getTenantId, getCurrentUser().getTenantId()) | |
91 | 91 | // .eq(Device::getOrganizationId,ids)); |
92 | 92 | // if (!deviceList.isEmpty()) { |
93 | 93 | // throw new DataValidationException("待删除数据存在关联设备,不能删除!"); |
... | ... | @@ -111,8 +111,8 @@ public class YtOrganizationServiceImpl extends AbstractBaseService<OrganizationM |
111 | 111 | // if (StringUtils.isNotBlank(organizationDTO.getParentId())) { |
112 | 112 | // Organization parentOrganization = baseMapper.selectById(organizationDTO.getParentId()); |
113 | 113 | // if (parentOrganization |
114 | -// .getTenantCode() | |
115 | -// .equals(getCurrentUser().getTenantCode())) { | |
114 | +// .getTenantId() | |
115 | +// .equals(getCurrentUser().getTenantId())) { | |
116 | 116 | // parent = parentOrganization; |
117 | 117 | // } |
118 | 118 | // } |
... | ... | @@ -140,7 +140,7 @@ public class YtOrganizationServiceImpl extends AbstractBaseService<OrganizationM |
140 | 140 | @Override |
141 | 141 | public List<OrganizationDTO> getMyOrganizations() { |
142 | 142 | // if (getCurrentUser().isTenantAdmin()) { |
143 | -// return findOrganizationTree(getCurrentUser().getTenantCode()); | |
143 | +// return findOrganizationTree(getCurrentUser().getTenantId()); | |
144 | 144 | // } else { |
145 | 145 | // Set<String> organizationIds = |
146 | 146 | // userOrganizationMappingMapper |
... | ... | @@ -157,16 +157,16 @@ public class YtOrganizationServiceImpl extends AbstractBaseService<OrganizationM |
157 | 157 | // baseMapper.selectList( |
158 | 158 | // new QueryWrapper<Organization>() |
159 | 159 | // .lambda() |
160 | -// .eq(Organization::getTenantCode, getCurrentUser().getTenantCode()) | |
160 | +// .eq(Organization::getTenantId, getCurrentUser().getTenantId()) | |
161 | 161 | // .in(organizationIds.size() > 0, Organization::getId, organizationIds)); |
162 | 162 | // return TreeUtils.buildTree(ReflectUtils.sourceToTarget(organizations, OrganizationDTO.class)); |
163 | 163 | // } |
164 | 164 | return null; |
165 | 165 | } |
166 | 166 | |
167 | - private List<OrganizationDTO> findOrganizationTree(String tenantCode) { | |
167 | + private List<OrganizationDTO> findOrganizationTree(String tenantId) { | |
168 | 168 | List<OrganizationDTO> organizationTreeList = |
169 | - baseMapper.findOrganizationTreeList(tenantCode, null); | |
169 | + baseMapper.findOrganizationTreeList(tenantId, null); | |
170 | 170 | return buildOrganizationDTOTree(organizationTreeList); |
171 | 171 | } |
172 | 172 | |
... | ... | @@ -198,14 +198,14 @@ public class YtOrganizationServiceImpl extends AbstractBaseService<OrganizationM |
198 | 198 | // if (user == null) { |
199 | 199 | // throw new DataValidationException("所选用户不存在"); |
200 | 200 | // } |
201 | -// if (!user.getTenantCode().equals(getCurrentUser().getTenantCode())) { | |
201 | +// if (!user.getTenantId().equals(getCurrentUser().getTenantId())) { | |
202 | 202 | // throw new DataValidationException("所选用户不可用"); |
203 | 203 | // } |
204 | 204 | // if (null != organizationIds && organizationIds.length > 0) { |
205 | 205 | // Set<String> newBinding = |
206 | 206 | // baseMapper |
207 | 207 | // .findOrganizationTreeList( |
208 | -// getCurrentUser().getTenantCode(), Arrays.asList(organizationIds)) | |
208 | +// getCurrentUser().getTenantId(), Arrays.asList(organizationIds)) | |
209 | 209 | // .stream() |
210 | 210 | // .map(OrganizationDTO::getId) |
211 | 211 | // .collect(Collectors.toSet()); | ... | ... |
... | ... | @@ -97,7 +97,7 @@ public class YtSmsServiceImpl implements YtSmsService { |
97 | 97 | smsLog.setMessageTemplateId(messageTemplate.getId()); |
98 | 98 | smsLog.setTemplateParam(JacksonUtil.toJsonNode(JacksonUtil.toString(templateParam))); |
99 | 99 | smsLog.setSendTime(LocalDateTime.now()); |
100 | - smsLog.setTenantCode(messageTemplate.getTenantId()); | |
100 | + smsLog.setTenantId(messageTemplate.getTenantId()); | |
101 | 101 | smsLog.setTemplatePurpose(smsReqDTO.getTemplatePurpose()); |
102 | 102 | smsLogMapper.insert(smsLog); |
103 | 103 | return ResponseCodeEnum.SUCCESS.name().equals(result); | ... | ... |
... | ... | @@ -41,7 +41,7 @@ public class YtTenantServiceImpl extends AbstractBaseService<TenantMapper, Tenan |
41 | 41 | public TenantDTO createNewTenant(TenantReqDTO tenantReqDTO) { |
42 | 42 | TenantDTO tenantDTO = new TenantDTO(); |
43 | 43 | BeanUtils.copyProperties(tenantReqDTO, tenantDTO); |
44 | - processTenantCode(tenantDTO); | |
44 | + processTenantId(tenantDTO); | |
45 | 45 | Tenant tenant = tenantDTO.getEntity(Tenant.class); |
46 | 46 | baseMapper.insert(tenant); |
47 | 47 | // 调用TB API |
... | ... | @@ -75,7 +75,7 @@ public class YtTenantServiceImpl extends AbstractBaseService<TenantMapper, Tenan |
75 | 75 | }); |
76 | 76 | } |
77 | 77 | |
78 | - private void processTenantCode(TenantDTO tenantDTO) { | |
78 | + private void processTenantId(TenantDTO tenantDTO) { | |
79 | 79 | if (tenantDTO.getTenantId() != null) { |
80 | 80 | if (tenantDTO.getTenantId().length() > 30) { |
81 | 81 | throw new DataValidationException("tenant code too long"); |
... | ... | @@ -84,7 +84,7 @@ public class YtTenantServiceImpl extends AbstractBaseService<TenantMapper, Tenan |
84 | 84 | baseMapper.selectCount( |
85 | 85 | new QueryWrapper<Tenant>() |
86 | 86 | .lambda() |
87 | - .eq(Tenant::getTenantCode, tenantDTO.getTenantId())); | |
87 | + .eq(Tenant::getTenantId, tenantDTO.getTenantId())); | |
88 | 88 | if (count > 0) { |
89 | 89 | throw new DataValidationException("tenant code already exist"); |
90 | 90 | } |
... | ... | @@ -100,10 +100,10 @@ public class YtTenantServiceImpl extends AbstractBaseService<TenantMapper, Tenan |
100 | 100 | if (tenant == null) { |
101 | 101 | throw new DataValidationException("tenant does not exist"); |
102 | 102 | } |
103 | - String existTenantCode = tenant.getTenantCode(); | |
103 | + String existTenantId = tenant.getTenantId(); | |
104 | 104 | tenantDTO.copyToEntity(tenant); |
105 | 105 | // tenantCode is immutable |
106 | - tenant.setTenantCode(existTenantCode); | |
106 | + tenant.setTenantId(existTenantId); | |
107 | 107 | baseMapper.updateById(tenant); |
108 | 108 | tenant.copyToDTO(tenantDTO); |
109 | 109 | return tenantDTO; |
... | ... | @@ -114,9 +114,9 @@ public class YtTenantServiceImpl extends AbstractBaseService<TenantMapper, Tenan |
114 | 114 | public boolean deleteTenants(String[] idArr) { |
115 | 115 | Set<String> ids = Set.of(idArr); |
116 | 116 | |
117 | - Set<String> tenantCodes = baseMapper.getTenantCodesByTenantIds(ids); | |
117 | + Set<String> tenantIds = baseMapper.getTenantIdsByTenantIds(ids); | |
118 | 118 | // 1. GET ALL ROLE_ID |
119 | - Set<String> allRoleIds = roleMapper.getAllIdsByTenantCode(tenantCodes); | |
119 | + Set<String> allRoleIds = roleMapper.getAllIdsByTenantId(tenantIds); | |
120 | 120 | // 2. DELETE SYS_ROLE SYS_ROLE_MENU SYS_USER_ROLE |
121 | 121 | if (!allRoleIds.isEmpty()) { |
122 | 122 | roleMapper.deleteBatchIds(allRoleIds); |
... | ... | @@ -124,20 +124,20 @@ public class YtTenantServiceImpl extends AbstractBaseService<TenantMapper, Tenan |
124 | 124 | roleMapper.deleteRoleUserMappingByRoleIds(allRoleIds); |
125 | 125 | } |
126 | 126 | // 3. DELETE SYS_MENU SYS_TENANT_MENU |
127 | - Set<String> allMenuIds = menuMapper.getAllIdsByTenantCode(tenantCodes); | |
127 | + Set<String> allMenuIds = menuMapper.getAllIdsByTenantId(tenantIds); | |
128 | 128 | if (!allMenuIds.isEmpty()) { |
129 | 129 | menuMapper.deleteBatchIds(allMenuIds); |
130 | 130 | menuMapper.deleteTenantMenuMappingByMenuIds(allMenuIds); |
131 | 131 | } |
132 | 132 | // 4. DELETE USER |
133 | - userMapper.delete(new QueryWrapper<User>().lambda().in(User::getTenantId, tenantCodes)); | |
133 | + userMapper.delete(new QueryWrapper<User>().lambda().in(User::getTenantId, tenantIds)); | |
134 | 134 | // 5. TELL RULE ENGINE TO STOP TENANT |
135 | 135 | // 6. DELETE OTHER RESOURCES IF ANY |
136 | 136 | // 7. DELETE TENANT |
137 | 137 | baseMapper.deleteBatchIds(ids); |
138 | 138 | // 删除 TENANT_ROLE、TENANT_MENU |
139 | - deleteTenantRolesByTenantCode(tenantCodes); | |
140 | - deleteTenantMenusByTenantCode(tenantCodes); | |
139 | + deleteTenantRolesByTenantId(tenantIds); | |
140 | + deleteTenantMenusByTenantId(tenantIds); | |
141 | 141 | // TODO 调用TB的API删除TB租户信息 |
142 | 142 | |
143 | 143 | return true; |
... | ... | @@ -145,20 +145,20 @@ public class YtTenantServiceImpl extends AbstractBaseService<TenantMapper, Tenan |
145 | 145 | |
146 | 146 | /** |
147 | 147 | * 通过租户Code删除租户角色关系 |
148 | - * @param tenantCodes 租户Code | |
148 | + * @param tenantIds 租户Code | |
149 | 149 | */ |
150 | - private void deleteTenantRolesByTenantCode(Set<String> tenantCodes) { | |
150 | + private void deleteTenantRolesByTenantId(Set<String> tenantIds) { | |
151 | 151 | tenantRoleMapper.delete( |
152 | - new QueryWrapper<TenantRole>().lambda().in(TenantRole::getTenantCode, tenantCodes)); | |
152 | + new QueryWrapper<TenantRole>().lambda().in(TenantRole::getTenantId, tenantIds)); | |
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
156 | 156 | * 通过租户Code删除租户角色关系 |
157 | - * @param tenantCodes 租户Code | |
157 | + * @param tenantIds 租户Code | |
158 | 158 | */ |
159 | - private void deleteTenantMenusByTenantCode(Set<String> tenantCodes) { | |
159 | + private void deleteTenantMenusByTenantId(Set<String> tenantIds) { | |
160 | 160 | tenantMenuMapper.delete( |
161 | - new QueryWrapper<TenantMenu>().lambda().in(TenantMenu::getTenantCode, tenantCodes)); | |
161 | + new QueryWrapper<TenantMenu>().lambda().in(TenantMenu::getTenantId, tenantIds)); | |
162 | 162 | } |
163 | 163 | |
164 | 164 | @Override |
... | ... | @@ -184,14 +184,14 @@ public class YtTenantServiceImpl extends AbstractBaseService<TenantMapper, Tenan |
184 | 184 | } |
185 | 185 | |
186 | 186 | @Override |
187 | - public List<String> getTenantRolesByTenantCode(String tenantCode) { | |
188 | - if(StringUtils.isEmpty(tenantCode)){ | |
187 | + public List<String> getTenantRolesByTenantId(String tenantId) { | |
188 | + if(StringUtils.isEmpty(tenantId)){ | |
189 | 189 | throw new DataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage()); |
190 | 190 | } |
191 | 191 | List<String> roles = new ArrayList<>(); |
192 | 192 | List<TenantRole> tenantRoleList = tenantRoleMapper |
193 | 193 | .selectList( |
194 | - new QueryWrapper<TenantRole>().lambda().eq(TenantRole::getTenantCode, tenantCode)); | |
194 | + new QueryWrapper<TenantRole>().lambda().eq(TenantRole::getTenantId, tenantId)); | |
195 | 195 | tenantRoleList.forEach(role->roles.add(role.getRoleId())); |
196 | 196 | return roles; |
197 | 197 | } |
... | ... | @@ -199,18 +199,18 @@ public class YtTenantServiceImpl extends AbstractBaseService<TenantMapper, Tenan |
199 | 199 | /** |
200 | 200 | * 保存租户与菜单、角色的映射关系 |
201 | 201 | * |
202 | - * @param tenantCode 租户Code | |
202 | + * @param tenantId 租户Code | |
203 | 203 | * @param roleIds 角色IDS |
204 | 204 | */ |
205 | - private void saveTenantMapping(String tenantCode, String[] roleIds) { | |
205 | + private void saveTenantMapping(String tenantId, String[] roleIds) { | |
206 | 206 | // 添加租户角色关系 |
207 | 207 | for (String roleId : roleIds) { |
208 | - saveTenantRoleMapping(roleId,tenantCode); | |
208 | + saveTenantRoleMapping(roleId,tenantId); | |
209 | 209 | // 查询roleId有多少菜单 |
210 | 210 | Set<String> menuIds = roleMapper.getMenuIdsByRoleId(roleId); |
211 | 211 | // 添加租户菜单关系 |
212 | 212 | for (String menuId : menuIds) { |
213 | - saveTenantMenuMapping(menuId,tenantCode); | |
213 | + saveTenantMenuMapping(menuId,tenantId); | |
214 | 214 | } |
215 | 215 | } |
216 | 216 | } |
... | ... | @@ -218,23 +218,23 @@ public class YtTenantServiceImpl extends AbstractBaseService<TenantMapper, Tenan |
218 | 218 | /** |
219 | 219 | * 保存租户与菜单的关系 |
220 | 220 | * @param menuId 菜单ID |
221 | - * @param tenantCode 租户Code | |
221 | + * @param tenantId 租户Code | |
222 | 222 | */ |
223 | - private void saveTenantMenuMapping(String menuId,String tenantCode){ | |
223 | + private void saveTenantMenuMapping(String menuId,String tenantId){ | |
224 | 224 | TenantMenu tenantMenu = new TenantMenu(); |
225 | 225 | tenantMenu.setMenuId(menuId); |
226 | - tenantMenu.setTenantCode(tenantCode); | |
226 | + tenantMenu.setTenantId(tenantId); | |
227 | 227 | tenantMenuMapper.insert(tenantMenu); |
228 | 228 | } |
229 | 229 | |
230 | 230 | /** |
231 | 231 | * 保存租户与角色的关系 |
232 | 232 | * @param roleId 角色ID |
233 | - * @param tenantCode 租户Code | |
233 | + * @param tenantId 租户Code | |
234 | 234 | */ |
235 | - private void saveTenantRoleMapping(String roleId,String tenantCode){ | |
235 | + private void saveTenantRoleMapping(String roleId,String tenantId){ | |
236 | 236 | TenantRole tenantRole = new TenantRole(); |
237 | - tenantRole.setTenantCode(tenantCode); | |
237 | + tenantRole.setTenantId(tenantId); | |
238 | 238 | tenantRole.setRoleId(roleId); |
239 | 239 | tenantRoleMapper.insert(tenantRole); |
240 | 240 | } | ... | ... |
... | ... | @@ -59,8 +59,8 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User> imp |
59 | 59 | private final TenantRoleMapper tenantRoleMapper; |
60 | 60 | |
61 | 61 | private final YtSmsService ytSmsService; |
62 | - private final MessageTemplateService messageTemplateService; | |
63 | - private final OrganizationService groupService; | |
62 | + private final YtMessageTemplateService messageTemplateService; | |
63 | + private final YtOrganizationService groupService; | |
64 | 64 | |
65 | 65 | public static final String ACTIVATE_URL_PATTERN = "%s/api/noauth/activate?activateToken=%s"; |
66 | 66 | private final PasswordEncoder passwordEncoder; |
... | ... | @@ -97,38 +97,38 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User> imp |
97 | 97 | } |
98 | 98 | if (isAdminOperate) { |
99 | 99 | // 添加的租户管理员 |
100 | - if (StringUtils.isNotBlank(userDTO.getTenantCode())) { | |
101 | - user.setTenantCode(userDTO.getTenantCode()); | |
100 | + if (StringUtils.isNotBlank(userDTO.getTenantId())) { | |
101 | + user.setTenantId(userDTO.getTenantId()); | |
102 | 102 | user.setPassword(passwordEncoder.encode(DEFAULT_PWD)); |
103 | 103 | int tenantExist = |
104 | 104 | tenantMapper.selectCount( |
105 | 105 | new QueryWrapper<Tenant>() |
106 | 106 | .lambda() |
107 | - .eq(Tenant::getTenantCode, userDTO.getTenantCode())); | |
107 | + .eq(Tenant::getTenantId, userDTO.getTenantId())); | |
108 | 108 | if (tenantExist == 0) { |
109 | 109 | throw new DataValidationException("tenant must exist"); |
110 | 110 | } |
111 | 111 | } else { |
112 | 112 | // 添加的平台系统其他用户 |
113 | 113 | user.setLevel(FastIotConstants.LevelValue.IS_OTHER_ADMIN); |
114 | - user.setTenantCode(tenantId); | |
114 | + user.setTenantId(tenantId); | |
115 | 115 | } |
116 | 116 | userExist = |
117 | 117 | baseMapper.selectCount( |
118 | 118 | new QueryWrapper<User>() |
119 | 119 | .lambda() |
120 | 120 | .eq(User::getUsername, userDTO.getUsername()) |
121 | - .eq(User::getTenantCode, userDTO.getTenantCode())) | |
121 | + .eq(User::getTenantId, userDTO.getTenantId())) | |
122 | 122 | > 0; |
123 | 123 | } else { |
124 | 124 | user.setLevel(FastIotConstants.LevelValue.IS_NORMAL); |
125 | - user.setTenantCode(tenantId); | |
125 | + user.setTenantId(tenantId); | |
126 | 126 | userExist = |
127 | 127 | baseMapper.selectCount( |
128 | 128 | new QueryWrapper<User>() |
129 | 129 | .lambda() |
130 | 130 | .eq(User::getUsername, userDTO.getUsername()) |
131 | - .eq(User::getTenantCode, tenantId)) | |
131 | + .eq(User::getTenantId, tenantId)) | |
132 | 132 | > 0; |
133 | 133 | } |
134 | 134 | if (userExist) { |
... | ... | @@ -170,7 +170,7 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User> imp |
170 | 170 | public String getActivationLink(String userId,boolean isPtSysadmin,String tenantId) { |
171 | 171 | User user = baseMapper.selectById(userId); |
172 | 172 | if (!isPtSysadmin |
173 | - && tenantId.equals(user.getTenantCode())) { | |
173 | + && tenantId.equals(user.getTenantId())) { | |
174 | 174 | throw new AccessDeniedException( |
175 | 175 | "you don't have permission to get activation link for this user"); |
176 | 176 | } |
... | ... | @@ -202,7 +202,7 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User> imp |
202 | 202 | userInfoDTO.setUserId(userId); |
203 | 203 | userInfoDTO.setRealName(user.getRealName()); |
204 | 204 | userInfoDTO.setAvatar(user.getAvatar()); |
205 | - userInfoDTO.setTenantCode(tenantId); | |
205 | + userInfoDTO.setTenantId(tenantId); | |
206 | 206 | userInfoDTO.setRoles(currentRoles); |
207 | 207 | Set<Role> roles = roleMapper.selectRoleByUserId(userId); |
208 | 208 | Set<PlainRolesDTO> plainRolesDTOSet = Sets.newHashSet(); |
... | ... | @@ -224,7 +224,7 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User> imp |
224 | 224 | UserDTO userDTO = new UserDTO(); |
225 | 225 | user.copyToDTO(userDTO, PASSWORD, ACTIVATE_TOKEN); |
226 | 226 | if (!isPtSysadmin |
227 | - && !tenantId.equals(user.getTenantCode())) { | |
227 | + && !tenantId.equals(user.getTenantId())) { | |
228 | 228 | return Optional.empty(); |
229 | 229 | } |
230 | 230 | return Optional.of(userDTO); |
... | ... | @@ -239,7 +239,7 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User> imp |
239 | 239 | Assert.notNull(userDTO.getId(), "user is must be specified"); |
240 | 240 | User user = baseMapper.selectById(userDTO.getId()); |
241 | 241 | if (!isPtSysadmin |
242 | - && !user.getTenantCode().equals(tenantId)) { | |
242 | + && !user.getTenantId().equals(tenantId)) { | |
243 | 243 | throw new NoneTenantAssetException("this user not belong to current tenant"); |
244 | 244 | } |
245 | 245 | if (!user.getUsername().equals(userDTO.getUsername())) { |
... | ... | @@ -284,7 +284,7 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User> imp |
284 | 284 | Map<String, Object> map = new HashMap<>(); |
285 | 285 | map.put("realName", queryMap.get("realName")); |
286 | 286 | map.put("username", queryMap.get("username")); |
287 | - map.put("tenantCode", tenantId); | |
287 | + map.put("tenantId", tenantId); | |
288 | 288 | userPage = baseMapper.getUserPage(userIPage, map); |
289 | 289 | } |
290 | 290 | if (null != userPage) { |
... | ... | @@ -325,7 +325,7 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User> imp |
325 | 325 | baseMapper.selectCount( |
326 | 326 | new QueryWrapper<User>() |
327 | 327 | .lambda() |
328 | - .ne(User::getTenantCode, tenantId) | |
328 | + .ne(User::getTenantId, tenantId) | |
329 | 329 | .in(User::getId, userIds)); |
330 | 330 | if (notTenantUserCount > 0) { |
331 | 331 | throw new AccessDeniedException("cannot delete user that not belong to your tenant"); |
... | ... | @@ -365,7 +365,7 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User> imp |
365 | 365 | tenantRoleMapper.selectList( |
366 | 366 | new QueryWrapper<TenantRole>() |
367 | 367 | .lambda() |
368 | - .eq(TenantRole::getTenantCode, userDTO.getTenantCode())); | |
368 | + .eq(TenantRole::getTenantId, userDTO.getTenantId())); | |
369 | 369 | // 保存用户与角色的映射信息 |
370 | 370 | if (null == tenantRoleList || tenantRoleList.size() == 0) { |
371 | 371 | throw new FastIotException(ErrorMessage.INVALID_PARAMETER); |
... | ... | @@ -388,7 +388,7 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User> imp |
388 | 388 | if (user == null) { |
389 | 389 | return; |
390 | 390 | } |
391 | - if (tenantId.equals(user.getTenantCode())) { | |
391 | + if (tenantId.equals(user.getTenantId())) { | |
392 | 392 | baseMapper.setPassword2NullAndInsertActiveToken( |
393 | 393 | userId, RandomStringUtils.randomAlphabetic(10)); |
394 | 394 | } |
... | ... | @@ -434,7 +434,7 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User> imp |
434 | 434 | public Optional<List<UserDTO>> getOrganizationUserByOrganizationId(String groupId,String tenantId) { |
435 | 435 | Organization group = organizationMapper.selectById(groupId); |
436 | 436 | if (group == null |
437 | - || !group.getTenantCode().equals(tenantId)) { | |
437 | + || !group.getTenantId().equals(tenantId)) { | |
438 | 438 | return Optional.empty(); |
439 | 439 | } |
440 | 440 | Set<String> userIds = |
... | ... | @@ -508,7 +508,7 @@ public class YtUserServiceImpl extends AbstractBaseService<UserMapper, User> imp |
508 | 508 | throw new DataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage()); |
509 | 509 | } |
510 | 510 | UserDTO userDTO = new UserDTO(); |
511 | - userDTO.setTenantCode(tenantId); | |
511 | + userDTO.setTenantId(tenantId); | |
512 | 512 | userDTO.setUsername(userName); |
513 | 513 | return baseMapper.findUserInfo(userDTO); |
514 | 514 | } | ... | ... |
... | ... | @@ -13,7 +13,7 @@ import java.util.Set; |
13 | 13 | |
14 | 14 | @Mapper |
15 | 15 | public interface MenuMapper extends BaseMapper<Menu> { |
16 | - List<MenuDTO> selectTenantMenu(String tenantCode); | |
16 | + List<MenuDTO> selectTenantMenu(String tenantId); | |
17 | 17 | |
18 | 18 | List<MenuDTO> selectSysAdminMenu(); |
19 | 19 | |
... | ... | @@ -21,27 +21,27 @@ public interface MenuMapper extends BaseMapper<Menu> { |
21 | 21 | |
22 | 22 | int deleteTenantMenuMappingByMenuIds(@Param("menuIds") Collection<String> menuIds); |
23 | 23 | |
24 | - Set<String> selectTenantMenuIds(String tenantCode); | |
24 | + Set<String> selectTenantMenuIds(String tenantId); | |
25 | 25 | |
26 | 26 | Set<String> selectRoleMenuIds(String roleId); |
27 | 27 | |
28 | - Set<String> getAllIdsByTenantCode(@Param("tenantCodes") Collection<String> tenantCodes); | |
28 | + Set<String> getAllIdsByTenantId(@Param("tenantIds") Collection<String> tenantIds); | |
29 | 29 | |
30 | 30 | int addMenuToTenant( |
31 | - @Param("tenantCode") String tenantCode, @Param("menuIds") Collection<String> menuIds); | |
31 | + @Param("tenantId") String tenantId, @Param("menuIds") Collection<String> menuIds); | |
32 | 32 | |
33 | 33 | int addMenuToRole( |
34 | 34 | @Param("roleId") String roleId, @Param("menuIds") Collection<String> menuIds); |
35 | 35 | |
36 | 36 | int removeMenuFromTenant( |
37 | - @Param("tenantCode") String tenantCode, @Param("menuIds") Collection<String> menuIds); | |
37 | + @Param("tenantId") String tenantId, @Param("menuIds") Collection<String> menuIds); | |
38 | 38 | |
39 | 39 | int removeMenuFromRole( |
40 | 40 | @Param("roleId") String roleId, @Param("menuIds") Collection<String> menuIds); |
41 | 41 | |
42 | 42 | Set<String> getAllPermission(); |
43 | 43 | |
44 | - Set<String> getAllPermissionsByTenantCode(String tenantCode); | |
44 | + Set<String> getAllPermissionsByTenantId(String tenantId); | |
45 | 45 | |
46 | 46 | Set<String> getAllPermissionsByUserId(String userId); |
47 | 47 | } | ... | ... |
... | ... | @@ -11,5 +11,5 @@ public interface MessageConfigMapper extends BaseMapper<MessageConfig> { |
11 | 11 | MessageConfigDTO getEnableConfigByMessageAndPlatform( |
12 | 12 | @Param("messageType") String messageType, |
13 | 13 | @Param("platformType") String platformType, |
14 | - @Param("tenantCode") String tenantCode); | |
14 | + @Param("tenantId") String tenantId); | |
15 | 15 | } | ... | ... |
... | ... | @@ -14,10 +14,10 @@ public interface OrganizationMapper extends BaseMapper<Organization> { |
14 | 14 | /** |
15 | 15 | * 通过租户code和组织Id递归查询其组织及子组织的List |
16 | 16 | * |
17 | - * @param tenantCode 租户code | |
17 | + * @param tenantId 租户code | |
18 | 18 | * @param organizationIds 待查询的组织ID,可以为空 |
19 | 19 | * @return 组织及子组织,直到叶节点 |
20 | 20 | */ |
21 | 21 | List<OrganizationDTO> findOrganizationTreeList( |
22 | - @Param("tenantCode") String tenantCode, @Param("organizationIds") Collection<String> organizationIds); | |
22 | + @Param("tenantId") String tenantId, @Param("organizationIds") Collection<String> organizationIds); | |
23 | 23 | } | ... | ... |
... | ... | @@ -23,7 +23,7 @@ public interface RoleMapper extends BaseMapper<Role> { |
23 | 23 | |
24 | 24 | int deleteRoleUserMappingByUserIds(@Param("userIds") Collection<String> userIds); |
25 | 25 | |
26 | - Set<String> getAllIdsByTenantCode(@Param("tenantCodes") Collection<String> tenantCodes); | |
26 | + Set<String> getAllIdsByTenantId(@Param("tenantIds") Collection<String> tenantIds); | |
27 | 27 | |
28 | 28 | Set<String> checkRoleUserMappingByRoleIds(@Param("ids") Collection<String> ids); |
29 | 29 | ... | ... |
... | ... | @@ -12,11 +12,11 @@ public interface SysDictMapper extends BaseMapper<SysDict> { |
12 | 12 | /** |
13 | 13 | * 根据租户Code和字典编码获取字典信息 |
14 | 14 | * |
15 | - * @param tenantCode 租户Code | |
15 | + * @param tenantId 租户Code | |
16 | 16 | * @param dictCode 字典信息 |
17 | 17 | * @return SysDictDTO字典信息 |
18 | 18 | */ |
19 | 19 | SysDictDTO getDictInfoByCode( |
20 | - @Param("tenantCode") String tenantCode, | |
20 | + @Param("tenantId") String tenantId, | |
21 | 21 | @Param("dictCode") String dictCode); |
22 | 22 | } | ... | ... |
... | ... | @@ -14,8 +14,8 @@ import org.thingsboard.server.dao.yunteng.entities.SysEnterprise; |
14 | 14 | @Mapper |
15 | 15 | public interface SysEnterpriseMapper extends BaseMapper<SysEnterprise> { |
16 | 16 | /** |
17 | - * @param tenantCode | |
17 | + * @param tenantId | |
18 | 18 | * @return |
19 | 19 | */ |
20 | - SysEnterpriseDTO get(@Param("tenantCode") String tenantCode); | |
20 | + SysEnterpriseDTO get(@Param("tenantId") String tenantId); | |
21 | 21 | } | ... | ... |
... | ... | @@ -26,5 +26,5 @@ public interface SysNoticeMapper extends BaseMapper<SysNotice> { |
26 | 26 | * @param id |
27 | 27 | * @return 消息详情 |
28 | 28 | */ |
29 | - SysNotice get(@Param("id") String id, @Param("tenantCode") String tenantCode); | |
29 | + SysNotice get(@Param("id") String id, @Param("tenantId") String tenantId); | |
30 | 30 | } | ... | ... |
... | ... | @@ -25,8 +25,8 @@ public interface SysNoticeUserMapper extends BaseMapper<SysNoticeUser> { |
25 | 25 | |
26 | 26 | /** |
27 | 27 | * @param id |
28 | - * @param tenantCode | |
28 | + * @param tenantId | |
29 | 29 | * @return |
30 | 30 | */ |
31 | - SysNoticeUserDTO get(@Param("id") String id, @Param("tenantCode") String tenantCode); | |
31 | + SysNoticeUserDTO get(@Param("id") String id, @Param("tenantId") String tenantId); | |
32 | 32 | } | ... | ... |
... | ... | @@ -12,7 +12,7 @@ import java.util.Set; |
12 | 12 | |
13 | 13 | @Mapper |
14 | 14 | public interface TenantMapper extends BaseMapper<Tenant> { |
15 | - Set<String> getTenantCodesByTenantIds(@Param("tenantIds") Collection<String> tenantIds); | |
15 | + Set<String> getTenantIdsByTenantIds(@Param("tenantIds") Collection<String> tenantIds); | |
16 | 16 | |
17 | 17 | IPage<TenantDTO> getTenantPage(IPage<?> page, @Param("tenantName") String tenantName); |
18 | 18 | } | ... | ... |
... | ... | @@ -23,11 +23,11 @@ public interface UserMapper extends BaseMapper<User> { |
23 | 23 | IPage<UserDTO> getUserPage(IPage<?> page, @Param("queryMap") Map<String, Object> queryMap); |
24 | 24 | |
25 | 25 | IPage<UserDTO> getAdminUserPage( |
26 | - IPage<?> page, @Param("tenantCode") String tenantCode, @Param("roleType") String roleType); | |
26 | + IPage<?> page, @Param("tenantId") String tenantId, @Param("roleType") String roleType); | |
27 | 27 | |
28 | 28 | IPage<UserDTO> selectAllTenantUser(IPage<?> page); |
29 | 29 | |
30 | - Set<String> getAllIdsByTenantCode(@Param("tenantCodes") Collection<String> tenantCodes); | |
30 | + Set<String> getAllIdsByTenantId(@Param("tenantIds") Collection<String> tenantIds); | |
31 | 31 | |
32 | 32 | void setPassword2NullAndInsertActiveToken( |
33 | 33 | @Param("userId") String userId, @Param("activeToken") String activeToken); | ... | ... |
... | ... | @@ -18,7 +18,7 @@ public interface YtMessageConfigService { |
18 | 18 | MessageConfigDTO updateMessageConfig(String tenantId,MessageConfigDTO configDTO); |
19 | 19 | |
20 | 20 | MessageConfigDTO getEnableConfigByMessageAndPlatform( |
21 | - String messageType, String platform, String tenantCode); | |
21 | + String messageType, String platform, String tenantId); | |
22 | 22 | |
23 | 23 | MessageConfigDTO findMessageConfigById(String id); |
24 | 24 | ... | ... |
... | ... | @@ -8,7 +8,7 @@ import org.thingsboard.server.common.data.yunteng.dto.OrganizationDTO; |
8 | 8 | import java.util.List; |
9 | 9 | import java.util.Set; |
10 | 10 | |
11 | -public interface OrganizationService { | |
11 | +public interface YtOrganizationService { | |
12 | 12 | OrganizationDTO saveOrganization(OrganizationDTO organizationDTO,String tenantId); |
13 | 13 | |
14 | 14 | boolean deleteOrganizations(DeleteDTO deleteDTO,String tenantId); | ... | ... |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
3 | + | |
4 | +<mapper namespace="com.codeez.mapper.AlarmContactMapper"> | |
5 | + <resultMap id="alarmContactMap" type="org.thingsboard.server.common.data.yunteng.dto.AlarmContactDTO" > | |
6 | + <result property="id" column="id"/> | |
7 | + <result property="username" column="username"/> | |
8 | + <result property="organizationId" column="organization_id"/> | |
9 | + <result property="phone" column="phone"/> | |
10 | + <result property="email" column="email"/> | |
11 | + <result property="wechat" column="wechat"/> | |
12 | + <result property="dingtalk" column="dingtalk"/> | |
13 | + <result property="remark" column="remark"/> | |
14 | + <result property="addPeople" column="add_people"/> | |
15 | + <result property="updateTime" column="update_time"/> | |
16 | + <result property="createTime" column="create_time"/> | |
17 | + <result property="creator" column="creator"/> | |
18 | + | |
19 | + </resultMap> | |
20 | + | |
21 | +</mapper> | ... | ... |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
3 | + | |
4 | +<mapper namespace="org.thingsboard.server.dao.yunteng.mapper.DeviceMapper"> | |
5 | + <resultMap type="org.thingsboard.server.common.data.yunteng.dto.DeviceDTO" id="deviceMap"> | |
6 | + <result property="id" column="id"/> | |
7 | + <result property="name" column="name"/> | |
8 | + <result property="deviceInfo" column="device_info" | |
9 | + typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/> | |
10 | + <result property="profileId" column="profile_id"/> | |
11 | + <result property="activeTime" column="active_time"/> | |
12 | + <result property="deviceType" column="device_type" typeHandler="org.apache.ibatis.type.EnumTypeHandler"/> | |
13 | + <result property="deviceState" column="device_state" typeHandler="org.apache.ibatis.type.EnumTypeHandler"/> | |
14 | + <result property="alarmStatus" column="alarm_status"/> | |
15 | + <result property="deviceToken" column="device_token"/> | |
16 | + <result property="tenantId" column="tenant_id"/> | |
17 | + <result property="tbDeviceId" column="tb_device_id"/> | |
18 | + <result property="label" column="label"/> | |
19 | + <result property="lastConnectTime" column="last_connect_time"/> | |
20 | + <result property="createTime" column="create_time"/> | |
21 | + <result property="updateTime" column="update_time"/> | |
22 | + <result property="creator" column="creator"/> | |
23 | + <result property="updater" column="updater"/> | |
24 | + <result property="organizationId" column="organization_id"/> | |
25 | + <association property="deviceProfile" javaType="org.thingsboard.server.common.data.yunteng.dto.DeviceProfileDTO"> | |
26 | + <result property="name" column="profile_name"/> | |
27 | + </association> | |
28 | + <association property="organizationDTO" javaType="org.thingsboard.server.common.data.yunteng.dto.OrganizationDTO"> | |
29 | + <result property="name" column="organization_name"/> | |
30 | + </association> | |
31 | + </resultMap> | |
32 | + <sql id="columns"> | |
33 | + ifd.id,ifd.name,ifd.device_info,ifd.profile_id,ifd.active_time,ifd.device_token,ifd.tenant_id | |
34 | + ,ifd.tb_device_id,ifd.label,ifd.last_connect_time,ifd.device_type,ifd.device_state,ifd.create_time,ifd.update_time,ifd.creator, | |
35 | + ifd.updater,ifd.organization_id,ifd,alarm_status | |
36 | + </sql> | |
37 | + <select id="getDevicePage" resultMap="deviceMap"> | |
38 | + SELECT | |
39 | + <include refid="columns"/>,ifdp.name AS profile_name,io.name AS organization_name | |
40 | + FROM iotfs_device ifd | |
41 | + LEFT JOIN iotfs_device_profile ifdp ON ifd.profile_id = ifdp.id | |
42 | + LEFT JOIN iotfs_organization io ON io.id = ifd.organization_id | |
43 | + <where> | |
44 | + <if test="queryMap.tenantId !=null and queryMap.tenantId !=''"> | |
45 | + AND ifd.tenant_id = #{queryMap.tenantId} | |
46 | + </if> | |
47 | + <if test="queryMap.profileId !=null and queryMap.profileId !=''"> | |
48 | + AND ifd.profile_id = #{queryMap.profileId} | |
49 | + </if> | |
50 | + <if test="queryMap.name !=null and queryMap.name !=''"> | |
51 | + AND ifd.name LIKE concat('%',#{queryMap.name}::TEXT,'%') | |
52 | + </if> | |
53 | + <if test="queryMap.deviceType !=null and queryMap.deviceType !=''"> | |
54 | + AND ifd.device_type = #{queryMap.deviceType} | |
55 | + </if> | |
56 | + <if test="queryMap.deviceState !=null and queryMap.deviceState !=''"> | |
57 | + AND ifd.device_state = #{queryMap.deviceState} | |
58 | + </if> | |
59 | + <if test="queryMap.alarmStatus !=null"> | |
60 | + AND ifd.alarm_status = #{queryMap.alarmStatus} | |
61 | + </if> | |
62 | + <if test="queryMap.organizationIds !=null"> | |
63 | + AND ifd.organization_id IN | |
64 | + <foreach collection="queryMap.organizationIds" item="organizationId" open="(" separator="," close=")"> | |
65 | + #{organizationId} | |
66 | + </foreach> | |
67 | + </if> | |
68 | + </where> | |
69 | + </select> | |
70 | +</mapper> | ... | ... |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
3 | + | |
4 | +<mapper namespace="org.thingsboard.server.dao.yunteng.mapper.DeviceProfileMapper"> | |
5 | + <resultMap type="org.thingsboard.server.common.data.yunteng.dto.DeviceProfileDTO" id="deviceProfileMap"> | |
6 | + <result property="id" column="id"/> | |
7 | + <result property="name" column="name"/> | |
8 | + <result property="convertJs" column="convert_js"/> | |
9 | + <result property="description" column="description"/> | |
10 | + <result property="transportType" column="transport_type" typeHandler="org.apache.ibatis.type.EnumTypeHandler"/> | |
11 | + <result property="tbProfileId" column="tb_profile_id"/> | |
12 | + <result property="tenantId" column="tenant_id"/> | |
13 | + <result property="createTime" column="create_time"/> | |
14 | + <result property="updateTime" column="update_time"/> | |
15 | + <result property="creator" column="creator"/> | |
16 | + <result property="updater" column="updater"/> | |
17 | + </resultMap> | |
18 | + <select id="getDeviceProfileInfo" resultMap="deviceProfileMap"> | |
19 | + SELECT id,name | |
20 | + ,convert_js,description,transport_type,tb_profile_id,tenant_id,create_time,update_time,creator,updater FROM | |
21 | + iotfs_device_profile | |
22 | + <where> | |
23 | + <if test="id !=null and id!=''"> | |
24 | + AND id = #{id} | |
25 | + </if> | |
26 | + </where> | |
27 | + </select> | |
28 | +</mapper> | ... | ... |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
3 | + | |
4 | +<mapper namespace="com.codeez.mapper.DeviceTypeMapper"> | |
5 | + <resultMap type="org.thingsboard.server.common.data.yunteng.dto.DeviceTypeDTO" id="deviceTypeMap"> | |
6 | + <result property="id" column="id"/> | |
7 | + <result property="name" column="name"/> | |
8 | + <result property="parentId" column="parent_id"/> | |
9 | + <result property="path" column="path"/> | |
10 | + <result property="sort" column="sort"/> | |
11 | + <result property="tenantId" column="tenant_id"/> | |
12 | + <result property="createTime" column="create_time"/> | |
13 | + <result property="updateTime" column="update_time"/> | |
14 | + <result property="creator" column="creator"/> | |
15 | + <result property="updater" column="updater"/> | |
16 | + </resultMap> | |
17 | +</mapper> | ... | ... |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
3 | + | |
4 | +<mapper namespace="com.codeez.mapper.MaiLogMapper"> | |
5 | + <resultMap id="mailLogDTO" type="org.thingsboard.server.common.data.yunteng.dto.MailLogDTO" > | |
6 | + <result property="id" column="id"/> | |
7 | + <result property="emailFrom" column="email_from"/> | |
8 | + <result property="emailTo" column="email_to" | |
9 | + typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/> | |
10 | + <result property="emailCc" column="email_cc" | |
11 | + typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/> | |
12 | + <result property="emailBcc" column="email_bcc" | |
13 | + typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/> | |
14 | + <result property="emailSubject" column="email_subject"/> | |
15 | + <result property="emailBody" column="email_body"/> | |
16 | + <result property="status" column="status"/> | |
17 | + <result property="sendTime" column="send_time"/> | |
18 | + <result property="tenantId" column="tenant_id"/> | |
19 | + <result property="messageTemplateId" column="message_template_id"/> | |
20 | + <result property="remark" column="remark"/> | |
21 | + </resultMap> | |
22 | +</mapper> | ... | ... |
... | ... | @@ -10,7 +10,7 @@ |
10 | 10 | <result property="type" column="type" typeHandler="org.apache.ibatis.type.EnumTypeHandler"/> |
11 | 11 | <result property="permission" column="permission"/> |
12 | 12 | <result property="sort" column="sort"/> |
13 | - <result property="tenantCode" column="tenant_code"/> | |
13 | + <result property="tenantId" column="tenant_id"/> | |
14 | 14 | <result property="component" column="component"/> |
15 | 15 | <result property="meta" column="meta" |
16 | 16 | typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/> |
... | ... | @@ -35,14 +35,14 @@ |
35 | 35 | case_sensitive, |
36 | 36 | create_time, |
37 | 37 | update_time, |
38 | - tenant_code | |
38 | + tenant_id | |
39 | 39 | </sql> |
40 | 40 | <select id="selectTenantMenu" resultMap="menuDTOMap"> |
41 | 41 | SELECT |
42 | 42 | <include refid="menuDTOMapColumn"> |
43 | 43 | </include> |
44 | 44 | FROM sys_menu |
45 | - WHERE id IN (SELECT menu_id FROM sys_tenant_menu WHERE tenant_code = #{tenantCode}) | |
45 | + WHERE id IN (SELECT menu_id FROM sys_tenant_menu WHERE tenant_id = #{tenantId}) | |
46 | 46 | </select> |
47 | 47 | |
48 | 48 | <select id="selectMyMenu" resultMap="menuDTOMap"> |
... | ... | @@ -66,7 +66,7 @@ |
66 | 66 | <select id="selectTenantMenuIds" resultType="java.lang.String"> |
67 | 67 | SELECT menu_id |
68 | 68 | FROM sys_tenant_menu |
69 | - WHERE tenant_code = #{tenantCode} | |
69 | + WHERE tenant_id = #{tenantId} | |
70 | 70 | </select> |
71 | 71 | |
72 | 72 | <select id="selectRoleMenuIds" resultType="java.lang.String"> |
... | ... | @@ -76,9 +76,9 @@ |
76 | 76 | </select> |
77 | 77 | |
78 | 78 | <insert id="addMenuToTenant"> |
79 | - INSERT INTO sys_tenant_menu(menu_id , tenant_code) VALUES | |
79 | + INSERT INTO sys_tenant_menu(menu_id , tenant_id) VALUES | |
80 | 80 | <foreach collection="menuIds" item="menuId" index="index" separator=","> |
81 | - (#{menuId},#{tenantCode}) | |
81 | + (#{menuId},#{tenantId}) | |
82 | 82 | </foreach> |
83 | 83 | </insert> |
84 | 84 | |
... | ... | @@ -90,7 +90,7 @@ |
90 | 90 | </insert> |
91 | 91 | <delete id="removeMenuFromTenant"> |
92 | 92 | DELETE FROM sys_tenant_menu WHERE |
93 | - tenant_code =#{tenantCode} AND menu_id IN | |
93 | + tenant_id =#{tenantId} AND menu_id IN | |
94 | 94 | <foreach collection="menuIds" item="menuId" open="(" separator="," close=")"> |
95 | 95 | #{menuId} |
96 | 96 | </foreach> |
... | ... | @@ -104,10 +104,10 @@ |
104 | 104 | </foreach> |
105 | 105 | </delete> |
106 | 106 | |
107 | - <select id="getAllIdsByTenantCode" resultType="java.lang.String"> | |
108 | - SELECT id FROM sys_menu WHERE tenant_code IN | |
109 | - <foreach collection="tenantCodes" item="tenantCode" open="(" separator="," close=")"> | |
110 | - #{tenantCode} | |
107 | + <select id="getAllIdsByTenantId" resultType="java.lang.String"> | |
108 | + SELECT id FROM sys_menu WHERE tenant_id IN | |
109 | + <foreach collection="tenantIds" item="tenantId" open="(" separator="," close=")"> | |
110 | + #{tenantId} | |
111 | 111 | </foreach> |
112 | 112 | </select> |
113 | 113 | |
... | ... | @@ -116,11 +116,11 @@ |
116 | 116 | FROM sys_menu |
117 | 117 | </select> |
118 | 118 | |
119 | - <select id="getAllPermissionsByTenantCode" resultType="java.lang.String"> | |
119 | + <select id="getAllPermissionsByTenantId" resultType="java.lang.String"> | |
120 | 120 | SELECT permission |
121 | 121 | FROM sys_menu |
122 | 122 | WHERE id IN |
123 | - (SELECT menu_id FROM sys_tenant_menu WHERE tenant_code = #{tenantCode}) | |
123 | + (SELECT menu_id FROM sys_tenant_menu WHERE tenant_id = #{tenantId}) | |
124 | 124 | </select> |
125 | 125 | |
126 | 126 | <select id="getAllPermissionsByUserId" resultType="java.lang.String"> | ... | ... |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
3 | + | |
4 | +<mapper namespace="org.thingsboard.server.dao.yunteng.mapper.MessageConfigMapper"> | |
5 | + <resultMap id="messageConfigDTOMap" type="org.thingsboard.server.common.data.yunteng.dto.MessageConfigDTO"> | |
6 | + <result property="id" column="id"/> | |
7 | + <result property="platformType" column="platform_type"/> | |
8 | + <result property="config" column="config" | |
9 | + typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/> | |
10 | + <result property="tenantId" column="tenant_id"/> | |
11 | + <result property="messageType" column="message_type"/> | |
12 | + <result property="status" column="status"/> | |
13 | + <result property="creator" column="creator"/> | |
14 | + <result property="createTime" column="create_time"/> | |
15 | + <result property="updater" column="updater"/> | |
16 | + <result property="updateTime" column="update_time"/> | |
17 | + <result property="configName" column="config_name"/> | |
18 | + </resultMap> | |
19 | + | |
20 | + <sql id="columns"> | |
21 | + id | |
22 | + ,platform_type,config,config_name,tenant_id,message_type,status,creator,create_time,updater,update_time | |
23 | + </sql> | |
24 | + <select id="getEnableConfigByMessageAndPlatform" resultMap="messageConfigDTOMap"> | |
25 | + SELECT | |
26 | + <include refid="columns"/> | |
27 | + FROM message_config | |
28 | + <where> | |
29 | + status = 1 | |
30 | + <if test="messageType !=null and messageType != ''">AND message_type = #{messageType}</if> | |
31 | + <if test="platformType !=null and platformType != ''">AND platform_type = #{platformType}</if> | |
32 | + <if test="tenantId !=null and tenantId != ''">AND tenant_id = #{tenantId}</if> | |
33 | + </where> | |
34 | + </select> | |
35 | +</mapper> | ... | ... |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
3 | + | |
4 | +<mapper namespace="org.thingsboard.server.dao.yunteng.mapper.MessageTemplateMapper"> | |
5 | + <resultMap id="messageTemplateDTOMap" type="org.thingsboard.server.common.data.yunteng.dto.MessageTemplateDTO"> | |
6 | + <result property="id" column="id"/> | |
7 | + <result property="templateCode" column="template_code"/> | |
8 | + <result property="templateName" column="template_name"/> | |
9 | + <result property="signName" column="sign_name"/> | |
10 | + <result property="messageConfigId" column="message_config_id"/> | |
11 | + <result property="messageType" column="message_type"/> | |
12 | + <result property="templatePurpose" column="template_purpose"/> | |
13 | + <result property="creator" column="creator"/> | |
14 | + <result property="createTime" column="create_time"/> | |
15 | + <result property="updater" column="updater"/> | |
16 | + <result property="updateTime" column="update_time"/> | |
17 | + <result property="status" column="status"/> | |
18 | + <association property="messageConfig" javaType="org.thingsboard.server.common.data.yunteng.dto.MessageConfigDTO"> | |
19 | + <result property="configName" column="config_name"/> | |
20 | + </association> | |
21 | + </resultMap> | |
22 | + <sql id="columns"> | |
23 | + mt.id,mt.template_code,mt.template_name,mt.sign_name,mt.message_config_id,mt.template_purpose,mt.creator, | |
24 | + mt.create_time,mt.updater,mt.update_time,mt.message_type,mc.config_name,mt.status | |
25 | + </sql> | |
26 | + <select id="getTemplatePage" resultMap="messageTemplateDTOMap"> | |
27 | + SELECT | |
28 | + <include refid="columns"/> | |
29 | + FROM message_template mt LEFT JOIN message_config mc ON | |
30 | + mt.message_config_id=mc.id | |
31 | + <where> | |
32 | + <if test="queryMap.tenantId !=null and queryMap.tenantId != ''">mc.tenant_id = #{queryMap.tenantId}</if> | |
33 | + <if test="queryMap.templateCode !=null and queryMap.templateCode != ''"> | |
34 | + AND mt.template_code LIKE concat('%',#{queryMap.templateCode}::TEXT,'%') | |
35 | + </if> | |
36 | + <if test="queryMap.templateName !=null and queryMap.templateName != ''"> | |
37 | + AND mt.template_name LIKE concat('%',#{queryMap.templateName}::TEXT,'%') | |
38 | + </if> | |
39 | + </where> | |
40 | + </select> | |
41 | + | |
42 | + <select id="findMessageTemplate" resultMap="messageTemplateDTOMap"> | |
43 | + SELECT | |
44 | + <include refid="columns"/> | |
45 | + FROM message_template mt LEFT JOIN message_config mc ON | |
46 | + mt.message_config_id=mc.id | |
47 | + <where> | |
48 | + <if test="id !=null and id != ''">mt.id = #{id}</if> | |
49 | + <if test="tenantId !=null and tenantId != ''">AND mt.tenant_id = #{tenantId}</if> | |
50 | + <if test="templateCode !=null and templateCode != ''">AND mt.template_code = #{templateCode}</if> | |
51 | + <if test="messageConfigId !=null and messageConfigId != ''">AND mt.message_configId = #{messageConfigId}</if> | |
52 | + <if test="messageType !=null and messageType != ''">AND mt.message_type = #{messageType}</if> | |
53 | + <if test="templatePurpose !=null and templatePurpose != ''">AND mt.template_purpose = #{templatePurpose}</if> | |
54 | + <if test="status !=null">AND mt.status = #{status}</if> | |
55 | + </where> | |
56 | + </select> | |
57 | +</mapper> | ... | ... |
... | ... | @@ -16,9 +16,9 @@ |
16 | 16 | |
17 | 17 | <select id="findOrganizationTreeList" resultMap="organizationDTOMap"> |
18 | 18 | WITH RECURSIVE organization AS ( |
19 | - SELECT id, parent_id, name, sort,creator,create_time,updater,update_time,remark,tenant_code | |
19 | + SELECT id, parent_id, name, sort,creator,create_time,updater,update_time,remark,tenant_id | |
20 | 20 | FROM iotfs_organization |
21 | - WHERE tenant_code = #{tenantCode} | |
21 | + WHERE tenant_id = #{tenantId} | |
22 | 22 | <if test="organizationIds !=null and organizationIds.size() > 0"> |
23 | 23 | AND id IN |
24 | 24 | <foreach collection="organizationIds" item="organizationId" open="(" separator="," close=")"> |
... | ... | @@ -26,12 +26,12 @@ |
26 | 26 | </foreach> |
27 | 27 | </if> |
28 | 28 | UNION ALL |
29 | - SELECT ig.id, ig.parent_id, ig.name, ig.sort,ig.creator,ig.create_time,ig.updater,ig.update_time,ig.remark,ig.tenant_code | |
29 | + SELECT ig.id, ig.parent_id, ig.name, ig.sort,ig.creator,ig.create_time,ig.updater,ig.update_time,ig.remark,ig.tenant_id | |
30 | 30 | FROM iotfs_organization ig |
31 | 31 | JOIN organization ON ig.parent_id = organization.id |
32 | - WHERE ig.tenant_code = #{tenantCode} | |
32 | + WHERE ig.tenant_id = #{tenantId} | |
33 | 33 | ) |
34 | - SELECT id, parent_id, name, sort,creator,create_time,updater,update_time,remark,tenant_code | |
35 | - FROM organization WHERE tenant_code = #{tenantCode} | |
34 | + SELECT id, parent_id, name, sort,creator,create_time,updater,update_time,remark,tenant_id | |
35 | + FROM organization WHERE tenant_id = #{tenantId} | |
36 | 36 | </select> |
37 | 37 | </mapper> | ... | ... |
... | ... | @@ -6,7 +6,7 @@ |
6 | 6 | <result property="id" column="id"/> |
7 | 7 | <result property="name" column="name"/> |
8 | 8 | <result property="roleType" column="role_type"/> |
9 | - <result property="tenantCode" column="tenant_code"/> | |
9 | + <result property="tenantId" column="tenant_id"/> | |
10 | 10 | <result property="enabled" column="enabled"/> |
11 | 11 | <result property="creator" column="creator"/> |
12 | 12 | <result property="createTime" column="create_time"/> |
... | ... | @@ -22,8 +22,8 @@ |
22 | 22 | GROUP BY user_id |
23 | 23 | </select> |
24 | 24 | <delete id="deleteRoleBatchByTenantIds"> |
25 | - DELETE FROM sys_role WHERE tenant_code in ( | |
26 | - SELECT tenant_code FROM sys_tenant WHERE id IN | |
25 | + DELETE FROM sys_role WHERE tenant_id in ( | |
26 | + SELECT tenant_id FROM sys_tenant WHERE id IN | |
27 | 27 | <foreach collection="tenantIds" item="tenantId" open="(" separator="," close=")"> |
28 | 28 | #{tenantId} |
29 | 29 | </foreach> |
... | ... | @@ -58,10 +58,10 @@ |
58 | 58 | </foreach> |
59 | 59 | </delete> |
60 | 60 | |
61 | - <select id="getAllIdsByTenantCode" resultType="java.lang.String"> | |
62 | - SELECT id from sys_role WHERE tenant_code IN | |
63 | - <foreach collection="tenantCodes" item="tenantCode" open="(" separator="," close=")"> | |
64 | - #{tenantCode} | |
61 | + <select id="getAllIdsByTenantId" resultType="java.lang.String"> | |
62 | + SELECT id from sys_role WHERE tenant_id IN | |
63 | + <foreach collection="tenantIds" item="tenantId" open="(" separator="," close=")"> | |
64 | + #{tenantId} | |
65 | 65 | </foreach> |
66 | 66 | </select> |
67 | 67 | |
... | ... | @@ -83,11 +83,11 @@ |
83 | 83 | </delete> |
84 | 84 | |
85 | 85 | <select id="findRoleInfo" resultMap="roleDtoMap"> |
86 | - SELECT id,name,role_type,tenant_code,creator,create_time,updater,update_time,remark,code FROM sys_role | |
86 | + SELECT id,name,role_type,tenant_id,creator,create_time,updater,update_time,remark,code FROM sys_role | |
87 | 87 | <where> |
88 | 88 | enabled='t' |
89 | 89 | <if test="roleType !=null and roleType !=''">AND role_type=#{roleType}</if> |
90 | - <if test="tenantCode !=null and tenantCode !=''">AND tenant_code=#{tenantCode}</if> | |
90 | + <if test="tenantId !=null and tenantId !=''">AND tenant_id=#{tenantId}</if> | |
91 | 91 | <if test="code !=null and code !=''">AND code=#{code}</if> |
92 | 92 | <if test="roleIds !=null">OR id IN |
93 | 93 | <foreach collection="roleIds" item="id" open="(" separator="," close=")"> | ... | ... |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
3 | + | |
4 | +<mapper namespace="com.codeez.mapper.SmsLogMapper"> | |
5 | + <resultMap id="smsLogDTOMap" type="org.thingsboard.server.common.data.yunteng.dto.SmsLogDTO" > | |
6 | + <result property="id" column="id"/> | |
7 | + <result property="type" column="type"/> | |
8 | + <result property="status" column="status"/> | |
9 | + <result property="sendTime" column="send_time"/> | |
10 | + <result property="toPhone" column="to_phone"/> | |
11 | + <result property="templateParam" column="template_param" | |
12 | + typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/> | |
13 | + <result property="tenantId" column="tenant_id"/> | |
14 | + <result property="messageTemplateId" column="message_template_id"/> | |
15 | + </resultMap> | |
16 | +</mapper> | ... | ... |
... | ... | @@ -31,7 +31,7 @@ |
31 | 31 | LEFT JOIN sys_dict sd ON sd.ID = sdi.dict_id |
32 | 32 | <where> |
33 | 33 | sdi.status = 1 |
34 | - <if test="tenantCode !=null and tenantCode!=''">AND sd.tenant_code=#{tenantCode}</if> | |
34 | + <if test="tenantId !=null and tenantId!=''">AND sd.tenant_id=#{tenantId}</if> | |
35 | 35 | <if test="dictCode !=null and dictCode!=''">AND sd.dict_code = #{dictCode}</if> |
36 | 36 | <if test="itemValue !=null and itemValue!=''">AND sdi.item_value = #{itemValue}</if> |
37 | 37 | </where> | ... | ... |
... | ... | @@ -7,21 +7,21 @@ |
7 | 7 | <result property="dictName" column="dict_name"/> |
8 | 8 | <result property="dictCode" column="dict_code"/> |
9 | 9 | <result property="description" column="description"/> |
10 | - <result property="tenantCode" column="tenant_code"/> | |
10 | + <result property="tenantId" column="tenant_id"/> | |
11 | 11 | <result property="creator" column="creator"/> |
12 | 12 | <result property="createTime" column="create_time"/> |
13 | 13 | <result property="updater" column="updater"/> |
14 | 14 | <result property="updateTime" column="update_time"/> |
15 | 15 | </resultMap> |
16 | 16 | <sql id="columns"> |
17 | - id,dict_name,dict_code,description,tenant_code,creator,create_time,updater,update_time | |
17 | + id,dict_name,dict_code,description,tenant_id,creator,create_time,updater,update_time | |
18 | 18 | </sql> |
19 | 19 | <select id="getDictInfoByCode" resultMap="smsDictDTOMap"> |
20 | 20 | SELECT |
21 | 21 | <include refid="columns"/> |
22 | 22 | FROM sys_dict |
23 | 23 | <where> |
24 | - <if test="tenantCode != null and tenantCode !=''">tenant_code=#{tenantCode}</if> | |
24 | + <if test="tenantId != null and tenantId !=''">tenant_id=#{tenantId}</if> | |
25 | 25 | <if test="dictCode != null and dictCode !=''">AND dict_code=#{dictCode}</if> |
26 | 26 | </where> |
27 | 27 | </select> | ... | ... |
... | ... | @@ -16,7 +16,7 @@ |
16 | 16 | <result property="updater" column="updater"/> |
17 | 17 | <result property="createTime" column="create_time"/> |
18 | 18 | <result property="updateTime" column="update_time"/> |
19 | - <result property="tenantCode" column="tenant_code"/> | |
19 | + <result property="tenantId" column="tenant_id"/> | |
20 | 20 | </resultMap> |
21 | 21 | |
22 | 22 | <sql id="dict"> |
... | ... | @@ -47,13 +47,13 @@ |
47 | 47 | sn.updater updater, |
48 | 48 | sn.create_time create_time, |
49 | 49 | sn.update_time update_time, |
50 | - sn.tenant_code tenant_code | |
50 | + sn.tenant_id tenant_id | |
51 | 51 | FROM sys_notice sn |
52 | 52 | </sql> |
53 | 53 | <select id="page" resultMap="sysNotice"> |
54 | 54 | <include refid="columns"/> |
55 | 55 | WHERE |
56 | - sn.tenant_code = #{queryMap.tenantCode} | |
56 | + sn.tenant_id = #{queryMap.tenantId} | |
57 | 57 | <if test="queryMap.type != null"> |
58 | 58 | sn.type = #{queryMap.type} |
59 | 59 | </if> |
... | ... | @@ -61,7 +61,7 @@ |
61 | 61 | <select id="get" resultMap="sysNotice"> |
62 | 62 | <include refid="columns"/> |
63 | 63 | WHERE |
64 | - sn.tenant_code = #{tenantCode} | |
64 | + sn.tenant_id = #{tenantId} | |
65 | 65 | AND sn.id = #{id} |
66 | 66 | </select> |
67 | 67 | </mapper> | ... | ... |
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 | <result property="updater" column="updater"/> |
12 | 12 | <result property="createTime" column="create_time"/> |
13 | 13 | <result property="updateTime" column="update_time"/> |
14 | - <result property="tenantCode" column="tenant_code"/> | |
14 | + <result property="tenantId" column="tenant_id"/> | |
15 | 15 | <result property="id" column="id"/> |
16 | 16 | <association property="sysNotice" javaType="org.thingsboard.server.common.data.yunteng.dto.SysNoticeDTO"> |
17 | 17 | <result property="type" column="type" typeHandler="org.apache.ibatis.type.EnumTypeHandler"/> |
... | ... | @@ -36,7 +36,7 @@ |
36 | 36 | snu.updater updater, |
37 | 37 | snu.create_time create_time, |
38 | 38 | snu.update_time update_time, |
39 | - snu.tenant_code tenant_code, | |
39 | + snu.tenant_id tenant_id, | |
40 | 40 | snu.id id, |
41 | 41 | sn.type AS type, |
42 | 42 | sn.sender_name sender_name, |
... | ... | @@ -47,7 +47,7 @@ |
47 | 47 | <select id="page" resultMap="sysNoticeUser"> |
48 | 48 | <include refid="columns"/> |
49 | 49 | WHERE |
50 | - snu.tenant_code = #{queryMap.tenantCode} | |
50 | + snu.tenant_id = #{queryMap.tenantId} | |
51 | 51 | <if test="queryMap.type != null"> |
52 | 52 | AND sn.type = #{queryMap.type} |
53 | 53 | </if> |
... | ... | @@ -58,7 +58,7 @@ |
58 | 58 | <select id="get" resultMap="sysNoticeUser"> |
59 | 59 | <include refid="columns"/> |
60 | 60 | WHERE |
61 | - snu.tenant_code = #{tenantCode} | |
61 | + snu.tenant_id = #{tenantId} | |
62 | 62 | AND snu.id = #{id} |
63 | 63 | </select> |
64 | 64 | </mapper> | ... | ... |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
3 | + | |
4 | +<mapper namespace="org.thingsboard.server.dao.yunteng.mapper.TenantMapper"> | |
5 | + <resultMap type="org.thingsboard.server.common.data.yunteng.dto.TenantDTO" id="tenantDTOMap"> | |
6 | + <result property="id" column="id"/> | |
7 | + <result property="tenantId" column="tenant_id"/> | |
8 | + <result property="name" column="name"/> | |
9 | + <result property="enabled" column="enabled"/> | |
10 | + <result property="description" column="description"/> | |
11 | + <result property="defaultConfig" column="default_config"/> | |
12 | + <result property="tenantExpireTime" column="tenant_expire_time"/> | |
13 | + <result property="createTime" column="create_time"/> | |
14 | + <result property="icon" column="icon"/> | |
15 | + </resultMap> | |
16 | + <select id="getTenantIdsByTenantIds" resultType="java.lang.String"> | |
17 | + SELECT tenant_id FROM sys_tenant WHERE id IN | |
18 | + <foreach collection="tenantIds" item="tenantId" open="(" separator="," close=")"> | |
19 | + #{tenantId} | |
20 | + </foreach> | |
21 | + </select> | |
22 | + | |
23 | + <select id="getTenantPage" resultMap="tenantDTOMap"> | |
24 | + SELECT id, tenant_id,name, enabled, description, default_config, tenant_expire_time, create_time,icon | |
25 | + FROM sys_tenant | |
26 | + <where> | |
27 | + tenant_id != 'DEFAULT_SYS_ADMIN_TENANT_CODE' | |
28 | + <if test="tenantName!=null"> | |
29 | + AND name LIKE CONCAT('%',#{tenantName}::TEXT,'%') | |
30 | + </if> | |
31 | + </where> | |
32 | + </select> | |
33 | +</mapper> | ... | ... |
... | ... | @@ -10,7 +10,7 @@ |
10 | 10 | <result property="accountExpireTime" column="account_expire_time"/> |
11 | 11 | <association property="tenant" javaType="org.thingsboard.server.common.data.yunteng.dto.TenantDTO"> |
12 | 12 | <result column="tenant_name" property="name"/> |
13 | - <result column="tenant_code" property="tenantCode"/> | |
13 | + <result column="tenant_id" property="tenantId"/> | |
14 | 14 | <result column="tenant_enabled" property="enabled"/> |
15 | 15 | <result column="tenant_expire_time" property="tenantExpireTime"/> |
16 | 16 | </association> |
... | ... | @@ -29,7 +29,7 @@ |
29 | 29 | <result property="avatar" column="avatar"/> |
30 | 30 | <result property="deptId" column="dept_id"/> |
31 | 31 | <result property="tenantName" column="tenant_name"/> |
32 | - <result property="tenantCode" column="tenant_code"/> | |
32 | + <result property="tenantId" column="tenant_id"/> | |
33 | 33 | <result property="createTime" column="create_time"/> |
34 | 34 | <result property="updateTime" column="update_time"/> |
35 | 35 | <result property="accountExpireTime" column="account_expire_time"/> |
... | ... | @@ -45,7 +45,7 @@ |
45 | 45 | su.avatar AS avatar, |
46 | 46 | su.enabled AS enabled, |
47 | 47 | su.account_expire_time AS account_expire_time, |
48 | - su.tenant_code AS tenant_code, | |
48 | + su.tenant_id AS tenant_id, | |
49 | 49 | su.create_time AS create_time, |
50 | 50 | su.update_time AS update_time, |
51 | 51 | su.real_name AS real_name, |
... | ... | @@ -60,12 +60,12 @@ |
60 | 60 | su.enabled as enabled, |
61 | 61 | su.account_expire_time as account_expire_time, |
62 | 62 | st.name as tenant_name, |
63 | - st.tenant_code as tenant_code, | |
63 | + st.tenant_id as tenant_id, | |
64 | 64 | st.enabled as tenant_enabled, |
65 | 65 | st.tenant_expire_time as tenant_expire_time, |
66 | 66 | rr.role_type as role_type |
67 | 67 | FROM sys_user su |
68 | - LEFT JOIN sys_tenant st ON su.tenant_code = st.tenant_code | |
68 | + LEFT JOIN sys_tenant st ON su.tenant_id = st.tenant_id | |
69 | 69 | LEFT JOIN ( |
70 | 70 | SELECT sur.user_id, |
71 | 71 | sr.role_type |
... | ... | @@ -81,7 +81,7 @@ |
81 | 81 | <include refid="columns"/>, |
82 | 82 | st.name AS tenant_name |
83 | 83 | FROM sys_user su |
84 | - LEFT JOIN sys_tenant st ON su.tenant_code = st.tenant_code | |
84 | + LEFT JOIN sys_tenant st ON su.tenant_id = st.tenant_id | |
85 | 85 | <where> |
86 | 86 | <if test="queryMap.realName!=null and queryMap.realName!=''"> |
87 | 87 | AND su.real_name LIKE CONCAT('%',#{queryMap.realName}::TEXT,'%') |
... | ... | @@ -89,8 +89,8 @@ |
89 | 89 | <if test="queryMap.username!=null and queryMap.username!=''"> |
90 | 90 | AND su.username LIKE CONCAT('%',#{queryMap.username}::TEXT,'%') |
91 | 91 | </if> |
92 | - <if test="queryMap.tenantCode !=null and queryMap.tenantCode!=''"> | |
93 | - AND su.tenant_code=#{queryMap.tenantCode} | |
92 | + <if test="queryMap.tenantId !=null and queryMap.tenantId!=''"> | |
93 | + AND su.tenant_id=#{queryMap.tenantId} | |
94 | 94 | </if> |
95 | 95 | </where> |
96 | 96 | </select> |
... | ... | @@ -100,7 +100,7 @@ |
100 | 100 | <include refid="columns"/>, |
101 | 101 | st.name AS tenant_name |
102 | 102 | FROM sys_user su |
103 | - LEFT JOIN sys_tenant st ON su.tenant_code = st.tenant_code | |
103 | + LEFT JOIN sys_tenant st ON su.tenant_id = st.tenant_id | |
104 | 104 | WHERE su.ID IN (SELECT user_id |
105 | 105 | FROM sys_user_role |
106 | 106 | WHERE role_id IN (SELECT ID |
... | ... | @@ -109,20 +109,20 @@ |
109 | 109 | <if test="roleType == 'ROLE_PLATFORM_ADMIN'"> |
110 | 110 | OR role_type = 'ROLE_SYS_ADMIN' |
111 | 111 | </if> |
112 | - AND tenant_code = #{tenantCode})) | |
112 | + AND tenant_id = #{tenantId})) | |
113 | 113 | </select> |
114 | 114 | <select id="selectAllTenantUser" resultMap="userDTOMap"> |
115 | 115 | SELECT |
116 | 116 | <include refid="columns"/>, |
117 | 117 | st.name AS tenant_name |
118 | 118 | FROM sys_user su |
119 | - LEFT JOIN sys_tenant st ON su.tenant_code = st.tenant_code | |
119 | + LEFT JOIN sys_tenant st ON su.tenant_id = st.tenant_id | |
120 | 120 | WHERE su.level = 2; |
121 | 121 | </select> |
122 | - <select id="getAllIdsByTenantCode" resultType="java.lang.String"> | |
123 | - SELECT id FROM sys_user WHERE tenant_code IN | |
124 | - <foreach collection="tenantCodes" item="tenantCode" open="(" separator="," close=")"> | |
125 | - #{tenantCode} | |
122 | + <select id="getAllIdsByTenantId" resultType="java.lang.String"> | |
123 | + SELECT id FROM sys_user WHERE tenant_id IN | |
124 | + <foreach collection="tenantIds" item="tenantId" open="(" separator="," close=")"> | |
125 | + #{tenantId} | |
126 | 126 | </foreach> |
127 | 127 | </select> |
128 | 128 | |
... | ... | @@ -140,12 +140,12 @@ |
140 | 140 | su.enabled as enabled, |
141 | 141 | su.account_expire_time as account_expire_time, |
142 | 142 | st.name as tenant_name, |
143 | - st.tenant_code as tenant_code, | |
143 | + st.tenant_id as tenant_id, | |
144 | 144 | st.enabled as tenant_enabled, |
145 | 145 | st.tenant_expire_time as tenant_expire_time, |
146 | 146 | rr.role_type as role_type |
147 | 147 | FROM sys_user su |
148 | - LEFT JOIN sys_tenant st ON su.tenant_code = st.tenant_code | |
148 | + LEFT JOIN sys_tenant st ON su.tenant_id = st.tenant_id | |
149 | 149 | LEFT JOIN ( |
150 | 150 | SELECT sur.user_id, |
151 | 151 | sr.role_type |
... | ... | @@ -161,7 +161,7 @@ |
161 | 161 | FROM sys_user su |
162 | 162 | <where> |
163 | 163 | <if test="username !=null and username!=''">AND su.username=#{username}</if> |
164 | - <if test="tenantCode !=null and tenantCode!=''">AND su.tenant_code=#{tenantCode}</if> | |
164 | + <if test="tenantId !=null and tenantId!=''">AND su.tenant_id=#{tenantId}</if> | |
165 | 165 | </where> |
166 | 166 | </select> |
167 | 167 | </mapper> | ... | ... |
... | ... | @@ -862,10 +862,10 @@ |
862 | 862 | </plugins> |
863 | 863 | </pluginManagement> |
864 | 864 | <plugins> |
865 | - <plugin> | |
866 | - <groupId>com.mycila</groupId> | |
867 | - <artifactId>license-maven-plugin</artifactId> | |
868 | - </plugin> | |
865 | +<!-- <plugin>--> | |
866 | +<!-- <groupId>com.mycila</groupId>--> | |
867 | +<!-- <artifactId>license-maven-plugin</artifactId>--> | |
868 | +<!-- </plugin>--> | |
869 | 869 | </plugins> |
870 | 870 | </build> |
871 | 871 | ... | ... |