mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-05 04:03:45 +09:00
mybatis 세팅됨
This commit is contained in:
@@ -29,10 +29,12 @@ dependencies {
|
|||||||
developmentOnly 'org.springframework.boot:spring-boot-devtools'
|
developmentOnly 'org.springframework.boot:spring-boot-devtools'
|
||||||
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client'
|
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client'
|
||||||
annotationProcessor 'org.projectlombok:lombok'
|
annotationProcessor 'org.projectlombok:lombok'
|
||||||
|
implementation group: 'org.glassfish.web', name: 'jakarta.servlet.jsp.jstl', version: '2.0.0'
|
||||||
|
implementation 'org.apache.tomcat.embed:tomcat-embed-jasper'
|
||||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||||
testImplementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter-test:3.0.3'
|
testImplementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter-test:3.0.3'
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
tasks.named('test') {
|
tasks.named('test') {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.no1.wms;
|
package com.no1.wms;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
|||||||
26
src/main/java/com/no1/wms/authority/AuthorityController.java
Normal file
26
src/main/java/com/no1/wms/authority/AuthorityController.java
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package com.no1.wms.authority;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class AuthorityController {
|
||||||
|
@Autowired
|
||||||
|
AuthorityService authorityService;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/test")
|
||||||
|
public ModelAndView test(ModelAndView mav){
|
||||||
|
AuthorityDto dto = authorityService.selectById("94690a18-a933-11ee-b9dd-0242ac110006");
|
||||||
|
|
||||||
|
System.out.println(dto.getName());
|
||||||
|
|
||||||
|
mav.setViewName("test/kkk");
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
29
src/main/java/com/no1/wms/authority/AuthorityDto.java
Normal file
29
src/main/java/com/no1/wms/authority/AuthorityDto.java
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
package com.no1.wms.authority;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.apache.ibatis.type.Alias;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Alias("AuthorityDto")
|
||||||
|
public class AuthorityDto {
|
||||||
|
private UUID id;
|
||||||
|
private String name;
|
||||||
|
private int account;
|
||||||
|
private int authority;
|
||||||
|
private int productCategory;
|
||||||
|
private int product;
|
||||||
|
private int prices;
|
||||||
|
private int vendor;
|
||||||
|
private int warehouse;
|
||||||
|
private int stock;
|
||||||
|
private int planIn;
|
||||||
|
private int productIn;
|
||||||
|
private int productOut;
|
||||||
|
private int board;
|
||||||
|
private boolean activation;
|
||||||
|
private boolean isGroupAuthority;
|
||||||
|
}
|
||||||
11
src/main/java/com/no1/wms/authority/AuthorityMapper.java
Normal file
11
src/main/java/com/no1/wms/authority/AuthorityMapper.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package com.no1.wms.authority;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface AuthorityMapper {
|
||||||
|
AuthorityDto selectById(String id);
|
||||||
|
}
|
||||||
17
src/main/java/com/no1/wms/authority/AuthorityService.java
Normal file
17
src/main/java/com/no1/wms/authority/AuthorityService.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package com.no1.wms.authority;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class AuthorityService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
AuthorityMapper mapper;
|
||||||
|
public AuthorityDto selectById(String id){
|
||||||
|
return mapper.selectById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
12
src/main/java/com/no1/wms/base/BaseController.java
Normal file
12
src/main/java/com/no1/wms/base/BaseController.java
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package com.no1.wms.base;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class BaseController {
|
||||||
|
@GetMapping("/")
|
||||||
|
public String base(){
|
||||||
|
return "base/hello";
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/main/java/com/no1/wms/login/LoginController.java
Normal file
15
src/main/java/com/no1/wms/login/LoginController.java
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
package com.no1.wms.login;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class LoginController {
|
||||||
|
@GetMapping("/login")
|
||||||
|
public ModelAndView login(ModelAndView mav){
|
||||||
|
mav.setViewName("login");
|
||||||
|
return mav;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
7
src/main/java/com/no1/wms/utils/Utils.java
Normal file
7
src/main/java/com/no1/wms/utils/Utils.java
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package com.no1.wms.utils;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class Utils {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1 +1,13 @@
|
|||||||
|
#DB Datasource
|
||||||
|
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
|
||||||
|
spring.datasource.url=jdbc:mariadb://summerneko.com:43306/wms
|
||||||
|
spring.datasource.username=client
|
||||||
|
spring.datasource.password=no1wms
|
||||||
|
|
||||||
|
# Mapper Xml Location
|
||||||
|
mybatis.mapper-locations=classpath:mappers/*.xml
|
||||||
|
mybatis.type-aliases-package=com.no1.wms
|
||||||
|
|
||||||
|
# jsp
|
||||||
|
spring.mvc.view.prefix=/WEB-INF/views/
|
||||||
|
spring.mvc.view.suffix=.jsp
|
||||||
9
src/main/resources/mappers/AuthorityMapper.xml
Normal file
9
src/main/resources/mappers/AuthorityMapper.xml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTO Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.no1.wms.authority.AuthorityMapper">
|
||||||
|
<select id="selectById" resultType="AuthorityDto">
|
||||||
|
SELECT * FROM authority WHERE id = #{id}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
10
src/main/resources/static/hello.html
Normal file
10
src/main/resources/static/hello.html
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
11
src/main/webapp/WEB-INF/views/base/hello.jsp
Normal file
11
src/main/webapp/WEB-INF/views/base/hello.jsp
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
kkkkkk
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
11
src/main/webapp/WEB-INF/views/test/kkk.jsp
Normal file
11
src/main/webapp/WEB-INF/views/test/kkk.jsp
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
kkkkk 성공
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user