The operation of adding and deleting multiple table associations under Jquery-easyui

Source: Internet
Author: User

The project is Hibernate+jquery-easyui, the introduction of the multi-table associated with the deletion and modification operations.

It's simple: you just need to insert data in a table that is associated with a multi-table, such as a departmental table that is associated with an employee table, and you cannot insert the associated department directly through a Web page submission form, but you want to add data through the object in the new object at the controller.

Increase

The code under the servlet is dept dept = Deptservice.findbyidifo (Integer.parseint (Req.getparameter ("DeptID")); Employee.setdept ( dept);//finally add the employee Saveempinfo corresponding method written in the service layer and DAO layer in this ignore empservice.saveempinfo (employee);


Delete

Deleting the row data directly, such as Empid (f_id back to the backend via the foreground), does not need to be processed


Modify

Department Dept Dept = New Dept (); Boolean Flag1 = true;//Find All department information Loop comparison (need to use reserved columns) list<dept> List1 = Deptservice.findallinfo ( ); for (Dept D:list1) {if (D.getdeptname (). Equals (Req.getparameter ("DeptID"))) {Flag1 = false;}} if (!FLAG1) {employee.setdepttemp (Req.getparameter ("DeptID"));} else {dept = Deptservice.findbyidifo ( Integer.parseint (Req.getparameter ("DeptID")); employee.setdept (dept);} Empservice.updateempinfo (employee);


This article is from "Lovely Xiaopp" blog, reprint please contact the author!

The operation of adding and deleting multiple table associations under Jquery-easyui

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.