44import example .common .domain .Salary ;
55import example .common .entity .Department ;
66import example .common .entity .Employee ;
7+
78import java .sql .Timestamp ;
89import java .util .List ;
910import java .util .function .BiFunction ;
1011import java .util .function .Function ;
1112import java .util .stream .Stream ;
13+
1214import org .seasar .doma .AggregateStrategy ;
1315import org .seasar .doma .AssociationLinker ;
1416import org .seasar .doma .Dao ;
@@ -25,229 +27,229 @@ public interface EmployeeDao {
2527
2628 @ Sql (
2729 """
28- SELECT /*%expand*/*
29- FROM employee
30- WHERE id = /* id */0
31- """ )
30+ SELECT /*%expand*/*
31+ FROM employee
32+ WHERE id = /* id */0
33+ """ )
3234 @ Select
3335 Employee selectById (Integer id );
3436
3537 @ Sql (
3638 """
37- SELECT /*%expand*/*
38- FROM employee
39- WHERE
40- /*%if min != null */
41- age >= /* min */10
42- /*%end */
43- /*%if max != null */
44- AND age <= /* max */70
45- /*%end */
46- ORDER BY age
47- """ )
39+ SELECT /*%expand*/*
40+ FROM employee
41+ WHERE
42+ /*%if min != null */
43+ age >= /* min */10
44+ /*%end */
45+ /*%if max != null */
46+ AND age <= /* max */70
47+ /*%end */
48+ ORDER BY age
49+ """ )
4850 @ Select
4951 List <Employee > selectByAgeRange (Age min , Age max );
5052
5153 @ Sql (
5254 """
53- SELECT /*%expand*/*
54- FROM employee
55- WHERE
56- /*%for age : ages */
57- age = /* age */30
58- /*%if age_has_next */
59- /*# "or" */
60- /*%end */
61- /*%end */
62- """ )
55+ SELECT /*%expand*/*
56+ FROM employee
57+ WHERE
58+ /*%for age : ages */
59+ age = /* age */30
60+ /*%if age_has_next */
61+ /*# "or" */
62+ /*%end */
63+ /*%end */
64+ """ )
6365 @ Select
6466 List <Employee > selectByAges (List <Age > ages );
6567
6668 @ Sql (
6769 """
68- SELECT /*%expand*/*
69- FROM employee
70- WHERE
71- /*%if name != null*/
72- name = /* name */'hoge'
73- /*%else */
74- AND name IS NULL
75- /*%end */
76- """ )
70+ SELECT /*%expand*/*
71+ FROM employee
72+ WHERE
73+ /*%if name != null*/
74+ name = /* name */'hoge'
75+ /*%else */
76+ AND name IS NULL
77+ /*%end */
78+ """ )
7779 @ Select
7880 List <Employee > selectByName (String name );
7981
8082 @ Sql (
8183 """
82- SELECT /*%expand*/*
83- FROM employee
84- WHERE name IN /* names */('aaa', 'bbb')
85- """ )
84+ SELECT /*%expand*/*
85+ FROM employee
86+ WHERE name IN /* names */('aaa', 'bbb')
87+ """ )
8688 @ Select
8789 List <Employee > selectByNames (List <String > names );
8890
8991 @ Sql (
9092 """
91- SELECT /*%expand*/*
92- FROM employee
93- WHERE
94- /*%if @isNotEmpty(name) */
95- name = /* name */'hoge'
96- /*%end*/
97- """ )
93+ SELECT /*%expand*/*
94+ FROM employee
95+ WHERE
96+ /*%if @isNotEmpty(name) */
97+ name = /* name */'hoge'
98+ /*%end*/
99+ """ )
98100 @ Select
99101 List <Employee > selectByNotEmptyName (String name );
100102
101103 @ Sql (
102104 """
103- SELECT /*%expand*/*
104- FROM employee
105- WHERE name LIKE /* @prefix(prefix) */'X%' escape '$'
106- """ )
105+ SELECT /*%expand*/*
106+ FROM employee
107+ WHERE name LIKE /* @prefix(prefix) */'X%' escape '$'
108+ """ )
107109 @ Select
108110 List <Employee > selectByNameWithPrefixMatching (String prefix );
109111
110112 @ Sql (
111113 """
112- SELECT /*%expand*/*
113- FROM employee
114- WHERE name LIKE /* @suffix(suffix) */'%X' escape '$'
115- """ )
114+ SELECT /*%expand*/*
115+ FROM employee
116+ WHERE name LIKE /* @suffix(suffix) */'%X' escape '$'
117+ """ )
116118 @ Select
117119 List <Employee > selectByNameWithSuffixMatching (String suffix );
118120
119121 @ Sql (
120122 """
121- SELECT /*%expand*/*
122- FROM employee
123- WHERE name LIKE /* @infix(inside) */'%X%' escape '$'
124- """ )
123+ SELECT /*%expand*/*
124+ FROM employee
125+ WHERE name LIKE /* @infix(inside) */'%X%' escape '$'
126+ """ )
125127 @ Select
126128 List <Employee > selectByNameWithInfixMatching (String inside );
127129
128130 @ Sql (
129131 """
130- SELECT /*%expand*/*
131- FROM employee
132- WHERE hiredate >= /* @roundDownTimePart(from) */'2001-01-01 12:34:56'
133- AND hiredate < /* @roundUpTimePart(to) */'2001-01-01 12:34:56'
134- """ )
132+ SELECT /*%expand*/*
133+ FROM employee
134+ WHERE hiredate >= /* @roundDownTimePart(from) */'2001-01-01 12:34:56'
135+ AND hiredate < /* @roundUpTimePart(to) */'2001-01-01 12:34:56'
136+ """ )
135137 @ Select
136138 List <Employee > selectByHiredateRange (Timestamp from , Timestamp to );
137139
138140 @ Sql (
139141 """
140- SELECT /*%expand*/*
141- FROM employee
142- WHERE salary > /* salary */0
143- """ )
142+ SELECT /*%expand*/*
143+ FROM employee
144+ WHERE salary > /* salary */0
145+ """ )
144146 @ Select
145147 List <Employee > selectBySalary (Salary salary );
146148
147149 @ Sql (
148150 """
149- SELECT sum(salary)
150- FROM employee
151- """ )
151+ SELECT sum(salary)
152+ FROM employee
153+ """ )
152154 @ Select
153155 Salary selectSummedSalary ();
154156
155157 @ Sql (
156158 """
157- SELECT /*%expand*/*
158- FROM employee
159- WHERE name = /* e.name */'aaa'
160- """ )
159+ SELECT /*%expand*/*
160+ FROM employee
161+ WHERE name = /* e.name */'aaa'
162+ """ )
161163 @ Select
162164 List <Employee > selectByExample (Employee e );
163165
164166 @ Sql (
165167 """
166- SELECT /*%expand*/*
167- FROM employee
168- ORDER BY id
169- """ )
168+ SELECT /*%expand*/*
169+ FROM employee
170+ ORDER BY id
171+ """ )
170172 @ Select
171173 List <Employee > selectAll ();
172174
173175 @ Sql (
174176 """
175- SELECT /*%expand*/*
176- FROM employee
177- ORDER BY id
178- """ )
177+ SELECT /*%expand*/*
178+ FROM employee
179+ ORDER BY id
180+ """ )
179181 @ Select
180182 List <Employee > selectAll (SelectOptions options );
181183
182184 @ Sql (
183185 """
184- SELECT /*%expand*/*
185- FROM employee
186- WHERE age > /* age */0
187- ORDER BY age
188- """ )
186+ SELECT /*%expand*/*
187+ FROM employee
188+ WHERE age > /* age */0
189+ ORDER BY age
190+ """ )
189191 @ Select (strategy = SelectType .STREAM )
190192 <R > R selectByAge (int age , Function <Stream <Employee >, R > mapper );
191193
192194 @ Sql (
193195 """
194- SELECT /*%expand */*
195- FROM employee e
196- LEFT OUTER JOIN department d
197- ON e.department_id = d.id
198- ORDER BY e.id
199- """ )
196+ SELECT /*%expand */*
197+ FROM employee e
198+ LEFT OUTER JOIN department d
199+ ON e.department_id = d.id
200+ ORDER BY e.id
201+ """ )
200202 @ Select (aggregateStrategy = EmployeeAggregateStrategy .class )
201203 List <Employee > selectAllEmployeeDepartment ();
202204
203205 @ Sql (
204206 """
205- INSERT INTO Employee
206- (ID
207- , NAME
208- , AGE
209- , DEPARTMENT_ID
210- , HIREDATE
211- , JOB_TYPE
212- , SALARY
213- , INSERT_TIMESTAMP
214- , UPDATE_TIMESTAMP
215- , VERSION)
216- VALUES ( /* employee.id */1
217- , /* employee.name */'test'
218- , /* employee.age */10
219- , /* employee.departmentId */1
220- , /* employee.hiredate */'2010-01-01'
221- , /* employee.jobType */'SALESMAN'
222- , /* employee.salary */300
223- , /* employee.insertTimestamp */'2010-01-01 12:34:56'
224- , /* employee.updateTimestamp */'2010-01-01 12:34:56'
225- , /* employee.version */1 )
226- """ )
207+ INSERT INTO Employee
208+ (ID
209+ , NAME
210+ , AGE
211+ , DEPARTMENT_ID
212+ , HIREDATE
213+ , JOB_TYPE
214+ , SALARY
215+ , INSERT_TIMESTAMP
216+ , UPDATE_TIMESTAMP
217+ , VERSION)
218+ VALUES ( /* employee.id */1
219+ , /* employee.name */'test'
220+ , /* employee.age */10
221+ , /* employee.departmentId */1
222+ , /* employee.hiredate */'2010-01-01'
223+ , /* employee.jobType */'SALESMAN'
224+ , /* employee.salary */300
225+ , /* employee.insertTimestamp */'2010-01-01 12:34:56'
226+ , /* employee.updateTimestamp */'2010-01-01 12:34:56'
227+ , /* employee.version */1 )
228+ """ )
227229 @ Insert
228230 int insert (Employee employee );
229231
230232 @ Sql (
231233 """
232- UPDATE Employee
233- SET NAME = /* employee.name */'test'
234- , AGE = /* employee.age */10
235- , DEPARTMENT_ID = /* employee.departmentId */1
236- , HIREDATE = /* employee.hiredate */'2010-01-01'
237- , JOB_TYPE = /* employee.jobType */'SALESMAN'
238- , SALARY = /* employee.salary */300
239- , UPDATE_TIMESTAMP = /* employee.updateTimestamp */'2010-01-01 12:34:56'
240- , VERSION = /* employee.version */1
241- WHERE ID = /* employee.id */1
242- """ )
234+ UPDATE Employee
235+ SET NAME = /* employee.name */'test'
236+ , AGE = /* employee.age */10
237+ , DEPARTMENT_ID = /* employee.departmentId */1
238+ , HIREDATE = /* employee.hiredate */'2010-01-01'
239+ , JOB_TYPE = /* employee.jobType */'SALESMAN'
240+ , SALARY = /* employee.salary */300
241+ , UPDATE_TIMESTAMP = /* employee.updateTimestamp */'2010-01-01 12:34:56'
242+ , VERSION = /* employee.version */1
243+ WHERE ID = /* employee.id */1
244+ """ )
243245 @ Update
244246 int update (Employee employee );
245247
246248 @ Sql (
247249 """
248- DELETE FROM Employee
249- WHERE ID = /* employee.id */0
250- """ )
250+ DELETE FROM Employee
251+ WHERE ID = /* employee.id */0
252+ """ )
251253 @ Delete
252254 int delete (Employee employee );
253255}
0 commit comments