| | |
| | | @ApiOperation(value = "添加租户") |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> add(@Validated @RequestBody TTenantDTO dto) { |
| | | if(tenantService.isExit(dto)){ |
| | | return R.fail("该账号已存在"); |
| | | } |
| | | // 密码加密 |
| | | dto.setPassword(SecurityUtils.encryptPassword(dto.getPassword())); |
| | | return R.ok(tenantService.save(dto)); |
| | |
| | | @ApiOperation(value = "修改租户") |
| | | @PostMapping(value = "/update") |
| | | public R<Boolean> update(@Validated @RequestBody TTenantDTO dto) { |
| | | if(tenantService.isExit(dto)){ |
| | | return R.fail("该账号已存在"); |
| | | } |
| | | // 密码加密 |
| | | if(StringUtils.isNotBlank(dto.getPassword())){ |
| | | dto.setPassword(SecurityUtils.encryptPassword(dto.getPassword())); |
| | |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TTenant> getDetailById(@RequestParam String id) { |
| | | TTenant tenant = tenantService.getById(id); |
| | | tenant.setTenantAttributes(StringUtils.isNotEmpty(tenant.getTenantAttributes())?DictUtils.getDictLabel(DictConstants.DICT_TYPE_TENANT_ATTRIBUTE,tenant.getTenantAttributes()):""); |
| | | tenant.setTenantType(StringUtils.isNotEmpty(tenant.getTenantType())?DictUtils.getDictLabel(DictConstants.DICT_TYPE_TENANT_TYPE,tenant.getTenantType()):""); |
| | | // tenant.setTenantAttributes(StringUtils.isNotEmpty(tenant.getTenantAttributes())?DictUtils.getDictLabel(DictConstants.DICT_TYPE_TENANT_ATTRIBUTE,tenant.getTenantAttributes()):""); |
| | | // tenant.setTenantType(StringUtils.isNotEmpty(tenant.getTenantType())?DictUtils.getDictLabel(DictConstants.DICT_TYPE_TENANT_TYPE,tenant.getTenantType()):""); |
| | | return R.ok(tenant); |
| | | } |
| | | |