Commit 2ea4f8b2 authored by litengwei's avatar litengwei

Merge remote-tracking branch 'origin/develop_dl' into develop_dl

parents c60bf9de 7315b817
package com.yeejoin.equipmanage.common.dto;
import lombok.Data;
@Data
public class FileManageDto {
private Long id;
/**
* 创建事件
*/
private String createDate;
/**
* 名称 - 输入或下拉
*/
private String name;
/**
* 类型
*/
private String type;
/**
* 文件名称
*/
private String fileName;
/**
* 文件地址
*/
private String fileUrl;
/**
* 业务类别-业务大类 区分项目管理、设备资料等
*/
private String businessCategory;
/**
* 业务小类-区分项目管理中不同页签 检验管理、消防改造
*/
private String businessType;
/**
* 机构编码 - 用于权限过滤
*/
private String bizOrgCode;
private Integer pageNumber;
private Integer pageSize;
}
package com.yeejoin.equipmanage.common.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("wl_file_manage")
public class FileManage extends BaseEntity {
/**
* 名称 - 输入或下拉
*/
private String name;
/**
* 类型
*/
@TableField("type")
private String type;
/**
* 文件名称
*/
@TableField("file_name")
private String fileName;
/**
* 部件id
*/
@TableField("file_url")
private String fileUrl;
/**
* 部件名称
*/
@TableField("business_category")
private String businessCategory;
/**
* 部件名称
*/
@TableField("business_type")
private String businessType;
/**
* 机构编码 - 用于权限过滤
*/
@TableField("biz_org_code")
private String bizOrgCode;
}
package com.yeejoin.equipmanage.controller;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.equipmanage.common.dto.FileManageDto;
import com.yeejoin.equipmanage.common.entity.FileManage;
import com.yeejoin.equipmanage.common.utils.CommonPageInfoParam;
import com.yeejoin.equipmanage.common.utils.CommonPageParamUtil;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.config.PersonIdentify;
import com.yeejoin.equipmanage.service.FileManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Date;
import java.util.Map;
@RestController
@Api(tags = "卡片 - 项目管理管理")
@RequestMapping(value = "/cardFileManage", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class FileManageController extends BaseController {
@Autowired
private FileManageService fileManageService;
@PersonIdentify
@RequestMapping(value = "/saveFileManage", method = RequestMethod.POST)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "POST", value = "添加", produces = "application/json;charset=UTF-8", notes = "添加")
public ResponseModel saveFileManage(@RequestBody FileManageDto dto) {
ReginParams reginParams = getSelectedOrgInfo();
dto.setBizOrgCode(reginParams.getPersonIdentity().getBizOrgCode());
fileManageService.saveFileManage(dto);
return CommonResponseUtil.success();
}
@PersonIdentify
@RequestMapping(value = "/getFileManageByPage", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "列表查询", produces = "application/json;charset=UTF-8", notes = "列表查询")
public ResponseModel<Map<String, Object>> getFileManageByPage(FileManageDto dto) {
ReginParams reginParams = getSelectedOrgInfo();
dto.setBizOrgCode(reginParams.getPersonIdentity().getBizOrgCode());
return CommonResponseUtil.success(fileManageService.getFileManageByPage(dto));
}
@PersonIdentify
@RequestMapping(value = "/getFileManageByName", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "列表行点击查看按钮", produces = "application/json;charset=UTF-8", notes = "列表行点击查看按钮")
public ResponseModel<Page<Map<String, Object>>> getFileManageByName(FileManageDto dto) {
ReginParams reginParams = getSelectedOrgInfo();
dto.setBizOrgCode(reginParams.getPersonIdentity().getBizOrgCode());
return CommonResponseUtil.success(fileManageService.getFileManageByName(dto));
}
}
package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.dto.FileManageDto;
import com.yeejoin.equipmanage.common.entity.FileManage;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
public interface FileManageMapper extends BaseMapper<FileManage> {
/**
* 列表查询
*/
Page<Map<String, Object>> getFileManageByPage(@Param("page") Page page, @Param("dto") FileManageDto dto);
/**
* 列表上统计信息
*/
Map<String, Object> getCountInfo(@Param("dto") FileManageDto dto);
/**
* 根据名称查详细文件
*/
Page<Map<String, Object>> getFileManageByName(@Param("page") Page page, @Param("dto") FileManageDto dto);
}
package com.yeejoin.equipmanage.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.equipmanage.common.dto.FileManageDto;
import com.yeejoin.equipmanage.common.entity.FileManage;
import java.util.Map;
public interface FileManageService extends IService<FileManage> {
/**
* 添加文件
* @param dto 数据信息
* @param reginParams 登录信息
*/
void saveFileManage(FileManageDto dto);
/**
* 列表查询
* @param dto 筛选条件
* @return 数据结果
*/
Map<String, Object> getFileManageByPage(FileManageDto dto);
/**
* 列表行点击查看按钮
* @param dto 筛选条件
* @return 数据结果
*/
Page<Map<String, Object>> getFileManageByName(FileManageDto dto);
}
package com.yeejoin.equipmanage.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.equipmanage.common.dto.FileManageDto;
import com.yeejoin.equipmanage.common.entity.FileManage;
import com.yeejoin.equipmanage.mapper.FileManageMapper;
import com.yeejoin.equipmanage.service.FileManageService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Service
public class FileManageServiceImpl extends ServiceImpl<FileManageMapper, FileManage> implements FileManageService {
@Override
public void saveFileManage(FileManageDto dto) {
FileManage fileManage = new FileManage();
BeanUtils.copyProperties(dto, fileManage);
fileManage.setCreateDate(new Date());
this.save(fileManage);
}
@Override
public Map<String, Object> getFileManageByPage(FileManageDto dto) {
Page<Map<String, Object>> fileManageByPage = this.baseMapper.getFileManageByPage(new Page<>(dto.getPageNumber(), dto.getPageSize()), dto);
Map<String, Object> countInfo = this.baseMapper.getCountInfo(dto);
HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("pageInfo", fileManageByPage);
resultMap.put("topInfo", countInfo);
return resultMap;
}
@Override
public Page<Map<String, Object>> getFileManageByName(FileManageDto dto) {
return this.baseMapper.getFileManageByName(new Page<>(dto.getPageNumber(), dto.getPageSize()), dto);
}
}
......@@ -1078,4 +1078,27 @@
alter table `f_fire_fighting_system` add column `system_describe` text DEFAULT NULL COMMENT '系统介绍';
</sql>
</changeSet>
<changeSet author="zs" id="20240313-1">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="wl_file_manage"/>
</not>
</preConditions>
<comment>create table wl_file_manage 卡片项目管理 - 文件管理表</comment>
<sql>
CREATE TABLE `wl_file_manage` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(255) DEFAULT NULL COMMENT '名称 - 输入或下拉',
`type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '文件类型-下拉筛选使用',
`file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '名称',
`file_url` longtext COMMENT '文件路径',
`business_category` varchar(100) DEFAULT NULL COMMENT '业务类别-业务大类 区分项目管理、设备资料等',
`business_type` varchar(100) DEFAULT NULL COMMENT '业务小类-区分项目管理中不同页签 检验管理、消防改造',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`biz_org_code` varchar(255) DEFAULT NULL COMMENT '机构编码',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.equipmanage.mapper.FileManageMapper">
<select id="getFileManageByPage" resultType="java.util.Map">
SELECT
`name`,
count(1) as fileNum
FROM wl_file_manage
<where>
<if test="dto.businessCategory != null and dto.businessCategory != ''">
and business_category = #{dto.businessCategory}
</if>
<if test="dto.businessType != null and dto.businessType != ''">
and business_type = #{dto.businessType}
</if>
<if test="dto.type != null and dto.type != ''">
and `type` = #{dto.type}
</if>
<if test="dto.name != null and dto.name != ''">
and `name` = #{dto.name}
</if>
<if test="dto.bizOrgCode != null and dto.bizOrgCode != ''">
and biz_org_code like concat(#{dto.bizOrgCode}, '%')
</if>
</where>
group by `name`
</select>
<select id="getCountInfo" resultType="java.util.Map">
SELECT
count(distinct `name`) as objectNum,
count(1) as fileNum
FROM wl_file_manage
<where>
<if test="dto.businessCategory != null and dto.businessCategory != ''">
and business_category = #{dto.businessCategory}
</if>
<if test="dto.businessType != null and dto.businessType != ''">
and business_type = #{dto.businessType}
</if>
<if test="dto.type != null and dto.type != ''">
and `type` = #{dto.type}
</if>
<if test="dto.name != null and dto.name != ''">
and `name` = #{dto.name}
</if>
<if test="dto.bizOrgCode != null and dto.bizOrgCode != ''">
and biz_org_code like concat(#{dto.bizOrgCode}, '%')
</if>
</where>
</select>
<select id="getFileManageByName" resultType="java.util.Map">
SELECT
file_name as fileName,
file_url as fileUrl
FROM wl_file_manage
<where>
business_category = #{dto.businessCategory}
and business_type = #{dto.businessType}
<if test="dto.type != null and dto.type != ''">
and `type` = #{dto.type}
</if>
<if test="dto.name != null and dto.name != ''">
and `name` = #{dto.name}
</if>
<if test="dto.fileName != null and dto.fileName != ''">
and `file_name` like concat('%', #{dto.fileName}, '%')
</if>
<if test="dto.bizOrgCode != null and dto.bizOrgCode != ''">
and biz_org_code like concat(#{dto.bizOrgCode}, '%')
</if>
</where>
ORDER BY create_date DESC
</select>
</mapper>
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 to comment