diff --git a/code/后端/desktop_archievement_backend/src/main/java/com/cpic/xim/mybatis/mapper/ArchievementMapper.java b/code/后端/desktop_archievement_backend/src/main/java/com/cpic/xim/mybatis/mapper/ArchievementMapper.java new file mode 100644 index 0000000..286a78f --- /dev/null +++ b/code/后端/desktop_archievement_backend/src/main/java/com/cpic/xim/mybatis/mapper/ArchievementMapper.java @@ -0,0 +1,17 @@ +/* + * @Author: Kane + * @Date: 2023-07-27 11:05:53 + * @LastEditors: Kane + * @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/mybatis/mapper/ArchivementMapper.java + * @Description: + * + * Copyright (c) ${2022} by Kane, All Rights Reserved. + */ +package com.cpic.xim.mybatis.mapper; + +import java.util.HashMap; + +public interface ArchievementMapper +{ + public void getDepartmentArchievement(HashMap params); +} \ No newline at end of file diff --git a/code/后端/desktop_archievement_backend/src/main/java/com/cpic/xim/mybatis/pojo/MensualArchievementItem.java b/code/后端/desktop_archievement_backend/src/main/java/com/cpic/xim/mybatis/pojo/MensualArchievementItem.java new file mode 100644 index 0000000..8e2e344 --- /dev/null +++ b/code/后端/desktop_archievement_backend/src/main/java/com/cpic/xim/mybatis/pojo/MensualArchievementItem.java @@ -0,0 +1,93 @@ +/* + * @Author: Kane + * @Date: 2023-07-27 11:12:19 + * @LastEditors: Kane + * @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/mybatis/pojo/MensualArchievementItem.java + * @Description: 每月业绩对象。 + * + * Copyright (c) ${2022} by Kane, All Rights Reserved. + */ +package com.cpic.xim.mybatis.pojo; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class MensualArchievementItem +{ + public MensualArchievementItem() + {} + + public MensualArchievementItem( String month, String premium) + { + this.month = month; + this.premium = premium; + } + + public String getMonth() + { + return month; + } + + public void setMonth( String month ) + { + this.month = month; + } + + public String getPremium() + { + return premium; + } + + public void setPremium( String premium ) + { + this.premium = premium; + } + + @Override + public String toString() + { + return "MensualArchievementItem [month=" + month + ", premium=" + premium + "]"; + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = 1; + result = prime * result + ((month == null) ? 0 : month.hashCode()); + result = prime * result + ((premium == null) ? 0 : premium.hashCode()); + return result; + } + + @Override + public boolean equals( Object obj ) + { + if ( this == obj ) + return true; + if ( obj == null ) + return false; + if ( getClass() != obj.getClass() ) + return false; + MensualArchievementItem other = (MensualArchievementItem) obj; + if ( month == null ) + { + if ( other.month != null ) + return false; + } else if ( !month.equals( other.month ) ) + return false; + if ( premium == null ) + { + if ( other.premium != null ) + return false; + } else if ( !premium.equals( other.premium ) ) + return false; + return true; + } + + // 月份 + @JsonProperty( "month" ) + private String month; + + // 月总保费 + @JsonProperty( "premium" ) + private String premium; +} diff --git a/code/后端/desktop_archievement_backend/src/main/resources/mybatis-config.xml b/code/后端/desktop_archievement_backend/src/main/resources/mybatis-config.xml deleted file mode 100644 index 403d4e7..0000000 --- a/code/后端/desktop_archievement_backend/src/main/resources/mybatis-config.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/code/后端/desktop_archievement_backend/src/main/resources/mybatis/jdbc.properties b/code/后端/desktop_archievement_backend/src/main/resources/mybatis/jdbc.properties new file mode 100644 index 0000000..fe5e4da --- /dev/null +++ b/code/后端/desktop_archievement_backend/src/main/resources/mybatis/jdbc.properties @@ -0,0 +1,4 @@ +jdbc.oracle.driver=oracle.jdbc.driver.OracleDriver +jdbc.oracle.xmcx1.url=jdbc:oracle:thin:@10.39.0.86:1521:xmcx1 +jdbc.oracle.xmcx1.username=desktop_archievement_admin +jdbc.oracle.xmcx1.password=Cpic123456 \ No newline at end of file diff --git a/code/后端/desktop_archievement_backend/src/main/resources/mybatis/mapper/ArchievementMapper.xml b/code/后端/desktop_archievement_backend/src/main/resources/mybatis/mapper/ArchievementMapper.xml new file mode 100644 index 0000000..c16ad05 --- /dev/null +++ b/code/后端/desktop_archievement_backend/src/main/resources/mybatis/mapper/ArchievementMapper.xml @@ -0,0 +1,16 @@ + + + + + + + + + \ No newline at end of file diff --git a/code/后端/desktop_archievement_backend/src/main/resources/StaffMapper.xml b/code/后端/desktop_archievement_backend/src/main/resources/mybatis/mapper/StaffMapper.xml similarity index 100% rename from code/后端/desktop_archievement_backend/src/main/resources/StaffMapper.xml rename to code/后端/desktop_archievement_backend/src/main/resources/mybatis/mapper/StaffMapper.xml diff --git a/code/后端/desktop_archievement_backend/src/main/resources/mybatis/mybatis-config.xml b/code/后端/desktop_archievement_backend/src/main/resources/mybatis/mybatis-config.xml new file mode 100644 index 0000000..5794368 --- /dev/null +++ b/code/后端/desktop_archievement_backend/src/main/resources/mybatis/mybatis-config.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/后端/desktop_archievement_backend/src/test/java/com/cpic/xim/DesktopArchievement/test/DesktopArchievementTest.java b/code/后端/desktop_archievement_backend/src/test/java/com/cpic/xim/DesktopArchievement/test/DesktopArchievementTest.java index c6fd69d..25cdbc5 100644 --- a/code/后端/desktop_archievement_backend/src/test/java/com/cpic/xim/DesktopArchievement/test/DesktopArchievementTest.java +++ b/code/后端/desktop_archievement_backend/src/test/java/com/cpic/xim/DesktopArchievement/test/DesktopArchievementTest.java @@ -9,15 +9,28 @@ */ package com.cpic.xim.DesktopArchievement.test; -import java.sql.SQLException; -import org.junit.Test; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import java.io.IOException; +import java.io.InputStream; +import java.sql.SQLException; +import java.util.HashMap; +import org.apache.ibatis.io.Resources; +import org.apache.ibatis.session.SqlSession; +import org.apache.ibatis.session.SqlSessionFactory; +import org.apache.ibatis.session.SqlSessionFactoryBuilder; +import org.junit.Test; +import com.cpic.xim.mybatis.mapper.ArchievementMapper; import com.cpic.xim.utils.archievement.DepartmentArchievement; import com.cpic.xim.utils.ranking.CallerRankingList; + + @SuppressWarnings( "all" ) public class DesktopArchievementTest { + private static String configFilePath = "mybatis/mybatis-config.xml"; + @Test public void testQueryArchievement() { @@ -39,7 +52,7 @@ public class DesktopArchievementTest public void testCallerRankingList() { CallerRankingList rankingList = null; - + try { rankingList = CallerRankingList.getCallerRankingList( "QDI", "2023", "06" ); @@ -55,4 +68,31 @@ public class DesktopArchievementTest assertNotNull( rankingList ); } + + @Test + public void testDepartmentArchievement() + { + try + { + InputStream configFile = Resources.getResourceAsStream( configFilePath ); + SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder(); + SqlSessionFactory factory = builder.build( configFile ); + SqlSession session = factory.openSession(); + + ArchievementMapper mapper = session.getMapper( ArchievementMapper.class ); + + HashMap params = new HashMap<>(); + params.put("a_department_code", "QDI"); + + mapper.getDepartmentArchievement( params ); + + System.out.println(params.toString()); + + assertTrue( params.size() > 1 ); + } + catch (IOException error ) + { + assert( false ); + } + } }