Procházet zdrojové kódy

系统用户登录

před 5 roky
rodič
revize
28725496f4

+ 32 - 0
bms/pom.xml

@@ -44,6 +44,38 @@
             <artifactId>spring-boot-starter-test</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper</artifactId>
+            <version>4.1.0</version>  <!--我这里用的是4.1.0版本-->
+        </dependency>
+
+        <!-- mybatis-plus依赖 -->
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+            <version>3.1.2</version>
+        </dependency>
+        <!-- mybatis-plus代码生成器依赖 -->
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-generator</artifactId>
+            <version>3.1.2</version>
+        </dependency>
+
+        <!-- velocity模板引擎 -->
+        <dependency>
+            <groupId>org.apache.velocity</groupId>
+            <artifactId>velocity-engine-core</artifactId>
+            <version>2.0</version>
+        </dependency>
+
+        <!-- freemarker 模板引擎-->
+        <dependency>
+            <groupId>org.freemarker</groupId>
+            <artifactId>freemarker</artifactId>
+            <version>2.3.23</version>
+        </dependency>
     </dependencies>
 
     <build>

+ 18 - 0
bms/src/main/java/com/hssx/bms/BmsApplication.java

@@ -1,13 +1,31 @@
 package com.hssx.bms;
 
+import com.github.pagehelper.PageHelper;
+import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+
+import java.util.Properties;
 
 @SpringBootApplication
+@MapperScan("com.hssx.bms.mapper")
 public class BmsApplication {
 
     public static void main(String[] args) {
         SpringApplication.run(BmsApplication.class, args);
     }
 
+    //配置分页插件
+    @Bean
+    public PageHelper pageHelper(){
+        PageHelper pageHelper = new PageHelper();
+        Properties properties = new Properties();
+        properties.setProperty("offsetAsPageNum","true");
+        properties.setProperty("rowBoundsWithCount","true");
+        properties.setProperty("reasonable","true");
+        properties.setProperty("dialect","mysql");    //配置mysql数据库的方言
+        pageHelper.setProperties(properties);
+        return pageHelper;
+    }
 }

+ 47 - 0
bms/src/main/java/com/hssx/bms/controller/SystemUserController.java

@@ -0,0 +1,47 @@
+package com.hssx.bms.controller;
+
+
+import com.hssx.bms.entity.SystemUser;
+import com.hssx.bms.service.SystemUserService;
+import com.hssx.bms.until.HttpRespMsg;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-10-15
+ */
+@RestController
+@RequestMapping("/system")
+public class SystemUserController {
+    @Autowired
+    private SystemUserService systemUserService;
+
+    /**
+     *
+     * @param user
+     * 参数:name 账号 password 密码
+     * @return
+     */
+    @ApiOperation(value = "普通用户登录", notes = "登录方法")
+    @RequestMapping("/login")
+    @ResponseBody
+    public HttpRespMsg sysLogin(SystemUser user, HttpServletRequest request,
+                                HttpServletResponse response) {
+        HttpRespMsg msg = systemUserService.login(user,request);
+        return msg;
+    }
+
+}
+

+ 80 - 0
bms/src/main/java/com/hssx/bms/entity/SystemUser.java

@@ -0,0 +1,80 @@
+package com.hssx.bms.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-10-15
+ */
+public class SystemUser extends Model<SystemUser> {
+
+    private static final long serialVersionUID=1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @TableField("name")
+    private String name;
+
+    @TableField("password")
+    private String password;
+
+    @TableField("role")
+    private String role;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getRole() {
+        return role;
+    }
+
+    public void setRole(String role) {
+        this.role = role;
+    }
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+    @Override
+    public String toString() {
+        return "SystemUser{" +
+        "id=" + id +
+        ", name=" + name +
+        ", password=" + password +
+        ", role=" + role +
+        "}";
+    }
+}

+ 16 - 0
bms/src/main/java/com/hssx/bms/mapper/SystemUserMapper.java

@@ -0,0 +1,16 @@
+package com.hssx.bms.mapper;
+
+import com.hssx.bms.entity.SystemUser;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-10-15
+ */
+public interface SystemUserMapper extends BaseMapper<SystemUser> {
+
+}

+ 20 - 0
bms/src/main/java/com/hssx/bms/service/SystemUserService.java

@@ -0,0 +1,20 @@
+package com.hssx.bms.service;
+
+import com.hssx.bms.entity.SystemUser;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.hssx.bms.until.HttpRespMsg;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-10-15
+ */
+public interface SystemUserService extends IService<SystemUser> {
+
+    HttpRespMsg login(SystemUser user, HttpServletRequest request);
+}

+ 28 - 0
bms/src/main/java/com/hssx/bms/service/impl/SystemUserServiceImpl.java

@@ -0,0 +1,28 @@
+package com.hssx.bms.service.impl;
+
+import com.hssx.bms.entity.SystemUser;
+import com.hssx.bms.mapper.SystemUserMapper;
+import com.hssx.bms.service.SystemUserService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.hssx.bms.until.HttpRespMsg;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-10-15
+ */
+@Service
+public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemUser> implements SystemUserService {
+
+    @Override
+    public HttpRespMsg login(SystemUser user, HttpServletRequest request) {
+
+        return null;
+    }
+}

+ 14 - 0
bms/src/main/java/com/hssx/bms/test/A.java

@@ -0,0 +1,14 @@
+package com.hssx.bms.test;
+
+interface A { //定义一个接口
+    //全局常量
+    String MESSAGE = "HelloWorld";
+
+    void print(); //定义抽象方法
+
+    default void otherprint() { //定义可以带方法体的默认方法
+
+        System.out.println("默认方法");
+
+    }
+}

+ 13 - 0
bms/src/main/java/com/hssx/bms/test/AsClass.java

@@ -0,0 +1,13 @@
+package com.hssx.bms.test;
+
+/**
+ * Author: 吴涛涛 cuiyi@itany.com
+ * Date : 2019 - 10 - 15 11:36
+ * Description:<描述>
+ * Version: 1.0
+ */
+public abstract class AsClass {
+    private String name;
+    private String password;
+
+}

+ 19 - 0
bms/src/main/java/com/hssx/bms/test/B.java

@@ -0,0 +1,19 @@
+package com.hssx.bms.test;
+
+/**
+ * Author: 吴涛涛 cuiyi@itany.com
+ * Date : 2019 - 10 - 15 11:35
+ * Description:<描述>
+ * Version: 1.0
+ */
+public class B implements A {
+    @Override
+    public void print() {
+
+    }
+
+    @Override
+    public void otherprint() {
+
+    }
+}

+ 217 - 0
bms/src/main/java/com/hssx/bms/until/CodeGenerator.java

