编号:ZSSAC-585 描述:服务管理数据隔离
This commit is contained in:
parent
dd2a1afaa9
commit
6d661046d6
@ -77,6 +77,8 @@ public class ApplyListInfoController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ApplyListInfo applyListInfo)
|
||||
{
|
||||
applyListInfo.setCreated(getUsername());
|
||||
applyListInfo.setModified(getUsername());
|
||||
return toAjax(applyListInfoService.insertApplyListInfo(applyListInfo));
|
||||
}
|
||||
|
||||
@ -88,6 +90,7 @@ public class ApplyListInfoController extends BaseController
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ApplyListInfo applyListInfo)
|
||||
{
|
||||
applyListInfo.setModified(getUsername());
|
||||
return toAjax(applyListInfoService.updateApplyListInfo(applyListInfo));
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,42 @@
|
||||
package com.sf.common.enums;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* header参数
|
||||
*
|
||||
* @author ztzh
|
||||
*
|
||||
*/
|
||||
public enum RequestHeaderEnums
|
||||
{
|
||||
/**
|
||||
* 通知完成指令,用于客户端收到通知消息的确认
|
||||
*/
|
||||
APP_CODE("appCode"),
|
||||
;
|
||||
|
||||
private static Map<String, RequestHeaderEnums> map = new HashMap<>();
|
||||
|
||||
static {
|
||||
for (RequestHeaderEnums type : RequestHeaderEnums.values()) {
|
||||
map.put(type.code, type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String code;
|
||||
|
||||
RequestHeaderEnums(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public static final RequestHeaderEnums getByCode(String code) {
|
||||
return map.get(code);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.sf.common.utils.http;
|
||||
|
||||
import com.sf.common.utils.StringUtils;
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public class RequestUtils {
|
||||
|
||||
public static String getHeader(String code){
|
||||
RequestAttributes requestAttributes1 = RequestContextHolder.getRequestAttributes();
|
||||
HttpServletRequest request = ((ServletRequestAttributes) requestAttributes1).getRequest();
|
||||
if(StringUtils.isBlank(request.getHeader(code))){
|
||||
throw new SecurityException("参数异常appCode为空");
|
||||
}
|
||||
return request.getHeader(code);
|
||||
}
|
||||
}
|
@ -1,8 +1,14 @@
|
||||
package com.sf.system.deployment.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletRequestAttributeEvent;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.sf.common.enums.RequestHeaderEnums;
|
||||
import com.sf.common.utils.StringUtils;
|
||||
import com.sf.common.utils.http.RequestUtils;
|
||||
import com.sf.system.deployment.domain.DeploymentApplyEnvironment;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -21,6 +27,9 @@ import com.sf.common.enums.BusinessType;
|
||||
import com.sf.deployment.service.IDeploymentApplyEnvironmentService;
|
||||
import com.sf.common.utils.poi.ExcelUtil;
|
||||
import com.sf.common.core.page.TableDataInfo;
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
/**
|
||||
* 环境维护Controller
|
||||
@ -42,6 +51,7 @@ public class DeploymentApplyEnvironmentController extends BaseController
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(DeploymentApplyEnvironment deploymentApplyEnvironment)
|
||||
{
|
||||
deploymentApplyEnvironment.setAppCode(RequestUtils.getHeader(RequestHeaderEnums.APP_CODE.getCode()));
|
||||
startPage();
|
||||
List<DeploymentApplyEnvironment> list = deploymentApplyEnvironmentService.selectDeploymentApplyEnvironmentList(deploymentApplyEnvironment);
|
||||
return getDataTable(list);
|
||||
@ -78,6 +88,7 @@ public class DeploymentApplyEnvironmentController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody DeploymentApplyEnvironment deploymentApplyEnvironment)
|
||||
{
|
||||
deploymentApplyEnvironment.setAppCode( RequestUtils.getHeader(RequestHeaderEnums.APP_CODE.getCode()));
|
||||
return toAjax(deploymentApplyEnvironmentService.insertDeploymentApplyEnvironment(deploymentApplyEnvironment));
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,9 @@ package com.sf.system.deployment.controller;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.sf.common.enums.RequestHeaderEnums;
|
||||
import com.sf.common.utils.StringUtils;
|
||||
import com.sf.common.utils.http.RequestUtils;
|
||||
import com.sf.system.deployment.domain.rqs.ModuleListByCoreRequest;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -44,6 +46,7 @@ public class DeploymentModuleListController extends BaseController
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(DeploymentModuleList deploymentModuleList)
|
||||
{
|
||||
deploymentModuleList.setAppCore(RequestUtils.getHeader(RequestHeaderEnums.APP_CODE.getCode()));
|
||||
startPage();
|
||||
List<DeploymentModuleList> list = deploymentModuleListService.selectDeploymentModuleListList(deploymentModuleList);
|
||||
return getDataTable(list);
|
||||
@ -55,7 +58,7 @@ public class DeploymentModuleListController extends BaseController
|
||||
public AjaxResult queryByCore(ModuleListByCoreRequest request)
|
||||
{
|
||||
if(StringUtils.isEmpty(request.getAppCore())){
|
||||
return error("appCore不能为空");
|
||||
throw new SecurityException("参数异常appCode为空");
|
||||
}
|
||||
DeploymentModuleList deploymentModuleList = new DeploymentModuleList();
|
||||
deploymentModuleList.setAppCore(request.getAppCore());
|
||||
@ -95,6 +98,7 @@ public class DeploymentModuleListController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody DeploymentModuleList deploymentModuleList)
|
||||
{
|
||||
deploymentModuleList.setAppCore(RequestUtils.getHeader(RequestHeaderEnums.APP_CODE.getCode()));
|
||||
return toAjax(deploymentModuleListService.insertDeploymentModuleList(deploymentModuleList));
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,9 @@ package com.sf.system.deployment.controller;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.sf.common.enums.RequestHeaderEnums;
|
||||
import com.sf.common.utils.DateUtils;
|
||||
import com.sf.common.utils.http.RequestUtils;
|
||||
import com.sf.system.deployment.domain.DeploymentServicePublish;
|
||||
import com.sf.system.deployment.service.IDeploymentServicePublishService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@ -44,6 +46,7 @@ public class DeploymentServicePublishController extends BaseController
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(DeploymentServicePublish deploymentServicePublish)
|
||||
{
|
||||
deploymentServicePublish.setAppCode(RequestUtils.getHeader(RequestHeaderEnums.APP_CODE.getCode()));
|
||||
startPage();
|
||||
List<DeploymentServicePublish> list = deploymentServicePublishService.selectDeploymentServicePublishList(deploymentServicePublish);
|
||||
return getDataTable(list);
|
||||
@ -80,6 +83,7 @@ public class DeploymentServicePublishController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody DeploymentServicePublish deploymentServicePublish)
|
||||
{
|
||||
deploymentServicePublish.setAppCode(RequestUtils.getHeader(RequestHeaderEnums.APP_CODE.getCode()));
|
||||
return toAjax(deploymentServicePublishService.insertDeploymentServicePublish(deploymentServicePublish));
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,8 @@ import com.sf.common.core.controller.BaseController;
|
||||
import com.sf.common.core.domain.AjaxResult;
|
||||
import com.sf.common.core.page.TableDataInfo;
|
||||
import com.sf.common.enums.BusinessType;
|
||||
import com.sf.common.enums.RequestHeaderEnums;
|
||||
import com.sf.common.utils.http.RequestUtils;
|
||||
import com.sf.common.utils.poi.ExcelUtil;
|
||||
import com.sf.system.deployment.domain.SysApkInfo;
|
||||
import com.sf.system.deployment.service.ISysApkInfoService;
|
||||
@ -35,6 +37,7 @@ public class SysApkInfoController extends BaseController
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysApkInfo sysApkInfo)
|
||||
{
|
||||
sysApkInfo.setAppCode(RequestUtils.getHeader(RequestHeaderEnums.APP_CODE.getCode()));
|
||||
startPage();
|
||||
List<SysApkInfo> list = sysApkInfoService.selectSysApkInfoList(sysApkInfo);
|
||||
return getDataTable(list);
|
||||
@ -71,6 +74,7 @@ public class SysApkInfoController extends BaseController
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysApkInfo sysApkInfo)
|
||||
{
|
||||
sysApkInfo.setAppCode(RequestUtils.getHeader(RequestHeaderEnums.APP_CODE.getCode()));
|
||||
sysApkInfo.setCreated(getUsername());
|
||||
sysApkInfo.setModified(getUsername());
|
||||
return toAjax(sysApkInfoService.insertSysApkInfo(sysApkInfo));
|
||||
|
@ -22,7 +22,7 @@ public class DeploymentApplyEnvironment extends BaseEntity
|
||||
private Long appId;
|
||||
|
||||
/** 应用编号 */
|
||||
private String applyCode;
|
||||
private String appCode;
|
||||
|
||||
/** 环境名称 */
|
||||
@Excel(name = "环境名称")
|
||||
@ -58,14 +58,14 @@ public class DeploymentApplyEnvironment extends BaseEntity
|
||||
{
|
||||
return appId;
|
||||
}
|
||||
public void setApplyCode(String applyCode)
|
||||
public void setAppCode(String appCode)
|
||||
{
|
||||
this.applyCode = applyCode;
|
||||
this.appCode = appCode;
|
||||
}
|
||||
|
||||
public String getApplyCode()
|
||||
public String getAppCode()
|
||||
{
|
||||
return applyCode;
|
||||
return appCode;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
@ -109,7 +109,7 @@ public class DeploymentApplyEnvironment extends BaseEntity
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("appId", getAppId())
|
||||
.append("applyCode", getApplyCode())
|
||||
.append("applyCode", getAppCode())
|
||||
.append("name", getName())
|
||||
.append("serverAddress", getServerAddress())
|
||||
.append("remark", getRemark())
|
||||
|
@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<resultMap type="DeploymentApplyEnvironment" id="DeploymentApplyEnvironmentResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="appId" column="app_id" />
|
||||
<result property="applyCode" column="apply_code" />
|
||||
<result property="appCode" column="app_code" />
|
||||
<result property="name" column="name" />
|
||||
<result property="serverAddress" column="server_address" />
|
||||
<result property="remark" column="remark" />
|
||||
@ -20,12 +20,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDeploymentApplyEnvironmentVo">
|
||||
select id, app_id, apply_code, name, server_address, remark, is_delete, create_dept, create_time, create_by, update_time, update_by from DEPLOYMENT_APPLY_ENVIRONMENT
|
||||
select id, app_id, app_code, name, server_address, remark, is_delete, create_dept, create_time, create_by, update_time, update_by from DEPLOYMENT_APPLY_ENVIRONMENT
|
||||
</sql>
|
||||
|
||||
<select id="selectDeploymentApplyEnvironmentList" parameterType="DeploymentApplyEnvironment" resultMap="DeploymentApplyEnvironmentResult">
|
||||
<include refid="selectDeploymentApplyEnvironmentVo"/>
|
||||
<where>
|
||||
<if test="appCode != null and appCode != ''">and app_code = #{appCode}</if>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
@ -39,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
insert into DEPLOYMENT_APPLY_ENVIRONMENT
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="appId != null">app_id,</if>
|
||||
<if test="applyCode != null">apply_code,</if>
|
||||
<if test="appCode != null">app_code,</if>
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="serverAddress != null and serverAddress != ''">server_address,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
@ -52,7 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="appId != null">#{appId},</if>
|
||||
<if test="applyCode != null">#{applyCode},</if>
|
||||
<if test="appCode != null">#{appCode},</if>
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="serverAddress != null and serverAddress != ''">#{serverAddress},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
@ -69,7 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
update DEPLOYMENT_APPLY_ENVIRONMENT
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="appId != null">app_id = #{appId},</if>
|
||||
<if test="applyCode != null">apply_code = #{applyCode},</if>
|
||||
<if test="appCode != null">apply_code = #{appCode},</if>
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="serverAddress != null and serverAddress != ''">server_address = #{serverAddress},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
|
@ -42,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectDeploymentServicePublishVo"/>
|
||||
<where>
|
||||
<if test="appName != null and appName != ''"> and app_name like concat('%', #{appName}, '%')</if>
|
||||
<if test="appCode != null and appCode != ''"> and app_code = #{appCode}</if>
|
||||
<if test="version != null and version != ''"> and version = #{version}</if>
|
||||
<if test="validityStartTime != null "> and validity_start_time = #{validityStartTime}</if>
|
||||
<if test="validityEndTime != null "> and validity_end_time = #{validityEndTime}</if>
|
||||
@ -58,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="applyId != null">apply_id,</if>
|
||||
<if test="appName != null and appName != ''">app_name,</if>
|
||||
<if test="appCode != null and appCode != ''">app_code,</if>
|
||||
<if test="apkUrl != null and apkUrl != ''">apk_url,</if>
|
||||
<if test="systemType != null and systemType != ''">system_type,</if>
|
||||
<if test="apkId != null and apkId != ''">apk_id,</if>
|
||||
@ -84,6 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="applyId != null">#{applyId},</if>
|
||||
<if test="appName != null and appName != ''">#{appName},</if>
|
||||
<if test="appCode != null and appCode != ''">#{appCode},</if>
|
||||
<if test="apkUrl != null and apkUrl != ''">#{apkUrl},</if>
|
||||
<if test="systemType != null and systemType != ''">#{systemType},</if>
|
||||
<if test="apkId != null and apkId != ''">#{apkId},</if>
|
||||
|
@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysApkInfoVo">
|
||||
select id, app_id,app_code, uploading_type, sys_apk_name, version, sys_apk, sys_apk_size, sys_type, uploading_status, uploading_log_id, order_num, is_delete, created, modified, create_time, update_time from SYS_APK_INFO
|
||||
select id, app_id,app_code, uploading_type, sys_apk_name, version, sys_apk, sys_apk_size, sys_type, uploading_status, uploading_log_id, order_num, is_delete, created, modified, create_time, update_time from DEPLOYMENT_APK_INFO
|
||||
</sql>
|
||||
|
||||
<select id="selectSysApkInfoList" parameterType="SysApkInfo" resultMap="SysApkInfoResult">
|
||||
@ -47,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<insert id="insertSysApkInfo" parameterType="SysApkInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into SYS_APK_INFO
|
||||
insert into DEPLOYMENT_APK_INFO
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="uploadingType != null and uploadingType != ''">uploading_type,</if>
|
||||
<if test="sysApkName != null and sysApkName != ''">sys_apk_name,</if>
|
||||
@ -87,7 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</insert>
|
||||
|
||||
<update id="updateSysApkInfo" parameterType="SysApkInfo">
|
||||
update SYS_APK_INFO
|
||||
update DEPLOYMENT_APK_INFO
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="uploadingType != null and uploadingType != ''">uploading_type = #{uploadingType},</if>
|
||||
<if test="sysApkName != null and sysApkName != ''">sys_apk_name = #{sysApkName},</if>
|
||||
@ -110,7 +110,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysApkInfoById" parameterType="Long">
|
||||
delete from SYS_APK_INFO where id = #{id}
|
||||
delete from DEPLOYMENT_APK_INFO where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSysApkInfoByIds" parameterType="String">
|
||||
|
Loading…
x
Reference in New Issue
Block a user