👀 SELECT
<!-- select list -->
<select id="point_select" resultType="pointdao">
select * from userpoint order by uidx desc
</select>
<!-- select one -->
<select id="point_one" resultType="pointdao">
select * from userpoint where uidx=#{aa} order by uidx desc
</select>
<!-- count -->
<select id="ajax_select" resultType="String">
select count(*) as ctn from rainfall where today=#{today}
</select>
<!-- 동적query -->
<select id="notice_search" resultType="noticeDAO" parameterType="Map">
select * from notice
<where>
<if test="search_part==0"> <!-- 제목+내용으로 검색할 경우 -->
n_subject like concat('%',#{search_word},'%') or
n_text like concat('%',#{search_word},'%')
</if>
<if test="search_part==1"> <!-- 제목으로 검색할 경우 -->
n_subject like concat('%',#{search_word},'%')
</if>
<if test="search_part==2"> <!-- 글쓴이로 검색할 경우 -->
n_title = #{search_word}
</if>
</where>
order by nidx desc;
</select>
👀 INSERT
<insert id="coupon_insert">
insert into coupon (cidx,cpname,cprate,cpuse,cpdate,indate)
values ('0',#{cpname},#{cprate},#{cpuse},#{cpdate},now())
</insert>
👀 UPDATE
<update id="rainfall_update" parameterType="Object">
update rainfall set
area_part1=#{area_part1},
area_part2=#{area_part2},
area_part3=#{area_part3},
area_part4=#{area_part4},
area_part5=#{area_part5} where ridx=#{ridx}
</update>
👀 DELETE
<delete id="rainfall_delete">
delete from rainfall where ridx=#{del} order by ridx desc
</delete>
'CLASS > SPRING,JSTL' 카테고리의 다른 글
#10-1 / 패스워드를 md5형태로 변환 (0) | 2024.07.29 |
---|---|
#9-3 / Session 등록시 주의사항 (0) | 2024.07.28 |
#9-2 / notice list + category 검색기능( 동적 query문 ), delete (1) | 2024.07.24 |
별도의 config, mapper를 사용하는 방식 (1) | 2024.07.24 |
#9-1 / ☔ - 통계차트 수정,삭제 페이지 (0) | 2024.07.24 |