mybatis 세팅됨

This commit is contained in:
Suh
2024-01-02 17:10:05 +09:00
parent bf8a470a94
commit 2864bb89d4
14 changed files with 174 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
package com.no1.wms;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View 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;
}
}

View 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;
}

View 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);
}

View 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);
}
}

View 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";
}
}

View 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;
}
}

View File

@@ -0,0 +1,7 @@
package com.no1.wms.utils;
import java.util.UUID;
public class Utils {
}

View File

@@ -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

View 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>

View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>

View 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>

View 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>