我想要一个触发器,每当更新贷款表时触发(即返回一本书)。它应该只从贷款表中的行中获取贷款逾期的值并将它们插入到新表中。
“贷款”表:
CREATE TABLE loan (
book_code INT NOT NULL,
student_num INT NOT NULL,
out_date DATE NOT NULL,
due_date DATE NOT NULL,
return_date DATE,
CONSTRAINT pk_loan PRIMARY KEY (book_code, student_num, out_date),
CONSTRAINT fk_book_code FOREIGN KEY (book_code) REFERENCES copy(book_code),
CONSTRAINT fk_num FOREIGN KEY (student_num) REFERENCES student(student_num)
);
Run Code Online (Sandbox Code Playgroud)
和“过期”表
CREATE TABLE overdue (
overdue_id INT NOT NULL AUTO_INCREMENT,
student_num INT NOT NULL,
out_date DATE NOT NULL,
due_date DATE NOT NULL,
return_date DATE,
CONSTRAINT pk_overdue PRIMARY KEY (overdue_id),
CONSTRAINT fk_num FOREIGN KEY (student_num) …Run Code Online (Sandbox Code Playgroud) 下表中显示的数据也会显示在我的网络应用程序中.除了BOOKINGNO列,而不是列h:commandButton.只有BOOKINGNO在相应行上的记录为null时,才应呈现commandButton .
目前,使用下面的代码,按钮不会呈现.
PLOTNO SITENO ACCOMNO STARTDATE ENDDATE BOOKINGNO
16 1 10 2014-10-01 2014-10-03 <null>
21 2 2 2014-09-26 2014-09-29 923291
22 2 3 2014-10-01 2014-10-03 <null>
23 2 7 2014-09-26 2014-09-29 457235
<h:dataTable>
...
<h:column>
<h:commandButton
onclick="if (!confirm('Do you want to book this holiday?')) return false"
value="Book"
action="#{dealsBean.book(item.plotNo)}"
rendered="#{dealsBean.bookingNo = null}">
</h:commandButton>
</h:column>
/<h:dataTable>
Run Code Online (Sandbox Code Playgroud)
我尝试了各种不同的rendered论点,但似乎都没有做我想要的.
我的语法是否正确?