Compare commits
4 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
74817103de | 8 months ago |
|
|
c575dbd936 | 8 months ago |
|
|
24103e115a | 8 months ago |
|
|
b8a5d49e55 | 8 months ago |
@ -1,9 +0,0 @@
|
||||
package com.zsz.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zsz.pojo.Admin;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface AdminMapper extends BaseMapper<Admin> {
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Zheng Jie
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.zsz.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
/**
|
||||
* WebMvcConfigurer
|
||||
*
|
||||
* @author Zheng Jie
|
||||
* @date 2018-11-30
|
||||
*/
|
||||
@Configuration
|
||||
//@EnableWebMvc
|
||||
public class ConfigurerAdapter implements WebMvcConfigurer {
|
||||
|
||||
@Resource
|
||||
private SystemUtil systemUtil;
|
||||
|
||||
public static final String PATH_PREFIX = "upload/";
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/" + PATH_PREFIX + "**").addResourceLocations("file:" + systemUtil.getFilePrefix());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.zsz.config;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
|
||||
@Configuration
|
||||
@MapperScan("com.zsz.mapper")
|
||||
public class MpConfig {
|
||||
|
||||
/**
|
||||
* 分页插件
|
||||
*/
|
||||
@Bean
|
||||
public PaginationInterceptor paginationInterceptor() {
|
||||
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
|
||||
// paginationInterceptor.setLimit(你的最大单页限制数量,默认 500 条,小于 0 如 -1 不受限制);
|
||||
return paginationInterceptor;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package com.zsz.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author : Mingxuan_x
|
||||
* @version : 1.0
|
||||
* @Description: 系统工具类
|
||||
* @Telephone : 15135964789
|
||||
* @createDate : 2021/4/11 14:38
|
||||
* @updateUser : Mingxuan_x
|
||||
* @updateDate : 2021/4/11 14:38
|
||||
* @updateRemark : 修改内容
|
||||
**/
|
||||
@Component
|
||||
public class SystemUtil {
|
||||
|
||||
@Value("${file.upload.windows.dir}")
|
||||
private String windowsPath;
|
||||
|
||||
|
||||
@Value("${file.upload.linux.dir}")
|
||||
private String linuxPath;
|
||||
|
||||
@Value("${file.upload.mac.dir}")
|
||||
private String macPath;
|
||||
|
||||
|
||||
private final String LINUX = "linux";
|
||||
private final String WINDOWS = "windows";
|
||||
|
||||
/**
|
||||
* 获取文件存储路径
|
||||
*
|
||||
* @return:
|
||||
* @Author: Mingxuan_X
|
||||
* @Date: 2021/4/11
|
||||
*/
|
||||
|
||||
public String getFilePrefix() {
|
||||
String s = null;
|
||||
//判断操作系统环境
|
||||
String environment = System.getProperty("os.name").toLowerCase();
|
||||
if (environment.contains(LINUX)) {
|
||||
s = linuxPath;
|
||||
} else if (environment.contains(WINDOWS)) {
|
||||
s = windowsPath;
|
||||
} else {
|
||||
s = macPath;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in new issue