1
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
package com.ruoyi.web.controller.jarvis;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
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.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.jarvis.domain.SuperAdmin;
|
||||
import com.ruoyi.jarvis.service.ISuperAdminService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 超级管理员Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/jarvis/superadmin")
|
||||
public class SuperAdminController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISuperAdminService superAdminService;
|
||||
|
||||
/**
|
||||
* 查询超级管理员列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SuperAdmin superAdmin)
|
||||
{
|
||||
startPage();
|
||||
List<SuperAdmin> list = superAdminService.selectSuperAdminList(superAdmin);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出超级管理员列表
|
||||
*/
|
||||
@Log(title = "超级管理员", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SuperAdmin superAdmin)
|
||||
{
|
||||
List<SuperAdmin> list = superAdminService.selectSuperAdminList(superAdmin);
|
||||
ExcelUtil<SuperAdmin> util = new ExcelUtil<SuperAdmin>(SuperAdmin.class);
|
||||
util.exportExcel(response, list, "超级管理员数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取超级管理员详细信息
|
||||
*/
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(superAdminService.selectSuperAdminById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增超级管理员
|
||||
*/
|
||||
@Log(title = "超级管理员", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SuperAdmin superAdmin)
|
||||
{
|
||||
return toAjax(superAdminService.insertSuperAdmin(superAdmin));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改超级管理员
|
||||
*/
|
||||
@Log(title = "超级管理员", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SuperAdmin superAdmin)
|
||||
{
|
||||
return toAjax(superAdminService.updateSuperAdmin(superAdmin));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除超级管理员
|
||||
*/
|
||||
@Log(title = "超级管理员", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(superAdminService.deleteSuperAdminByIds(ids));
|
||||
}
|
||||
/**
|
||||
* 获取超级管理员下拉选项列表(unionId 和 name)
|
||||
*/
|
||||
@GetMapping("/select/adminUnionId")
|
||||
public AjaxResult optionSelect()
|
||||
{
|
||||
SuperAdmin superAdmin = new SuperAdmin();
|
||||
superAdmin.setIsActive(1); // 只查询激活的管理员
|
||||
List<SuperAdmin> list = superAdminService.selectSuperAdminList(superAdmin);
|
||||
List<Map<String, Object>> optionList = list.stream()
|
||||
.map(item -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("label", item.getName());
|
||||
map.put("value", item.getUnionId());
|
||||
return map;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
return AjaxResult.success(optionList);
|
||||
}
|
||||
}
|
||||
@@ -153,7 +153,7 @@ token:
|
||||
# 令牌密钥
|
||||
secret: abcdefghijklmnopqrstuvwxyz
|
||||
# 令牌有效期(默认30分钟)
|
||||
expireTime: 30
|
||||
expireTime: 10080
|
||||
|
||||
# MyBatis配置
|
||||
mybatis:
|
||||
|
||||
@@ -153,7 +153,7 @@ token:
|
||||
# 令牌密钥
|
||||
secret: abcdefghijklmnopqrstuvwxyz
|
||||
# 令牌有效期(默认30分钟)
|
||||
expireTime: 30
|
||||
expireTime: 10080
|
||||
|
||||
# MyBatis配置
|
||||
mybatis:
|
||||
|
||||
Reference in New Issue
Block a user