CRM Project Complete Implementation

Source: Internet
Author: User

These two days we are writing the project interface and implementation!

Today is the main problem: When I add a new class, the class of teachers I need to determine whether the teacher exists, if not exist, I will add this teacher to the school staff table!

I will first judge whether the teacher exists, but every time I add a class, the teacher will always add a piece of data again. But I also first judge, and do not know where the problem is.

1  Public intaddclassroom (Classroom cr) {2String sqls = "SELECT * from T_schoolemp where s_name=?";//When the teacher name entered does not exist, the data is isolated3ResultSet rs =jdbcutil.executequery (Sqls, Cr.getteacher (). GetName ());4         Try {5             if(Rs.getrow () ==0) {//When the teacher does not exist, add the teacher to the school staff table6String Sqladd = "INSERT into t_schoolemp values (null,?,?)";7                 intnum =jdbcutil.executeupdate (Sqladd, Cr.getteacher ()8. GetName (), 6);9             }Ten}Catch(SQLException e) { One e.printstacktrace (); A }//Add a new class -String sql = "INSERT into T_classromm (Cr_name,sl_id,s_id,cr_time,cr_num) VALUES (?," -+ "(select sl_id from T_shool where sl_name=?)," the+ "(select s_id from T_schoolemp where s_name=?),?,?);"; -         intCount =jdbcutil.executeupdate (SQL, Cr.getname (), Cr.getschool () -. GetName (), Cr.getteacher (). GetName (),NewDate (), CR - . Getclassnum ()); +         returncount; -  +}

The result is:

s_id S_name sj_id
18 Good Boy 6
19 Good Boy 6

The second one is in the statistical data, we do not use a table to statistics, but with a new object to receive the statistics of the data! I started with the list<list<string>> List a bit of a problem now changed to list<map<string, string>> actually I think two are similar

The main code:

1  PublicList<map<string, string>>getstatistical (String c_name) {2list<map<string, string>> list =NewArraylist<map<string, string>>();3SQL statements for Statistics4String sql = "Select S.sl_name ' School name ', Count (c.cr_name) ' Network vein class number ',"5+ "SUM (case ST.VIP when ' member ' then 1 ELSE 0 END) ' Number of members ',"6+ "SUM (case ST.VIP when ' non-member ' then 1 ELSE 0 END) ' number of non-members ')7+ "from T_shool S"8+ "left JOIN t_classromm c on s.sl_id = c.sl_id"9+ "Left JOIN t_student st on st.st_clid = c.cr_id"Ten+ "Where S.sl_cid = (select t_city.c_id from t_city where t_city.c_name=?)" One+ "GROUP by S.sl_name;"; AResultSet rs =jdbcutil.executequery (SQL, c_name); -         Try { -              while(Rs.next ()) { themap<string, string> map =NewHashmap<string, string>(); -Map.put ("School Name", Rs.getstring ("School name"))); -Map.put ("Number of net pulse classes", rs.getstring ("Number of nets")); -Map.put ("Number of members", Rs.getstring ("Number of members")); +Map.put ("Non-member number", Rs.getstring ("Non-member number"))); - list.add (map); +  A             } at}Catch(SQLException e) { - e.printstacktrace (); -}finally { - jdbcutil.close (); -         } -         returnlist; in  -}

More and more feel that we should be the best group in the Class!

A person has a very own idea! I think it's the right thing! Even if it is a group to complete the work, he will go to the completion of a person. I found out that I was the worst person in the group!

My team leader is a girl, but she is also a very good team leader! The study Committee will not need me to say every day to help me find problems to solve the problem! The truth is very grateful to him!

More than half a month I will be on holiday to go home! Not home for nearly half a year! This is the longest time to leave home!

CRM Project Complete Implementation

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.