基于ssm vue个人需求和地域特色的外卖推荐系统源码和论文

news2024/11/25 2:50:55

首先,论文一开始便是清楚的论述了系统的研究内容。其次,剖析系统需求分析,弄明白“做什么”,分析包括业务分析和业务流程的分析以及用例分析,更进一步明确系统的需求。然后在明白了系统的需求基础上需要进一步地设计系统,主要包罗软件架构模式、整体功能模块、数据库设计。本项目软件架构选择B/S模式,总体功能模块运用自顶向下的分层思想。再然后就是实现系统并进行代码编写实现功能。论文的最后章节总结一下自己完成本论文和开发本项目的心得和总结。通过外卖系推荐统将会使外卖各个方面的工作效率带来实质性的提升。

关键字:外卖推荐系统 B/S模式 软件架构

基于ssm vue个人需求和地域特色的外卖推荐系统源码和论文741

演示视频:

基于ssm vue个人需求和地域特色的外卖推荐系统源码和论文741

Abstract

First of all, the thesis clearly discusses the systematic research content at the very beginning. Secondly, the analysis of system requirements analysis, understand "what to do", including business analysis and business process analysis and use case analysis, further clear system requirements. Then, on the basis of understanding the requirements of the system, we need to further design the system, mainly including software architecture pattern, overall functional modules and database design. The software architecture of the project is B/S mode, and the overall functional modules are layered from top to bottom. Then is the realization of the system and code writing to achieve the function. The last chapter of the paper summarizes the experience and summary of the completion of this paper and the development of this project. Through the delivery system recommendation system will make the delivery of all aspects of work efficiency to bring substantial improvement.

Key words: takeaway recommendation system B/S mode software architecture

 

package com.controller;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;
import com.entity.OrdersEntity;
import com.service.OrdersService;

import com.entity.CaidanliebiaoEntity;
import com.entity.view.CaidanliebiaoView;

import com.service.CaidanliebiaoService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
import com.service.StoreupService;
import com.entity.StoreupEntity;

/**
 * 菜单列表
 * 后端接口
 * @author 
 * @email 
 * @date 2022-03-26 14:26:59
 */
@RestController
@RequestMapping("/caidanliebiao")
public class CaidanliebiaoController {
    @Autowired
    private CaidanliebiaoService caidanliebiaoService;


    @Autowired
    private StoreupService storeupService;

    @Autowired
    private OrdersService ordersService;
    