@@ -0,0 +1,217 @@
+package com.hssx.bms.until;
+
+import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
+import com.baomidou.mybatisplus.core.toolkit.StringPool;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.generator.AutoGenerator;
+import com.baomidou.mybatisplus.generator.InjectionConfig;
+import com.baomidou.mybatisplus.generator.config.*;
+import com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder;
+import com.baomidou.mybatisplus.generator.config.po.TableInfo;
+import com.baomidou.mybatisplus.generator.config.rules.FileType;
+import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Scanner;
+
+/**
+ * mybatis-plus代码生成器
+ *  使用该类需要添加以下依赖,在此之前请移除所有与mybatis有关的其他依赖,防止冲突
+ *   <dependency>
+ *      <groupId>com.baomidou</groupId>
+ *       <artifactId>mybatis-plus-generator</artifactId>
+ *       <version>3.1.2</version>
+ *  </dependency>
+ *
+ *  <dependency>
+ *        <groupId>com.baomidou</groupId>
+ *        <artifactId>mybatis-plus-boot-starter</artifactId>
+ *        <version>3.1.2</version>
+ *   </dependency>
+ *
+ */
+// 演示例子,执行 main 方法控制台输入模块表名回车自动生成对应项目目录中
+public class CodeGenerator {
+
+    /**
+     * <p>
+     * 读取控制台内容
+     * </p>
+     */
+    public static String scanner(String tip) {
+        Scanner scanner = new Scanner(System.in);
+        StringBuilder help = new StringBuilder();
+        help.append("请输入" + tip + ":");
+        System.out.println(help.toString());
+        if (scanner.hasNext()) {
+            String ipt = scanner.next();
+            if (StringUtils.isNotEmpty(ipt)) {
+                return ipt;
+            }
+        }
+        throw new MybatisPlusException("请输入正确的" + tip + "!");
+    }
+
+    public static void main(String[] args) {
+        // 代码生成器
+        AutoGenerator mpg = new AutoGenerator();
+
+        // 全局配置
+        GlobalConfig gc = new GlobalConfig();
+        // 全局配置
+
+
+        // 自定义文件命名,注意 %s 会自动填充表实体属性!
+//        gc.setMapperName("%sDao");
+//        gc.setXmlName("%sMapper");
+//        gc.setServiceName("%sService");
+//        gc.setServiceImplName("%sServiceImap");
+//        gc.setControllerName("%sController");
+        //生成的代码存放到某个路径下,这里是E盘,
+//        gc.setOutputDir("E://");
+        //生成的代码位置为当前项目
+        String projectPath = System.getProperty("user.dir");
+        gc.setOutputDir(projectPath + "/src/main/java");
+        gc.setAuthor("吴涛涛");
+        gc.setOpen(false);
+        gc.setFileOverride(true);
+        gc.setActiveRecord(true);
+        //%s是实体类类名占位符,不配置这行的话,对于User会生成IUserService,配置后即可生成UserService;
+        gc.setServiceName("%sService");
+        // XML 二级缓存
+//      gc.setEnableCache(true);
+        // XML ResultMap
+        gc.setBaseResultMap(true);
+        // XML columList
+        gc.setBaseColumnList(true);
+        //
+        // gc.setSwagger2(true); 实体属性 Swagger2 注解
+        mpg.setGlobalConfig(gc);
+
+        // 数据源配置
+        DataSourceConfig dsc = new DataSourceConfig();
+        dsc.setUrl("jdbc:mysql://118.190.47.230:3306/dolphin_edu?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8");
+//        dsc.setSchemaName("public");
+        dsc.setDriverName("com.mysql.cj.jdbc.Driver");
+        dsc.setUsername("root");
+        dsc.setPassword("p011430seya1026");
+        mpg.setDataSource(dsc);
+
+        // 包配置
+        PackageConfig pc = new PackageConfig();
+        //若果需要在Parent(此处即com.example.plus)下新建模块时打开下面注释,后续在控制台提示输入模块时,输入想要新建的模块名就可以
+//        pc.setModuleName(scanner("模块名"));
+        pc.setParent("com.hssx.bms");
+        mpg.setPackageInfo(pc);
+
+        // 自定义配置
+        InjectionConfig cfg = new InjectionConfig() {
+            @Override
+            public void initMap() {
+                // to do nothing
+            }
+        };
+        //以下为两种模板来生成*mapper.xml文件,任选一种即可,不同的模板对应不同的依赖
+        // 如果模板引擎是 freemarker,请添加以下依赖。
+        /**
+         *         <dependency>
+         *             <groupId>org.freemarker</groupId>
+         *             <artifactId>freemarker</artifactId>
+         *             <version>2.3.23</version>
+         *         </dependency>
+         */
+//        String templatePath = "/templates/mapper.xml.ftl";
+        // 如果模板引擎是 velocity 请添加以下依赖。
+        /**
+         *         <dependency>
+         *             <groupId>org.apache.velocity</groupId>
+         *             <artifactId>velocity-engine-core</artifactId>
+         *             <version>2.0</version>
+         *         </dependency>
+         */
+         String templatePath = "/templates/mapper.xml.vm";
+
+        // 自定义输出配置
+        List<FileOutConfig> focList = new ArrayList<>();
+        // 自定义配置会被优先输出
+        focList.add(new FileOutConfig(templatePath) {
+            @Override
+            public String outputFile(TableInfo tableInfo) {
+                if(pc.getModuleName() == null){
+                    return projectPath + "/src/main/resources/mapper/"
+                            + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
+                }else{
+                    // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
+                    return projectPath + "/src/main/resources/mapper/" + pc.getModuleName()
+                            + "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
+                }
+
+            }
+
+        });
+
+        cfg.setFileCreate(new IFileCreate() {
+            @Override
+            public boolean isCreate(ConfigBuilder configBuilder, FileType fileType, String filePath) {
+                // 判断自定义文件夹是否需要创建,这里调用默认的方法
+                checkDir(filePath);
+                //对于已存在的文件,只需重复生成 entity 和 mapper.xml
+                File file = new File(filePath);
+                boolean exist = file.exists();
+                if(exist){
+                    if (filePath.endsWith("Mapper.xml")||FileType.ENTITY==fileType){
+                        return true;
+                    }else {
+                        return false;
+                    }
+                }
+                //不存在的文件都需要创建
+                return  true;
+            }
+        });
+
+        cfg.setFileOutConfigList(focList);
+        mpg.setCfg(cfg);
+        mpg.setTemplate(new TemplateConfig().setXml(null));
+
+        // 配置模板
+//        TemplateConfig templateConfig = new TemplateConfig();
+//
+//        // 配置自定义输出模板
+//        //指定自定义模板路径,注意不要带上.ftl/.vm, 会根据使用的模板引擎自动识别
+//        // templateConfig.setEntity("templates/entity2.java");
+//        // templateConfig.setService();
+//        // templateConfig.setController();
+//
+//        templateConfig.setXml(null);
+//        mpg.setTemplate(templateConfig);
+
+        // 策略配置
+        StrategyConfig strategy = new StrategyConfig();
+        strategy.setNaming(NamingStrategy.underline_to_camel);
+        strategy.setColumnNaming(NamingStrategy.underline_to_camel);
+        //若想要生成的实体类继承某个类,则可打开下面注释。写上需要继承的类的位置即可
+//        strategy.setSuperEntityClass("com.baomidou.ant.common.BaseEntity");
+        //【实体】是否为lombok模型(默认 false)
+//        strategy.setEntityLombokModel(true);
+        //对控制器生成 @RestController 注解
+        strategy.setRestControllerStyle(true);
+        //是否生成实体时,生成字段注解
+        strategy.setEntityTableFieldAnnotationEnable(true);
+//        strategy.setEntitySerialVersionUID(false)//加此行不生成生成实体类序列化编号,不加默认生成
+        //若想要生成的实体类继承某个Controller,则可打开下面注释。写上需要继承的Controller的位置即可
+//        strategy.setSuperControllerClass("com.baomidou.ant.common.BaseController");
+        //此处user是表名,多个英文逗号分割
+        strategy.setInclude("system_user");
+//        strategy.setExclude();//数据库表全生成
+//        strategy.setInclude(scanner("user").split(","));//表名,多个英文逗号分割
+        strategy.setControllerMappingHyphenStyle(true);
+        //数据库表前缀,不配置这行的话,生成的类会带有T如:TUser,配置后即可将前缀去掉
+//        strategy.setTablePrefix("tb_");
+        mpg.setStrategy(strategy);
+//        mpg.setTemplateEngine(new FreemarkerTemplateEngine());
+        mpg.execute();
+    }
+}

+ 39 - 0
bms/src/main/java/com/hssx/bms/until/HttpRespMsg.java

@@ -0,0 +1,39 @@
+package com.hssx.bms.until;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+import java.io.Serializable;
+
+public class HttpRespMsg implements Serializable {
+
+    //status code, ok or error.
+    public String code;
+
+
+    @JsonInclude(JsonInclude.Include.NON_NULL)
+    public String msg;
+
+    //data content, in jsonformat, or zipped string when format is gzip
+    @JsonInclude(JsonInclude.Include.NON_NULL)
+    public Object data;
+
+    public HttpRespMsg() {
+        code = "ok";
+    }
+
+    public void setError(String errorMsg) {
+        code = "error";
+        msg = errorMsg;
+    }
+
+
+    public String toJSONStr() {
+        JSONObject json = new JSONObject();
+        json.put("code", code);
+        json.put("data", data);
+        json.put("msg", msg);
+
+        return json.toJSONString();
+    }
+}

+ 135 - 0
bms/src/main/java/com/hssx/bms/until/MD5Util.java

@@ -0,0 +1,135 @@
+package com.hssx.bms.until;
+
+import org.springframework.util.DigestUtils;
+
+import java.io.*;
+import java.text.ParseException;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipOutputStream;
+
+/**
+ * Author: 吴涛涛 cuiyi@itany.com
+ * Date : 2019 - 07 - 25 16:56
+ * Description:<描述>MD5加密工具
+ * Version: 1.0
+ */
+public class MD5Util {
+
+    public static String getPassword(String password) {
+        return DigestUtils.md5DigestAsHex(password.getBytes());
+    }
+
+    public static void main(String[] args) throws ParseException {
+        String a = "1.0.1";
+        String b = "1.0.2";
+        int i = b.compareTo(a);
+        int i1 = a.compareTo(b);
+        System.out.println(i+":"+i1);
+//        zip4jDemo();
+
+//        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+////        LocalDateTime parse = LocalDateTime.parse("2019-07-31T16:00:00.000Z", formatter);
+//        System.out.println(parse);
+
+//        String start = "2019-07-31T16:00:00.000Z".replace("Z", " UTC");//是空格+UTC
+//        DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z");
+//        Date date1 = df.parse(start);
+//        SimpleDateFormat df1 = new SimpleDateFormat ("EEE MMM dd HH:mm:ss Z yyyy", Locale.UK);
+//        Date startDate = df1.parse(date1.toString());
+//        System.out.println("date1.toString()"+date1.toString()+"=====startDate"+startDate);
+//        String substring = "D:/mould/upload/".substring(0, "D:/mould/upload/".length() - "/upload/".length());
+//        System.out.println("substring"+substring);
+//        List<Integer>ids = new ArrayList<>();
+//        ids.add(-1);
+//        List<String> list1 = new ArrayList<String>();
+//        List<String> list2 = new ArrayList<String>();
+//        list1.add("g");
+//        list1.add("s");
+//        list1.add("a");
+//        list1.add("f");
+//        list2.add("g");
+//        list2.add("c");
+//        list2.add("b");
+//        list2.add("a");
+//        list1.retainAll(list2);
+//        System.out.print(list1);
+//        String password = "000000";
+//        System.out.println(MD5Util.getPassword(password));
+//        System.out.println(UUID.randomUUID().toString().replaceAll("-", ""));;
+
+
+    }
+
+//    public void zipDemo() {
+//        //需要压缩的文件--包括文件地址和文件名
+//        String[] path = {"D:\\666.jpg", "D:\\777.jpg"};
+//        // 要生成的压缩文件地址和文件名称
+//        String desPath = "D:\\new.zip";
+//        File zipFile = new File(desPath);
+//        ZipOutputStream zipStream = null;
+//        FileInputStream zipSource = null;
+//        BufferedInputStream bufferStream = null;
+//        try {
+//            //构造最终压缩包的输出流
+//            zipStream = new ZipOutputStream(new FileOutputStream(zipFile));
+//            for (int i = 0; i < path.length; i++) {
+//                File file = new File(path[i]);
+//                //将需要压缩的文件格式化为输入流
+//                zipSource = new FileInputStream(file);
+//                //压缩条目不是具体独立的文件,而是压缩包文件列表中的列表项,称为条目,就像索引一样
+//                ZipEntry zipEntry = new ZipEntry(i + "2222.jpg");//"2222.jpg"是添加到压缩包里的源文件的名字加i是防止名字相同出错
+//                //定位该压缩条目位置,开始写入文件到压缩包中
+//                zipStream.putNextEntry(zipEntry);
+//                //输入缓冲流
+//                bufferStream = new BufferedInputStream(zipSource, 1024 * 10);
+//                int read = 0;
+//                //创建读写缓冲区
+//                byte[] buf = new byte[1024 * 10];
+//                while ((read = bufferStream.read(buf, 0, 1024 * 10)) != -1) {
+//                    zipStream.write(buf, 0, read);
+//                }
+//            }
+//
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        } finally {
+//            //关闭流
+//            try {
+//                if (null != bufferStream) bufferStream.close();
+//                if (null != zipStream) zipStream.close();
+//                if (null != zipSource) zipSource.close();
+//            } catch (IOException e) {
+//                e.printStackTrace();
+//            }
+//        }
+//    }
+//
+//    public static void zip4jDemo(){
+//// 生成的压缩文件
+//        ZipFile zipFile = null;
+//        try {
+//            zipFile = new ZipFile("D:\\aa.zip");
+//
+//        ZipParameters parameters = new ZipParameters();
+//        // 压缩方式
+//        parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
+//        // 压缩级别
+//        parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
+//        // 要打包的文件夹
+//        File currentFile = new File("D:\\666");
+//        File[] fs = currentFile.listFiles();
+//        // 遍历test文件夹下所有的文件、文件夹
+//        for (File f : fs) {
+//            if (f.isDirectory()) {
+//                zipFile.addFolder(f.getPath(), parameters);
+//            } else {
+//                zipFile.addFile(f, parameters);
+//            }
+//        }
+//            zipFile.addFolder("D:\\666", parameters);
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
+//    }
+}

+ 61 - 0
bms/src/main/resources/application-prod.properties

@@ -0,0 +1,61 @@
+# ####################################################################################################
+# 服务端配置
+server.port=9099
+server.servlet.context-path=/
+server.tomcat.uri-encoding=UTF-8
+server.tomcat.max-http-post-size=-1
+server.connection-timeout=18000000s
+# ####################################################################################################
+# thymeleaf 配置
+spring.thymeleaf.cache=false
+spring.thymeleaf.jackson.time-zone=GMT+8
+spring.thymeleaf.jackson.date-format=yyyy-MM-dd HH:mm:ss
+# ####################################################################################################
+# 数据源配置
+spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
+# 云模服务器对应的数据库
+#spring.datasource.url=jdbc:mysql://118.190.47.230:3306/cloud_model?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+# 我们测试的自己服务器数据库
+spring.datasource.url=jdbc:mysql://118.190.47.230:3306/dolphin_edu?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+spring.datasource.username=root
+spring.datasource.password=p011430seya1026
+#spring.datasource.druid.test-on-borrow=true
+#spring.datasource.druid.test-while-idle=true
+# ####################################################################################################
+# MyBatis 配置
+mybatis.mapper-locations=mappers/*Mapper.xml
+mybatis.type-aliases-package=com.hssx.cloudmodel.entity/*
+# 控制台输出SQL语句
+logging.level.com.hssx.cloudmodel.mapper = debug
+# ####################################################################################################
+#配置Session
+spring.session.store-type=none
+# ####################################################################################################
+#成功页面跳转
+spring.thymeleaf.prefix=classpath:/static/
+######################################################################################################
+## redis 配置
+#spring.redis.host=localhost
+#spring.redis.port=6379
+######################################################################################################
+# 文件上传路径
+upload.path=E:/staticproject/cloudmodel/upload/
+# 备用密码
+sysPwd=yunmo
+######################################################################################################
+# 邀请人员链接前缀
+invitation.url.prefix=http://118.190.47.230:9098/#/invite/
+#######################################################################################################
+# 配置上传文件的大小设置
+# Single file max size  即单个文件大小
+spring.servlet.multipart.max-file-size=1000MB
+spring.servlet.multipart.max-request-size=10000MB
+##################SpringBoot连接池配置########
+spring.datasource.hikari.minimum-idle=3
+spring.datasource.hikari.maximum-pool-size=10
+spring.datasource.hikari.max-lifetime =30000
+spring.datasource.hikari.connection-test-query=SELECT 1
+########################################################################################################
+# 日志
+logging.path=E:/staticproject/cloudmodel/
+

+ 32 - 0
bms/src/main/resources/application-prod.yml

@@ -0,0 +1,32 @@
+
+##########
+logging:
+  level:
+    root: info
+    org.mybatis: debug
+    java.sql: debug
+    org.springframework.web: trace
+    #打印sql语句
+    com.example.plus.mapper: debug
+##########
+mybatis-plus:
+#  mapper-locations: classpath:mapper/*/*.xml
+#  #实体扫描,多个package用逗号或者分号分隔
+#  typeAliasesPackage: com.hssx.cloudmodel
+  global-config:
+    #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+    id-type: 0
+    #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+    field-strategy: 2
+    db-column-underline: true
+    refresh-mapper:
+#################插入和更新非null判断
+    db-config:
+      insert-strategy: not_null
+      update-strategy: not_null
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+########################
+
+

+ 57 - 0
bms/src/main/resources/application.properties

@@ -1 +1,58 @@
+# ####################################################################################################
+# 服务端配置
+server.port=8090
+server.servlet.context-path=/
+server.tomcat.uri-encoding=UTF-8
+server.tomcat.max-http-post-size=-1
+server.connection-timeout=18000000s
+# ####################################################################################################
+# thymeleaf 配置
+spring.thymeleaf.cache=false
+spring.thymeleaf.jackson.time-zone=GMT+8
+spring.thymeleaf.jackson.date-format=yyyy-MM-dd HH:mm:ss
+# ####################################################################################################
+# 数据源配置
+spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
+spring.datasource.url=jdbc:mysql://118.190.47.230:3306/dolphin_edu?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+spring.datasource.username=root
+spring.datasource.password=p011430seya1026
+#spring.datasource.druid.test-on-borrow=true
+#spring.datasource.druid.test-while-idle=true
+# ####################################################################################################
+# MyBatis 配置
+mybatis.mapper-locations=mappers/*Mapper.xml
+mybatis.type-aliases-package=com.hssx.bms.entity/*
+# 控制台输出SQL语句
+logging.level.com.hssx.bms.mapper = debug
+# ####################################################################################################
+#配置Session
+spring.session.store-type=none
+# ####################################################################################################
+#成功页面跳转
+spring.thymeleaf.prefix=classpath:/static/
+######################################################################################################
+## redis 配置
+#spring.redis.host=localhost
+#spring.redis.port=6379
+######################################################################################################
+# 文件上传路径
+upload.path=D:/mould/upload/
+######################################################################################################
+# 文件下载路径
+download.path=D:/mould/download/
+# 邀请人员链接前缀
+invitation.url.prefix=https://localhost:8090/#/invite/
+# 备用密码
+sysPwd=yunmo
+#######################################################################################################
+# 配置上传文件的大小设置
+# Single file max size  即单个文件大小
+spring.servlet.multipart.max-file-size=10000MB
+spring.servlet.multipart.max-request-size=10000MB
+##################SpringBoot连接池配置########
+spring.datasource.hikari.minimum-idle=3
+spring.datasource.hikari.maximum-pool-size=10
+spring.datasource.hikari.max-lifetime =30000
+spring.datasource.hikari.connection-test-query=SELECT 1
+logging.path=E:/
 

+ 30 - 0
bms/src/main/resources/application.yml

@@ -0,0 +1,30 @@
+
+##########
+logging:
+  level:
+    root: info
+    org.mybatis: debug
+    java.sql: debug
+    org.springframework.web: trace
+    #打印sql语句
+    com.example.plus.mapper: debug
+##########
+mybatis-plus:
+#  mapper-locations: classpath:mapper/*/*.xml
+#  #实体扫描,多个package用逗号或者分号分隔
+#  typeAliasesPackage: com.hssx.cloudmodel
+  global-config:
+    #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+    id-type: 0
+    #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+    field-strategy: 2
+    db-column-underline: true
+    refresh-mapper:
+#################插入和更新非null判断
+    db-config:
+      insert-strategy: not_null
+      update-strategy: not_null
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+

+ 18 - 0
bms/src/main/resources/mapper/SystemUserMapper.xml

@@ -0,0 +1,18 @@
+<?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.hssx.bms.mapper.SystemUserMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.hssx.bms.entity.SystemUser">
+        <id column="id" property="id" />
+        <result column="name" property="name" />
+        <result column="password" property="password" />
+        <result column="role" property="role" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, name, password, role
+    </sql>
+
+</mapper>

+ 14 - 0
pom.xml

@@ -38,5 +38,19 @@
             <artifactId>mysql-connector-java</artifactId>
             <scope>runtime</scope>
         </dependency>
+
+        <!-- 文件上传 -->
+        <dependency>
+            <groupId>commons-fileupload</groupId>
+            <artifactId>commons-fileupload</artifactId>
+            <version>1.3.3</version>
+        </dependency>
+
+        <!-- fastjson -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.7</version>
+        </dependency>
     </dependencies>
 </project>