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:
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
package com.ruoyi.jarvis.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 超级管理员对象 super_admin
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class SuperAdmin extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 微信ID */
|
||||
@Excel(name = "微信ID")
|
||||
private String wxid;
|
||||
|
||||
/** 姓名 */
|
||||
@Excel(name = "姓名")
|
||||
private String name;
|
||||
|
||||
/** 联盟ID */
|
||||
@Excel(name = "联盟ID")
|
||||
private String unionId;
|
||||
|
||||
/** 应用密钥 */
|
||||
@Excel(name = "应用密钥")
|
||||
private String appKey;
|
||||
|
||||
/** 秘密密钥 */
|
||||
@Excel(name = "秘密密钥")
|
||||
private String secretKey;
|
||||
|
||||
/** 是否激活: 0-否, 1-是 */
|
||||
@Excel(name = "是否激活", readConverterExp = "0=否,1=是")
|
||||
private Integer isActive;
|
||||
|
||||
/** 创建时间 */
|
||||
@Excel(name = "创建时间")
|
||||
private Date createdAt;
|
||||
|
||||
/** 更新时间 */
|
||||
@Excel(name = "更新时间")
|
||||
private Date updatedAt;
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getWxid()
|
||||
{
|
||||
return wxid;
|
||||
}
|
||||
|
||||
public void setWxid(String wxid)
|
||||
{
|
||||
this.wxid = wxid;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUnionId()
|
||||
{
|
||||
return unionId;
|
||||
}
|
||||
|
||||
public void setUnionId(String unionId)
|
||||
{
|
||||
this.unionId = unionId;
|
||||
}
|
||||
|
||||
public String getAppKey()
|
||||
{
|
||||
return appKey;
|
||||
}
|
||||
|
||||
public void setAppKey(String appKey)
|
||||
{
|
||||
this.appKey = appKey;
|
||||
}
|
||||
|
||||
public String getSecretKey()
|
||||
{
|
||||
return secretKey;
|
||||
}
|
||||
|
||||
public void setSecretKey(String secretKey)
|
||||
{
|
||||
this.secretKey = secretKey;
|
||||
}
|
||||
|
||||
public Integer getIsActive()
|
||||
{
|
||||
return isActive;
|
||||
}
|
||||
|
||||
public void setIsActive(Integer isActive)
|
||||
{
|
||||
this.isActive = isActive;
|
||||
}
|
||||
|
||||
public Date getCreatedAt()
|
||||
{
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Date createdAt)
|
||||
{
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public Date getUpdatedAt()
|
||||
{
|
||||
return updatedAt;
|
||||
}
|
||||
|
||||
public void setUpdatedAt(Date updatedAt)
|
||||
{
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.jarvis.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.jarvis.domain.SuperAdmin;
|
||||
|
||||
/**
|
||||
* 超级管理员Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface SuperAdminMapper
|
||||
{
|
||||
/**
|
||||
* 查询超级管理员
|
||||
*
|
||||
* @param id 超级管理员主键
|
||||
* @return 超级管理员
|
||||
*/
|
||||
public SuperAdmin selectSuperAdminById(Long id);
|
||||
|
||||
/**
|
||||
* 查询超级管理员列表
|
||||
*
|
||||
* @param superAdmin 超级管理员
|
||||
* @return 超级管理员集合
|
||||
*/
|
||||
public List<SuperAdmin> selectSuperAdminList(SuperAdmin superAdmin);
|
||||
|
||||
/**
|
||||
* 新增超级管理员
|
||||
*
|
||||
* @param superAdmin 超级管理员
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSuperAdmin(SuperAdmin superAdmin);
|
||||
|
||||
/**
|
||||
* 修改超级管理员
|
||||
*
|
||||
* @param superAdmin 超级管理员
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSuperAdmin(SuperAdmin superAdmin);
|
||||
|
||||
/**
|
||||
* 删除超级管理员
|
||||
*
|
||||
* @param id 超级管理员主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSuperAdminById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除超级管理员
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSuperAdminByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.jarvis.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.jarvis.domain.SuperAdmin;
|
||||
|
||||
/**
|
||||
* 超级管理员Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ISuperAdminService
|
||||
{
|
||||
/**
|
||||
* 查询超级管理员
|
||||
*
|
||||
* @param id 超级管理员主键
|
||||
* @return 超级管理员
|
||||
*/
|
||||
public SuperAdmin selectSuperAdminById(Long id);
|
||||
|
||||
/**
|
||||
* 查询超级管理员列表
|
||||
*
|
||||
* @param superAdmin 超级管理员
|
||||
* @return 超级管理员集合
|
||||
*/
|
||||
public List<SuperAdmin> selectSuperAdminList(SuperAdmin superAdmin);
|
||||
|
||||
/**
|
||||
* 新增超级管理员
|
||||
*
|
||||
* @param superAdmin 超级管理员
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSuperAdmin(SuperAdmin superAdmin);
|
||||
|
||||
/**
|
||||
* 修改超级管理员
|
||||
*
|
||||
* @param superAdmin 超级管理员
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSuperAdmin(SuperAdmin superAdmin);
|
||||
|
||||
/**
|
||||
* 批量删除超级管理员
|
||||
*
|
||||
* @param ids 需要删除的超级管理员主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSuperAdminByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除超级管理员信息
|
||||
*
|
||||
* @param id 超级管理员主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSuperAdminById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.ruoyi.jarvis.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.jarvis.mapper.SuperAdminMapper;
|
||||
import com.ruoyi.jarvis.domain.SuperAdmin;
|
||||
import com.ruoyi.jarvis.service.ISuperAdminService;
|
||||
|
||||
/**
|
||||
* 超级管理员Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class SuperAdminServiceImpl implements ISuperAdminService
|
||||
{
|
||||
@Autowired
|
||||
private SuperAdminMapper superAdminMapper;
|
||||
|
||||
/**
|
||||
* 查询超级管理员
|
||||
*
|
||||
* @param id 超级管理员主键
|
||||
* @return 超级管理员
|
||||
*/
|
||||
@Override
|
||||
public SuperAdmin selectSuperAdminById(Long id)
|
||||
{
|
||||
return superAdminMapper.selectSuperAdminById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询超级管理员列表
|
||||
*
|
||||
* @param superAdmin 超级管理员
|
||||
* @return 超级管理员
|
||||
*/
|
||||
@Override
|
||||
public List<SuperAdmin> selectSuperAdminList(SuperAdmin superAdmin)
|
||||
{
|
||||
return superAdminMapper.selectSuperAdminList(superAdmin);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增超级管理员
|
||||
*
|
||||
* @param superAdmin 超级管理员
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSuperAdmin(SuperAdmin superAdmin)
|
||||
{
|
||||
return superAdminMapper.insertSuperAdmin(superAdmin);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改超级管理员
|
||||
*
|
||||
* @param superAdmin 超级管理员
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSuperAdmin(SuperAdmin superAdmin)
|
||||
{
|
||||
return superAdminMapper.updateSuperAdmin(superAdmin);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除超级管理员
|
||||
*
|
||||
* @param ids 需要删除的超级管理员主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSuperAdminByIds(Long[] ids)
|
||||
{
|
||||
return superAdminMapper.deleteSuperAdminByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除超级管理员信息
|
||||
*
|
||||
* @param id 超级管理员主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSuperAdminById(Long id)
|
||||
{
|
||||
return superAdminMapper.deleteSuperAdminById(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user