-
Notifications
You must be signed in to change notification settings - Fork 0
/
Board_SQL.xml
77 lines (69 loc) · 2.01 KB
/
Board_SQL.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="egovframework.example.dashboard.service.impl.BoardMapper">
<!-- 게시판 최신글 목록 조회 -->
<select id="revlist" resultType="revVO">
SELECT
review_no
, review_title
, review_created_at
FROM tb_review
ORDER BY review_no DESC
LIMIT 8;
</select>
<!-- 시각화(Word Cloud) -->
<select id="wordcloud" resultType="revVO">
SELECT review_content FROM tb_review;
</select>
<!-- 약국 목록 조회 -->
<select id="boardlist" resultType="boardVO">
SELECT
pharm_no
, sido_code
, sido_name
, sigungu_code
, sigungu_name
, pharm_name
, pharm_open
FROM tb_pharm
<where>
<if test="(pname != null) and (!pname.equals(''))">
and pharm_name LIKE CONCAT('%', #{pname}, '%')
</if>
<if test="ltypecombo != null and ltypecombo != ''">
and sido_code = CAST(#{ltypecombo} AS INTEGER)
</if>
<if test="mtypecombo != null and mtypecombo != ''">
and sigungu_code = CAST(#{mtypecombo} AS INTEGER)
</if>
<if test="stypecombo != null and stypecombo != ''">
and pharm_no = CAST(#{stypecombo} AS INTEGER)
</if>
</where>
ORDER BY pharm_no
LIMIT #{pageSize}
OFFSET #{pageindex}
</select>
<!-- 약국 목록 카운트 조회 -->
<select id="countboardlist" resultType="int">
SELECT COUNT(*)
FROM tb_pharm
<where>
<if test="(pname != null) and (!pname.equals(''))">
and pharm_name Like CONCAT('%', #{pname}, '%')
</if>
</where>
</select>
<!-- 약국 한건 조회 -->
<select id="boardselectone" parameterType="Integer" resultType="boardVO">
SELECT
pharm_no
, pharm_name
, pharm_add
, pharm_zip
, pharm_tel
, pharm_open
FROM tb_pharm
WHERE pharm_no = #{pharm_no}
</select>
</mapper>