Record handling exception

Source: Internet
Author: User

This article is for future search only.

First, I want to set up the company authentication method. There may be multiple authentication methods, including free Internet access, authentication, SMS authentication, and password authentication. Therefore, the companyauthtype object contains multiple records.

First run the Code:

Public String editcom (company model, string assets, string contextpath, string realpath) throws exception {Company = (company) companydao. findbyid (model. getcompanyid (); If (null = Company) {Throw new serialexception ();} // set the name, phone number, and successfully connected company. setcompanyname (model. getcompanyname (); Company. setmobile (model. getmobile (); Company. setsuccessurl (model. getsuccessurl (); companydao. update (company );/ /First find the authentication method. If yes, delete list <companyauthtype> catl = icompanyauthtypedao. findbyproperties (New String [] {"Company. companyid "}, new object [] {model. getcompanyid ()}); If (null! = Catl &&! Catl. isempty () {// Delete the original authentication method record icompanyauthtypedao. deletebyproperties (New String [] {"Company. companyid "}, new object [] {model. getcompanyid ()}, null);} // you can specify one or more if (! Stringutils. isempty (model. getids () {icompanyauthtypedao. deletebyproperties (New String [] {"Company. companyid "}, new object [] {model. getcompanyid ()}, null); string [] IDs = model. getids (). split (","); For (string ID: IDS) {authtype at = (authtype) iauthtypedao. findbyid (Long. valueof (ID); If (null! = At) {companyauthtype cat = new companyauthtype (); cat. setauthtype (AT); cat. setcompany (company); icompanyauthtypedao. save (CAT) ;}}// use companyid to find all aplists <AP> lst = iapdao. findbyproperties (New String [] {"Company. companyid "}, new object [] {model. getcompanyid ()}); If (null! = Lst &&! Lst. isempty () {for (AP: lst) {// modify all AP logon success links if (null! = Model. getsuccessurl ()&&""! = Model. getsuccessurl () {AP. setsuccessurl (model. getsuccessurl () ;}// modify the AP authentication method iapdao. Save (AP );}}
}

The above is the complete implementation of action. This record mainly describes the problems encountered in the implementation of action and the issues that are not considered weekly.

The first step is to determine whether the authentication IDs string returned by the front-end is empty. If it is not empty, delete the original authentication method, and then save the authentication method of IDs, first, find the entity in authtype (by ID in IDS), and find the company entity through companyid. Last, new companyauthtype is saved using the set and save methods. Note: Before saving, you must determine whether the authentication entity and merchant entity are empty. If not, save the authentication entity.

Then, you need to modify the logon success link for all the APS under the merchant. Before modification, you must determine whether the successful link obtained through the model is blank and save it.

 

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.