代码优化

This commit is contained in:
mashuai 2023-12-14 17:53:53 +08:00
parent 3a3324753a
commit 96962230bc
8 changed files with 51 additions and 9 deletions

View File

@ -11,6 +11,8 @@ import lombok.Data;
@ApiModel("附件表入参") @ApiModel("附件表入参")
public class FileInfoDto { public class FileInfoDto {
private Integer ID;
//模块id //模块id
@ApiModelProperty(value = "模块id", required = true) @ApiModelProperty(value = "模块id", required = true)
private Integer modelId; private Integer modelId;

View File

@ -32,4 +32,12 @@ public class ServiceGreementDto {
//协议状态(0 启用, 1 停用) //协议状态(0 启用, 1 停用)
@ApiModelProperty(value = "协议状态(0 启用, 1 停用)", required = true) @ApiModelProperty(value = "协议状态(0 启用, 1 停用)", required = true)
private String status; private String status;
//模版编号
@ApiModelProperty(value = "模版编号", required = true)
private String modelCode;
//应用模块名称
@ApiModelProperty(value = "应用模块名称", required = true)
private String modelName;
} }

View File

@ -32,6 +32,16 @@ public class ServiceGreementVo {
@ApiModelProperty(value = "协议状态(0 启用, 1 停用)", required = true) @ApiModelProperty(value = "协议状态(0 启用, 1 停用)", required = true)
private String status; private String status;
//模版编号
@Excel(name = "模版编号")
@ApiModelProperty(value = "模版编号", required = true)
private String modelCode;
//应用模块名称
@Excel(name = "应用模块名称")
@ApiModelProperty(value = "应用模块名称", required = true)
private String modelName;
//文件路径 //文件路径
@Excel(name = "文件路径") @Excel(name = "文件路径")
@ApiModelProperty(value = "文件路径", required = true) @ApiModelProperty(value = "文件路径", required = true)

View File

@ -1,5 +1,6 @@
package com.bonus.zlpt.company.controller; package com.bonus.zlpt.company.controller;
import com.bonus.zlpt.common.core.domain.R;
import com.bonus.zlpt.common.core.utils.poi.ExcelUtil; import com.bonus.zlpt.common.core.utils.poi.ExcelUtil;
import com.bonus.zlpt.common.core.web.controller.BaseController; import com.bonus.zlpt.common.core.web.controller.BaseController;
import com.bonus.zlpt.common.core.web.domain.AjaxResult; import com.bonus.zlpt.common.core.web.domain.AjaxResult;
@ -17,6 +18,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.List; import java.util.List;
import java.util.UUID;
/** /**
* 隐私服务协议表(ServiceGreementInfo)表控制层 * 隐私服务协议表(ServiceGreementInfo)表控制层
@ -71,6 +73,8 @@ public class ServiceGreementInfoController extends BaseController {
public AjaxResult addPrivacyAgreementTemplateList(@RequestBody ServiceGreementInfo dto) public AjaxResult addPrivacyAgreementTemplateList(@RequestBody ServiceGreementInfo dto)
{ {
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
String code = UUID.randomUUID().toString().replaceAll("-", "");
dto.getServiceGreementDto().setModelCode(code);
dto.getServiceGreementDto().setUserId(userId.intValue()); dto.getServiceGreementDto().setUserId(userId.intValue());
return toAjax(serviceGreementInfoService.insertConfig(dto)); return toAjax(serviceGreementInfoService.insertConfig(dto));
} }
@ -96,7 +100,8 @@ public class ServiceGreementInfoController extends BaseController {
@ApiOperation("编辑隐私协议模板信息") @ApiOperation("编辑隐私协议模板信息")
public AjaxResult updatePrivacyAgreementTemplateList(@RequestBody ServiceGreementInfo dto) public AjaxResult updatePrivacyAgreementTemplateList(@RequestBody ServiceGreementInfo dto)
{ {
return toAjax(serviceGreementInfoService.update(dto)); serviceGreementInfoService.update(dto);
return success();
} }
/** /**

View File

@ -1,5 +1,6 @@
package com.bonus.zlpt.company.service; package com.bonus.zlpt.company.service;
import com.bonus.zlpt.common.core.domain.R;
import com.bonus.zlpt.company.api.domain.ServiceGreementInfo; import com.bonus.zlpt.company.api.domain.ServiceGreementInfo;
import com.bonus.zlpt.company.api.domain.dto.ServiceDto; import com.bonus.zlpt.company.api.domain.dto.ServiceDto;
import com.bonus.zlpt.company.api.domain.vo.ServiceGreementVo; import com.bonus.zlpt.company.api.domain.vo.ServiceGreementVo;
@ -39,7 +40,7 @@ public interface ServiceGreementInfoService {
* 编辑隐私协议模板信息 * 编辑隐私协议模板信息
* @param dto * @param dto
*/ */
int update(ServiceGreementInfo dto); R update(ServiceGreementInfo dto);
/** /**
* 根据id删除隐私协议模板 * 根据id删除隐私协议模板

View File

@ -1,5 +1,6 @@
package com.bonus.zlpt.company.service.impl; package com.bonus.zlpt.company.service.impl;
import com.bonus.zlpt.common.core.domain.R;
import com.bonus.zlpt.company.api.domain.ServiceGreementInfo; import com.bonus.zlpt.company.api.domain.ServiceGreementInfo;
import com.bonus.zlpt.company.api.domain.dto.ServiceDto; import com.bonus.zlpt.company.api.domain.dto.ServiceDto;
import com.bonus.zlpt.company.api.domain.vo.ServiceGreementVo; import com.bonus.zlpt.company.api.domain.vo.ServiceGreementVo;
@ -64,9 +65,19 @@ public class ServiceGreementInfoServiceImpl implements ServiceGreementInfoServic
*/ */
@Override @Override
@Transactional @Transactional
public int update(ServiceGreementInfo dto) { public R update(ServiceGreementInfo dto) {
mapper.update(dto.getServiceGreementDto());
return mapper.updateAttachment(dto.getFileInfoDto()); if ((dto.getServiceGreementDto() != null && dto.getServiceGreementDto().getServiceId() != null) && (dto.getFileInfoDto() != null && dto.getFileInfoDto().getModelId() != null)) {
mapper.update(dto.getServiceGreementDto());
return R.ok(mapper.updateAttachment(dto.getFileInfoDto()));
}
if (dto.getServiceGreementDto() == null || dto.getServiceGreementDto().getServiceId() == null) {
return R.ok(mapper.updateAttachment(dto.getFileInfoDto()));
}
if (dto.getFileInfoDto() == null || dto.getFileInfoDto().getModelId() == null) {
return R.ok(mapper.update(dto.getServiceGreementDto()));
}
return R.ok();
} }
/** /**

View File

@ -6,14 +6,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertConfig" keyColumn="service_id" keyProperty="serviceId" parameterType="com.bonus.zlpt.company.api.domain.dto.ServiceGreementDto" useGeneratedKeys="true"> <insert id="insertConfig" keyColumn="service_id" keyProperty="serviceId" parameterType="com.bonus.zlpt.company.api.domain.dto.ServiceGreementDto" useGeneratedKeys="true">
insert into service_greement_info ( insert into service_greement_info (
<if test="serviceName != null and serviceName != '' ">service_name,</if> <if test="serviceId != null and serviceId != '' ">service_id,</if>
<if test="serviceName != null and serviceName != ''">service_name,</if>
<if test="userId != null and userId != '' ">user_id,</if> <if test="userId != null and userId != '' ">user_id,</if>
status, <if test="modelCode != null and modelCode != '' ">model_code,</if>
<if test="modelName != null and modelName != '' ">model_name,</if>
create_time create_time
)values( )values(
<if test="serviceId != null and serviceId != '' ">#{serviceId},</if>
<if test="serviceName != null and serviceName != ''">#{serviceName},</if> <if test="serviceName != null and serviceName != ''">#{serviceName},</if>
<if test="userId != null and userId != ''">#{userId},</if> <if test="userId != null and userId != ''">#{userId},</if>
'0', <if test="modelCode != null and modelCode != ''">#{modelCode},</if>
<if test="modelName != null and modelName != ''">#{modelName},</if>
sysdate() sysdate()
) )
</insert> </insert>
@ -36,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="serviceName != null and serviceName != ''">service_name = #{serviceName},</if> <if test="serviceName != null and serviceName != ''">service_name = #{serviceName},</if>
<if test="userId != null and userId != ''">userId = #{userId},</if> <if test="userId != null and userId != ''">userId = #{userId},</if>
<if test="status != null and status != ''">status = #{status},</if> <if test="status != null and status != ''">status = #{status},</if>
<if test="modelName != null and modelName != ''">model_name = #{modelName},</if>
</set> </set>
where service_id = #{serviceId} where service_id = #{serviceId}
</update> </update>

View File

@ -5,7 +5,7 @@ import org.apache.ibatis.annotations.Mapper;
import java.util.List; import java.util.List;
@Mapper
public interface BaseAddressMapper { public interface BaseAddressMapper {
List<BaseAddress> selectEconomizeAddress(); List<BaseAddress> selectEconomizeAddress();