一.springmvc的测试环境的搭建
导入下面三个标签:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = qst.imnu.config.BeanConfig.class) //参数也可以为xml文件
@WebAppConfiguration //当测试环境提示No ServletContext set时,应该是缺少web容器,加入此标签
二.关于mybatis的多表联查,参照以下形式
一对多关系:
<resultMap id="StudentCourceMap" type="qst.imnu.pojo.Studentandcource">
<id column="number" property="number"></id>
<result column="name" property="name"/>
<result column="sex" property="sex"/>
<collection property="colist" ofType="qst.imnu.pojo.Cource">
<id column="no" property="no"/>
<result column="coname" property="coname"/>
<result column="fraction" property="fraction"/>
<result column="stunumber" property="stunumber"/>
</collection>
</resultMap>
三.当ajax请求数据,后台查询数据为null返回值时,可以用js用以下方式来判断数据空值
1.$(jQuery).isEmptyObject(object) //true为空
2.let flog = Object.keys(data); //传入参数为对象时,返回对象属性名的数组,当传入数组时,返回数组序列的console.log(flog.length == 0); 数组。