    /**
     * 后端列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,CaidanliebiaoEntity caidanliebiao, 
		HttpServletRequest request){

		String tableName = request.getSession().getAttribute("tableName").toString();
		if(tableName.equals("shangjia")) {
			caidanliebiao.setShangjiazhanghao((String)request.getSession().getAttribute("username"));
		}
        EntityWrapper<CaidanliebiaoEntity> ew = new EntityWrapper<CaidanliebiaoEntity>();
		PageUtils page = caidanliebiaoService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, caidanliebiao), params), params));
        return R.ok().put("data", page);
    }
    
    /**
     * 前端列表
     */
	@IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params,CaidanliebiaoEntity caidanliebiao, 
		HttpServletRequest request){
        EntityWrapper<CaidanliebiaoEntity> ew = new EntityWrapper<CaidanliebiaoEntity>();
		PageUtils page = caidanliebiaoService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, caidanliebiao), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/lists")
    public R list( CaidanliebiaoEntity caidanliebiao){
       	EntityWrapper<CaidanliebiaoEntity> ew = new EntityWrapper<CaidanliebiaoEntity>();
      	ew.allEq(MPUtil.allEQMapPre( caidanliebiao, "caidanliebiao")); 
        return R.ok().put("data", caidanliebiaoService.selectListView(ew));
    }

	 /**
     * 查询
     */
    @RequestMapping("/query")
    public R query(CaidanliebiaoEntity caidanliebiao){
        EntityWrapper< CaidanliebiaoEntity> ew = new EntityWrapper< CaidanliebiaoEntity>();
 		ew.allEq(MPUtil.allEQMapPre( caidanliebiao, "caidanliebiao")); 
		CaidanliebiaoView caidanliebiaoView =  caidanliebiaoService.selectView(ew);
		return R.ok("查询菜单列表成功").put("data", caidanliebiaoView);
    }
	
    /**
     * 后端详情
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        CaidanliebiaoEntity caidanliebiao = caidanliebiaoService.selectById(id);
		caidanliebiao.setClicktime(new Date());
		caidanliebiaoService.updateById(caidanliebiao);
        return R.ok().put("data", caidanliebiao);
    }

    /**
     * 前端详情
     */
	@IgnoreAuth
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id){
        CaidanliebiaoEntity caidanliebiao = caidanliebiaoService.selectById(id);
		caidanliebiao.setClicktime(new Date());
		caidanliebiaoService.updateById(caidanliebiao);
        return R.ok().put("data", caidanliebiao);
    }
    


    /**
     * 赞或踩
     */
    @RequestMapping("/thumbsup/{id}")
    public R thumbsup(@PathVariable("id") String id,String type){
        CaidanliebiaoEntity caidanliebiao = caidanliebiaoService.selectById(id);
        if(type.equals("1")) {
        	caidanliebiao.setThumbsupnum(caidanliebiao.getThumbsupnum()+1);
        } else {
        	caidanliebiao.setCrazilynum(caidanliebiao.getCrazilynum()+1);
        }
        caidanliebiaoService.updateById(caidanliebiao);
        return R.ok();
    }

    /**
     * 后端保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody CaidanliebiaoEntity caidanliebiao, HttpServletRequest request){
    	caidanliebiao.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(caidanliebiao);

        caidanliebiaoService.insert(caidanliebiao);
        return R.ok();
    }
    
    /**
     * 前端保存
     */
    @RequestMapping("/add")
    public R add(@RequestBody CaidanliebiaoEntity caidanliebiao, HttpServletRequest request){
    	caidanliebiao.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(caidanliebiao);

        caidanliebiaoService.insert(caidanliebiao);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody CaidanliebiaoEntity caidanliebiao, HttpServletRequest request){
        //ValidatorUtils.validateEntity(caidanliebiao);
        caidanliebiaoService.updateById(caidanliebiao);//全部更新
        return R.ok();
    }
    

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        caidanliebiaoService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
    
    /**
     * 提醒接口
     */
	@RequestMapping("/remind/{columnName}/{type}")
	public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, 
						 @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
		map.put("column", columnName);
		map.put("type", type);
		
		if(type.equals("2")) {
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
			Calendar c = Calendar.getInstance();
			Date remindStartDate = null;
			Date remindEndDate = null;
			if(map.get("remindstart")!=null) {
				Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
				c.setTime(new Date()); 
				c.add(Calendar.DAY_OF_MONTH,remindStart);
				remindStartDate = c.getTime();
				map.put("remindstart", sdf.format(remindStartDate));
			}
			if(map.get("remindend")!=null) {
				Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
				c.setTime(new Date());
				c.add(Calendar.DAY_OF_MONTH,remindEnd);
				remindEndDate = c.getTime();
				map.put("remindend", sdf.format(remindEndDate));
			}
		}
		
		Wrapper<CaidanliebiaoEntity> wrapper = new EntityWrapper<CaidanliebiaoEntity>();
		if(map.get("remindstart")!=null) {
			wrapper.ge(columnName, map.get("remindstart"));
		}
		if(map.get("remindend")!=null) {
			wrapper.le(columnName, map.get("remindend"));
		}

		String tableName = request.getSession().getAttribute("tableName").toString();
		if(tableName.equals("shangjia")) {
			wrapper.eq("shangjiazhanghao", (String)request.getSession().getAttribute("username"));
		}

		int count = caidanliebiaoService.selectCount(wrapper);
		return R.ok().put("count", count);
	}
	
	/**
     * 前端智能排序
     */
	@IgnoreAuth
    @RequestMapping("/autoSort")
    public R autoSort(@RequestParam Map<String, Object> params,CaidanliebiaoEntity caidanliebiao, HttpServletRequest request,String pre){
        EntityWrapper<CaidanliebiaoEntity> ew = new EntityWrapper<CaidanliebiaoEntity>();
        Map<String, Object> newMap = new HashMap<String, Object>();
        Map<String, Object> param = new HashMap<String, Object>();
		Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
		while (it.hasNext()) {
			Map.Entry<String, Object> entry = it.next();
			String key = entry.getKey();
			String newKey = entry.getKey();
			if (pre.endsWith(".")) {
				newMap.put(pre + newKey, entry.getValue());
			} else if (StringUtils.isEmpty(pre)) {
				newMap.put(newKey, entry.getValue());
			} else {
				newMap.put(pre + "." + newKey, entry.getValue());
			}
		}
		params.put("sort", "clicktime");
        
        params.put("order", "desc");
		PageUtils page = caidanliebiaoService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, caidanliebiao), params), params));
        return R.ok().put("data", page);
    }


	/**
     * 协同算法(按用户购买推荐)
     */
    @RequestMapping("/autoSort2")
    public R autoSort2(@RequestParam Map<String, Object> params,CaidanliebiaoEntity caidanliebiao, HttpServletRequest request){
    	String userId = request.getSession().getAttribute("userId").toString();
    	String goodtypeColumn = "caixifenlei";
    	List<OrdersEntity> orders = ordersService.selectList(new EntityWrapper<OrdersEntity>().eq("userid", userId).eq("tablename", "caidanliebiao").orderBy("addtime", false));
        List<String> goodtypes = new ArrayList<String>();
    	Integer limit = params.get("limit")==null?10:Integer.parseInt(params.get("limit").toString());
    	List<CaidanliebiaoEntity> caidanliebiaoList = new ArrayList<CaidanliebiaoEntity>();
	//去重
    	List<OrdersEntity> ordersDist = new ArrayList<OrdersEntity>();
    	for(OrdersEntity o1 : orders) {
    		boolean addFlag = true;
    		for(OrdersEntity o2 : ordersDist) {
    			if(o1.getGoodid()==o2.getGoodid() || o1.getGoodtype().equals(o2.getGoodtype())) {
    				addFlag = false;
    				break;
    			}
    		}
    		if(addFlag) ordersDist.add(o1);
    	}
        if(ordersDist!=null && ordersDist.size()>0) {
        	for(OrdersEntity o : ordersDist) {
        		caidanliebiaoList.addAll(caidanliebiaoService.selectList(new EntityWrapper<CaidanliebiaoEntity>().eq(goodtypeColumn, o.getGoodtype())));
        	}
        }
    	EntityWrapper<CaidanliebiaoEntity> ew = new EntityWrapper<CaidanliebiaoEntity>();
	params.put("sort", "id");
	params.put("order", "desc");
	PageUtils page = caidanliebiaoService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, caidanliebiao), params), params));
        List<CaidanliebiaoEntity> pageList = (List<CaidanliebiaoEntity>)page.getList();
        if(caidanliebiaoList.size()<limit) {
        	int toAddNum = (limit-caidanliebiaoList.size())<=pageList.size()?(limit-caidanliebiaoList.size()):pageList.size();
            for(CaidanliebiaoEntity o1 : pageList) {
                boolean addFlag = true;
                for(CaidanliebiaoEntity o2 : caidanliebiaoList) {
                    if(o1.getId().intValue()==o2.getId().intValue()) {
                        addFlag = false;
                        break;
                    }
                }
                if(addFlag) {
                    caidanliebiaoList.add(o1);
                    if(--toAddNum==0) break;
                }
            }
        }
        page.setList(caidanliebiaoList);
	return R.ok().put("data", page);
    }





}
package com.controller;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;
import com.entity.OrdersEntity;
import com.service.OrdersService;

