|
@@ -3,8 +3,10 @@ package com.yijia.station.controller;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
|
|
|
+import com.yijia.common.core.domain.entity.SysDept;
|
|
|
import com.yijia.common.core.domain.model.LoginUser;
|
|
|
import com.yijia.common.utils.SecurityUtils;
|
|
|
+import com.yijia.system.service.ISysDeptService;
|
|
|
import com.yijia.system.service.ISysUserService;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -36,73 +38,51 @@ import com.yijia.common.core.page.TableDataInfo;
|
|
|
public class StationInfoController extends BaseController
|
|
|
{
|
|
|
@Autowired
|
|
|
- private IStationInfoService stationInfoService;
|
|
|
- @Autowired
|
|
|
private ISysUserService sysUserService;
|
|
|
+ @Autowired
|
|
|
+ private ISysDeptService sysDeptService;
|
|
|
/**
|
|
|
* 查询油站信息列表
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('station:info:list')")
|
|
|
@GetMapping("/list")
|
|
|
- public TableDataInfo list(StationInfo stationInfo)
|
|
|
+ public TableDataInfo list(SysDept sysDept)
|
|
|
{
|
|
|
LoginUser currentUser = SecurityUtils.getLoginUser();
|
|
|
String selectDeptid= sysUserService.getUserRoleDeptId(currentUser);
|
|
|
if(selectDeptid !=null && selectDeptid!=""){
|
|
|
List<String> list = Arrays.asList(selectDeptid.split(","));
|
|
|
- stationInfo.setStationIdList(list);
|
|
|
+ sysDept.setDeptIdList(list);
|
|
|
}
|
|
|
startPage();
|
|
|
- List<StationInfo> list = stationInfoService.selectStationInfoList(stationInfo);
|
|
|
+ sysDept.setJiBie(Integer.valueOf("2"));
|
|
|
+ List<SysDept> list = sysDeptService.selectDeptList(sysDept);
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('station:info:selectStationInfo')")
|
|
|
@GetMapping("/selectStationInfo")
|
|
|
- public TableDataInfo selectStationInfo(StationInfo stationInfo)
|
|
|
+ public TableDataInfo selectStationInfo(SysDept sysDept)
|
|
|
{
|
|
|
LoginUser currentUser = SecurityUtils.getLoginUser();
|
|
|
String selectDeptid= sysUserService.getUserRoleDeptId(currentUser);
|
|
|
if(selectDeptid !=null && selectDeptid!=""){
|
|
|
List<String> list = Arrays.asList(selectDeptid.split(","));
|
|
|
- stationInfo.setStationIdList(list);
|
|
|
+ sysDept.setDeptIdList(list);
|
|
|
}
|
|
|
- List<StationInfo> list = stationInfoService.selectStationInfoList(stationInfo);
|
|
|
- return getDataTable(list);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 导出油站信息列表
|
|
|
- */
|
|
|
- @PreAuthorize("@ss.hasPermi('station:info:export')")
|
|
|
- @Log(title = "油站信息", businessType = BusinessType.EXPORT)
|
|
|
- @GetMapping("/export")
|
|
|
- public AjaxResult export(StationInfo stationInfo)
|
|
|
- {
|
|
|
- List<StationInfo> list = stationInfoService.selectStationInfoList(stationInfo);
|
|
|
- ExcelUtil<StationInfo> util = new ExcelUtil<StationInfo>(StationInfo.class);
|
|
|
- return util.exportExcel(list, "info");
|
|
|
+ sysDept.setJiBie(Integer.valueOf("2"));
|
|
|
+ List<SysDept> list = sysDeptService.selectDeptList(sysDept);
|
|
|
+ return getTable(list);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取油站信息详细信息
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('station:info:query')")
|
|
|
- @GetMapping(value = "/{stationId}")
|
|
|
- public AjaxResult getInfo(@PathVariable("stationId") Long stationId)
|
|
|
+ @GetMapping(value = "/{deptId}")
|
|
|
+ public AjaxResult getInfo(@PathVariable("deptId") Long deptId)
|
|
|
{
|
|
|
- return AjaxResult.success(stationInfoService.selectStationInfoById(stationId));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 新增油站信息
|
|
|
- */
|
|
|
- @PreAuthorize("@ss.hasPermi('station:info:add')")
|
|
|
- @Log(title = "油站信息", businessType = BusinessType.INSERT)
|
|
|
- @PostMapping
|
|
|
- public AjaxResult add(@RequestBody StationInfo stationInfo)
|
|
|
- {
|
|
|
- return toAjax(stationInfoService.insertStationInfo(stationInfo));
|
|
|
+ return AjaxResult.success(sysDeptService.selectDeptById(deptId));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -111,19 +91,9 @@ public class StationInfoController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('station:info:edit')")
|
|
|
@Log(title = "油站信息", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
- public AjaxResult edit(@RequestBody StationInfo stationInfo)
|
|
|
+ public AjaxResult edit(@RequestBody SysDept sysDept)
|
|
|
{
|
|
|
- return toAjax(stationInfoService.updateStationInfo(stationInfo));
|
|
|
+ return toAjax(sysDeptService.updateDept(sysDept));
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 删除油站信息
|
|
|
- */
|
|
|
- @PreAuthorize("@ss.hasPermi('station:info:remove')")
|
|
|
- @Log(title = "油站信息", businessType = BusinessType.DELETE)
|
|
|
- @DeleteMapping("/{stationIds}")
|
|
|
- public AjaxResult remove(@PathVariable Long[] stationIds)
|
|
|
- {
|
|
|
- return toAjax(stationInfoService.deleteStationInfoByIds(stationIds));
|
|
|
- }
|
|
|
}
|