Small function module of birthday reminder function

Source: Internet
Author: User

//Get employee Birthday reminder Data     PublicListintPageintrows) {List<H_Basic> RTN =NewArraylist(); intnum = (Page-1) *rows;        Init (); RTN= Se.createquery ("From H_basic where"+"to_char (sysdate, ' mm ') =to_char (birthday, ' mm ') and To_char (birthday, ' DD ') >=to_char (sysdate, ' dd ')"+""+"and zhuangtai= ' 1 '"). Setfirstresult (num). setmaxresults (rows). List ();        Destory (); returnRtn; }    //Get employee Birthdays total number of data bars     Public intgetbirthdaytotal () {intRTN =0;        Init (); List<Object> lo =se. CreateQuery ("Select COUNT (name) from H_basic where"+"to_char (sysdate, ' mm ') =to_char (birthday, ' mm ') and To_char (birthday, ' DD ') >=to_char (sysdate, ' dd ')"). List (); if(Lo! =NULL&& lo.size () >0) {Rtn= Integer.parseint (lo.Get(0). toString ());        } destory (); returnRtn; }

Service Layer:

//get data on employee birthdays     PublicString Getbirthdayjson (intPageintrows) {Pagejson<H_Basic> PJ =NewPagejson<>(); String RTN=jsonobject.tojsonstring (PJ); intTotal =NewYuangongdao (). Getbirthdaytotal (); if(Total >0) {List<H_Basic> ls =NewYuangongdao (). Getbirthday (page, rows);            Pj.settotal (total);            Pj.setrows (LS); RTN=jsonobject.tojsonstring (PJ); }        returnRtn; }

Servlet layer:

Package Com.hanqi.web;import Java.io.ioexception;import javax.servlet.servletexception;import Javax.servlet.http.httpservlet;import Javax.servlet.http.httpservletrequest;import Javax.servlet.http.httpservletresponse;import Com.hanqi.service.BasicService;/** * Servlet implementation class Birthdayservlet*/ Public classBirthdayservlet extends HttpServlet {Private StaticFinalLongSerialversionuid =1L; /** * @see httpservlet#httpservlet ()*/     PublicBirthdayservlet () {super (); //TODO auto-generated Constructor stub    }    /** * @see httpservlet#doget (httpservletrequest request, httpservletresponse response)*/    protected voiddoget (httpservletrequest request, httpservletresponse response) throws Servletexception, IOException { Request.setcharacterencoding ("UTF-8"); Response.setcharacterencoding ("UTF-8"); Response.setcontenttype ("text/html"); String spage=request.getparameter ("page"); String srows=request.getparameter ("rows"); if(spage!=NULL&& srows!=NULL)        {        intPage=Integer.parseint (spage); intRows=Integer.parseint (srows); String JSON=NewBasicservice (). Getbirthdayjson (page, rows);            Response.getwriter (). print (JSON); }        Else{response.getwriter (). Print ("{' title ': 0, ' rows ': []}"); }                            }    /** * @see httpservlet#dopost (httpservletrequest request, httpservletresponse response)*/    protected voidDoPost (httpservletrequest request, httpservletresponse response) throws Servletexception, IOException {//TODO auto-generated Method Stubdoget (request, response); }}

Show Layer Script:

$("#bir"). DataGrid ({URL:'Birthdayservlet', columns:[[{field:'name', Title:'name'}, {field:'Birthday', Title:'Days left', Formatter:function (value, row, index) {varDa=NewDate (value); varDd=da.getdate (); varss=dd-Day ; if(ss=="1")                    {                    return "Tomorrow"; }                Else if(ss=="0")                    {                    return "Today"; }                Else {                returnss+"days";                                                            }}, Styler:function (value, row, index) { varDa=NewDate (value); varDd=da.getdate (); varbb=dd-Day ; if(bb==1|| bb==0)                    {                    return 'background-color: #ffee00; color:red;'; }}]], FitC Olumns:true,//column Adaptive width, cannot and frozen column set to Truepagelist:[Ten, -, -, -],//number of rows per page select listPageSize:Ten,//number of rows per page of the incidentSortname:'Birthday', SortOrder:'ASC', Remotesort:false, pagination:true//Show pagination Bar})

Display layer:

<div data-options="region: ' East ', Iconcls: ' Icon-reload ', title: ' Birthday Reminder ', split:true ' style="width:130px; ">            <div id="ff"class="easyui-tabs  " data-options="fit:true">          <table id=" Bir " ></table>    </div>     

Small function module of birthday reminder function

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.