import com.entity.CaidanliebiaoEntity;
import com.entity.view.CaidanliebiaoView;

import com.service.CaidanliebiaoService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
import com.service.StoreupService;
import com.entity.StoreupEntity;

/**
 * 菜单列表
 * 后端接口
 * @author 
 * @email 
 * @date 2022-03-26 14:26:59
 */
@RestController
@RequestMapping("/caidanliebiao")
public class CaidanliebiaoController {
    @Autowired
    private CaidanliebiaoService caidanliebiaoService;


    @Autowired
    private StoreupService storeupService;

    @Autowired
    private OrdersService ordersService;
    


    /**
     * 后端列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,CaidanliebiaoEntity caidanliebiao, 
		HttpServletRequest request){

		String tableName = request.getSession().getAttribute("tableName").toString();
		if(tableName.equals("shangjia")) {
			caidanliebiao.setShangjiazhanghao((String)request.getSession().getAttribute("username"));
		}
        EntityWrapper<CaidanliebiaoEntity> ew = new EntityWrapper<CaidanliebiaoEntity>();
		PageUtils page = caidanliebiaoService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, caidanliebiao), params), params));
        return R.ok().put("data", page);
    }
    
    /**
     * 前端列表
     */
	@IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params,CaidanliebiaoEntity caidanliebiao, 
		HttpServletRequest request){
        EntityWrapper<CaidanliebiaoEntity> ew = new EntityWrapper<CaidanliebiaoEntity>();
		PageUtils page = caidanliebiaoService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, caidanliebiao), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/lists")
    public R list( CaidanliebiaoEntity caidanliebiao){
       	EntityWrapper<CaidanliebiaoEntity> ew = new EntityWrapper<CaidanliebiaoEntity>();
      	ew.allEq(MPUtil.allEQMapPre( caidanliebiao, "caidanliebiao")); 
        return R.ok().put("data", caidanliebiaoService.selectListView(ew));
    }

	 /**
     * 查询
     */
    @RequestMapping("/query")
    public R query(CaidanliebiaoEntity caidanliebiao){
        EntityWrapper< CaidanliebiaoEntity> ew = new EntityWrapper< CaidanliebiaoEntity>();
 		ew.allEq(MPUtil.allEQMapPre( caidanliebiao, "caidanliebiao")); 
		CaidanliebiaoView caidanliebiaoView =  caidanliebiaoService.selectView(ew);
		return R.ok("查询菜单列表成功").put("data", caidanliebiaoView);
    }
	
    /**
     * 后端详情
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        CaidanliebiaoEntity caidanliebiao = caidanliebiaoService.selectById(id);
		caidanliebiao.setClicktime(new Date());
		caidanliebiaoService.updateById(caidanliebiao);
        return R.ok().put("data", caidanliebiao);
    }

    /**
     * 前端详情
     */
	@IgnoreAuth
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id){
        CaidanliebiaoEntity caidanliebiao = caidanliebiaoService.selectById(id);
		caidanliebiao.setClicktime(new Date());
		caidanliebiaoService.updateById(caidanliebiao);
        return R.ok().put("data", caidanliebiao);
    }
    


    /**
     * 赞或踩
     */
    @RequestMapping("/thumbsup/{id}")
    public R thumbsup(@PathVariable("id") String id,String type){
        CaidanliebiaoEntity caidanliebiao = caidanliebiaoService.selectById(id);
        if(type.equals("1")) {
        	caidanliebiao.setThumbsupnum(caidanliebiao.getThumbsupnum()+1);
        } else {
        	caidanliebiao.setCrazilynum(caidanliebiao.getCrazilynum()+1);
        }
        caidanliebiaoService.updateById(caidanliebiao);
        return R.ok();
    }

    /**
     * 后端保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody CaidanliebiaoEntity caidanliebiao, HttpServletRequest request){
    	caidanliebiao.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(caidanliebiao);

        caidanliebiaoService.insert(caidanliebiao);
        return R.ok();
    }
    
    /**
     * 前端保存
     */
    @RequestMapping("/add")
    public R add(@RequestBody CaidanliebiaoEntity caidanliebiao, HttpServletRequest request){
    	caidanliebiao.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(caidanliebiao);

        caidanliebiaoService.insert(caidanliebiao);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody CaidanliebiaoEntity caidanliebiao, HttpServletRequest request){
        //ValidatorUtils.validateEntity(caidanliebiao);
        caidanliebiaoService.updateById(caidanliebiao);//全部更新
        return R.ok();
    }
    

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        caidanliebiaoService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
    
    /**
     * 提醒接口
     */
	@RequestMapping("/remind/{columnName}/{type}")
	public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, 
						 @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
		map.put("column", columnName);
		map.put("type", type);
		
		if(type.equals("2")) {
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
			Calendar c = Calendar.getInstance();
			Date remindStartDate = null;
			Date remindEndDate = null;
			if(map.get("remindstart")!=null) {
				Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
				c.setTime(new Date()); 
				c.add(Calendar.DAY_OF_MONTH,remindStart);
				remindStartDate = c.getTime();
				map.put("remindstart", sdf.format(remindStartDate));
			}
			if(map.get("remindend")!=null) {
				Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
				c.setTime(new Date());
				c.add(Calendar.DAY_OF_MONTH,remindEnd);
				remindEndDate = c.getTime();
				map.put("remindend", sdf.format(remindEndDate));
			}
		}
		
		Wrapper<CaidanliebiaoEntity> wrapper = new EntityWrapper<CaidanliebiaoEntity>();
		if(map.get("remindstart")!=null) {
			wrapper.ge(columnName, map.get("remindstart"));
		}
		if(map.get("remindend")!=null) {
			wrapper.le(columnName, map.get("remindend"));
		}

		String tableName = request.getSession().getAttribute("tableName").toString();
		if(tableName.equals("shangjia")) {
			wrapper.eq("shangjiazhanghao", (String)request.getSession().getAttribute("username"));
		}

		int count = caidanliebiaoService.selectCount(wrapper);
		return R.ok().put("count", count);
	}
	
	/**
     * 前端智能排序
     */
	@IgnoreAuth
    @RequestMapping("/autoSort")
    public R autoSort(@RequestParam Map<String, Object> params,CaidanliebiaoEntity caidanliebiao, HttpServletRequest request,String pre){
        EntityWrapper<CaidanliebiaoEntity> ew = new EntityWrapper<CaidanliebiaoEntity>();
        Map<String, Object> newMap = new HashMap<String, Object>();
        Map<String, Object> param = new HashMap<String, Object>();
		Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
		while (it.hasNext()) {
			Map.Entry<String, Object> entry = it.next();
			String key = entry.getKey();
			String newKey = entry.getKey();
			if (pre.endsWith(".")) {
				newMap.put(pre + newKey, entry.getValue());
			} else if (StringUtils.isEmpty(pre)) {
				newMap.put(newKey, entry.getValue());
			} else {
				newMap.put(pre + "." + newKey, entry.getValue());
			}
		}
		params.put("sort", "clicktime");
        
        params.put("order", "desc");
		PageUtils page = caidanliebiaoService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, caidanliebiao), params), params));
        return R.ok().put("data", page);
    }


	/**
     * 协同算法(按用户购买推荐)
     */
    @RequestMapping("/autoSort2")
    public R autoSort2(@RequestParam Map<String, Object> params,CaidanliebiaoEntity caidanliebiao, HttpServletRequest request){
    	String userId = request.getSession().getAttribute("userId").toString();
    	String goodtypeColumn = "caixifenlei";
    	List<OrdersEntity> orders = ordersService.selectList(new EntityWrapper<OrdersEntity>().eq("userid", userId).eq("tablename", "caidanliebiao").orderBy("addtime", false));
        List<String> goodtypes = new ArrayList<String>();
    	Integer limit = params.get("limit")==null?10:Integer.parseInt(params.get("limit").toString());
    	List<CaidanliebiaoEntity> caidanliebiaoList = new ArrayList<CaidanliebiaoEntity>();
	//去重
    	List<OrdersEntity> ordersDist = new ArrayList<OrdersEntity>();
    	for(OrdersEntity o1 : orders) {
    		boolean addFlag = true;
    		for(OrdersEntity o2 : ordersDist) {
    			if(o1.getGoodid()==o2.getGoodid() || o1.getGoodtype().equals(o2.getGoodtype())) {
    				addFlag = false;
    				break;
    			}
    		}
    		if(addFlag) ordersDist.add(o1);
    	}
        if(ordersDist!=null && ordersDist.size()>0) {
        	for(OrdersEntity o : ordersDist) {
        		caidanliebiaoList.addAll(caidanliebiaoService.selectList(new EntityWrapper<CaidanliebiaoEntity>().eq(goodtypeColumn, o.getGoodtype())));
        	}
        }
    	EntityWrapper<CaidanliebiaoEntity> ew = new EntityWrapper<CaidanliebiaoEntity>();
	params.put("sort", "id");
	params.put("order", "desc");
	PageUtils page = caidanliebiaoService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, caidanliebiao), params), params));
        List<CaidanliebiaoEntity> pageList = (List<CaidanliebiaoEntity>)page.getList();
        if(caidanliebiaoList.size()<limit) {
        	int toAddNum = (limit-caidanliebiaoList.size())<=pageList.size()?(limit-caidanliebiaoList.size()):pageList.size();
            for(CaidanliebiaoEntity o1 : pageList) {
                boolean addFlag = true;
                for(CaidanliebiaoEntity o2 : caidanliebiaoList) {
                    if(o1.getId().intValue()==o2.getId().intValue()) {
                        addFlag = false;
                        break;
                    }
                }
                if(addFlag) {
                    caidanliebiaoList.add(o1);
                    if(--toAddNum==0) break;
                }
            }
        }
        page.setList(caidanliebiaoList);
	return R.ok().put("data", page);
    }





}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1292483.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

