Open hyeonpark-5 opened 4 months ago
package com.vitamin.app.service;
import com.vitamin.app.dto.AdminDTO; import com.vitamin.app.dto.ClosedDTO; import com.vitamin.app.dto.NoticeDTO; import com.vitamin.app.dto.ReserveDTO;
public interface AdminService { public int adminLogin(AdminDTO aDTO); public int insertNotice(NoticeDTO nDTO);
public int updateNotice(NoticeDTO nDTO);
public int deleteNotice(NoticeDTO nDTO);
public int insertClosed(ClosedDTO cDTO);
public int checkReserve(ReserveDTO rDTO);
public int adminDeleteReserve(ReserveDTO rDTO);
}
- DoctorService
package com.vitamin.app.service;
import com.vitamin.app.dto.DoctorDTO; import com.vitamin.app.dto.MajorDTO; import com.vitamin.app.dto.MedicationDTO;
public interface DoctorService { public int insertDoctor(DoctorDTO dtDTO);
public int insertMajor(MajorDTO mjDTO);
public int insertMedication(MedicationDTO medDTO);
}
- HospitalService
package com.vitamin.app.service;
import com.vitamin.app.dto.*;
public interface HospitalService { public int insertHospital(HospitalDTO hDTO);
public int insertRoom(RoomDTO rmDTO);
public int insertBreak(BreakDTO bkDTO);
public int insertClinic(ClinicDTO ccDTO);
public int insertConsultation(ConsultationDTO cnDTO);
}
- MainService
package com.vitamin.app.service;
import com.vitamin.app.dto.DiseaseDTO; import com.vitamin.app.dto.NoticeDTO; import com.vitamin.app.dto.ReserveDTO; import com.vitamin.app.dto.UserDTO;
public interface MainService { //회원정보 수정 public int updateUser(UserDTO uDTO); // 회원정보 삭제 public int deleteUser(UserDTO uDTO);
// 예약하기
public int insertReserve(ReserveDTO rDTO);
// 예약 조회
public ReserveDTO selectReserve(ReserveDTO rDTO);
// 예약 수정
public int updateReservation(ReserveDTO rDTO);
// 예약 삭제
public int deleteReserve(ReserveDTO rDTO);
// 게시물 조회
public NoticeDTO selectNotice(NoticeDTO nDTO);
// 질병 입력
public int insertDisease(DiseaseDTO dDTO);
}
- UserService
package com.vitamin.app.service;
import com.vitamin.app.dto.UserDTO;
public interface UserService { // 회원가입 public int insertUser(UserDTO uDTO);
// 로그인
public UserDTO login(String id);
}
틀을 잡음
구체적인 사항은 정의, 구현 필요
package com.vitamin.app.service;
import com.vitamin.app.dto.AdminDTO; import com.vitamin.app.dto.ClosedDTO; import com.vitamin.app.dto.NoticeDTO; import com.vitamin.app.dto.ReserveDTO; import com.vitamin.app.mapper.AdminMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service;
@Service public class AdminServiceImpl implements AdminService{ @Autowired private AdminMapper adminMapper;
@Override
public int adminLogin(AdminDTO aDTO){
return adminMapper.adminLogin(aDTO);
}
@Override
public int insertNotice(NoticeDTO nDTO){
return adminMapper.insertNotice(nDTO);
}
@Override
public int updateNotice(NoticeDTO nDTO){
return adminMapper.updateNotice(nDTO);
}
@Override
public int deleteNotice(NoticeDTO nDTO){
return adminMapper.deleteNotice(nDTO);
}
@Override
public int insertClosed(ClosedDTO cDTO){
return adminMapper.insertClosed(cDTO);
}
@Override
public int checkReserve(ReserveDTO rDTO){
return adminMapper.checkReserve(rDTO);
}
@Override
public int adminDeleteReserve(ReserveDTO rDTO){
return adminMapper.adminDeleteReserve(rDTO);
}
}
- DoctorServiceImpl
package com.vitamin.app.service;
import com.vitamin.app.dto.DoctorDTO; import com.vitamin.app.dto.MajorDTO; import com.vitamin.app.dto.MedicationDTO; import com.vitamin.app.mapper.DoctorMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service;
@Service public class DoctorServiceImpl implements DoctorService{ @Autowired private DoctorMapper doctorMapper;
@Override
public int insertDoctor(DoctorDTO dtDTO){
return doctorMapper.insertDoctor(dtDTO);
}
@Override
public int insertMajor(MajorDTO mjDTO){
return doctorMapper.insertMajor(mjDTO);
}
@Override
public int insertMedication(MedicationDTO medDTO){
return doctorMapper.insertMedication(medDTO);
}
}
- HospitalServiceImpl
package com.vitamin.app.service;
import com.vitamin.app.dto.*; import com.vitamin.app.mapper.HospitalMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service;
@Service public class HospitalServiceImpl implements HospitalService{
@Autowired
private HospitalMapper hospitalMapper;
@Override
public int insertHospital(HospitalDTO hDTO){
return hospitalMapper.insertHospital(hDTO);
}
@Override
public int insertRoom(RoomDTO rmDTO){
return hospitalMapper.insertRoom(rmDTO);
}
@Override
public int insertBreak(BreakDTO bkDTO){
return hospitalMapper.insertBreak(bkDTO);
}
@Override
public int insertClinic(ClinicDTO ccDTO){
return hospitalMapper.insertClinic(ccDTO);
}
@Override
public int insertConsultation(ConsultationDTO cnDTO){
return hospitalMapper.insertConsultation(cnDTO);
}
}
- MainServiceImpl
package com.vitamin.app.service;
import com.vitamin.app.dto.DiseaseDTO; import com.vitamin.app.dto.NoticeDTO; import com.vitamin.app.dto.ReserveDTO; import com.vitamin.app.dto.UserDTO; import com.vitamin.app.mapper.MainMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service;
@Service public class MainServiceImpl implements MainService{ @Autowired private MainMapper mainMapper;
@Override
public int updateUser(UserDTO uDTO){
return mainMapper.updateUser(uDTO);
}
@Override
public int deleteUser(UserDTO uDTO){
return mainMapper.deleteUser(uDTO);
}
@Override
public int insertReserve(ReserveDTO rDTO){
return mainMapper.insertReserve(rDTO);
}
@Override
public ReserveDTO selectReserve(ReserveDTO rDTO){
return mainMapper.selectReserve(rDTO);
}
@Override
public int updateReservation(ReserveDTO rDTO){
return mainMapper.updateReservation(rDTO);
}
@Override
public int deleteReserve(ReserveDTO rDTO){
return mainMapper.deleteReserve(rDTO);
}
@Override
public NoticeDTO selectNotice(NoticeDTO nDTO){
return mainMapper.selectNotice(nDTO);
}
@Override
public int insertDisease(DiseaseDTO dDTO){
return mainMapper.insertDisease(dDTO);
}
}
- UserServiceImpl
package com.vitamin.app.service;
import com.vitamin.app.dto.UserDTO; import com.vitamin.app.mapper.UserMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service;
@Service public class UserServiceImpl implements UserService { @Autowired private UserMapper userMapper;
@Override
public int insertUser(UserDTO uDTO){
return userMapper.insertUser(uDTO);
}
@Override
public UserDTO login(String id){
return userMapper.login(id);
}
}
Mapper 구현
기타사항
adminMapper.xml 예약 확정, 예약취소 id 수정
import com.vitamin.app.dto.AdminDTO; import com.vitamin.app.dto.ClosedDTO; import com.vitamin.app.dto.NoticeDTO; import com.vitamin.app.dto.ReserveDTO; import org.apache.ibatis.annotations.Mapper;
@Mapper public interface AdminMapper { int adminLogin(AdminDTO aDTO); public int insertNotice(NoticeDTO nDTO);
}
package com.vitamin.app.mapper;
import com.vitamin.app.dto.DoctorDTO; import com.vitamin.app.dto.MajorDTO; import com.vitamin.app.dto.MedicationDTO; import org.apache.ibatis.annotations.Mapper;
@Mapper public interface DoctorMapper { public int insertDoctor(DoctorDTO dtDTO);
}
package com.vitamin.app.mapper;
import com.vitamin.app.dto.*;
public interface HospitalMapper { public int insertHospital(HospitalDTO hDTO);
}
package com.vitamin.app.mapper;
import com.vitamin.app.dto.DiseaseDTO; import com.vitamin.app.dto.NoticeDTO; import com.vitamin.app.dto.ReserveDTO; import com.vitamin.app.dto.UserDTO; import org.apache.ibatis.annotations.Mapper;
@Mapper public interface MainMapper { //회원정보 수정 int updateUser(UserDTO uDTO);
}
package com.vitamin.app.mapper;
import com.vitamin.app.dto.DiseaseDTO; import com.vitamin.app.dto.NoticeDTO; import com.vitamin.app.dto.ReserveDTO; import com.vitamin.app.dto.UserDTO; import org.apache.ibatis.annotations.Mapper;
@Mapper public interface MainMapper { //회원정보 수정 int updateUser(UserDTO uDTO);
}