一个完整的idea spring boot 项目及坑---6.Service


知识点:

1.将前端easyui -datagrid展示所需要数据的进行封装.

mybaitis分页插件+springmvc+eazyuidatagrid 分页功能实现

package com.example.demo.service;

import com.example.demo.bean.EUDataGridResult;
import com.example.demo.FilterBean.FilterConditions;
import com.example.demo.bean.MetShopv2Order;
import com.example.demo.bean.OrderInfo;
import com.example.demo.mapper.MetShopv2OrderMapper;
import com.example.demo.mapper.OrderInfoMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsService {

    @Autowired
    MetShopv2OrderMapper metShopv2OrderMapper;
    @Autowired
    OrderInfoMapper orderInfoMapper;

    /**
     *
     * @param mr
     * @return
     */
    public Integer change_orderid(MetShopv2Order mr){
        System.out.println("GoodsService.change_orderid is start..");

        return metShopv2OrderMapper.updateByPrimaryKeySelective(mr);
    }

    /**
     * 根据筛选条件获取数据库中数据
     * @param page 当前页
     * @param rows 每页展示数量
     * @param filterConditions  筛选条件
     * @return 包含了总条目数和数据集合
     */
    public EUDataGridResult getList(Integer page,Integer rows,FilterConditions filterConditions){

        System.out.println("筛选条件:"+filterConditions);
        System.out.println("筛选数据:"+orderInfoMapper.getListByCondition(filterConditions));
        System.out.println("GoodsService getList is start");
        EUDataGridResult euDataGridResult = new EUDataGridResult();
        System.out.println("翻页前");
        PageHelper.startPage(page,rows);//设置翻页
        System.out.println("翻页后");

        List<OrderInfo> orders = orderInfoMapper.getListByCondition(filterConditions);
        System.out.println("数据:"+orders);
        euDataGridResult.setRows(orders);

        PageInfo<OrderInfo> p=new PageInfo<>(orders);
        System.out.println("PageInfo:"+p);
        euDataGridResult.setTotal(p.getTotal());

        System.out.println(euDataGridResult.toString());
        return euDataGridResult;
    }

}

[INFO] Scanning for projects... [ERROR] [ERROR] Some problems were encountered while processing the POMs: [ERROR] 'dependencies.dependency.version' for org.mybatis.spring.boot:mybatis-spring-boot-starter:jar is missing. @ line 73, column 21 [ERROR] 'dependencies.dependency.version' for org.mybatis.spring.boot:mybatis-spring-boot-starter:jar is missing. @ line 85, column 21 [ERROR] 'dependencies.dependency.version' for org.mybatis.spring.boot:mybatis-spring-boot-starter:jar is missing. @ line 82, column 21 @ [ERROR] The build could not read 3 projects -> [Help 1] [ERROR] [ERROR] The project org.pw:user-service:1.0-SNAPSHOT (C:\workspace\tools\idea\myproject\mysb\user-service\pom.xml) has 1 error [ERROR] 'dependencies.dependency.version' for org.mybatis.spring.boot:mybatis-spring-boot-starter:jar is missing. @ line 73, column 21 [ERROR] [ERROR] The project org.pw:order-service:1.0-SNAPSHOT (C:\workspace\tools\idea\myproject\mysb\order-service\pom.xml) has 1 error [ERROR] 'dependencies.dependency.version' for org.mybatis.spring.boot:mybatis-spring-boot-starter:jar is missing. @ line 85, column 21 [ERROR] [ERROR] The project org.pw:login-service:1.0-SNAPSHOT (C:\workspace\tools\idea\myproject\mysb\login-service\pom.xml) has 1 error [ERROR] 'dependencies.dependency.version' for org.mybatis.spring.boot:mybatis-spring-boot-starter:jar is missing. @ line 82, column 21 [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles:.
06-01
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值