1.Employee 添加
//提交报销单
List<Employee> selectByDepartmentAndPost(@Param("dsn") String dsn, @Param("post") String post);
2.Employee xml
<select id="selectByDepartmentAndPost" resultMap="employee">
select e.*,d.sn dsn,d.name dname from employee e left join department d on d.sn=e.department_sn
where e.sn is not NULL
<if test="dsn!=null">
and e.department_sn=#{dsn}
</if>
<if test="post!=null">
and e.post=#{post}
</if>
</select>
3.C biz
public void submit(int id) {
ClaimVoucher claimVoucher = claimVoucherDao.select(id);
Employee employee = employeeDao.select(claimVoucher.getCreateSn());
claimVoucher.setStatus(Contant.CLAIMVOUCHER_SUBMIT);
claimVoucher.setNextDealSn(employeeDao.selectByDepartmentAndPost(employee.getDepartmentSn(),Contant.POST_FM).get(0).getSn());
claimVoucherDao.update(claimVoucher);
DealRecord dealRecord = new DealRecord();
dealRecord.setDealWay(Contant.DEAL_SUBMIT);
dealRecord.setDealSn(employee.getSn());
dealRecord.setClaimVoucherId(id);
dealRecord.setDealResult(Contant.CLAIMVOUCHER_SUBMIT);
dealRecord.setDealTime(new Date());
dealRecord.setComment("无");
dealRecordDao.insert(dealRecord);
}
4.Controller
@RequestMapping("/submit")
public String submit(int id){
claimVoucherBiz.submit(id);
return "redirect:deal";
}
5.修改 deal.jsp上的
<a href="/claim_voucher/submit?id=${cv.id}">提交</a>