发表于: 2017-09-03 19:27:14

3 896


今天完成的事情:

jsp页面的跳转还有点问题,url总是没有项目名,导致404。加上绝对路径就好了

<td><a href="${pageContext.request.contextPath}/u/${stu.id}">Edit</a></td>
<td><a class="delete" href="${pageContext.request.contextPath}/d/${stu.id}">Delete</a></td>
<a href="${pageContext.request.contextPath}/a/student">Add New Student</a>

表也需要修改一下,由于我手里没有数据,所以表里基本也写不了几个数据,所以有些可以改成静态页面的内容,没必要再单独建表

都没必要弄成表了,因为可以是不变的。这样的话T10一张学员表,T11一张职位表就行了。

加入了picture,可以储存图片的位置。id都改为bigint

重新弄一下mybatis项目吧

正在加service层,目前看来也没啥变化。静态页面可以直接引用前端的

明天计划的事情:

任务4,学习tiles

遇到的问题:

小课堂又不知道讲什么了

收获:

晚上一番讨论,我发现自动生成的代码里,sql语句里都有整体提交和挨个判空两种

<update id="updateByPrimaryKeySelective" parameterType="com.jnshu.entities.student" >
 update goodstudent
<set >
   <if test="picture != null" >
     picture = #{picture,jdbcType=VARCHAR},
</if>
   <if test="job != null" >
     job = #{job,jdbcType=VARCHAR},
</if>
   <if test="name != null" >
     name = #{name,jdbcType=VARCHAR},
</if>
   <if test="profession != null" >
     profession = #{profession,jdbcType=VARCHAR},
</if>
   <if test="introduce != null" >
     introduce = #{introduce,jdbcType=VARCHAR},
</if>
   <if test="createAt != null" >
     create_at = #{createAt,jdbcType=BIGINT},
</if>
   <if test="updateAt != null" >
     update_at = #{updateAt,jdbcType=BIGINT},
</if>
 </set>
 where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.jnshu.entities.student" >
 update goodstudent
set picture = #{picture,jdbcType=VARCHAR},
job = #{job,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
profession = #{profession,jdbcType=VARCHAR},
introduce = #{introduce,jdbcType=VARCHAR},
create_at = #{createAt,jdbcType=BIGINT},
update_at = #{updateAt,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>

果然人家早就想到了这种事情,只是我们一直没有注意而已。所以说不懂的时候还是要多查多看。


返回列表 返回列表
评论

    分享到