更新租户授权配置允许同时配置多个
This commit is contained in:
parent
93afe83d55
commit
ce6db8a2a8
@ -6,11 +6,15 @@ import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.common.log.annotation.Log;
|
||||
import com.xhpc.common.log.enums.BusinessType;
|
||||
import com.xhpc.common.util.LogUserUtils;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import com.xhpc.tenant.domain.XhpcTenantDomain;
|
||||
import com.xhpc.tenant.service.XhpcTenantService;
|
||||
import org.apache.tools.ant.taskdefs.condition.Http;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ -21,6 +25,9 @@ public class XhpcTenantController extends BaseController {
|
||||
@Resource
|
||||
XhpcTenantService tenantService;
|
||||
|
||||
@Resource
|
||||
LogUserUtils logUserUtils;
|
||||
|
||||
|
||||
@GetMapping("/getPage")
|
||||
public TableDataInfo getPage(String tenantId,
|
||||
@ -46,28 +53,42 @@ public class XhpcTenantController extends BaseController {
|
||||
|
||||
@Log(title = "租户管理-新增租户", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/detail")
|
||||
public R insertNewTenant(@RequestBody XhpcTenantDomain domain){
|
||||
public R insertNewTenant(HttpServletRequest request, @RequestBody XhpcTenantDomain domain){
|
||||
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
domain.setCreateUser(loginUser.getUserid());
|
||||
domain.setUpdateUser(loginUser.getUserid());
|
||||
|
||||
return R.ok(tenantService.insertTenant(domain));
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "租户管理-更新租户信息", businessType = BusinessType.UPDATE)
|
||||
@PatchMapping("/detail")
|
||||
public R updateTenant(@RequestBody XhpcTenantDomain domain){
|
||||
public R updateTenant(HttpServletRequest request, @RequestBody XhpcTenantDomain domain){
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
domain.setCreateUser(loginUser.getUserid());
|
||||
domain.setUpdateUser(loginUser.getUserid());
|
||||
return R.ok(tenantService.updateTenantInfo(domain));
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "租户管理-更新租户授权配置信息", businessType = BusinessType.UPDATE)
|
||||
@PatchMapping("/config")
|
||||
public R updateTenantConfig(@RequestBody XhpcTenantDomain domain){
|
||||
public R updateTenantConfig(HttpServletRequest request, @RequestBody XhpcTenantDomain domain){
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
domain.setCreateUser(loginUser.getUserid());
|
||||
domain.setUpdateUser(loginUser.getUserid());
|
||||
return R.ok(tenantService.updateTenantConfig(domain));
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "租户管理-更新租户状态", businessType = BusinessType.UPDATE)
|
||||
@PatchMapping("/status")
|
||||
public R updateTenantStatus(@RequestBody XhpcTenantDomain domain){
|
||||
public R updateTenantStatus(HttpServletRequest request, @RequestBody XhpcTenantDomain domain){
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
domain.setCreateUser(loginUser.getUserid());
|
||||
domain.setUpdateUser(loginUser.getUserid());
|
||||
return R.ok(tenantService.updateTenantConfig(domain));
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,8 @@ package com.xhpc.tenant.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@ -95,5 +97,9 @@ public class XhpcTenantDomain implements Serializable {
|
||||
*/
|
||||
private Integer isDeleted;
|
||||
|
||||
|
||||
// 修改信息的时候传递多参数
|
||||
private List<String> tenantIds;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@ -63,7 +63,15 @@ public class XhpcTenantServiceImpl implements XhpcTenantService {
|
||||
|
||||
@Override
|
||||
public boolean updateTenantConfig(XhpcTenantDomain domain){
|
||||
return tenantMapper.updateTenantConfigByPrimaryKey(domain) > 0;
|
||||
if(domain.getTenantIds() != null && domain.getTenantIds().size() > 0){
|
||||
for (String tenantId : domain.getTenantIds()){
|
||||
domain.setTenantId(tenantId);
|
||||
tenantMapper.updateTenantConfigByPrimaryKey(domain);
|
||||
}
|
||||
} else {
|
||||
tenantMapper.updateTenantConfigByPrimaryKey(domain);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -61,13 +61,13 @@
|
||||
</update>
|
||||
|
||||
<insert id="insert" keyColumn="tenant_id" keyProperty="tenantId" parameterType="com.xhpc.tenant.domain.XhpcTenantDomain" useGeneratedKeys="true">
|
||||
insert into xhpc_tenant (tenant_name, `domain`, background_url,
|
||||
insert into xhpc_tenant (tenant_id, tenant_name, `domain`, background_url,
|
||||
linkman, contact_number, address,
|
||||
station_quote, station_pile_quote, expire_time,
|
||||
create_user, create_dept, create_time,
|
||||
update_user, update_time, `status`,
|
||||
is_deleted)
|
||||
values (#{tenantName,jdbcType=VARCHAR}, #{domain,jdbcType=VARCHAR}, #{backgroundUrl,jdbcType=VARCHAR},
|
||||
values (#{tenantId, jdbcType=VARCHAR}, #{tenantName,jdbcType=VARCHAR}, #{domain,jdbcType=VARCHAR}, #{backgroundUrl,jdbcType=VARCHAR},
|
||||
#{linkman,jdbcType=VARCHAR}, #{contactNumber,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},
|
||||
#{stationQuote,jdbcType=INTEGER}, #{stationPileQuote,jdbcType=INTEGER}, #{expireTime,jdbcType=TIMESTAMP},
|
||||
#{createUser,jdbcType=BIGINT}, #{createDept,jdbcType=BIGINT}, sysdate(),
|
||||
@ -77,6 +77,9 @@
|
||||
<insert id="insertSelective" keyColumn="tenant_id" keyProperty="tenantId" parameterType="com.xhpc.tenant.domain.XhpcTenantDomain" useGeneratedKeys="true">
|
||||
insert into xhpc_tenant
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="tenantId != null and tenantId !=''">
|
||||
tenant_id,
|
||||
</if>
|
||||
<if test="tenantName != null">
|
||||
tenant_name,
|
||||
</if>
|
||||
@ -121,6 +124,9 @@
|
||||
is_deleted
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="tenantId != null and tenantId !=''">
|
||||
#{tenantId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="tenantName != null">
|
||||
#{tenantName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@ -256,7 +262,7 @@
|
||||
station_pile_quote = #{stationPileQuote,jdbcType=INTEGER},
|
||||
expire_time = #{expireTime,jdbcType=TIMESTAMP},
|
||||
update_user = #{updateUser,jdbcType=BIGINT},
|
||||
update_time = sysdate(),
|
||||
update_time = sysdate()
|
||||
where tenant_id = #{tenantId,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user