** jsp
<div class="content">
<ul class="tab">
<li style="width:643px;" onclick="goMenuByURL('/calendar/calendarList.do');"><span><message:message code="calendar.tab.calendar" /></span></li>
<li style="width:644px;"class="on" onclick="goMenuByURL('/calendar/calendarFood.do');"><span><message:message code="calendar.tab.food" /></span></li>
</ul>
<div></div>
<ul id="week_one" class="tab2 tab_menu_ul">
<li id="week_1"><span><message:message code="calendar.txt.food.monday" /></span></li>
<li id="week_2"><span><message:message code="calendar.txt.food.tuesday" /></span></li>
<li id="week_3"><span><message:message code="calendar.txt.food.wednesday" /></span></li>
<li id="week_4"><span><message:message code="calendar.txt.food.thursday" /></span></li>
<li id="week_5"><span><message:message code="calendar.txt.food.friday" /></span></li>
</ul>
<div id="tab_1" class="tab_div" style="display: none;">
<c:forEach var="result" items="${list}" varStatus="status" >
<c:if test="${2 == result.WEEK_DAY}">
<dl class="diet1">
<dt>${result.FOOD_NAME}</dt>
<dd>
<c:choose>
<c:when test="${! empty result.IMAGE_PATH}">
<img src="${result.IMAGE_PATH}" onClick="showImageDiv('${result.IMAGE_THUMB_PATH}','<message:message code="calendar.tab.food" />');" alt="오늘의 메뉴" />
</c:when>
<c:otherwise>
<img src="/statics/img/prepare.png" alt="대기중" />
</c:otherwise>
</c:choose>
</dd>
<dd>${result.FOOD_TEXT}</dd>
</dl>
</c:if>
</c:forEach>
</div>
<div id="tab_2" class="tab_div" style="display: none;">
<c:forEach var="result" items="${list}" varStatus="status" >
<c:if test="${3 == result.WEEK_DAY}">
<dl class="diet1">
<dt>${result.FOOD_NAME}</dt>
<dd>
<c:choose>
<c:when test="${! empty result.IMAGE_PATH}">
<img src="${result.IMAGE_PATH}" onClick="showImageDiv('${result.IMAGE_THUMB_PATH}','<message:message code="calendar.tab.food" />');" alt="오늘의 메뉴" />
</c:when>
<c:otherwise>
<img src="/statics/img/prepare.png" alt="대기중" />
</c:otherwise>
</c:choose>
</dd>
<dd>${result.FOOD_TEXT}</dd>
</dl>
</c:if>
</c:forEach>
</div>
<div id="tab_3" class="tab_div" style="display: none;">
<c:forEach var="result" items="${list}" varStatus="status" >
<c:if test="${4 == result.WEEK_DAY}">
<dl class="diet1">
<dt>${result.FOOD_NAME}</dt>
<dd>
<c:choose>
<c:when test="${! empty result.IMAGE_PATH}">
<img src="${result.IMAGE_PATH}" onClick="showImageDiv('${result.IMAGE_THUMB_PATH}','<message:message code="calendar.tab.food" />');" alt="오늘의 메뉴" />
</c:when>
<c:otherwise>
<img src="/statics/img/prepare.png" alt="대기중" />
</c:otherwise>
</c:choose>
</dd>
<dd>${result.FOOD_TEXT}</dd>
</dl>
</c:if>
</c:forEach>
</div>
<div id="tab_4" class="tab_div" style="display: none;">
<c:forEach var="result" items="${list}" varStatus="status" >
<c:if test="${5 == result.WEEK_DAY}">
<dl class="diet1">
<dt>${result.FOOD_NAME}</dt>
<dd>
<c:choose>
<c:when test="${! empty result.IMAGE_PATH}">
<img src="${result.IMAGE_PATH}" onClick="showImageDiv('${result.IMAGE_THUMB_PATH}','<message:message code="calendar.tab.food" />');" alt="오늘의 메뉴" />
</c:when>
<c:otherwise>
<img src="/statics/img/prepare.png" alt="대기중" />
</c:otherwise>
</c:choose>
</dd>
<dd>${result.FOOD_TEXT}</dd>
</dl>
</c:if>
</c:forEach>
</div>
<div id="tab_5" class="tab_div" style="display: none;">
<c:forEach var="result" items="${list}" varStatus="status" >
<c:if test="${6 == result.WEEK_DAY}">
<dl class="diet1">
<dt>${result.FOOD_NAME}</dt>
<dd>
<c:choose>
<c:when test="${! empty result.IMAGE_PATH}">
<img src="${result.IMAGE_PATH}" onClick="showImageDiv('${result.IMAGE_THUMB_PATH}','<message:message code="calendar.tab.food" />');" alt="오늘의 메뉴" />
</c:when>
<c:otherwise>
<img src="/statics/img/prepare.png" alt="대기중" />
</c:otherwise>
</c:choose>
</dd>
<dd>${result.FOOD_TEXT}</dd>
</dl>
</c:if>
</c:forEach>
</div>
</div>
<script type="text/javascript">
//<![CDATA[
//월,화.. Tab
$(document).ready(function() {
//오늘 요일에 박스
var nowDate = new Date();
var nNumday = nowDate.getDay(); //오늘의 요일 1=일요일...7=토요일 월2,화3,수4,목5,금6
var menuId = "#week_" + nNumday;
var divId = "#tab_" + nNumday;
tabMenuUlShow(menuId,true);
tabDivShow(divId,true);
for(var i = 1; i <= 5; i++) {
weekClick(i);
}
});
function weekClick(num){
$("#week_" + num).click(function(){ weekClickDetail(num); });
}
function weekClickDetail(num){
var menuId = "#week_" + num;
var divId = "#tab_" + num;
tabMenuUlShow(menuId,true);
tabDivShow(divId,true);
}
function tabDivShow(tabDivId){
$("div.tab_div").hide();
$(tabDivId).show();
}
function tabMenuUlShow(tabMenuUlId){
$("ul.tab_menu_ul li").removeClass("on");
$(tabMenuUlId).addClass("on");
}
//]]>
</script>
** java
@RequestMapping(value="/calendarFood", method=RequestMethod.GET)
public ModelAndView calendarFood(HttpServletRequest request, HttpServletResponse response) throws Exception {
LoginVO loginVo = SessionUtil.getLoginSession(request);
String preschoolId = loginVo.getPreschool_id();
HashMap<String, String> hMap = new HashMap<String, String>();
hMap.put("preschool_id", preschoolId);
ModelAndView mav = new ModelAndView();
List<HashMap<String, String>> list = calendarService.selectFoodList(hMap);
mav.addObject("list" , list);
mav.setViewName(VIEW_TYPE_FRONT + "/calendar/calendarFood");
return mav;
}
** 쿼리
<select id="selectFoodList" parameterType="java.util.HashMap" resultType="java.util.HashMap">
SELECT TFD.PRESCHOOL_ID
, TFD.ORDERING
, TFD.FOOD_NAME
, TFD.IMAGE
, TFD.FOOD_TEXT
, FOOD_DATE
, DAYOFWEEK(TFD.FOOD_DATE) AS WEEK_DAY
, TCF.FILE_PATH AS IMAGE_PATH
, TCF.THUMB_PATH AS IMAGE_THUMB_PATH
FROM TB_FOOD TFD
LEFT JOIN TB_COMM_FILE TCF
ON CONCAT(CONCAT(TFD.FOOD_DATE, '_'), TFD.PRESCHOOL_ID) = TCF.MENU_ID
AND TCF.MENU_CD = 'TB_FOOD'
AND TFD.ORDERING = TCF.ORDERING
WHERE 1=1
AND TFD.FOOD_DATE BETWEEN DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL(DAYOFWEEK(CURDATE()) - 1) DAY),'%Y%m%d' ) AND DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL(DAYOFWEEK(CURDATE()) - 1) DAY),'%Y%m%d' )+6
AND TFD.PRESCHOOL_ID = #{preschool_id}
ORDER BY TFD.FOOD_DATE, TFD.ORDERING
</select>
'IT. 컴퓨터' 카테고리의 다른 글
text 박스에 값 넣기 (0) | 2014.01.14 |
---|---|
엑셀 다운로드 (0) | 2014.01.14 |
달력, 스케줄 (0) | 2013.12.23 |
Can I borrow uour flip-flops? (0) | 2013.12.23 |
그건 단지 제안일 뿐이에요... (0) | 2013.12.22 |