007 Medical Project-Module one: User's search: 3. Action and service for user table queries

Source: Internet
Author: User
Tags root access

Here the main write action and service.

Write Service layer First:

The schema is as follows:

 Public Interface UserService {    public list<sysusercustom> findsysusercustom (Sysuserqueryvo Sysuserqueryvo)throws  Exception;    }

The project structure has been integrated in the previous building of the system.

Here's a little bit of ink to talk about the process:

Enter the address in the URL, and then enter the appropriate action according to the SPRINGMVC configuration. Execute the function inside and query the database to return the data to the page.

Here is the SPRINGMVC scan function registered with the bean.

As follows:

will automatically register the Yycg.**.action package with the @controller in the Bean container.

As follows:

 Packageyycg.base.action;Importjava.util.List;Importorg.springframework.beans.factory.annotation.Autowired;ImportOrg.springframework.stereotype.Controller;ImportOrg.springframework.ui.Model;Importorg.springframework.web.bind.annotation.RequestMapping;ImportOrg.springframework.web.bind.annotation.ResponseBody;ImportYycg.base.pojo.vo.SysuserCustom;ImportYycg.base.pojo.vo.SysuserQueryVo;ImportYycg.base.process.result.DataGridResultInfo;ImportYycg.base.service.UserService;/** Users click on a link on the page to come here, and then execute the method here, from the database to find the data I want to return to the *model, and then the model inside the data will be passed to the displayed page, when the page to display, the model inside the data display * to complete the task. */@Controller//Root Access directory@RequestMapping ("/user") Public classuseraction {//@Autowired    PrivateUserService UserService; //sub-access directory. User Query page@RequestMapping ("/queryuser")     PublicString Queryuser (model model)throwsexception{return"/base/user/queryuser"; }    //result set for user query page//finally Datagridresultinfo converts a Java object into a JSON object through @responsebody. //the formal parameter wrapper class will be passed from action to service and then to mapper@RequestMapping ("/queryuser_result")     Public@ResponseBody datagridresultinfo Queryuser_result (Sysuserqueryvo sysuserqueryvo)throwsException {//These are all based on the rules of Easyui .Datagridresultinfo datagridresultinfo=NewDatagridresultinfo (); /** Easyui rules here to fill total and rows*/List<SysuserCustom> rows=Userservice.findsysusercustom (SYSUSERQUERYVO);        Datagridresultinfo.setrows (rows);        Datagridresultinfo.settotal (Rows.size ()); returnDatagridresultinfo; }        }

007 Medical Project-Module one: User's search: 3. Action and service for user table queries

Related Article

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.