#mybatis 관련 설정 변경

dto의 uuid를 그냥 string으로
This commit is contained in:
Suh
2024-01-05 11:45:53 +09:00
parent 4262262a0b
commit 511a927e33
7 changed files with 32 additions and 26 deletions

View File

@@ -19,7 +19,7 @@ repositories {
dependencies { dependencies {
implementation 'org.springframework.boot:spring-boot-starter-jdbc' implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.3.0' implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.3'
compileOnly 'org.projectlombok:lombok' compileOnly 'org.projectlombok:lombok'
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'
@@ -27,7 +27,7 @@ dependencies {
implementation group: 'org.glassfish.web', name: 'jakarta.servlet.jsp.jstl', version: '2.0.0' implementation group: 'org.glassfish.web', name: 'jakarta.servlet.jsp.jstl', version: '2.0.0'
implementation 'org.apache.tomcat.embed:tomcat-embed-jasper' 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:2.3.0' testImplementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter-test:2.1.3'
// https://mvnrepository.com/artifact/com.google.code.gson/gson // https://mvnrepository.com/artifact/com.google.code.gson/gson
implementation group: 'com.google.code.gson', name: 'gson', version: '2.10.1' implementation group: 'com.google.code.gson', name: 'gson', version: '2.10.1'
// https://mvnrepository.com/artifact/org.apache.poi/poi // https://mvnrepository.com/artifact/org.apache.poi/poi

View File

@@ -5,6 +5,8 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import java.util.UUID;
@Controller @Controller
public class AuthorityController { public class AuthorityController {
@Autowired @Autowired
@@ -12,10 +14,11 @@ public class AuthorityController {
@GetMapping("/test/tt") @GetMapping("/test/tt")
public ModelAndView test(ModelAndView mav){ public ModelAndView test(ModelAndView mav, AuthorityDto d){
//AuthorityDto dto = authorityService.selectById("94690a18-a933-11ee-b9dd-0242ac110006"); d.setId("94690a18-a933-11ee-b9dd-0242ac110006");
AuthorityDto dto = authorityService.selectById(d);
//System.out.println(dto.getName()); System.out.println(dto.getName());
mav.setViewName("test/testlayout"); mav.setViewName("test/testlayout");
return mav; return mav;

View File

@@ -10,20 +10,21 @@ import java.util.UUID;
@AllArgsConstructor @AllArgsConstructor
@Alias("AuthorityDto") @Alias("AuthorityDto")
public class AuthorityDto { public class AuthorityDto {
private UUID id; private String id;
private String name; private String name;
private int account; private Integer account;
private int authority; private Integer authority;
private int productCategory; private Integer productCategory;
private int product; private Integer product;
private int prices; private Integer prices;
private int vendor; private Integer vendor;
private int warehouse; private Integer warehouse;
private int stock; private Integer stock;
private int planIn; private Integer planIn;
private int productIn; private Integer productIn;
private int productOut; private Integer productOut;
private int board; private Integer board;
private boolean activation; private Boolean activation;
private boolean isGroupAuthority; private Boolean isGroupAuthority;
} }

View File

@@ -1,11 +1,12 @@
package com.no1.wms.authority; package com.no1.wms.authority;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import java.util.UUID; import java.util.UUID;
@Repository
@Mapper @Mapper
public interface AuthorityMapper { public interface AuthorityMapper {
AuthorityDto selectById(String id); AuthorityDto selectById(AuthorityDto id);
} }

View File

@@ -11,7 +11,7 @@ public class AuthorityService {
@Autowired @Autowired
AuthorityMapper mapper; AuthorityMapper mapper;
public AuthorityDto selectById(String id){ public AuthorityDto selectById(AuthorityDto dto){
return mapper.selectById(id); return mapper.selectById(dto);
} }
} }

View File

@@ -1,6 +1,7 @@
package com.no1.wms.base; package com.no1.wms.base;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

View File

@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTO Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!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"> <mapper namespace="com.no1.wms.stock.StockMapper">
<!-- select --> <!-- select -->
<select id="count" parameterType="map" resultType="com.no1.wms.stock.StockDto"> <select id="count" parameterType="map" resultType="com.no1.wms.stock.StockDto">
@@ -27,7 +27,7 @@
order by id desc limit #{start}, #{perPage} order by id desc limit #{start}, #{perPage}
</select> </select>
<select id="stockOne" parameterType="UUID" resultType="com.no1.wms.stock.StockDto"> <select id="stockOne" parameterType="java.util.UUID" resultType="com.no1.wms.stock.StockDto">
selct * from stock where id = #{id} selct * from stock where id = #{id}
</select> </select>
<!-- select --> <!-- select -->