-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMngNotMapper.xml
More file actions
146 lines (137 loc) · 4.38 KB
/
MngNotMapper.xml
File metadata and controls
146 lines (137 loc) · 4.38 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?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="kr.happyjob.study.mngNot.dao.MngNotDao">
<!-- 목록 조회 -->
<select id="noticelist" resultType="kr.happyjob.study.mngNot.model.NoticeModel">
/*kr.happyjob.study.mngNot.dao.MngNotDao.noticelist*/
select nt.notice_del_yn
,nt.loginID
,nt.notice_no
,nt.notice_title
,nt.notice_date
,nt.notice_cont
,nt.file_no
,fi.file_name
,fi.logic_path
,fi.physic_path
,fi.file_size
,fi.exten
,ui.name
from tb_notice nt
inner join tb_userinfo ui on ui.loginID = nt.loginID
left outer join tb_file fi on fi.file_no = nt.file_no
<where>
<if test="(delyn != null) and (!delyn.equals(''))">
and nt.notice_del_yn = #{delyn}
</if>
<if test="(sname != null) and (!sname.equals(''))">
<choose>
<when
test="searchKey eq 'writer'.toString()">
and ui.name Like CONCAT('%', #{sname}, '%')
</when>
<when
test="searchKey eq 'title'.toString()">
and nt.notice_title LIKE CONCAT('%', #{sname}, '%')
</when>
<otherwise>
and ( ui.name Like CONCAT('%', #{sname}, '%')
or nt.notice_title LIKE CONCAT('%', #{sname}, '%')
)
</otherwise>
</choose>
</if>
</where>
ORDER BY nt.notice_date DESC
LIMIT #{pageindex}, #{pageSize}
</select>
<!-- 목록 총 갯수 조회 -->
<select id="countnoticelist" resultType="int">
/*kr.happyjob.study.mngNot.dao.MngNotDao.countnoticelist*/
select count(*)
from tb_notice nt
inner join tb_userinfo ui on ui.loginID = nt.loginID
left outer join tb_file fi on fi.file_no = nt.file_no
<where>
<if test="(delyn != null) and (!delyn.equals(''))">
and nt.notice_del_yn = #{delyn}
</if>
<if test="(sname != null) and (!sname.equals(''))">
<choose>
<when
test="searchKey eq 'writer'.toString()">
and ui.name Like CONCAT('%', #{sname}, '%')
</when>
<when
test="searchKey eq 'title'.toString()">
and nt.notice_title LIKE CONCAT('%', #{sname}, '%')
</when>
<otherwise>
and ( ui.name Like CONCAT('%', #{sname}, '%')
or nt.notice_title LIKE CONCAT('%', #{sname}, '%')
)
</otherwise>
</choose>
</if>
</where>
</select>
<select id="noticeselectone" resultType="kr.happyjob.study.mngNot.model.NoticeModel">
select nt.notice_del_yn
,nt.loginID
,nt.notice_no
,nt.notice_title
,nt.notice_date
,nt.notice_cont
,nt.file_no
,fi.file_name
,fi.logic_path
,fi.physic_path
,fi.file_size
,fi.exten
,ui.name
from tb_notice nt
inner join tb_userinfo ui on ui.loginID = nt.loginID
left outer join tb_file fi on fi.file_no = nt.file_no
where nt.notice_no = #{notice_no}
</select>
<insert id="noticeinsert">
<selectKey resultType="int" keyProperty="no" order="BEFORE">
select ifnull(max(notice_no),0) + 1 from tb_notice
</selectKey>
insert into tb_notice
(
notice_no
, notice_del_yn
, loginID
, notice_title
, notice_cont
, notice_date
, file_no
)
values (
#{no}
,'N'
,#{loginid}
,#{notice_title}
,#{notice_cont}
,now()
,0
)
</insert>
<update id="noticeupdate">
update tb_notice
set notice_title = #{notice_title}
, notice_cont = #{notice_cont}
, notice_date = now()
where notice_no = #{notice_no}
</update>
<update id="noticedelete">
update tb_notice
set notice_del_yn = 'Y'
where notice_no = #{notice_no}
</update>
<delete id="noticedeleteold">
delete from tb_notice
where notice_no = #{notice_no}
</delete>
</mapper>