SPRINGMVC+JDBC Connection Database (first micro-commerce project, Agent registration)

Source: Internet
Author: User

String uuid = Uuid.randomuuid (). toString (). Trim (). ReplaceAll ("-", ""), manual automatic generation of UUID this table primary key (the primary role is that the database generates unique, It can be used to generate a primary key such as this table, and the authorization code like here is unique to everyone, so use this to generate. )
String uuid, the generated assignment to Uudi, and then the UUID in the SQL statement written to the database, write the premise, the database must have this UUID column properties.
When writing to the database here, do not need to the same as other properties in the page to write the Set,get method, where you do not have to write directly inside the SQL, and then in the Jdbctemplate.update statement should be corresponding to write on it.
@Service
@Transactional
public class UserService {

@Autowired
Private JdbcTemplate JdbcTemplate;

Public Json Register (agentregistered_page Page) {
JSON JSON = new JSON ();
Manually automatically generate UUID this table primary key
String uuid = Uuid.randomuuid (). toString (). Trim (). ReplaceAll ("-", "" ");
Manual automatic generation of accredit authorization codes
String Accredit=uuid.randomuuid (). toString (). Trim (). ReplaceAll ("-", "" ");
String sql= "INSERT INTO agency (Uuid,accredit,account,password,phonenumber,realname,idcardnumber,agentregion, Nameofcompany,referees,agencyhead,photoagencyasalegalperson,thebusinesslicense,duplicateofbusinesslicense, thebankopensanaccountlicence,pid,encrypted_problem_one,encrypted_problem_two,encrypted_problem_three,encrypted _answers_one,encrypted_answers_two,encrypted_answers_three,province,city,area) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,? ,?,?,?,?,?,?,?,?,?,?,?,?) ";
Jdbctemplate.update (Sql,uuid,accredit,page.getaccount (), Page.getpassword (), Page.getphonenumber (), Page.getrealname (), Page.getidcardnumber (), Page.getagentregion (), Page.getnameofcompany (), Page.getReferees (), Page.getagencyhead (), Page.getphotoagencyasalegalperson (), Page.getthebusinesslicense (), Page.getduplicateofbusinesslicense (), Page.getthebankopensanaccountlicence (), Page.getpid (), Page.getEncrypted_ Problem_one (), Page.getencrypted_problem_two (), Page.getencrypted_problem_three (), Page.getencrypted_answers_one ( ), Page.getencrypted_answers_two (), Page.getencrypted_answers_three (), Page.getprovince (), page.getCity (), Page.getarea ());
return JSON;
}
}

SPRINGMVC+JDBC Connection Database (first micro-commerce project, Agent registration)

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.