前臺使用ajax動態獲取資料並且顯示在頁面上,SSM框架二級聯動
阿新 • • 發佈:2019-02-10
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ssm.dao.IStudentDao">
<resultMap type="Student" id="studentmapper">
<id column="id" property="id"/>
<result column="name" property="name"/>
<result column="age" property="age"/>
</resultMap>
<select id="selectStudent" resultMap="studentmapper">
select id from student where name=#{0} and age=#{1}
</select>
<!-- ============================================================= -->
<select id="selectProvince" resultType="Province">
select pid,province
from province
<!-- <if test="list!=null and list.size>0">
where pid in
<foreach collection="list" open="(" close=")" item="pro" separator=",">
#{pro.pid}
</foreach>
</if> -->
</select>
<select id="findAllCity" resultType="City">
select cid,city_name(欄位名) from city where p_id=#{pid}
</select>
</mapper>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ssm.dao.IStudentDao">
<resultMap type="Student" id="studentmapper">
<id column="id" property="id"/>
<result column="name" property="name"/>
<result column="age" property="age"/>
</resultMap>
<select id="selectStudent" resultMap="studentmapper">
select id from student where name=#{0} and age=#{1}
</select>
<!-- ============================================================= -->
<select id="selectProvince" resultType="Province">
select pid,province
from province
<!-- <if test="list!=null and list.size>0">
where pid in
<foreach collection="list" open="(" close=")" item="pro" separator=",">
#{pro.pid}
</foreach>
</if> -->
</select>
<select id="findAllCity" resultType="City">
select cid,city_name(欄位名) from city where p_id=#{pid}
</select>
</mapper>