2. 다음과 같이 나오도록 하시오. 다음과 같이 나오도록 하시오.
- /emp/salgrade 접속시
- 이름 월급 월급등급
<c:forEach var="empSalgrade" items="${empSalgrades }">
<tr>
<td>${empSalgrade.ename }</td>
<td>${empSalgrade.sal }</td>
<td>${empSalgrade.grade }</td>
</tr>
</c:forEach>
@Slf4j
@Controller
@RequestMapping("/emp")
public class EmpController {
@Autowired
private DeptService deptService;
@GetMapping("/salgrade")
public String salgrade(Model model) {
log.info("salgrade()..");
model.addAttribute("empSalgrades", empService.getEmpSalgradeVOList());
return "/emp/salgrade";
}
}
public interface EmpService {
List<EmpSalgradeVO> getEmpSalgradeVOList();
}
@Slf4j
@Service
public class EmpServiceImpl implements EmpService {
@Autowired
private EmpMapper empMapper;
@Override
public List<EmpSalgradeVO> getEmpSalgradeVOList() {
log.info("getEmpSalgradeVOList()..");
return empMapper.selectEmpSalgradeList();
};
}
@Mapper
public interface EmpMapper {
List<EmpSalgradeVO> selectEmpSalgradeList();
}
<mapper namespace="edu.sejong.ex.mapper.EmpMapper">
<select id="selectEmpSalgradeList" resultType="edu.sejong.ex.vo.EmpSalgradeVO">
<![CDATA[
select * from emp, salgrade where sal >= losal and sal <= hisal
]]>
</select>
</mapper>