Isnotnull, isequal, isempty in ibatis

Source: Internet
Author: User

Isnull is used to determine whether the property field is null. It is more convenient to use isempty, including null and null strings.

 

Example 1:
Isequal is equivalent to equals. The number is much more than that. Generally, it is used to determine the status value.
<Isequal property = "state" comparevalue = "0">
</Isequal>
Or
<Isequal property = "state" compareproperty = "nextstate">
</Isequal>

 

Example 1:

Is the name of the incoming map or Class Attribute equal to "1"? It attaches and vvvv = 'haha'
<Isequal property = "name" comparevalue = "1" prepend = "and">
Vvvv = 'haha'
</Isequal>

Is the name of the input map or Class Attribute null? Is it null, and vvvv = NULL?
<Isnull property = "name" prepend = "and">
Vvvv = NULL
</Isnull>

 

My applications:

### Description

1. Function Description

You can set some non-important pop-up announcement settings.

2. Functional Requirements

1) Users are allowed to block three types of announcements: "Return announcement", "bank deposit notice", and "online deposit notice.

2) You can use the check box settings on the above three announcement pop-up pages to stop notifying such announcements.

3. interface requirements

1) The announcement page is displayed:

On the "Return announcement" (25), "bank deposit notice" (63), and "online deposit notice" (64), add the check box "No such announcement will pop up ".

2) Announcement prompt settings:

You can directly block the above three announcements (enable 10 | disable 11 ).

4. Business Process

5. Logic requirements

The user storage blocking status is stored in the "sale_back", "remittance_bank", and "remittance_online" Fields in t_bussiness_set.

6. Performance Requirements

7. Related modules

8. database related tables

1) t_bussiness_set merchant settings table

2) t_notice announcement table

 

1. sqlmap

<select id="querySingleModelByOut"  parameterClass="com.hanpeng.base.phone.model.TBussinessNotice" resultClass="com.hanpeng.base.phone.model.TBussinessNotice">select * from (select row_.*, rownum rownum_ from (SELECTi.NOTICE_NUM  as noticeNum ,i.BUSSINESS_ID  as bussinessId ,i.STATE  as state ,i.READ_DATE  as readDate ,n.NOTICE_TITLE as noticeTitle ,n.NOTICE_INFO as noticeInfo ,n.CREATE_DATE as createDate ,n.EMPLOYEE_ID as employeeId ,n.NOTICE_TYPE as noticeType ,n.NOTICE_SHOW_TYPE as noticeShowType ,n.FINISH_DATE as finishDate ,n.PUBLISH_DATE as publishDate FROM  T_BUSSINESS_NOTICE i left join T_NOTICE n on n.NOTICE_NUM = i.NOTICE_NUM WHEREn.PUBLISH_DATE <= sysdate AND n.FINISH_DATE >= sysdate<isNotEmpty prepend=" AND " property="bussinessId"> i.BUSSINESS_ID = #bussinessId# </isNotEmpty><isNotEmpty prepend=" AND " property="state"> i.STATE = #state# </isNotEmpty><isNotEmpty prepend=" AND " property="noticeShowType"> n.NOTICE_SHOW_TYPE = #noticeShowType# </isNotEmpty><isEqual property="saleBack" compareValue="10" prepend=" AND ">n.NOTICE_TYPE!='25'</isEqual><isEqual property="remittanceBank" compareValue="10" prepend=" AND ">n.NOTICE_TYPE!='63'</isEqual><isEqual property="remittanceOnline" compareValue="10" prepend=" AND ">n.NOTICE_TYPE!='64'</isEqual>   )row_ where rownum <=1 ) where rownum_>=0</select>

2. Action

/*** Query announcement pop-up * @ return * @ author wwy * @ date 2011-10-13 13:35:11 */Public void querybyout () {try {printwriter out = This. getresponse (). getwriter (); If (getuserid ()! = NULL) {bussinessnotice = noticeservice. selectsinglemodelbyout ("26", getuserid (); If (bussinessnotice = NULL) {out. print ("");} else {out. print ("{\" noticenum \ ": \" "+ bussinessnotice. getnoticenum () + "\"} ") ;}} else {out. print ("") ;}} catch (exception e) {log. error ("An error occurred while querying the pop-up announcement" + E. fillinstacktrace ());}}

3. serviceimpl

Public tbussinessnotice selectsinglemodelbyout (string state, string bussinessid) {tbussinessnotice TBN = new tbussinessnotice (); TBN. setbussinessid (bussinessid); TBN. setstate ("17"); TBN. setnoticeshowtype (State); tbussinessset bussinessset = bussinesssetservice. querybyid (bussinessid); // sets the status. sqlmap judges TBN Based on the status isequal. setsaleback (bussinessset. getsaleback (); TBN. setremittancebank (bussinessset. getremittancebank (); TBN. setremittanceonline (bussinessset. getremittanceonline (); Return bussinessnoticedao. selectsinglemodelbyout (TBN );}

4. frametop. jsp

<SCRIPT type = "text/JavaScript"> // pop-up announcement query var autonotice = setinterval (getnotice, 1000*60); function getnotice () {clearinterval (autonotice); $. ajax ({type: 'post', URL: 'notice _ querybyout ', datatype: 'json', success: function (data) {If (Data! = NULL) {$. hpdialog. Open ('notice _ detailbynotice? Initloadmethod = C & id = '+ data. noticenum);} else {autonotice = setinterval (getnotice, 1000*60) ;}}) ;}function noticecallback () {getnotice () ;}</SCRIPT>

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.