9种伪原创工具推荐,快速提升创作效率

如何让自己的文章在海量信息中脱颖而出&#xff0c;成为一个备受关注的焦点&#xff0c;成为许多创作者迫切思考的问题。在这篇文章中&#xff0c;我将向大家介绍9种伪原创工具&#xff0c;这些工具可以让你的文章轻松升级&#xff0c;更具创意和吸引力。 1.Spinbot&#xff08…

simulink中 Data store memory、write和read模块及案例介绍

目录 1.Data store memory模块 2.data store write模块 3.data store read模块 4.仿真分析 4.1简单使用三个模块 4.2 模块间的调用顺序剖析 1.Data store memory模块 向右拖拉得到Data store read模块&#xff0c;向左拉得到Data write模块 理解&#xff1a;可视为定义变量…

C++ 函数详解

目录 函数概述 函数的分类 函数的参数 函数的调用 函数的嵌套调用 函数的链式访问 函数声明和定义 函数递归 函数概述 函数——具有某种功能的代码块。 一个程序中我们经常会用到某种功能&#xff0c;如两数相加&#xff0c;如果每次都在需要用到时实现&#xff0c;那…

矩阵学习相关——(待完善)

线性代数基础知识之–矩阵&#xff08;Matrix&#xff09; 矩阵概念————&#xff08;基础知识&#xff09; 矩阵理论基础知识 矩阵理论基础知识 矩阵入门 写给有编程基础的人 初学讲义之高中数学二十七&#xff1a;矩阵和行列式 直观理解&#xff01;你一定要读…

