资源简介

《超市订单管理系统》项目源码 Mybatis+Spring+SpringMVC 框架

资源截图

代码片段和文件信息

package cn.smbms.controller;

import cn.smbms.pojo.Bill;
import cn.smbms.pojo.Provider;
import cn.smbms.pojo.User;
import cn.smbms.service.bill.BillService;
import cn.smbms.service.provider.ProviderService;
import cn.smbms.tools.Constants;
import cn.smbms.tools.PageSupport;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.mysql.jdbc.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

@Controller
@RequestMapping(“/sys/bill“)
public class BillController {
    @Resource
    private BillService billService;
    @Resource
    private ProviderService providerService;
    @RequestMapping(value = “/list.html“)
    public String getBillList(Model model
                              @RequestParam(value = “queryProductName“ required = false) String queryProductName
                              @RequestParam(value = “queryProviderId“ required = false) String queryProviderId
                              @RequestParam(value = “queryIsPayment“ required = false) String queryIsPayment
                              @RequestParam(value = “pageIndex“ required = false) String pageIndex) {
        int _queryProviderId = 0;
        int _queryIsPayment=0;
        List billList = new ArrayList();
        ListproviderList=new ArrayList();
        //设置页面容量
        int pageSize = Constants.pageSize;
        //当前页码
        int currentPageNo = 1;

        if (queryProductName==null){
            queryProductName=““;
        }
        if (queryProviderId !=null && !queryProviderId.equals(““)){
            _queryProviderId = Integer.parseInt(queryProviderId);
        }
        if (queryIsPayment !=null && !queryIsPayment.equals(““)){
            _queryIsPayment = Integer.parseInt(queryIsPayment);
        }
        if (pageIndex != null) {
            try {
                currentPageNo = Integer.valueOf(pageIndex);
            } catch (NumberFormatException e) {
                return “redirect:/sys/bill/syserror.html“;
            }
        }
        //总数量
        int totalCount = 0;
        try {
            totalCount = billService.getBillCount(queryProductName_queryProviderId_queryIsPayment);
        } catch (Exception e) {
            e.printStackTrace();
        }
        //总页数
        PageSupport pages =  new PageSupport();
        pages.setCurrentPageNo(currentPageNo);
        pages.setPageSize(pageSize);
        pages.setTotalCount(totalCount);
        int totalPageCount = pages.getTotalPageCount();
        //控制首页和尾页
        if(currentPageNo < 1){
            currentPageNo = 1;
        }else if(current

评论

共有 条评论