package com.ruoyi.web.controller.station;
|
|
import java.util.List;
|
|
import com.ruoyi.station.service.IMjHeadsUsersService;
|
import com.ruoyi.station.service.IMjTeamMemberService;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.ui.ModelMap;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.station.domain.MjStatistic;
|
import com.ruoyi.station.service.IMjStatisticService;
|
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
/**
|
* 统计Controller
|
*
|
* @author ruoyi
|
* @date 2020-09-24
|
*/
|
@Controller
|
@RequestMapping("/station/statistic")
|
public class MjStatisticController extends BaseController
|
{
|
private String prefix = "station/statistic";
|
|
@Autowired
|
private IMjStatisticService mjStatisticService;
|
@Autowired
|
private IMjTeamMemberService teamMemberService;
|
|
@RequiresPermissions("station:statistic:view")
|
@GetMapping()
|
public String statistic()
|
{
|
return prefix + "/statistic";
|
}
|
|
/**
|
* 查询统计列表
|
*/
|
@PostMapping("/list")
|
@ResponseBody
|
public Object list(MjStatistic mjStatistic)
|
{
|
//startPage();
|
List<MjStatistic> list = mjStatisticService.selectMjStatisticList(mjStatistic);
|
if(list.size()>0){
|
int total = teamMemberService.selectCountMember();
|
MjStatistic mjStatistic1 = list.get(0);
|
mjStatistic1.setTeamnum(total);
|
return mjStatistic1;
|
}else{
|
return null;
|
}
|
|
}
|
|
/**
|
* 导出统计列表
|
*/
|
@RequiresPermissions("station:statistic:export")
|
@Log(title = "统计", businessType = BusinessType.EXPORT)
|
@PostMapping("/export")
|
@ResponseBody
|
public AjaxResult export(MjStatistic mjStatistic)
|
{
|
List<MjStatistic> list = mjStatisticService.selectMjStatisticList(mjStatistic);
|
ExcelUtil<MjStatistic> util = new ExcelUtil<MjStatistic>(MjStatistic.class);
|
return util.exportExcel(list, "statistic");
|
}
|
|
/**
|
* 新增统计
|
*/
|
@GetMapping("/add")
|
public String add()
|
{
|
return prefix + "/add";
|
}
|
|
/**
|
* 新增保存统计
|
*/
|
@RequiresPermissions("station:statistic:add")
|
@Log(title = "统计", businessType = BusinessType.INSERT)
|
@PostMapping("/add")
|
@ResponseBody
|
public AjaxResult addSave(MjStatistic mjStatistic)
|
{
|
return toAjax(mjStatisticService.insertMjStatistic(mjStatistic));
|
}
|
|
/**
|
* 修改统计
|
*/
|
@GetMapping("/edit/{id}")
|
public String edit(@PathVariable("id") String id, ModelMap mmap)
|
{
|
MjStatistic mjStatistic = mjStatisticService.selectMjStatisticById(id);
|
mmap.put("mjStatistic", mjStatistic);
|
return prefix + "/edit";
|
}
|
|
/**
|
* 修改保存统计
|
*/
|
@RequiresPermissions("station:statistic:edit")
|
@Log(title = "统计", businessType = BusinessType.UPDATE)
|
@PostMapping("/edit")
|
@ResponseBody
|
public AjaxResult editSave(MjStatistic mjStatistic)
|
{
|
return toAjax(mjStatisticService.updateMjStatistic(mjStatistic));
|
}
|
|
/**
|
* 删除统计
|
*/
|
@RequiresPermissions("station:statistic:remove")
|
@Log(title = "统计", businessType = BusinessType.DELETE)
|
@PostMapping( "/remove")
|
@ResponseBody
|
public AjaxResult remove(String ids)
|
{
|
return toAjax(mjStatisticService.deleteMjStatisticByIds(ids));
|
}
|
}
|