C++多态(详解)

一、多态的概念 1.1、多态的概念 多态&#xff1a;多种形态&#xff0c;具体点就是去完成某个行为&#xff0c;当不同的对象去完成时会产生出不同的状态。 举个例子&#xff1a;比如买票这个行为&#xff0c;当普通人买票时&#xff0c;是全价买票&#xff1b;学生买票时&am…

JavaScript实现手写签名,可触屏手写,支持移动端与PC端双端保存

目录 1.HTML模板 2.获取DOM元素和定义变量 3.创建两个canvas元素&#xff0c;并设置它们的宽度和高度 4.绑定触摸事件&#xff1a;touchstart, touchmove, touchend和click 5.实现触摸事件回调函数&#xff1a;startDrawing, draw和stopDrawing 6.实现绘制线段的函数&…

C# WPF上位机开发(带配置文件的倒计时软件)

【 声明&#xff1a;版权所有&#xff0c;欢迎转载&#xff0c;请勿用于商业用途。 联系信箱&#xff1a;feixiaoxing 163.com】 前面我们写了倒计时软件&#xff0c;但是不知道大家有没有发现&#xff0c;这个软件起始有一个缺点&#xff0c;那就是倒计时的起始时间都是硬编码…

stl库之map与例题

map是一种关联式容器&#xff0c;它允许将键&#xff08;key&#xff09;映射到值&#xff08;value&#xff09;&#xff0c;所以我们习惯称map为映射 每个元素都是一个键值对&#xff0c;其中键是唯一的 创建map map<key类型, value类型> 变量名; 创建一个键为int&…

11.7QT界面制作

#include "widget.h"Widget::Widget(QWidget *parent): QWidget(parent) {this->resize(881,550);this->setStyleSheet("backgroud-color:rgb(33,35,40)");this->setWindowFlag(Qt::FramelessWindowHint);//标签类QLabel *l1 new QLabel(this);/…

深入理解Flexbox:构建灵活的布局系统

由于篇幅限制&#xff0c;我将提供一个详细的文章大纲和部分内容。您可以根据这个大纲扩展文章内容&#xff0c;以满足3000字的要求。 深入理解Flexbox&#xff1a;构建灵活的布局系统 引言 在现代web设计中&#xff0c;创建灵活且响应式的布局是非常重要的。Flexbox&#xf…

通达OA inc/package/down.php接口存在未授权访问漏洞

声明 本文仅用于技术交流&#xff0c;请勿用于非法用途 由于传播、利用此文所提供的信息而造成的任何直接或者间接的后果及损失&#xff0c;均由使用者本人负责&#xff0c;文章作者不为此承担任何责任。 一. 产品简介 通达OA&#xff08;Office Anywhere网络智能办公系统&am…

List的元素覆盖问题

问题场景 在备课底层JDBC链接链接数据库时&#xff0c;将读取的数据封装到对象中并添加到list集合中出现了问题。 错误逻辑 代码编写的考量为减少对象占用内存。想通过一个对象完成数据的传递和保存。 核心问题 List集合存储的是每一个对象的引用地址&#xff0c;如果引用的…

perl脚本获取Windows系统常用路径信息

windows系统常用的路径,比如临时目录、资源文件夹、字体保存目录、应用程序数据存放目录等等。在日常操作的时候寻找略有不便。这里用perl写一个脚本&#xff0c;并把这些目录信息格式化为json&#xff0c;方便查找。如下是perl代码&#xff1a; #! /usr/bin/perl use v5.14; …

机器学习---环境准备

一、pySpark环境准备 1、window配置python环境变量 window安装python&#xff0c;配置python环境变量。安装python后,在环境变量path中加入安装的路径&#xff0c;cmd中输入python&#xff0c;检验python是否安装成功。 注意&#xff1a;如果使用的是anaconda安装的python环境…

Elaticsearch 学习笔记

文章目录 Elaticsearch 学习笔记一、什么是 Elaticsearch &#xff1f;二、Elaticsearch 安装1 es 安装2 问题解决3 数据格式 三、索引操作1 PUT 请求&#xff1a;在postman中&#xff0c;向 ES 服务器发 PUT 请求&#xff08;PUT请求相当于创建的意思&#xff09;2 GET 请求&a…

Unity3D实现鼠标悬浮UI或物体上显示文字信息

系列文章目录 Unity工具 文章目录 系列文章目录前言最终效果一、UI事件显示文字1-1 ui事件需要引用命名空间using UnityEngine.EventSystems;1-2 IPointerEnterHandler 接口1-3 IPointerExitHandler 接口1-4 IPointerMoveHandler 接口 二、场景搭建2-1 实现如下 三、代码实现3…

【数据库】树形数据组织架构下的封锁并发控制,B树索引并发访问控制,树协议原理及案例分析

数据库并发访问树协议 ​专栏内容&#xff1a; 手写数据库toadb 本专栏主要介绍如何从零开发&#xff0c;开发的步骤&#xff0c;以及开发过程中的涉及的原理&#xff0c;遇到的问题等&#xff0c;让大家能跟上并且可以一起开发&#xff0c;让每个需要的人成为参与者。 本专栏会…

数码产品稿件怎么写?纯干货!

在科技日新月异的今天&#xff0c;数码产品已经成为人们生活的重要组成部分。无论是手机、电脑、平板还是智能家居&#xff0c;这些产品的出现都在不断改变着我们的生活方式。因此&#xff0c;对于数码产品的评测和分析就显得尤为重要。本文伯乐网络传媒将为你揭秘如何撰写高质…

ChatGPT可能即将发布新版本,带有debug功能:支持下载原始对话、可视化对话分支等

本文原文来自DataLearnerAI官方网站&#xff1a;ChatGPT内置隐藏debug功能&#xff1a;支持下载原始对话、可视化对话分支等 | 数据学习者官方网站(Datalearner) AIPRM的工作人员最近发现ChatGPT的客户端隐藏内置了一个新的debug特性&#xff0c;可以提高ChatGPT对话的问题调试…

【APP抓包】Charles+burp+夜神模拟器联动抓包(带导入系统级0证书)

【APP抓包】Charlesburp夜神模拟器联动抓包&#xff08;带导入系统级0证书&#xff09; 0x00、大傻春你要干什么&#xff1f;0x01、夜神模拟器安装0x02、安装Charles0、版本1、安装2、破解3、安装导入用户证书4、【非必要】安装系统证书 0x03、Charles配置代理1、Charles设置代…