システムエラー
システムエラーが発生しました。
数秒後、TOPページに戻ります。
戻らない場合、下記のリンクを選択してTOPページに戻ってください。
TOPページに戻る
org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [
SELECT
CASE WHEN t16.isbn_set IS NOT NULL THEN t16.isbn_set ELSE t1.isbn_set END AS isbn_set,
t1.note,
CASE WHEN t16.magazine_id IS NOT NULL THEN t16.magazine_id ELSE 0 END AS magazine_id,
CASE WHEN t16.subs IS NOT NULL THEN t16.subs ELSE 0 END AS subs,
t1.bookid,
t1.title1,
t1.title2,
t1.title3,
t1.vol,
t1.auth1,
t1.auth2,
t1.publica,
t1.pubyear,
t2.review,
t2.writer,
TO_CHAR(t2.inputdate,'YYYY年MM月DD日') AS inputdate,
t1.betu,
t1.class_mark,
t1.auth_mark,
t1.vol_mark,
t1.intitle,
t1.inauth,
t1.serise,
t1.servol,
t1.sub_serise,
t1.sub_servol,
t1.han,
t1.titledefault,
t1.isbn,
t1.isbn_b,
t1.country,
t1.language_mark,
t1.pubfrom,
t1.page AS page_num,
t1.size,
t1.price,
t1.chuki,
t1.kenmei,
t1.contens,
t3.contents,
t3.contents_a,
t3.contents_t,
COALESCE(t6.jw_kind, 0) AS jw_kind,
COALESCE(t7.book_cnt,0) AS book_cnt,
(COALESCE(t7.book_cnt,0) - COALESCE(t7.no_rental,0) - COALESCE(t7.rental_num,0) - COALESCE(t8.keep_cnt,0) - COALESCE(t7.missing_cnt,0)) AS rental_cnt,
COALESCE(t8.reserve_cnt,0) + COALESCE(t8.keep_cnt,0) AS reserve_cnt,
COALESCE(t6.rental_total,0) AS rental_total,
CASE WHEN ((COALESCE(t7.book_cnt,0) - COALESCE(t7.no_rental,0) - COALESCE(t7.rental_num,0) - COALESCE(t8.keep_cnt,0) - COALESCE(t7.missing_cnt,0)) <= 0) AND (t7.rental_num <= 0) AND COALESCE(t8.keep_cnt,0) > 0 THEN 2
WHEN (( COALESCE(t7.book_cnt,0) > 0 AND (COALESCE(t7.book_cnt,0) - COALESCE(t7.no_rental,0) - COALESCE(t7.rental_num,0) - COALESCE(t8.keep_cnt,0) - COALESCE(t7.missing_cnt,0)) <= 0) AND
(COALESCE(t7.rental_num,0) > 0 OR COALESCE(t8.keep_cnt,0) > 0)) THEN 1
ELSE 0 END AS rental_state,
TO_CHAR(t7.return_date,'YYYY年MM月DD日') AS return_date,
t10.accn AS bl_accn,
t10.betu AS bl_betu,
t10.class_mark AS bl_class_mark,
t10.auth_mark AS bl_auth_mark,
t10.vol_mark AS bl_vol_mark,
t10.rental_kindname AS bl_rental_kindname,
COALESCE(t10.rentalday,999) AS bl_rentalday,
t10.book_kindname AS bl_book_kindname,
t10.poss_kindname AS bl_poss_kindname,
t10.putplace_kindname AS bl_putplace_kindname,
t10.putplace_image_path AS bl_putplace_image_path,
t10.con_kindname AS bl_con_kindname,
COALESCE(t10.rental_state,0) AS bl_rental_state,
t10.return_date AS bl_return_date,
t11.title AS bcd_title,
t11.auth AS bcd_auth,
t11.page_num AS bcd_page_num,
COALESCE(t11.contents_d_id,0) AS bcd_contents_d_id,
t12.prize_year AS bp_prize_year,
t12.prize_name AS bp_prize_name,
COALESCE(t12.prize_id,0) AS bp_prize_id,
t6.recedate,
CASE WHEN t1.jpimage IS NOT NULL THEN 1 ELSE 0 END AS jpimage_flg,
CASE WHEN t1.kind ISNULL THEN 1 ELSE t1.kind END AS kind,
magazine_featuer,
t1.VOL as VOL,
COALESCE(t1.MAGAZIN_ID,0) AS MAGAZIN_ID,
t1.MAGAZINE_CODE,
t1.MAGAZINE_VOL1,
t1.MAGAZINE_VOL2,
t16.title1 AS magazine_title1,
t1.MAGAZINE_NUM,
t16.KENMEI AS magazine_kenmei,
t16.CONTENS AS magazine_contents,
t1.volid AS volid,
CASE WHEN t1.MAGAZIN_ID IS NOT NULL THEN 2 ELSE 1 END AS BOOKFLG
,(SELECT ARRAY_TO_STRING(
ARRAY(
SELECT btc.theme_name FROM xfind_book_theme_ct btc LEFT JOIN xfind_book_theme_dt btd on btc.theme_id = btd.theme_id where btd.bookid = t1.BOOKID
AND (VALIDATE>= CURRENT_DATE OR VALIDATE is null ) AND (OPEN_DATE <= CURRENT_DATE) AND COALESCE(OPEN_FLG,0) = 0 GROUP by btc.theme_id,btc.theme_name order by btc.theme_id),','
)
) AS theme_name
,(SELECT ARRAY_TO_STRING(
ARRAY(
SELECT btc.theme_id FROM xfind_book_theme_ct btc LEFT JOIN xfind_book_theme_dt btd on btc.theme_id = btd.theme_id where btd.bookid = t1.BOOKID
AND (VALIDATE>= CURRENT_DATE OR VALIDATE is null ) AND (OPEN_DATE <= CURRENT_DATE) AND COALESCE(OPEN_FLG,0) = 0 GROUP by btc.theme_id order by btc.theme_id),','
)
) AS theme_id
,COALESCE(t7.not_reserve_cnt,0) as not_reserve_cnt
,COALESCE(t7.reservable_rental_num,0) as reservable_rental_num
,t1.magazine_jan
,COALESCE(t10.book_kind1,0) as bl_book_kind1
,t1.scno
FROM book t1
LEFT JOIN book_review t2 ON (t1.scno = t2.scno AND t1.bookid = t2.bookid AND (t2.validate >= CURRENT_DATE OR t2.validate IS NULL))
LEFT JOIN book_contents t3 ON (t1.scno = t3.scno AND t1.bookid = t3.bookid)
LEFT JOIN (
SELECT scno, bookid,
SUM(COALESCE(rentalcnt,0)) as rental_total,
MIN(jw_kind) AS jw_kind,
MIN(recedate) AS recedate
FROM book_local
WHERE bookid = 117293
GROUP BY scno, bookid
) t6 ON (t1.scno = t6.scno AND t1.bookid = t6.bookid)
LEFT JOIN (
SELECT tb1.scno, tb1.bookid,
MIN(tb2.termdate) AS return_date,
COALESCE(COUNT(DISTINCT CASE WHEN COALESCE(tb1.CONDID,-1) <> 0 THEN tb1.accn ELSE NULL END),0) AS book_cnt,
COALESCE(COUNT(DISTINCT CASE WHEN COALESCE(tb6.rentalday,999) = 0 THEN tb1.accn ELSE NULL END),0) AS no_rental,
COALESCE(COUNT(DISTINCT CASE WHEN COALESCE(tb1.condid,-1) = 999 THEN tb1.accn ELSE NULL END),0) AS missing_cnt,
COALESCE(COUNT(DISTINCT CASE WHEN tb2.returndate IS NULL THEN tb2.accn ELSE NULL END),0) AS rental_num,
COUNT(DISTINCT CASE WHEN COALESCE(tb5.RECE_FLG,0)=1 OR COALESCE(tb6.RECE_FLG,0)=1 THEN tb1.RENTAL_KIND || tb1.ACCN ELSE NULL END) AS not_reserve_cnt,
COUNT(DISTINCT CASE WHEN COALESCE(tb5.RECE_FLG,0)=0 AND COALESCE(tb6.RECE_FLG,0)=0 AND (tb2.ID <> 0) THEN tb2.ID ELSE NULL END) AS reservable_rental_num
FROM book_local tb1
LEFT JOIN rental tb2 ON (tb2.accn = tb1.accn AND tb2.returndate IS NULL)
LEFT JOIN xfind_possess tb3 ON tb1.poss_ho=tb3.kindid
LEFT JOIN xfind_putplace tb4 ON tb1.putplace_ho=tb4.kindid
LEFT JOIN xfind_condition tb5 ON tb1.condid=tb5.kindid
LEFT JOIN KIND_REN tb6 ON (tb1.RENTAL_KIND = tb6.KINDID)
WHERE ((COALESCE(tb5.SEARCH_FLG,0) = 1 OR tb1.CONDID IS NULL))
AND(COALESCE(tb3.DEFAULT_FLG,0) = 1 OR tb1.POSS_HO IS NULL)
AND ((COALESCE(tb4.SEARCH_FLG,0) = 1 OR tb1.PUTPLACE_HO IS NULL))
AND COALESCE(tb1.open_flg,0) = 0
WHERE bookid = 117293
GROUP BY tb1.scno, tb1.bookid
) t7 ON (t1.scno = t7.scno AND t1.bookid = t7.bookid)
LEFT JOIN (
SELECT scno, bookid,
COUNT(DISTINCT CASE WHEN COALESCE(keepaccn,'') = '' THEN NULL ELSE ID END) AS keep_cnt,
COUNT(DISTINCT CASE WHEN COALESCE(keepaccn,'') = '' THEN ID ELSE NULL END) AS reserve_cnt
FROM reserve
WHERE bookid = 117293
AND rentaldate IS NULL
AND CANCELDATE IS NULL
GROUP BY scno, bookid
) t8 ON (t1.scno = t8.scno AND t1.bookid = t8.bookid)
LEFT JOIN (
SELECT tb1.scno, tb1.bookid, tb1.accn,betu,class_mark,auth_mark,vol_mark,tb1.book_kind1,
tb2.kindname AS rental_kindname,
(tb3.kindname || ' - ' || tb4.kindname) AS book_kindname,
tb5.kindname AS poss_kindname,
tb6.kindname AS putplace_kindname,
image_path AS putplace_image_path,
tb7.kindname AS con_kindname,
tb5.SORT_NO ,
CASE WHEN rental_num>0 THEN 1
WHEN tb10.keepaccn = tb1.accn THEN 2
ELSE 0 END AS rental_state,
TO_CHAR(return_date,'YYYY年MM月DD日') AS return_date
FROM book_local tb1
LEFT JOIN kind_ren tb2 ON tb1.rental_kind=tb2.kindid
LEFT JOIN xfind_kind_book1 tb3 ON tb1.book_kind1=tb3.kindid
LEFT JOIN xfind_kind_book2 tb4 ON tb1.book_kind2=tb4.kindid
LEFT JOIN xfind_possess tb5 ON tb1.poss_ho=tb5.kindid
LEFT JOIN xfind_putplace tb6 ON tb1.putplace_ho=tb6.kindid
LEFT JOIN xfind_condition tb7 ON tb1.condid=tb7.kindid
LEFT JOIN (
SELECT stb1.scno, stb1.accn,SUM(CASE WHEN stb2.accn IS NOT NULL AND stb2.returndate IS NULL THEN 1 ELSE 0 END) AS rental_num,
MIN(stb2.termdate) AS return_date
FROM book_local stb1
LEFT JOIN rental stb2 ON (stb2.accn = stb1.accn AND stb2.returndate IS NULL)
WHERE bookid = 117293
GROUP BY stb1.scno, stb1.accn
ORDER BY stb1.scno, stb1.accn
) tb8 ON (tb1.scno = tb8.scno AND tb1.accn = tb8.accn)
LEFT JOIN (
SELECT scno,keepaccn
FROM reserve
WHERE COALESCE(keepaccn,'') != '' AND rentaldate is null AND canceldate is null
AND bookid = 117293
GROUP BY scno,keepaccn
) tb10 on(tb10.scno = tb1.scno AND tb10.keepaccn = tb1.accn)
WHERE bookid = 117293
AND ((COALESCE(tb7.SEARCH_FLG,0) = 1 OR tb1.CONDID IS NULL))
AND (COALESCE(tb5.DEFAULT_FLG,0) = 1 OR tb1.POSS_HO IS NULL)
AND ((COALESCE(tb6.SEARCH_FLG,0) = 1 OR tb1.PUTPLACE_HO IS NULL))
AND COALESCE(tb1.open_flg,0) = 0
ORDER BY accn
) t10 ON (t1.scno = t10.scno AND t1.bookid = t10.bookid)
LEFT JOIN (
SELECT scno, bookid,id AS contents_d_id,title,auth,page AS page_num FROM book_contents_d ORDER BY id
) t11 ON (t1.scno = t11.scno AND t1.bookid = t11.bookid)
LEFT JOIN (
SELECT bp.scno, bookid,id AS prize_id,prize_year,p.prize_name
FROM book_prize bp
LEFT JOIN prize p ON bp.prize_id = p.prize_id ORDER BY id
) t12 ON (t1.scno = t12.scno AND t1.bookid = t12.bookid)
LEFT JOIN book_find t14 ON (t1.scno = t14.scno AND t1.bookid = t14.bookid)
LEFT JOIN web_book_kind_sort t15 ON (COALESCE(t14.kind,1) = t15.kindid)
LEFT JOIN magazine t16 ON (t1.scno = t16.scno AND t1.magazin_id = t16.magazine_id)
WHERE bookid = 117293
]; nested exception is org.postgresql.util.PSQLException: ERROR: syntax error at or near "WHERE"
Position: 7376
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:230)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:419)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:478)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:488)
at model.dao.ReserveDAO.find(ReserveDAO.java:728)
at control.ReserveController.initial(ReserveController.java:78)
at jdk.internal.reflect.GeneratedMethodAccessor11961.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:849)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:760)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:489)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:583)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:212)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:156)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:181)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:156)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:181)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:156)
at common.filter.SecurityCheck.doFilter(SecurityCheck.java:1518)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:181)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:156)
at common.filter.IpAddressFilter.doFilter(IpAddressFilter.java:925)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:181)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:156)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:168)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:483)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:130)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:679)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:617)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:934)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1698)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "WHERE"
Position: 7376
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:307)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:293)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:270)
at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:224)
at org.apache.commons.dbcp2.DelegatingStatement.executeQuery(DelegatingStatement.java:212)
at org.apache.commons.dbcp2.DelegatingStatement.executeQuery(DelegatingStatement.java:212)
at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:461)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:408)
... 52 more