스프링

스프링의 DTO,MAPPER,DAO 기초

오시리엔 2023. 8. 24. 11:13

@Data

@NoArgsConstructor

public class TestDto {

 

String clientId, clientPassword,clientNickname,clientGrade;

Date clientJoin;

int clientPoint;

 

String itemName;

int itemNo,itemPrice;

Date itemRegist;

 

String basketUser;

int basketNo, basketItem,basketQty;

Date basketTime;

 

 

 

}

 

public class testClientMapper implements RowMapper<TestDto> {

 

@Override

public TestDto mapRow(ResultSet rs, int rowNum) throws SQLException {

TestDto testDto = new TestDto();

testDto.setClientGrade(rs.getString("client_grade"));

testDto.setClientId(rs.getString("client_id"));

testDto.setClientJoin(rs.getDate("client_join"));

testDto.setClientNickname(rs.getString("client_nickname"));

testDto.setClientPassword(rs.getString("client_password"));

testDto.setClientPoint(rs.getInt("client_point"));

return testDto;

}

 

}

 

public class testItemMapper implements RowMapper<TestDto> {

 

@Override

public TestDto mapRow(ResultSet rs, int rowNum) throws SQLException {

TestDto testDto = new TestDto();

testDto.setItemName(rs.getString("item_name"));

testDto.setItemNo(rs.getInt("item_no"));

testDto.setItemPrice(rs.getInt("item_price"));

testDto.setItemRegist(rs.getDate("item_regist"));

return testDto;

}

 

}

 

public class testBasketMapper implements RowMapper<TestDto> {

 

@Override

public TestDto mapRow(ResultSet rs, int rowNum) throws SQLException {

TestDto testDto = new TestDto();

testDto.setBasketItem(rs.getInt("basket_item"));

testDto.setBasketNo(rs.getInt("basket_no"));

testDto.setBasketQty(rs.getInt("basket_qty"));

testDto.setBasketTime(rs.getDate("basket_time"));

testDto.setBasketUser(rs.getString("basket_user"));

return testDto;

}

 

}

 

public interface TestDao {

 

void insertClient();

public List<TestDto> listClient();

TestDto detailClientOne(String clientId);

boolean updateClient(String clientId);

boolean deleteClient(String clientId);

 

 

void insertItme();

public List<TestDto> listItme();

TestDto detailItme(int itemNo);

boolean updateItme(int itemNo);

boolean deleteItme(int itemNo);

 

 

void insertBasket();

public List<TestDto> listBasket();

TestDto detailOneBasket(int basketNo);

boolean updateBasket(int basketNo);

boolean deleteBasket(int basketNo);

}

 

 

 

'스프링' 카테고리의 다른 글

관리자외 접근을 차단하는 인터셉터 구현  (0) 2023.08.22
게시판 작성 코드(컨트롤러)  (0) 2023.08.21
스프링 기초 글쓰기  (0) 2023.08.20
스프링 세팅  (0) 2023.08.20