Commit 48fbec66 by lzy

配置

parent 11d07b81
...@@ -109,10 +109,11 @@ CREATE TABLE `plat_role_org` ( ...@@ -109,10 +109,11 @@ CREATE TABLE `plat_role_org` (
CREATE TABLE `plat_logo_config` ( CREATE TABLE `plat_logo_config` (
`id` VARCHAR ( 64 ) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'id', `id` VARCHAR ( 64 ) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'id',
`tenant_id` VARCHAR ( 64 ) COLLATE utf8mb4_general_ci NOT NULL COMMENT '租户id', `tenant_id` VARCHAR ( 64 ) COLLATE utf8mb4_general_ci NOT NULL COMMENT '租户id',
`name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称', `name` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '名称',
`logo_file_id` VARCHAR ( 64 ) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'logo文件ID', `code` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '编码',
`browser_file_id` VARCHAR ( 64 ) COLLATE utf8mb4_general_ci NOT NULL COMMENT '浏览器页签文件Id', `logo_file_id` VARCHAR ( 64 ) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'logo文件ID',
`background_file_id` VARCHAR ( 64 ) COLLATE utf8mb4_general_ci NOT NULL COMMENT '登录背景图片', `browser_file_id` VARCHAR ( 64 ) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '浏览器页签文件Id',
`background_file_id` VARCHAR ( 64 ) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '登录背景图片',
`create_date` datetime NOT NULL COMMENT '创建时间', `create_date` datetime NOT NULL COMMENT '创建时间',
`update_date` datetime NOT NULL COMMENT '更新时间', `update_date` datetime NOT NULL COMMENT '更新时间',
`del_flag` CHAR ( 1 ) DEFAULT NULL COMMENT '删除标识', `del_flag` CHAR ( 1 ) DEFAULT NULL COMMENT '删除标识',
......
package com.makeit.module.controller.sys;
import com.makeit.common.page.PageReqDTO;
import com.makeit.common.page.PageVO;
import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.platform.device.PlatDeviceDTO;
import com.makeit.dto.platform.space.PlatSpaceDeviceQueryDTO;
import com.makeit.dto.platform.sys.PlatLogoConfigDTO;
import com.makeit.dto.platform.sys.PlatLogoConfigDTOVO;
import com.makeit.enums.CommonEnum;
import com.makeit.service.platform.sys.PlatLogoConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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;
/**
* @Author:lzy
* @Date:2023/9/12 10:41
* @Describe:
*/
@Api(tags = "LOGO设置")
@RestController
@RequestMapping("/plat/sys/logo/config/")
public class PlatLogoConfigController {
@Autowired
private PlatLogoConfigService platLogoConfigService;
@ApiOperation("设置LOGO")
@PostMapping("add")
public ApiResponseEntity<?> add(@RequestBody PlatLogoConfigDTO dto) {
platLogoConfigService.add(dto);
return ApiResponseUtils.success();
}
@ApiOperation("查看")
@PostMapping("view")
public ApiResponseEntity<PlatLogoConfigDTOVO> view() {
PlatLogoConfigDTOVO data = platLogoConfigService.view();
return ApiResponseUtils.success(data);
}
}
package com.makeit.dto.platform.sys;
import com.makeit.common.dto.BaseIdDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author:lzy
* @Date:2023/9/12 10:23
* @Describe:
*/
@Data
@ApiModel("LOGO配置")
public class PlatLogoConfigDTO extends BaseIdDTO {
@ApiModelProperty("系统名称")
private String name;
@ApiModelProperty("LOGO文件ID")
private String logoFileId;
@ApiModelProperty("浏览器文件ID")
private String browserFileId;
@ApiModelProperty("背景图片ID")
private String backgroundFileId;
@ApiModelProperty("编码")
private String code;
}
package com.makeit.dto.platform.sys;
import com.makeit.common.dto.BaseIdDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author:lzy
* @Date:2023/9/12 10:25
* @Describe:
*/
@Data
@ApiModel("LOGO配置 PlatLogoConfigDTOVO")
public class PlatLogoConfigDTOVO extends BaseIdDTO {
@ApiModelProperty("系统名称")
private String name;
@ApiModelProperty("LOGO文件ID")
private String logoFileId;
@ApiModelProperty("LOGO文件地址")
private String logoFilePath;
@ApiModelProperty("浏览器文件ID")
private String browserFileId;
@ApiModelProperty("浏览器文件地址")
private String browserFilePath;
@ApiModelProperty("背景图片ID")
private String backgroundFileId;
@ApiModelProperty("背景图片地址")
private String backgroundFilePath;
@ApiModelProperty("编码")
private String code;
}
package com.makeit.dto.platform.sys;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author:lzy
* @Date:2023/9/12 11:22
* @Describe:
*/
@Data
@ApiModel("参数")
public class PlatLogoConfigQueryDTO {
@ApiModelProperty("code")
private String code;
}
...@@ -27,4 +27,7 @@ public class PlatLogoConfig extends BaseBusEntity { ...@@ -27,4 +27,7 @@ public class PlatLogoConfig extends BaseBusEntity {
@ApiModelProperty("背景图片ID") @ApiModelProperty("背景图片ID")
private String backgroundFileId; private String backgroundFileId;
@ApiModelProperty("code")
private String code;
} }
package com.makeit.mapper.platform.sys;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.makeit.entity.platform.sys.PlatLogoConfig;
/**
* @Author:lzy
* @Date:2023/9/12 10:21
* @Describe:
*/
public interface PlatLogoConfigMapper extends BaseMapper<PlatLogoConfig> {
}
package com.makeit.service.platform.sys;
import com.baomidou.mybatisplus.extension.service.IService;
import com.makeit.dto.platform.sys.PlatLogoConfigDTO;
import com.makeit.dto.platform.sys.PlatLogoConfigDTOVO;
import com.makeit.dto.platform.sys.PlatLogoConfigQueryDTO;
import com.makeit.entity.platform.sys.PlatLogoConfig;
/**
* @Author:lzy
* @Date:2023/9/12 10:19
* @Describe:
*/
public interface PlatLogoConfigService extends IService<PlatLogoConfig> {
/**
* 添加
* @param dto
*/
void add(PlatLogoConfigDTO dto);
/**
* 详情
* @return
*/
PlatLogoConfigDTOVO view(PlatLogoConfigQueryDTO dto);
}
package com.makeit.service.platform.sys.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.makeit.dto.platform.sys.PlatLogoConfigDTO;
import com.makeit.dto.platform.sys.PlatLogoConfigDTOVO;
import com.makeit.dto.platform.sys.PlatLogoConfigQueryDTO;
import com.makeit.entity.platform.sys.PlatLogoConfig;
import com.makeit.mapper.platform.sys.PlatLogoConfigMapper;
import com.makeit.module.system.dto.SysFileDTOVO;
import com.makeit.service.platform.sys.PlatLogoConfigService;
import com.makeit.utils.data.convert.BeanDtoVoUtils;
import com.makeit.utils.sys.FileUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Author:lzy
* @Date:2023/9/12 10:19
* @Describe:
*/
@Service
public class PlatLogoConfigServiceImpl extends ServiceImpl<PlatLogoConfigMapper, PlatLogoConfig> implements PlatLogoConfigService {
@Override
@Transactional(rollbackFor = Exception.class)
public void add(PlatLogoConfigDTO dto) {
PlatLogoConfig platLogoConfig = BeanDtoVoUtils.convert(dto,PlatLogoConfig.class);
if(dto.getId() != null){
updateById(platLogoConfig);
}else{
save(platLogoConfig);
}
}
@Override
public PlatLogoConfigDTOVO view(PlatLogoConfigQueryDTO dto) {
LambdaQueryWrapper<PlatLogoConfig> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PlatLogoConfig::getCode,dto.getCode());
List<PlatLogoConfig> list = list(queryWrapper);
PlatLogoConfigDTOVO data = new PlatLogoConfigDTOVO();
if(!list.isEmpty()){
data = BeanDtoVoUtils.convert(list.get(0),PlatLogoConfigDTOVO.class);
List<String> fileIds = new ArrayList<>();
fileIds.add(data.getLogoFileId());
fileIds.add(data.getBrowserFileId());
fileIds.add(data.getBackgroundFileId());
List<SysFileDTOVO> listFile = FileUtil.convert(fileIds);
Map<String,String> map = listFile.stream().collect(Collectors.toMap(SysFileDTOVO::getId,SysFileDTOVO::getFullUrl,(k1,k2)->k1));
data.setLogoFilePath(map.get(data.getLogoFileId()));
data.setBrowserFilePath(map.get(data.getBrowserFileId()));
data.setBackgroundFilePath(map.get(data.getBackgroundFileId()));
}
return data;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment