parent
815843348f
commit
b61cee0454
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>logistics-parent</artifactId>
|
||||
<groupId>com.zhangzeyuan</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>logistics-common</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!-- 时间操作组件 -->
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
</dependency>
|
||||
<!-- Apache工具组件 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-net</groupId>
|
||||
<artifactId>commons-net</artifactId>
|
||||
</dependency>
|
||||
<!-- Jackson Json处理工具包 -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
<!-- 单元测试 -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- 日志处理 -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>logistics-parent</artifactId>
|
||||
<groupId>com.zhangzeyuan</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>logistics-manager-dao</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.zhangzeyuan</groupId>
|
||||
<artifactId>logistics-manager-pojo</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- Mybatis -->
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis-spring</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.miemiedev</groupId>
|
||||
<artifactId>mybatis-paginator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.jsqlparser</groupId>
|
||||
<artifactId>jsqlparser</artifactId>
|
||||
</dependency>
|
||||
<!-- MySql -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
<!-- 连接池 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>logistics-manager</artifactId>
|
||||
<groupId>com.zhangzeyuan</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>logistics-manager-pojo</artifactId>
|
||||
|
||||
|
||||
</project>
|
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>logistics-manager-dao</artifactId>
|
||||
<groupId>com.zhangzeyuan</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>logistics-manager-service</artifactId>
|
||||
<!-- 添加相关的依赖 -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.zhangzeyuan</groupId>
|
||||
<artifactId>logistics-manager-dao</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- 添加Spring的相关依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aspects</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jms</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>logistics-parent</artifactId>
|
||||
<groupId>com.zhangzeyuan</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>logistics-manager</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.zhangzeyuan</groupId>
|
||||
<artifactId>logistics-common</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.zhangzeyuan</groupId>
|
||||
<artifactId>logustucs-manager-web</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<name>logustucs-manager-web Maven Webapp</name>
|
||||
<!-- FIXME change it to the project's website -->
|
||||
<url>http://www.example.com</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
<maven.compiler.target>1.7</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/junit/junit -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<!--<build>
|
||||
<finalName>logustucs-manager-web</finalName>
|
||||
<pluginManagement><!– lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) –>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</plugin>
|
||||
<!– see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging –>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.5.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>-->
|
||||
<build>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.tomcat.maven</groupId>
|
||||
<artifactId>tomcat7-maven-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<configuration>
|
||||
<path>/</path>
|
||||
<port>8082</port>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1,15 @@
|
||||
package com.zhangzeyuan.config;
|
||||
|
||||
import com.zhangzeyuan.pojo.Emp;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* @Author ZZY_1
|
||||
* @Date 2024/1/1 10:21
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = true)
|
||||
@Import(Emp.class)
|
||||
public class MyConfiguration {
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.zhangzeyuan.interceptors;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @Author ZZY_1
|
||||
* @Date 2023/12/31 22:09
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class MyInterceptor implements HandlerInterceptor {
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.zhangzeyuan.interceptors;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* @Author ZZY_1
|
||||
* @Date 2023/12/31 22:11
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class MyInterceptorConfig implements WebMvcConfigurer {
|
||||
@Autowired
|
||||
MyInterceptor myInterceptor;
|
||||
//配置拦截器的路径
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
InterceptorRegistration interceptorRegistration =
|
||||
registry.addInterceptor(myInterceptor).addPathPatterns("/**").excludePathPatterns("/login");
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
您的电脑将要10s内爆炸
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,98 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<style type="text/css">
|
||||
#empTable{
|
||||
width: 80%;
|
||||
border: 1px solid blue;
|
||||
margin: 0px auto;
|
||||
}
|
||||
#empTable th,td{
|
||||
border: 1px solid green;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
<body>this is first thymeleaf!
|
||||
|
||||
<span th:if="${emp} != null">
|
||||
工号:<span th:text="${emp.empno}"></span>
|
||||
:<span th:text="${emp.ename}"></span>
|
||||
:<span th:text="${emp.job}"></span>
|
||||
:<span th:text="${emp.hiredate}"></span>
|
||||
:<span th:text="${emp.sal}"></span>
|
||||
:<span th:text="${emp.comm}"></span>
|
||||
:<span th:text="${emp.mgr}"></span>
|
||||
</span>
|
||||
|
||||
|
||||
<span th:if='${emps} !=null'>
|
||||
<span th:if=" ${emps[0]}!=null">
|
||||
工号:<span th:text="${emps[0].empno}"></span>
|
||||
:<span th:text="${emps[0].ename}"></span>
|
||||
:<span th:text="${emps[0].job}"></span>
|
||||
:<span th:text="${emps[0].hiredate}"></span>
|
||||
:<span th:text="${emps[0].sal}"></span>
|
||||
:<span th:text="${emps[0].comm}"></span>
|
||||
:<span th:text="${emps[0].mgr}"></span>
|
||||
</span>
|
||||
</span>
|
||||
<table id="empTable" cellspacing="0px" cellpadding="0px">
|
||||
<tr>
|
||||
<th>索引</th>
|
||||
<th>序号</th>
|
||||
<th>总人数</th>
|
||||
<th>偶数索引?</th>
|
||||
<th>奇数索引?</th>
|
||||
<th>第一?</th>
|
||||
<th>最后?</th>
|
||||
<th>工号</th>
|
||||
<th>姓名</th>
|
||||
<th>职务</th>
|
||||
<th>上级</th>
|
||||
<th>入职日期</th>
|
||||
<th>year</th>
|
||||
<th>month</th>
|
||||
<th>day</th>
|
||||
<th>工资</th>
|
||||
<th>补助</th>
|
||||
<th>部门号</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
<tr th:each="emp,i:${emps}" th:class="${i.odd}?a:b">
|
||||
<td th:text="${i.index}"></td>
|
||||
<td th:text="${i.count}"></td>
|
||||
<td th:text="${i.size}"></td>
|
||||
<td th:text="${i.odd}"></td>
|
||||
<td th:text="${i.even}"></td>
|
||||
<td th:text="${i.first}"></td>
|
||||
<td th:text="${i.last}"></td>
|
||||
<td th:text="${emp.empno}"></td>
|
||||
<td th:text="${emp.ename}"></td>
|
||||
<td th:text="${emp.job}"></td>
|
||||
<td th:text="${#strings.isEmpty(emp.mgr)?'老板':emp.mgr}"></td>
|
||||
<td th:text="${#dates.format(emp.hiredate,'yyyy-MM-dd')}"></td>
|
||||
<td th:text="${#dates.year(emp.hiredate)}"></td>
|
||||
<td th:text="${#dates.month(emp.hiredate)}"></td>
|
||||
<td th:text="${#dates.day(emp.hiredate)}"></td>
|
||||
<td th:text="${#numbers.formatDecimal(emp.sal,7,'COMMA',2,'POINT')}"></td>
|
||||
<td th:text="${emp.comm}"></td>
|
||||
<td th:text="${emp.deptno}"></td>
|
||||
<td><a href="javascript:void(0)" th:onclick="removeEmp([[${emp.empno}]],[[${emp.ename}]])" >删除</a></td>
|
||||
</tr>
|
||||
<script>
|
||||
function removeEmp(empno,ename) {
|
||||
var result = confirm("确定要删除编号为:"+empno+"的"+ename);
|
||||
if (result) {
|
||||
window.location.href = "removeEmp?empno=" + empno + "&ename=" + ename;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<hr/>
|
||||
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,29 @@
|
||||
package com.zhangzeyuan;
|
||||
|
||||
import com.zhangzeyuan.pojo.Emp;
|
||||
import com.zhangzeyuan.service.EmpService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
/**
|
||||
* @Author ZZY_1
|
||||
* @Date 2023/12/31 21:58
|
||||
* @Version 1.0
|
||||
*/
|
||||
@SpringBootTest(classes = SpringBoot01Application.class)
|
||||
public class SpringBoot01ApplicationTest {
|
||||
|
||||
@Autowired
|
||||
private EmpService empService;
|
||||
@Test
|
||||
public void testFindAll() {
|
||||
List<Emp> list = empService.findAll();
|
||||
list.forEach(System.out::println);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue