上一次我们完成了购销合同列表的显示,下面我们来完成购销合同增加、修改、删除、查方法看。

首先回顾一下我们的Mapper映射文件
ContractMapper.xml:

<?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="cn.hpu.jk.mapper.ContractMapper">
<resultMap type="cn.hpu.jk.domain.Contract" id="contractRM">
<id property="id" column="CONTRACT_ID"/>
<result property="offeror" column="OFFEROR"/>
<result property="contractNo" column="CONTRACT_NO"/>
<result property="signingDate" column="SIGNING_DATE"/>
<result property="inputBy" column="INPUT_BY"/>
<result property="checkBy" column="CHECK_BY"/>
<result property="inspector" column="INSPECTOR"/>
<result property="totalAmount" column="TOTAL_AMOUNT"/>
<result property="importNum" column="IMPORT_NUM"/>
<result property="crequest" column="CREQUEST"/>
<result property="customName" column="CUSTOM_NAME"/>
<result property="deliveryPeriod" column="DELIVERY_PERIOD"/>
<result property="shipTime" column="SHIP_TIME"/>
<result property="tradeTerms" column="TRADE_TERMS"/>
<result property="remark" column="REMARK"/>
<result property="printStyle" column="PRINT_STYLE"/>
<result property="oldState" column="OLD_STATE"/>
<result property="state" column="STATE"/>
<result property="outState" column="OUT_STATE"/>

<result property="createBy" column="CREATE_BY"/>
<result property="creatDept" column="CREATE_DEPT"/>
<result property="creatTime" column="CREATE_TIME"/>
</resultMap>

<!-- 查询多个 -->
<select id="find" parameterType="map" resultMap="contractRM">
select * from contract_c
where 1=1
</select>

<!-- 查询一个 -->
<select id="get" parameterType="string" resultMap="contractRM">
select * from contract_c
where contract_id=#{id}
</select>

<!-- 新增 -->
<insert id="insert" parameterType="cn.hpu.jk.domain.Contract">
insert into contract_c
(CONTRACT_ID,,OFFEROR,CONTRACT_NO,SIGNING_DATE,INPUT_BY,CHECK_BY,INSPECTOR,TOTAL_AMOUNT,
IMPORT_NUM,CREQUEST,CUSTOM_NAME,DELIVERY_PERIOD,SHIP_TIME,TRADE_TERMS,REMARK,PRINT_STYLE,
OLD_STATE,STATE,OUT_STATE,CREATE_BY,CREATE_DEPT,CREATE_TIME)
values
(
#{id},
#{offeror, jdbcType=VARCHAR},
#{contractNo, jdbcType=VARCHAR},
#{signingDate, jdbcType=TIMESTAMP},
#{inputBy, jdbcType=VARCHAR},
#{checkBy, jdbcType=VARCHAR},
#{inspector, jdbcType=VARCHAR},
#{totalAmount, jdbcType=DOUBLE},
#{importNum, jdbcType=INTEGER},
#{crequest, jdbcType=VARCHAR},
#{customName, jdbcType=VARCHAR},
#{deliveryPeriod, jdbcType=TIMESTAMP},
#{shipTime, jdbcType=TIMESTAMP},
#{tradeTerms, jdbcType=VARCHAR},
#{remark, jdbcType=VARCHAR},
#{printStyle, jdbcType=CHAR},
#{oldState, jdbcType=INTEGER},
#{state, jdbcType=INTEGER},
#{outState, jdbcType=INTEGER},
#{createBy, jdbcType=VARCHAR},
#{creatDept, jdbcType=VARCHAR},
#{creatTime, jdbcType=TIMESTAMP}
)
</insert>

<!-- 修改 -->
<update id="update" parameterType="cn.hpu.jk.domain.Contract">
update contract_c
<set>
<if test="offeror != null">OFFEROR=#{offeror},</if>
<if test="contractNo != null">CONTRACT_NO=#{contractNo},</if>
<if test="signingDate != null">SIGNING_DATE=#{signingDate},</if>
<if test="inputBy != null">INPUT_BY=#{inputBy},</if>
<if test="checkBy != null">CHECK_BY=#{checkBy},</if>
<if test="inspector != null">INSPECTOR=#{inspector},</if>
<if test="totalAmount != null">TOTAL_AMOUNT=#{totalAmount},</if>
<if test="importNum != null">IMPORT_NUM=#{importNum},</if>
<if test="crequest != null">CREQUEST=#{crequest},</if>
<if test="customName != null">CUSTOM_NAME=#{customName},</if>
<if test="deliveryPeriod != null">DELIVERY_PERIOD=#{deliveryPeriod},</if>
<if test="shipTime != null">SHIP_TIME=#{shipTime},</if>
<if test="tradeTerms != null">TRADE_TERMS=#{tradeTerms},</if>
<if test="remark != null">REMARK=#{remark},</if>
<if test="printStyle != null">PRINT_STYLE=#{printStyle},</if>
<if test="oldState != null">OLD_STATE=#{oldState},</if>
<if test="state != null">STATE=#{state},</if>
<if test="outState != null">OUT_STATE=#{outState},</if>
</set>
where contract_id=#{id}
</update>

<!-- 删除一条 -->
<delete id="deleteById" parameterType="string">
delete from contract_c
where CONTRACT_ID=#{id}
</delete>

<!-- 删除多条(一维字符串数组的形式) -->
<delete id="delete" parameterType="string">
delete from contract_c
where CONTRACT_ID in
<foreach collection="array" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</delete>

<!-- 修改状态 -->
<update id="updateState" parameterType="map">
update contract_c set state=#{state}
where CONTRACT_ID in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</update>
</mapper>


可见我们已经发提前写好了增删改查的配置语句



我们首先来写增加功能


来看我们的Dao层,因为我们继承了BaseDao以及BaseDaoImpl,所以我们拥有下面的方法:


public void insert(T entity) {
this.getSqlSession().insert(ns + ".insert", entity);
}


所以Dao层不用再添加代码。



接下来是我们的Service层


之前我们已经在ContractService以及ContractServiceImpl添加了下面的方法


@Override
public void insert(Contract contract) {
//设置UUID
contract.setId(UUID.randomUUID().toString());
contract.setState(0);//默认为草稿
contractDao.insert(contract);
}

所以Service层无需添加代码



接下来看Controller层


我们在ContractController中添加以下方法


//跳到添加编辑页面
@RequestMapping("/cargo/contract/tocreate.action")
public String tocreate(){
return "/cargo/contract/jContractCreate.jsp";
}


//添加
@RequestMapping("/cargo/contract/insert.action")
public String insert(Contract contract){
contractService.insert(contract);

return "redirect:/cargo/contract/list.action";
}


接下来我们编写编辑页面的jsp文件:

jContractCreate.jsp


<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../../base.jsp"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>添加购销合同</title>
<script language="javascript" src="${ctx}/js/datepicker/WdatePicker.js"></script>
</head>
<body>
<form method="post">


<div id="menubar">
<div id="middleMenubar">
<div id="innerMenubar">
<div id="navMenubar">
<ul>
<li id="save"><a href="#" οnclick="formSubmit('insert.action','_self');">确定</a></li>
<li id="back"><a href="list.action">返回</a></li>
</ul>
</div>
</div>
</div>
</div>

<div class="textbox" id="centerTextbox">

<div class="textbox-header">
<div class="textbox-inner-header">
<div class="textbox-title">
添加购销合同信息
</div>
</div>
</div>
<div>

<div>
<table class="commonTable" cellspacing="1">
<tr>
<td class="columnTitle_mustbe">客户名称:</td>
<td class="tableContent"><input type="text" name="customName" /></td>
<td class="columnTitle_mustbe">收购方:</td>
<td class="tableContent"><input type="text" name="offeror" /></td>
</tr>

<tr>
<td class="columnTitle_mustbe">合同号:</td>
<td class="tableContent"><input type="text" name="contractNo" /></td>
<td class="columnTitle_mustbe">签单日期:</td>
<td class="tableContent">
<input type="text" style="width: 90px" name="signingDate" class="Wdate"
οnclick="WdatePicker({el:this,isShowOthers:true,dateFmt:'yyyy-MM-dd'});"/>
</td>
</tr>

<tr>
<td class="columnTitle_mustbe">制单人:</td>
<td class="tableContent"><input type="text" name="inputBy" /></td>
<td class="columnTitle_mustbe">审单人:</td>
<td class="tableContent"><input type="text" name="checkBy" /></td>
</tr>

<tr>
<td class="columnTitle_mustbe">验货员:</td>
<td class="tableContent"><input type="text" name="inspector" /></td>
<td class="columnTitle_mustbe">检验员:</td>
<td class="tableContent"><input type="text" name="inspector" /></td>
</tr>

<tr>
<td class="columnTitle_mustbe">总金额:</td>
<td class="tableContent"><input type="text" name="totalAmount" /></td>
<td class="columnTitle_mustbe">重要程度:</td>
<td class="tableContent">
<input type="radio" name="importNum" value="3" class="input" checked="checked"/>★★★
<input type="radio" name="importNum" value="2" class="input" checked="checked"/>★★
<input type="radio" name="importNum" value="1" class="input" checked="checked"/>★
</td>
</tr>

<tr>
<td class="columnTitle_mustbe">要求:</td>
<td class="tableContent"><input type="text" name="crequest" /></td>
<td class="columnTitle_mustbe">交货期限:</td>
<td class="tableContent">
<input type="text" style="width: 90px" name="deliveryPeriod" class="Wdate"
οnclick="WdatePicker({el:this,isShowOthers:true,dateFmt:'yyyy-MM-dd'});"/>
</td>
</tr>

<tr>
<td class="columnTitle_mustbe">船期:</td>
<td class="tableContent">
<input type="text" style="width: 90px" name="shipTime" class="Wdate"
οnclick="WdatePicker({el:this,isShowOthers:true,dateFmt:'yyyy-MM-dd'});"/>
</td>
<td class="columnTitle_mustbe">贸易条款:</td>
<td class="tableContent"><input type="text" name="tradeTerms" /></td>
</tr>

<tr>
<td class="columnTitle_mustbe">打印版式:</td>
<td class="tableContent">
<input type="radio" name="printStyle" value="2" checked="checked"/>两款
<input type="radio" name="printStyle" value="1" />一款
</td>
<td class="columnTitle_mustbe">归档前状态:</td>
<td class="tableContent"><input type="text" name="oldState" /></td>
</tr>

<tr>
<td class="columnTitle_mustbe">状态:</td>
<td class="tableContent"><input type="text" name="state" /></td>
<td class="columnTitle_mustbe">走货状态:</td>
<td class="tableContent"><input type="text" name="outState" /></td>
</tr>

<tr>
<td class="columnTitle_mustbe">说明:</td>
<td class="tableContent"><textarea name="remark" style="height:200px;width: 400px"></textarea></td>
</tr>
</table>
</div>
</div>


</form>
</body>
</html>


关于时间选取我们在中间使用了“js时间拾取器”,具体js文件在:

​​js时间拾取器.zip​​ (点击下载),里面有使用说明。



我们在购销合同列表添加一个按钮(上一次已添加过):


<li id="new"><a href="#" οnclick="formSubmit('tocreate.action','_self');this.blur();">添加</a></li>

效果


【springmvc+mybatis项目实战】杰信商贸-14.购销合同添加+修改+删除+查看_plsql developer



点击添加,添加成功!


【springmvc+mybatis项目实战】杰信商贸-14.购销合同添加+修改+删除+查看_spring mvc_02



注意,我们这里的总金额并不是让我们输入的,是后台根据购销合同的附带货物金额生成的,这里我们还没有写附带货物,所以暂时先这么写。



我们接下来写修改功能


Mapper文件中已经写好了修改的相关配置语句,那么来看我们的Dao层,因为我们继承了BaseDao以及BaseDaoImpl,所以我们拥有下面的方法:


public void update(T entity) {
this.getSqlSession().update(ns + ".update", entity);
}


所以Dao层不用再添加代码。



接下来是我们的Service层


之前我们已经在ContractService以及ContractServiceImpl添加了下面的方法


@Override
public void update(Contract contract) {

contractDao.update(contract);
}

所以Service层无需添加代码



接下来看Controller层


我们在ContractController中添加以下方法


//跳转到编辑页面
@RequestMapping("/cargo/contract/toupdate.action")
public String toupdate(String id,Model model){
Contract obj=contractService.get(id);
model.addAttribute("obj",obj);

return "/cargo/contract/jContractUpdate.jsp";
}


//修改方法
@RequestMapping("/cargo/contract/update.action")
public String update(Contract contract){
contractService.update(contract);

return "redirect:/cargo/contract/list.action";
}


之后编写修改的编辑jsp页面:


jContractUpdate.jsp


<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../../base.jsp"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>修改购销合同</title>
<script language="javascript" src="${ctx}/js/datepicker/WdatePicker.js"></script>
</head>
<body>
<form method="post">


<div id="menubar">
<div id="middleMenubar">
<div id="innerMenubar">
<div id="navMenubar">
<ul>
<li id="save"><a href="#" οnclick="formSubmit('insert.action','_self');">确定</a></li>
<li id="back"><a href="list.action">返回</a></li>
</ul>
</div>
</div>
</div>
</div>

<div class="textbox" id="centerTextbox">

<div class="textbox-header">
<div class="textbox-inner-header">
<div class="textbox-title">
修改购销合同信息
</div>
</div>
</div>
<div>

<div>
<table class="commonTable" cellspacing="1">
<input type="hidden" name="id" value="${obj.id}"/>
<tr>
<td class="columnTitle_mustbe">客户名称:</td>
<td class="tableContent"><input type="text" name="customName" value="${obj.customName }"/></td>
<td class="columnTitle_mustbe">收购方:</td>
<td class="tableContent"><input type="text" name="offeror" value="${obj.offeror }"/></td>
</tr>

<tr>
<td class="columnTitle_mustbe">合同号:</td>
<td class="tableContent"><input type="text" name="contractNo" value="${obj.contractNo }"/></td>
<td class="columnTitle_mustbe">签单日期:</td>
<td class="tableContent">
<input type="text" style="width: 90px" name="signingDate" class="Wdate" value="<fmt:formatDate value="${obj.signingDate }" pattern="yyyy-MM-dd"/>"
οnclick="WdatePicker({el:this,isShowOthers:true,dateFmt:'yyyy-MM-dd'});"/>
</td>
</tr>

<tr>
<td class="columnTitle_mustbe">制单人:</td>
<td class="tableContent"><input type="text" name="inputBy" value="${obj.inputBy }"/></td>
<td class="columnTitle_mustbe">审单人:</td>
<td class="tableContent"><input type="text" name="checkBy" value="${obj.checkBy }"/></td>
</tr>

<tr>
<td class="columnTitle_mustbe">验货员:</td>
<td class="tableContent"><input type="text" name="inspector" value="${obj.inspector }"/></td>
<td class="columnTitle_mustbe">总金额:</td>
<td class="tableContent"><input type="text" name="totalAmount" value="${obj.totalAmount}"/></td>
</tr>

<tr>
<td class="columnTitle_mustbe">要求:</td>
<td class="tableContent"><input type="text" name="crequest" value="${obj.crequest}"/></td>
<td class="columnTitle_mustbe">交货期限:</td>
<td class="tableContent">
<input type="text" style="width: 90px" name="deliveryPeriod" class="Wdate" value="<fmt:formatDate value="${obj.deliveryPeriod }" pattern="yyyy-MM-dd"/>"
οnclick="WdatePicker({el:this,isShowOthers:true,dateFmt:'yyyy-MM-dd'});"/>
</td>
</tr>

<tr>
<td class="columnTitle_mustbe">船期:</td>
<td class="tableContent">
<input type="text" style="width: 90px" name="shipTime" class="Wdate" value="<fmt:formatDate value="${obj.shipTime}" pattern="yyyy-MM-dd"/>"
οnclick="WdatePicker({el:this,isShowOthers:true,dateFmt:'yyyy-MM-dd'});"/>
</td>
<td class="columnTitle_mustbe">贸易条款:</td>
<td class="tableContent"><input type="text" name="tradeTerms" value="${obj.tradeTerms }"/></td>
</tr>

<tr>
<td class="columnTitle_mustbe">打印版式:</td>
<td class="tableContent">
<input type="radio" name="printStyle" value="2" <c:if test="${obj.printStyle=='2'}"> checked="checked"</c:if>/>两款
<input type="radio" name="printStyle" value="1" <c:if test="${obj.printStyle=='1'}"> checked="checked"</c:if>/>一款
</td>
<td class="columnTitle_mustbe">归档前状态:</td>
<td class="tableContent"><input type="text" name="oldState" value="${obj.oldState}"/></td>
</tr>

<tr>
<td class="columnTitle_mustbe">状态:</td>
<td class="tableContent"><input type="text" name="state" value="${obj.state}"/></td>
<td class="columnTitle_mustbe">走货状态:</td>
<td class="tableContent"><input type="text" name="outState" value="${obj.outState}"/></td>
</tr>

<tr>
<td class="columnTitle_mustbe">重要程度:</td>
<td class="tableContent">
<input type="radio" name="importNum" value="3" class="input" <c:if test="${obj.importNum==3}"> checked="checked"</c:if>/>★★★
<input type="radio" name="importNum" value="2" class="input" <c:if test="${obj.importNum==2}"> checked="checked"</c:if>/>★★
<input type="radio" name="importNum" value="1" class="input" <c:if test="${obj.importNum==1}"> checked="checked"</c:if>/>★
</td>
</tr>

<tr>
<td class="columnTitle_mustbe">说明:</td>
<td class="tableContent"><textarea name="remark" style="height:200px;width: 400px">${obj.remark}</textarea></td>
</tr>
</table>
</div>
</div>


</form>
</body>
</html>


购销合同列表中原来已经添加有修改的按钮了:


<li id="update"><a href="#" οnclick="formSubmit('toupdate.action','_self');this.blur();">修改</a></li>


效果:


点击修改(添加审单人、制单人等)


【springmvc+mybatis项目实战】杰信商贸-14.购销合同添加+修改+删除+查看_mybatis_03



【springmvc+mybatis项目实战】杰信商贸-14.购销合同添加+修改+删除+查看_spring mvc_04


修改之后的结果


【springmvc+mybatis项目实战】杰信商贸-14.购销合同添加+修改+删除+查看_plsql developer_05




修改方法完成!



下面我们写删除方法:


Mapper文件中已经写好了删除的相关配置语句,那么来看我们的Dao层,因为我们继承了BaseDao以及BaseDaoImpl,所以我们拥有下面的方法:


public void deleteById(Serializable id) {
this.getSqlSession().delete(ns + ".deleteById", id);
}


public void delete(Serializable[] ids) {
this.getSqlSession().delete(ns + ".delete", ids);
}


所以Dao层不用再添加代码。



接下来是我们的Service层


之前我们已经在ContractService以及ContractServiceImpl添加了下面的方法


@Override
public void delete(Serializable[] ids) {
contractDao.delete(ids);
}


@Override
public void deleteById(Serializable id) {
contractDao.deleteById(id);
}

所以Service层无需添加代码



接下来看Controller层


我们在ContractController中添加以下方法


//删除方法
@RequestMapping("/cargo/contract/delete.action")
public String delete(String[] ids){
contractService.delete(ids);

return "redirect:/cargo/contract/list.action";
}


我们list界面已经有删除按钮了:


<li id="delete"><a href="#" οnclick="formSubmit('delete.action','_self');this.blur();">删除</a></li>


测试:


【springmvc+mybatis项目实战】杰信商贸-14.购销合同添加+修改+删除+查看_plsql developer_06


测试结果:


【springmvc+mybatis项目实战】杰信商贸-14.购销合同添加+修改+删除+查看_spring mvc_07




删除方法成功!



接下来我们来写查看方法


Mapper文件中已经写好了查看的相关配置语句,那么来看我们的Dao层,因为我们继承了BaseDao以及BaseDaoImpl,所以我们拥有下面的方法:


public T get(Serializable id) {
return this.getSqlSession().selectOne(ns + ".get", id);
}


所以Dao层不用再添加代码。



之前我们已经在ContractService以及ContractServiceImpl添加了下面的方法


@Override
public Contract get(Serializable id) {
return contractDao.get(id);
}

所以Service层无需添加代码



接下来看Controller层


我们在ContractController中添加以下方法


//查看方法
@RequestMapping("/cargo/contract/toview.action")
public String toview(String id,Model model){
Contract obj=contractService.get(id);
model.addAttribute("obj", obj);

return "/cargo/contract/jContractView.jsp";
}


