Commit f28665ffc3ccf11c604de9a9c9512c57c233267d

Authored by 云中非
1 parent ebef653d

refactor: 迁移代码

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