|
@@ -3,11 +3,13 @@ package com.huaxu.controller;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.huaxu.common.FileUploadUtil;
|
|
import com.huaxu.common.FileUploadUtil;
|
|
|
|
+import com.huaxu.dto.TenantDto;
|
|
import com.huaxu.entity.TenantEntity;
|
|
import com.huaxu.entity.TenantEntity;
|
|
import com.huaxu.model.AjaxMessage;
|
|
import com.huaxu.model.AjaxMessage;
|
|
import com.huaxu.model.Pagination;
|
|
import com.huaxu.model.Pagination;
|
|
import com.huaxu.model.ResultStatus;
|
|
import com.huaxu.model.ResultStatus;
|
|
import com.huaxu.service.TenantService;
|
|
import com.huaxu.service.TenantService;
|
|
|
|
+import com.huaxu.service.UserService;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
@@ -28,11 +30,16 @@ import java.util.List;
|
|
@RequestMapping("/tenant")
|
|
@RequestMapping("/tenant")
|
|
@Api(tags = "租户管理")
|
|
@Api(tags = "租户管理")
|
|
public class TenantController {
|
|
public class TenantController {
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 租户
|
|
* 租户
|
|
*/
|
|
*/
|
|
@Autowired
|
|
@Autowired
|
|
private TenantService tenantService;
|
|
private TenantService tenantService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private UserService userService;
|
|
|
|
+
|
|
@Value("${UMIS.sys_config_path}")
|
|
@Value("${UMIS.sys_config_path}")
|
|
private String baseDir;
|
|
private String baseDir;
|
|
|
|
|
|
@@ -44,9 +51,9 @@ public class TenantController {
|
|
*/
|
|
*/
|
|
@RequestMapping(value = "get", method = RequestMethod.POST)
|
|
@RequestMapping(value = "get", method = RequestMethod.POST)
|
|
@ApiOperation(value = "根据id查询租户")
|
|
@ApiOperation(value = "根据id查询租户")
|
|
- public AjaxMessage<TenantEntity> selectOne(
|
|
|
|
|
|
+ public AjaxMessage<TenantDto> selectOne(
|
|
@ApiParam(value = "租户信息", required = true) @RequestParam Integer id) {
|
|
@ApiParam(value = "租户信息", required = true) @RequestParam Integer id) {
|
|
- TenantEntity result = tenantService.selectById(id);
|
|
|
|
|
|
+ TenantDto result = tenantService.selectById(id);
|
|
|
|
|
|
return new AjaxMessage<>(ResultStatus.OK, result);
|
|
return new AjaxMessage<>(ResultStatus.OK, result);
|
|
}
|
|
}
|
|
@@ -54,20 +61,20 @@ public class TenantController {
|
|
/**
|
|
/**
|
|
* 查询租户信息
|
|
* 查询租户信息
|
|
*
|
|
*
|
|
- * @param tenantEntity 参数对象
|
|
|
|
|
|
+ * @param tenantDto 参数对象
|
|
* @return 多条数据
|
|
* @return 多条数据
|
|
*/
|
|
*/
|
|
@RequestMapping(value = "selectList", method = RequestMethod.POST)
|
|
@RequestMapping(value = "selectList", method = RequestMethod.POST)
|
|
@ApiOperation(value = "查询租户信息")
|
|
@ApiOperation(value = "查询租户信息")
|
|
- public AjaxMessage<List<TenantEntity>> selectList(
|
|
|
|
- @ApiParam(value = "租户信息", required = true) @RequestBody TenantEntity tenantEntity) {
|
|
|
|
- List<TenantEntity> result = tenantService.selectList(tenantEntity);
|
|
|
|
|
|
+ public AjaxMessage<List<TenantDto>> selectList(
|
|
|
|
+ @ApiParam(value = "租户信息") @RequestBody TenantDto tenantDto) {
|
|
|
|
+ List<TenantDto> result = tenantService.selectList(tenantDto);
|
|
|
|
|
|
return new AjaxMessage<>(ResultStatus.OK, result);
|
|
return new AjaxMessage<>(ResultStatus.OK, result);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 新增
|
|
|
|
|
|
+ * 新增租户logo
|
|
*/
|
|
*/
|
|
@RequestMapping(value = "addTenantLogo", method = RequestMethod.POST)
|
|
@RequestMapping(value = "addTenantLogo", method = RequestMethod.POST)
|
|
@ResponseBody
|
|
@ResponseBody
|
|
@@ -87,13 +94,19 @@ public class TenantController {
|
|
/**
|
|
/**
|
|
* 新增一条数据
|
|
* 新增一条数据
|
|
*
|
|
*
|
|
- * @param tenantEntity 实体类
|
|
|
|
- * @return Response对象
|
|
|
|
|
|
+ * @param tenantDto 实体类
|
|
|
|
+ * @return Response对象t
|
|
*/
|
|
*/
|
|
@RequestMapping(value = "insert", method = RequestMethod.POST)
|
|
@RequestMapping(value = "insert", method = RequestMethod.POST)
|
|
@ApiOperation(value = "插入租户信息")
|
|
@ApiOperation(value = "插入租户信息")
|
|
- public AjaxMessage<Integer> insert(@ApiParam(value = "租户信息", required = true) @RequestBody TenantEntity tenantEntity) {
|
|
|
|
- int result = tenantService.insert(tenantEntity);
|
|
|
|
|
|
+ public AjaxMessage<Integer> insert(@ApiParam(value = "租户信息", required = true) @RequestBody TenantDto tenantDto) {
|
|
|
|
+ if (tenantDto.getPhone() != null) {
|
|
|
|
+ boolean isExsit = userService.checkMobileUnique(tenantDto.getPhone());
|
|
|
|
+ if (isExsit) {
|
|
|
|
+ return new AjaxMessage<>(ResultStatus.MEMBER_TELPHONE_ALREADY_EXISTS, 0);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ int result = tenantService.insert(tenantDto);
|
|
|
|
|
|
return new AjaxMessage<>(ResultStatus.OK, result);
|
|
return new AjaxMessage<>(ResultStatus.OK, result);
|
|
}
|
|
}
|
|
@@ -101,13 +114,13 @@ public class TenantController {
|
|
/**
|
|
/**
|
|
* 修改一条数据
|
|
* 修改一条数据
|
|
*
|
|
*
|
|
- * @param tenantEntity 实体类
|
|
|
|
|
|
+ * @param tenantDto 实体类
|
|
* @return Response对象
|
|
* @return Response对象
|
|
*/
|
|
*/
|
|
@RequestMapping(value = "update", method = RequestMethod.POST)
|
|
@RequestMapping(value = "update", method = RequestMethod.POST)
|
|
@ApiOperation(value = "修改租户信息")
|
|
@ApiOperation(value = "修改租户信息")
|
|
- public AjaxMessage<Integer> update(@ApiParam(value = "租户信息", required = true) @RequestBody TenantEntity tenantEntity) {
|
|
|
|
- int result = tenantService.update(tenantEntity);
|
|
|
|
|
|
+ public AjaxMessage<Integer> update(@ApiParam(value = "租户信息", required = true) @RequestBody TenantDto tenantDto) {
|
|
|
|
+ int result = tenantService.update(tenantDto);
|
|
return new AjaxMessage<>(ResultStatus.OK, result);
|
|
return new AjaxMessage<>(ResultStatus.OK, result);
|
|
|
|
|
|
}
|
|
}
|
|
@@ -135,17 +148,17 @@ public class TenantController {
|
|
*/
|
|
*/
|
|
@RequestMapping(value = "selectPage", method = RequestMethod.POST)
|
|
@RequestMapping(value = "selectPage", method = RequestMethod.POST)
|
|
@ApiOperation(value = "查询租户信息列表")
|
|
@ApiOperation(value = "查询租户信息列表")
|
|
- public AjaxMessage<Pagination<TenantEntity>> selectPage(
|
|
|
|
- @ApiParam(value = "租户信息", required = true) @RequestBody TenantEntity tenantEntity,
|
|
|
|
- @ApiParam(value = "页数,非必传,默认第一页", defaultValue = "1") int pageNum,
|
|
|
|
- @ApiParam(value = "条数,非必传,默认15条", defaultValue = "30") int pageSize
|
|
|
|
|
|
+ public AjaxMessage<Pagination<TenantDto>> selectPage(
|
|
|
|
+ @ApiParam(value = "租户名称") TenantDto tenantDto,
|
|
|
|
+ @ApiParam(value = "页数,非必传,默认第一页", defaultValue = "1") @RequestParam(required = false, defaultValue = "1") Integer pageNum,
|
|
|
|
+ @ApiParam(value = "条数,非必传,默认30条", defaultValue = "30") @RequestParam(required = false, defaultValue = "30") Integer pageSize
|
|
|
|
|
|
) {
|
|
) {
|
|
- IPage<TenantEntity> iPage = new Page<>(pageNum, pageSize);
|
|
|
|
|
|
+ IPage<TenantDto> iPage = new Page<>(pageNum, pageSize);
|
|
|
|
|
|
- iPage = tenantService.selectPage(tenantEntity, iPage);
|
|
|
|
|
|
+ iPage = tenantService.selectPage(iPage, tenantDto );
|
|
|
|
|
|
- Pagination<TenantEntity> pages = new Pagination<>(iPage);
|
|
|
|
|
|
+ Pagination<TenantDto> pages = new Pagination<>(iPage);
|
|
|
|
|
|
return new AjaxMessage<>(ResultStatus.OK, pages);
|
|
return new AjaxMessage<>(ResultStatus.OK, pages);
|
|
}
|
|
}
|