我们来编写查看界面的jsp代码:


jContractView.jsp


<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../../base.jsp"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>查看购销合同</title>
<script language="javascript" src="${ctx}/js/datepicker/WdatePicker.js"></script>
</head>
<body>
<form method="post">


<div id="menubar">
<div id="middleMenubar">
<div id="innerMenubar">
<div id="navMenubar">
<ul>
<li id="back"><a href="list.action">返回</a></li>
</ul>
</div>
</div>
</div>
</div>

<div class="textbox" id="centerTextbox">

<div class="textbox-header">
<div class="textbox-inner-header">
<div class="textbox-title">
查看购销合同信息
</div>
</div>
</div>
<div>

<div>
<table class="commonTable" cellspacing="1">
<tr>
<td class="columnTitle_mustbe">客户名称:</td>
<td class="tableContent">${obj.customName }</td>
<td class="columnTitle_mustbe">收购方:</td>
<td class="tableContent">${obj.offeror }</td>
</tr>

<tr>
<td class="columnTitle_mustbe">合同号:</td>
<td class="tableContent">${obj.contractNo }</td>
<td class="columnTitle_mustbe">签单日期:</td>
<td class="tableContent">
<fmt:formatDate value="${obj.signingDate }" pattern="yyyy-MM-dd"/>
</td>
</tr>

<tr>
<td class="columnTitle_mustbe">制单人:</td>
<td class="tableContent">${obj.inputBy }</td>
<td class="columnTitle_mustbe">审单人:</td>
<td class="tableContent">${obj.checkBy }</td>
</tr>

<tr>
<td class="columnTitle_mustbe">验货员:</td>
<td class="tableContent">${obj.inspector }</td>
<td class="columnTitle_mustbe">总金额:</td>
<td class="tableContent">${obj.totalAmount}</td>
</tr>

<tr>
<td class="columnTitle_mustbe">要求:</td>
<td class="tableContent">${obj.crequest}</td>
<td class="columnTitle_mustbe">交货期限:</td>
<td class="tableContent">
<fmt:formatDate value="${obj.deliveryPeriod }" pattern="yyyy-MM-dd"/>
</td>
</tr>

<tr>
<td class="columnTitle_mustbe">船期:</td>
<td class="tableContent">
<fmt:formatDate value="${obj.shipTime}" pattern="yyyy-MM-dd"/>
</td>
<td class="columnTitle_mustbe">贸易条款:</td>
<td class="tableContent">${obj.tradeTerms }</td>
</tr>

<tr>
<td class="columnTitle_mustbe">打印版式:</td>
<td class="tableContent">
<c:if test="${obj.printStyle=='2'}">两款</c:if>
<c:if test="${obj.printStyle=='1'}">一款</c:if>
</td>
<td class="columnTitle_mustbe">归档前状态:</td>
<td class="tableContent">${obj.oldState}</td>
</tr>

<tr>
<td class="columnTitle_mustbe">状态:</td>
<td class="tableContent">${obj.state}</td>
<td class="columnTitle_mustbe">走货状态:</td>
<td class="tableContent">${obj.outState}</td>
</tr>

<tr>
<td class="columnTitle_mustbe">重要程度:</td>
<td class="tableContent">
<c:if test="${obj.importNum==3}">★★★</c:if>
<c:if test="${obj.importNum==2}">★</c:if>
<c:if test="${obj.importNum==1}">★</c:if>
</td>
</tr>

<tr>
<td class="columnTitle_mustbe">说明:</td>
<td class="tableContent"><pre>${obj.remark}</pre></td>
</tr>
</table>
</div>
</div>


</form>
</body>
</html>


我们list界面已经有查看按钮了:


<li id="view"><a href="#" οnclick="formSubmit('toview.action','_self');this.blur();">查看</a></li>


测试:


【springmvc+mybatis项目实战】杰信商贸-14.购销合同添加+修改+删除+查看_oracle_08


测试结果:


【springmvc+mybatis项目实战】杰信商贸-14.购销合同添加+修改+删除+查看_plsql developer_09



查看方法成功!



到此购销合同的增删改查方法编写完毕



最后还剩下一个“上报”和“取消”功能,我们下篇总结再介绍。