package cn.bdqn.controller;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import common.PagerMySQL;
import cn.bdqn.biz.OaBiz;
import cn.bdqn.entity.Detall;
import cn.bdqn.entity.Leave;
import cn.bdqn.entity.Voucher;
@Controller
public class OaVoucherController {
@Resource(name="Oabiz")
private OaBiz oaBiz;
public void setOaBiz(OaBiz oaBiz) {
this.oaBiz = oaBiz;
}
@RequestMapping("/servletVoucher")
public String select(
String sn,
String status,String name,
Model mode,
@RequestParam(value="pageNo",defaultValue="1")Integer curPage,
@RequestParam(value="pageSize",defaultValue="6")Integer pageSize
){
PageHelper.startPage(curPage, pageSize);
List<Voucher> list=oaBiz.findVoucherAll(sn,status,name);
PageInfo<Voucher> pageInfo = new PageInfo<Voucher>(list);
PagerMySQL<Voucher> pager=new PagerMySQL<Voucher>(curPage,pageSize,new Long(pageInfo.getTotal()).intValue());
pager.setEntitiesList(list);
if(status!=null&&name!=null){
mode.addAttribute("pagerhuixian",status);
mode.addAttribute("pagerhuixians",name);
};
mode.addAttribute("pagerBooks", pager);
return "jsp/claim/claim_voucher_list.jsp";
}
@RequestMapping("/servletVouchers")
public String selects(
String status,String name,
Model mode,
@RequestParam(value="pageNo",defaultValue="1")Integer curPage,
@RequestParam(value="pageSize",defaultValue="6")Integer pageSize
){
PageHelper.startPage(curPage, pageSize);
List<Voucher> list=oaBiz.findVoucherAlls(status,name);
PageInfo<Voucher> pageInfo = new PageInfo<Voucher>(list);
PagerMySQL<Voucher> pager=new PagerMySQL<Voucher>(curPage,pageSize,new Long(pageInfo.getTotal()).intValue());
pager.setEntitiesList(list);
if(status!=null&&name!=null){
mode.addAttribute("pagerhuixian",status);
mode.addAttribute("pagerhuixians",name);
};
mode.addAttribute("pagerBooks", pager);
return "jsp/claim/claim_voucher_list.jsp";
}
/**
* 删除
* */
@RequestMapping("/delete")
public ModelAndView delectId(int id,Model model,int ids){
ModelAndView mode=new ModelAndView();
int num=oaBiz.delete(id);
int nums=oaBiz.deletes(ids);
if(num!=0 && nums!=0){
mode.setViewName("servletVoucher");
return mode;
}
mode.setViewName("servletVoucher");
return mode;
}
@RequestMapping("/AddVoucher")
public ModelAndView InsertBook(String create_sn,String create_time,String total_account,String status,String item,String event,String account,String des){
ModelAndView mode=new ModelAndView();
int num=oaBiz.addDetail(item, account, des);
int num1=oaBiz.addVoucher(create_sn, create_time, total_account, status, event);
if(num==1 && num1==1){
mode.setViewName("servletVouchers");
}else{
mode.setViewName("jsp/claim/claim_voucher_edit.jsp");
}
return mode;
}
@RequestMapping("/selectId")
public ModelAndView selectId(Integer id,HttpSession session){
ModelAndView mode=new ModelAndView();
Voucher voucher=oaBiz.findCha(id);
session.setAttribute("vo", voucher);
mode.setViewName("jsp/claim/claim_voucher_view.jsp");
return mode;
}
@RequestMapping("/selectVoucher")
public ModelAndView selectProCha(Integer id){
ModelAndView mode=new ModelAndView();
Voucher voucher=oaBiz.selectVoucher(id);
mode.addObject("voucher", voucher);
mode.setViewName("jsp/claim/claim_voucher_update.jsp");
return mode;
}
/**
* 修改
* */
@RequestMapping("/SelectProviders")
public String UpdateId(int id,String txtTotal_account,String txtType,String account,String item,String desc){
Voucher voucher=new Voucher();
voucher.setId(id);
voucher.setTotal_account(txtTotal_account);
voucher.setEvent(txtType);
Detall detall=new Detall();
detall.setAccount(account);
detall.setItem(item);
detall.setDes(desc);
int num1=oaBiz.UpdatedetallId(detall);
int num=oaBiz.UpdatevoucherId(voucher);
if(num==1 && num1==1){
return "servletVoucher";
}
return "servletVoucher";
}
@RequestMapping("/selectVouchershen")
public ModelAndView selectshen(Integer id){
ModelAndView mode=new ModelAndView();
Voucher voucher=oaBiz.selectVoucherShen(id);
mode.addObject("voucher", voucher);
mode.setViewName("jsp/claim/claim_voucher_check.jsp");
return mode;
}
//审核表
@RequestMapping("/UpdateVou")
public String updateVou(int id,String status){
Voucher Vou=new Voucher();
Vou.setId(id);
Vou.setStatus(status);
int ret=oaBiz.updateVou(Vou);
if(ret!=0){
return "servletVouchers";
}
return "/welcome.jsp";
}
//请假审核表
@RequestMapping("/UpdateVous")
public String updateLea(int id,String status){
Leave Vou=new Leave();
Vou.setId(id);
Vou.setStatus(status);
int ret=oaBiz.updateLeaves(Vou);
if(ret!=0){
return "servletLeave";
}
return "/welcome.jsp";
}
}
最近下载更多
mazihao12138 LV2
2023年7月3日
c469893928 LV2
2023年6月10日
kkkaaaa LV3
2023年5月16日
微信网友_5963854197018624 LV7
2023年4月6日
微信网友_6164511365238784 LV7
2022年10月10日
赖小宝 LV3
2022年8月26日
最代码-宋家辉 LV61
2022年8月22日
2039995605 LV9
2022年6月5日
www-chrome LV6
2022年5月20日
cx123123 LV7
2022年5月18日

最近浏览