预览地址:http://117.50.96.227/EpidemicInfo/
pojo
CityData
1 | package com.pojo; |
ProvinceData
1 | package com.pojo; |
dao
city的dao
CityMapper
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22package com.dao;
import com.pojo.CityData;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface CityMapper {
//获取所有城市的信息
public List<CityData> getAllInfo(@Param("date") String date);
//根据城市名称查询城市的信息
public List<CityData> getInfoByName(@Param("name") String name,@Param("date") String date);
//根据省份名称查询城市的信息
public List<CityData> getInfoByProvince(@Param("name") String name,@Param("date") String date);
//根据国家名称查询疫情信息
public List<CityData> getInfoByCountry(@Param("name") String countryName,@Param("date") String date);
}CityMapper.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<mapper namespace="com.dao.CityMapper">
<select id="getAllInfo" resultType="CityData">
select * from pythontest2 where lastupdatetime like #{date}
</select>
<select id="getInfoByName" resultType="CityData">
select * from pythontest2 where name like #{name} and lastupdatetime like #{date}
</select>
<select id="getInfoByProvince" resultType="CityData">
select * from pythontest2 where province like #{name} and lastupdatetime like #{date}
</select>
<select id="getInfoByCountry" resultType="CityData">
select * from pythontest where name like #{name} and lastupdatetime like #{date}
</select>
</mapper>
province的dao
ProvinceMapper
1
2
3
4
5
6
7
8
9
10
11package com.dao;
import com.pojo.ProvinceData;
import java.util.List;
public interface ProvinceMapper {
// 获取全国省份信息
public List<ProvinceData> getAllProvinceData();
}ProvinceMapper.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<mapper namespace="com.dao.ProvinceMapper">
<resultMap id="Province" type="com.pojo.ProvinceData">
<result property="value" column="confirm"/>
</resultMap>
<select id="getAllProvinceData" resultMap="Province">
select * from pythontest
</select>
</mapper>
Service
cityService
1 | package com.service; |
实现类:
1 | package com.service; |
provinceService
1 | package com.service; |
实现类:
1 | package com.service; |
Controller
CityController
1 | package com.controller; |
ProvinceController
1 | package com.controller; |
相关配置文件
applicationContext.xml
1 |
|
spring-dao.xml
1 |
|
spring-mvc.xml
1 |
|
spring-service.xml
1 |
|
mybatis-config.xml
1 |
|
database.properties
1 | com.mysql.jdbc.Driver = |
页面
1 | <%@ page contentType="text/html;charset=UTF-8" language="java" %> |
web.xml配置
1 |
|