Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master #1

Open
wants to merge 11 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 6 additions & 1 deletion .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/Newenergyvehicle.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/dataSources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

119 changes: 119 additions & 0 deletions Myfile/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<?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>Newenergyvehicle</artifactId>
<groupId>org.example</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>Myfile</artifactId>
<packaging>war</packaging>

<name>Myfile 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>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId>
<version>3.4.1</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>2.0</version>
</dependency>
<!--sfl4j日志依赖-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.7</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.8.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet.jsp.jstl/jstl-api -->
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/taglibs/standard -->
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet.jsp.jstl/jstl-api -->
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
<version>1.2</version>
</dependency>
</dependencies>

<build>
<finalName>Myfile</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>
</project>
60 changes: 60 additions & 0 deletions Myfile/src/main/java/com/zsw/DHY/controller/FilmController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package com.zsw.DHY.controller;

import com.zsw.DHY.pojo.Tbfilm;
import com.zsw.DHY.service.impl.FilmServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
* @program: Newenergyvehicle
* @description:
* @author: Mr.flying
* @create: 2022-06-10 17:12
**/

@Controller
public class FilmController {
@Autowired
private FilmServiceImpl filmService;

@RequestMapping("show.do")
public ModelAndView show() {
ModelAndView mv = new ModelAndView();
ArrayList<Tbfilm> film = filmService.select();
for (Tbfilm tbfilm : film) {
System.out.println(tbfilm.toString());
}
System.out.println("show");
mv.addObject("film", film);
mv.setViewName("Example copy 2");
return mv;
}

@RequestMapping("insert.do")
@ResponseBody
public Map<String, Object> inster(Tbfilm tbfilm) {
Map<String, Object> map = new HashMap<>();
int insert = filmService.insert(tbfilm);
if (insert > 0) {
map.put("code", 200);
} else {
map.put("code", 500);

}
return map;
}
@RequestMapping("deletetfilm.do")
@ResponseBody
public void deletet(@Param("id") String id){
System.out.println("id :"+id);
filmService.deletet(id);
}
}
38 changes: 38 additions & 0 deletions Myfile/src/main/java/com/zsw/DHY/controller/Page.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.zsw.DHY.controller;

import io.swagger.annotations.Api;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
* @program: Newenergyvehicle
* @description:
* @author: Mr.flying
* @create: 2022-06-10 15:40
**/

@Controller
public class Page {

@RequestMapping("page1.do")
public String page1(){
return "huxsfilm";
}
@RequestMapping("page2.do")
public String page2(){
return "Example copy";
}
@RequestMapping("page3.do")
public String page3(){
return "Example copy 2";
}
@RequestMapping("page4.do")
public String page4(){
return "Example copy 3";
}
@RequestMapping("Example.do")
public String Example(){
return "Example";
}

}
62 changes: 62 additions & 0 deletions Myfile/src/main/java/com/zsw/DHY/controller/UserController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.zsw.DHY.controller;

import com.sun.deploy.net.HttpResponse;
import com.zsw.DHY.pojo.TbUser;
import com.zsw.DHY.service.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;

/**
* @program: Newenergyvehicle
* @description:
* @author: Mr.flying
* @create: 2022-06-09 17:11
**/

@Controller
public class UserController {
@Autowired
private UserServiceImpl userService;

@RequestMapping("/login.do")
@ResponseBody
public Map<String, Object> login(String username, String password, HttpServletRequest request, HttpServletResponse response) {
HttpSession session = request.getSession();//session只能通过request取得,不能new
System.out.println("username:" + username);
System.out.println("password:" + password);
Map<String, Object> map = new HashMap<>(12);
TbUser login = userService.login(username, password);
if (login != null) {
map.put("code", 200);
session.setAttribute("user", login);//设置需要的参数(key-value)
System.out.println("login");
} else {

map.put("code", 500);

}
return map;
}

@RequestMapping("/insertUser.do")
@ResponseBody
public Map<String, Object> insert(TbUser tbUser) {
Map<String, Object> map = new HashMap<>();
int insert = userService.insert(tbUser);
if (insert > 0) {
map.put("code", 200);
} else {
map.put("code", 500);
}
return map;
}
}
Loading