55 lines
1.8 KiB
Java
55 lines
1.8 KiB
Java
package com.jsh.erp.controller;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.jsh.erp.service.tenant.TenantService;
|
|
import com.jsh.erp.utils.ErpInfo;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
|
|
|
|
/**
|
|
* @author ji_sheng_hua 管伊佳erp
|
|
*/
|
|
@RestController
|
|
@RequestMapping(value = "/tenant")
|
|
@Api(tags = {"租户管理"})
|
|
public class TenantController {
|
|
private Logger logger = LoggerFactory.getLogger(TenantController.class);
|
|
|
|
@Resource
|
|
private TenantService tenantService;
|
|
|
|
/**
|
|
* 批量设置状态-启用或者禁用
|
|
* @param jsonObject
|
|
* @param request
|
|
* @return
|
|
*/
|
|
@PostMapping(value = "/batchSetStatus")
|
|
@ApiOperation(value = "批量设置状态")
|
|
public String batchSetStatus(@RequestBody JSONObject jsonObject,
|
|
HttpServletRequest request)throws Exception {
|
|
Boolean status = jsonObject.getBoolean("status");
|
|
String ids = jsonObject.getString("ids");
|
|
Map<String, Object> objectMap = new HashMap<>();
|
|
int res = tenantService.batchSetStatus(status, ids);
|
|
if(res > 0) {
|
|
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
|
|
} else {
|
|
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
|
|
}
|
|
}
|
|
}
|