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.