UserMgrController.java 1.78 KB
package com.glsx.controller;

import java.util.List;

import cn.com.glsx.openplatform.model.PlatformUser;
import cn.com.glsx.openplatform.service.UserMgrService;
import cn.com.glsx.openplatform.vo.R;
import cn.com.glsx.openplatform.vo.UserVo;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.oreframework.web.ui.Pagination;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

//@Api
@RestController
@RequestMapping(value = "/usermgr")
public class UserMgrController {
    /**
     * 日志
     */
    private final static Logger LOGGER = LoggerFactory.getLogger(UserMgrController.class);

    @Autowired
    private UserMgrService userMgrService;

    @RequestMapping(value = "/getUserMgrList", method = RequestMethod.GET)
    @ResponseBody
    public R getUserMgrList(Pagination pagination, UserVo userVo) {
        //PageHelper注入分页和要分页的查询之前不能有其它查询,不然分页到第一个查询上面
        Page<PlatformUser> page = PageHelper.startPage(pagination.getCurrentPage(),
                pagination.getPageSize(), true);

        List<PlatformUser> userMgrList = userMgrService.getUserMgrList(userVo);

        return R.ok().putPageData(page, userMgrList);
    }

    @RequestMapping(value = "/getDropDownOptions", method = RequestMethod.GET)
    @ResponseBody
    public R getDropDownOptions() {
        List<String> customerNameList = userMgrService.getCustomerNameList();
        return R.ok().data(customerNameList);
    }
}