diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/service/impl/MaTypeServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/service/impl/MaTypeServiceImpl.java index 4d55eb1..b93af7e 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/service/impl/MaTypeServiceImpl.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/base/service/impl/MaTypeServiceImpl.java @@ -65,8 +65,11 @@ public class MaTypeServiceImpl implements ITypeService { level = maType1.getLevel(); } maType.setLevel(String.valueOf(Integer.parseInt(level) + 1)); + maType.setCompanyId(maType1.getCompanyId()); maType.setCreateTime(DateUtils.getNowDate()); - System.out.println(maType); + if (parentId == 0){ + maType.setCompanyId("101"); + } int i = maTypeMapper.insertType(maType); Long typeId = maType.getTypeId(); // 图片路径保存 diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/InputRecordMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/InputRecordMapper.xml index 9f11484..d272681 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/InputRecordMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/InputRecordMapper.xml @@ -92,5 +92,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" mt.type_name like concat('%',#{keyWord},'%') or mm.ma_code like concat('%',#{keyWord},'%')) + order by lod.create_time desc \ No newline at end of file diff --git a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/SgzbSystemApplication.java b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/SgzbSystemApplication.java index b9b625a..b4881fd 100644 --- a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/SgzbSystemApplication.java +++ b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/SgzbSystemApplication.java @@ -6,10 +6,15 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import com.bonus.sgzb.common.security.annotation.EnableCustomConfig; import com.bonus.sgzb.common.security.annotation.EnableRyFeignClients; import com.bonus.sgzb.common.swagger.annotation.EnableCustomSwagger2; +import org.springframework.boot.web.servlet.MultipartConfigFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.util.unit.DataSize; + +import javax.servlet.MultipartConfigElement; /** * 系统模块 - * + * * @author ruoyi */ @EnableCustomConfig @@ -17,11 +22,9 @@ import com.bonus.sgzb.common.swagger.annotation.EnableCustomSwagger2; @EnableRyFeignClients @SpringBootApplication @EnableEncryptableProperties -public class SgzbSystemApplication -{ - public static void main(String[] args) - { +public class SgzbSystemApplication { + public static void main(String[] args) { SpringApplication.run(SgzbSystemApplication.class, args); - System.out.println("(♥◠‿◠)ノ゙ 系统模块启动成功 ლ(´ڡ`ლ)゙ \n" ); + System.out.println("(♥◠‿◠)ノ゙ 系统模块启动成功 ლ(´ڡ`ლ)゙ \n"); } -} +} \ No newline at end of file diff --git a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/SysFileServiceImpl.java b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/SysFileServiceImpl.java index f44d369..5610094 100644 --- a/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/SysFileServiceImpl.java +++ b/sgzb-modules/sgzb-system/src/main/java/com/bonus/sgzb/system/service/impl/SysFileServiceImpl.java @@ -72,6 +72,12 @@ public class SysFileServiceImpl implements SysFileService { if (!ALLOWED_EXTENSIONS.contains(fileExtension.toLowerCase())) { throw new Exception("不支持该文件格式"); } + // 检查文件大小 + long fileSize = item.getSize(); + long maxSize = 20 * 1024 * 1024; // 20MB + if (fileSize > maxSize) { + throw new Exception("文件太大,请重新上传"); + } try { String url = saveFile(request, item, photoType); //AjaxResult res = fileClient.uploadFile(item);