数据库: - 新增 odf_checkin/odf_cables/odf_cable_faults/odf_cable_fault_images/odf_user_modules 5张表 - 新增菜单权限和角色分配 SQL 脚本 后台 API (.NET/SqlSugar): - 新增实体模型、DTO、Service、Controller (签到/光缆/故障/图片/用户模块) 前端 APP (UniApp): - 新增 portal/checkin/trunk/cable/fault-list/fault-detail/fault-add/trunk-search/route-plan 9个页面 - 新增 permission/checkin/trunk 服务层 - 新增 navigation/watermark 工具函数 后台管理前端 (ZR.Vue): - 新增光缆管理/干线故障管理/签到记录管理/用户模块权限 4个管理页面 - 新增对应 API 模块和表单组件
124 lines
4.1 KiB
C#
124 lines
4.1 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using ZR.Model.Business;
|
||
using ZR.Model.Business.Dto;
|
||
using ZR.Service.Business.IBusinessService;
|
||
|
||
//创建时间:2025-09-21
|
||
namespace ZR.Admin.WebApi.Controllers.Business
|
||
{
|
||
/// <summary>
|
||
/// 光缆管理
|
||
/// </summary>
|
||
[Route("business/OdfCables")]
|
||
public class OdfCablesController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 光缆管理接口
|
||
/// </summary>
|
||
private readonly IOdfCablesService _OdfCablesService;
|
||
|
||
public OdfCablesController(IOdfCablesService OdfCablesService)
|
||
{
|
||
_OdfCablesService = OdfCablesService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询光缆列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[ActionPermissionFilter(Permission = "odfcables:list")]
|
||
public IActionResult GetList([FromQuery] OdfCablesQueryDto parm)
|
||
{
|
||
var response = _OdfCablesService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 搜索光缆和故障(限定公司范围)
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("search")]
|
||
[ActionPermissionFilter(Permission = "odfcables:query")]
|
||
public IActionResult Search([FromQuery] long deptId, [FromQuery] string keyword)
|
||
{
|
||
var response = _OdfCablesService.Search(deptId, keyword);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 新增光缆
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "odfcables:add")]
|
||
[Log(Title = "光缆管理", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult Add([FromBody] OdfCables parm)
|
||
{
|
||
parm.CreatedAt = DateTime.Now;
|
||
parm.UpdatedAt = DateTime.Now;
|
||
var response = _OdfCablesService.Add(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 修改光缆
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPut]
|
||
[ActionPermissionFilter(Permission = "odfcables:edit")]
|
||
[Log(Title = "光缆管理", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult Update([FromBody] OdfCables parm)
|
||
{
|
||
parm.UpdatedAt = DateTime.Now;
|
||
var response = _OdfCablesService.Update(parm);
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询光缆详情
|
||
/// </summary>
|
||
/// <param name="id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{id}")]
|
||
[ActionPermissionFilter(Permission = "odfcables:query")]
|
||
public IActionResult GetDetail(int id)
|
||
{
|
||
var response = _OdfCablesService.GetDetail(id);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除光缆
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("delete/{id}")]
|
||
[ActionPermissionFilter(Permission = "odfcables:delete")]
|
||
[Log(Title = "光缆管理", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult Delete(int id)
|
||
{
|
||
var response = _OdfCablesService.Delete(id);
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 导出光缆列表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[Log(Title = "光缆管理", BusinessType = BusinessType.EXPORT, IsSaveResponseData = false)]
|
||
[HttpGet("export")]
|
||
[ActionPermissionFilter(Permission = "odfcables:export")]
|
||
public IActionResult Export([FromQuery] OdfCablesQueryDto parm)
|
||
{
|
||
var list = _OdfCablesService.ExportList(parm);
|
||
if (list == null || list.Result == null || list.Result.Count <= 0)
|
||
{
|
||
return ToResponse(ResultCode.FAIL, "没有要导出的数据");
|
||
}
|
||
var result = ExportExcelMini(list.Result, "光缆列表", "光缆列表");
|
||
return ExportExcel(result.Item2, result.Item1);
|
||
}
|
||
}
|
||
}
|