| ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TFleet.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TFleetController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGroupCompanyController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TFleetMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TFleetService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TFleetServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| sql/20260922_fleet.sql | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TFleet.java
New file @@ -0,0 +1,68 @@ package com.ruoyi.other.api.domain; import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.ruoyi.common.core.web.domain.BasePojo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import java.time.LocalDateTime; /** * <p> * 车队管理实体(t_fleet) * </p> * * @author mxcd * @since 2026-09-22 */ @Data @EqualsAndHashCode(callSuper = false) @TableName("t_fleet") @ApiModel(value = "TFleet对象", description = "车队管理") public class TFleet extends BasePojo { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "主键") @TableId(value = "id", type = IdType.AUTO) private Integer id; @ApiModelProperty(value = "公司ID(关联t_group_company.id)") @TableField("company_id") private Integer companyId; @ApiModelProperty(value = "车队名称") @TableField("fleet_name") private String fleetName; @ApiModelProperty(value = "联系人") @TableField("contact_name") private String contactName; @ApiModelProperty(value = "联系人电话") @TableField("contact_phone") private String contactPhone; @ApiModelProperty(value = "车队状态(1=启用,0=停用)") @TableField("status") private Integer status; @ApiModelProperty(value = "备注") @TableField("remark") private String remark; @ApiModelProperty(value = "更新时间") @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE) private LocalDateTime updateTime; @ApiModelProperty(value = "公司名称(查询回填,非表字段)") @TableField(exist = false) private String companyName; } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TFleetController.java
New file @@ -0,0 +1,168 @@ package com.ruoyi.other.controller; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.security.annotation.Logical; import com.ruoyi.common.security.annotation.RequiresPermissions; import com.ruoyi.other.api.domain.TFleet; import com.ruoyi.other.api.domain.TGroupCompany; import com.ruoyi.other.service.TFleetService; import com.ruoyi.other.service.TGroupCompanyService; import io.swagger.annotations.ApiOperation; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; /** * <p> * 车队管理 前端控制器 * </p> * * @author mxcd * @since 2026-09-22 */ @RestController @RequestMapping("/fleet") public class TFleetController { @Resource private TFleetService fleetService; @Resource private TGroupCompanyService groupCompanyService; /** * 分页查询车队 */ @RequiresPermissions(value = {"/fleet/list"}, logical = Logical.OR) @GetMapping("/page") @ApiOperation(value = "分页查询车队", tags = {"管理后台-车队管理"}) public AjaxResult<PageInfo<TFleet>> page(@RequestParam(value = "current", defaultValue = "1") Integer current, @RequestParam(value = "size", defaultValue = "10") Integer size, @RequestParam(value = "fleetName", required = false) String fleetName, @RequestParam(value = "companyId", required = false) Integer companyId, @RequestParam(value = "status", required = false) Integer status) { PageInfo<TFleet> page = new PageInfo<>(current, size); fleetService.lambdaQuery() .like(StringUtils.hasText(fleetName), TFleet::getFleetName, fleetName) .eq(companyId != null, TFleet::getCompanyId, companyId) .eq(status != null, TFleet::getStatus, status) .orderByDesc(TFleet::getId) .page(page); fillCompanyName(page.getRecords()); return AjaxResult.success(page); } /** * 添加车队 */ @RequiresPermissions(value = {"/fleet/list"}, logical = Logical.OR) @PostMapping("/add") @ApiOperation(value = "添加车队", tags = {"管理后台-车队管理"}) @Log(title = "【车队管理】添加车队", businessType = BusinessType.INSERT) public AjaxResult add(@RequestBody TFleet fleet) { if (fleet.getCompanyId() == null) { return AjaxResult.error("所属公司不能为空"); } if (!StringUtils.hasText(fleet.getFleetName())) { return AjaxResult.error("车队名称不能为空"); } fleet.setId(null); fleet.setDelFlag(false); if (fleet.getStatus() == null) { fleet.setStatus(1); } fleetService.save(fleet); return AjaxResult.success(); } /** * 编辑车队 */ @RequiresPermissions(value = {"/fleet/list"}, logical = Logical.OR) @PostMapping("/edit") @ApiOperation(value = "编辑车队", tags = {"管理后台-车队管理"}) @Log(title = "【车队管理】编辑车队", businessType = BusinessType.UPDATE) public AjaxResult edit(@RequestBody TFleet fleet) { if (fleet.getId() == null) { return AjaxResult.error("车队ID不能为空"); } fleetService.updateById(fleet); return AjaxResult.success(); } /** * 删除车队(支持逗号分隔批量删除) */ @RequiresPermissions(value = {"/fleet/list"}, logical = Logical.OR) @DeleteMapping("/del") @ApiOperation(value = "删除车队", tags = {"管理后台-车队管理"}) @Log(title = "【车队管理】删除车队", businessType = BusinessType.DELETE) public AjaxResult del(@RequestParam("ids") String ids) { if (!StringUtils.hasText(ids)) { return AjaxResult.error("车队ID不能为空"); } List<Integer> idList = java.util.Arrays.stream(ids.split(",")) .map(String::trim) .filter(StringUtils::hasText) .map(Integer::valueOf) .collect(Collectors.toList()); if (idList.isEmpty()) { return AjaxResult.error("车队ID不能为空"); } fleetService.removeByIds(idList); return AjaxResult.success(); } /** * 切换车队启用状态 */ @RequiresPermissions(value = {"/fleet/list"}, logical = Logical.OR) @PostMapping("/status") @ApiOperation(value = "切换车队启用状态", tags = {"管理后台-车队管理"}) @Log(title = "【车队管理】切换车队状态", businessType = BusinessType.UPDATE) public AjaxResult status(@RequestParam("id") Integer id, @RequestParam("status") Integer status) { if (id == null) { return AjaxResult.error("车队ID不能为空"); } TFleet update = new TFleet(); update.setId(id); update.setStatus(status); fleetService.updateById(update); return AjaxResult.success(); } /** * 按公司ID批量回填公司名称 */ private void fillCompanyName(List<TFleet> records) { if (records == null || records.isEmpty()) { return; } List<Integer> companyIds = records.stream() .map(TFleet::getCompanyId) .filter(Objects::nonNull) .distinct() .collect(Collectors.toList()); if (companyIds.isEmpty()) { return; } Map<Integer, String> nameMap = groupCompanyService.listByIds(companyIds).stream() .collect(Collectors.toMap(TGroupCompany::getId, TGroupCompany::getName, (a, b) -> a)); records.forEach(item -> item.setCompanyName(nameMap.get(item.getCompanyId()))); } } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGroupCompanyController.java
@@ -38,7 +38,7 @@ /** * 分页查询公司 */ @RequiresPermissions(value = {"/companyManagement/list"}, logical = Logical.OR) @RequiresPermissions(value = {"/companyManagement/list", "/fleet/list"}, logical = Logical.OR) @GetMapping("/page") @ApiOperation(value = "分页查询公司", tags = {"管理后台-公司管理"}) public AjaxResult<PageInfo<TGroupCompany>> page(@RequestParam(value = "current", defaultValue = "1") Integer current, ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TFleetMapper.java
New file @@ -0,0 +1,16 @@ package com.ruoyi.other.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.other.api.domain.TFleet; /** * <p> * 车队管理 Mapper 接口 * </p> * * @author mxcd * @since 2026-09-22 */ public interface TFleetMapper extends BaseMapper<TFleet> { } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TFleetService.java
New file @@ -0,0 +1,16 @@ package com.ruoyi.other.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.other.api.domain.TFleet; /** * <p> * 车队管理 服务类 * </p> * * @author mxcd * @since 2026-09-22 */ public interface TFleetService extends IService<TFleet> { } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TFleetServiceImpl.java
New file @@ -0,0 +1,20 @@ package com.ruoyi.other.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.other.api.domain.TFleet; import com.ruoyi.other.mapper.TFleetMapper; import com.ruoyi.other.service.TFleetService; import org.springframework.stereotype.Service; /** * <p> * 车队管理 服务实现类 * </p> * * @author mxcd * @since 2026-09-22 */ @Service public class TFleetServiceImpl extends ServiceImpl<TFleetMapper, TFleet> implements TFleetService { } sql/20260922_fleet.sql
New file @@ -0,0 +1,19 @@ -- ---------------------------- -- 车队管理表 -- 创建日期: 2026-09-22 -- 库: charging_pile_other -- ---------------------------- CREATE TABLE `t_fleet` ( `id` int NOT NULL AUTO_INCREMENT COMMENT '主键', `company_id` int NOT NULL COMMENT '公司ID(关联t_group_company.id)', `fleet_name` varchar(128) NOT NULL COMMENT '车队名称', `contact_name` varchar(64) NULL DEFAULT NULL COMMENT '联系人', `contact_phone` varchar(32) NULL DEFAULT NULL COMMENT '联系人电话', `status` tinyint NULL DEFAULT NULL COMMENT '车队状态(1=启用,0=停用)', `remark` varchar(255) NULL DEFAULT NULL COMMENT '备注', `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', `del_flag` int NULL DEFAULT NULL COMMENT '删除(0=否,1=是)', PRIMARY KEY (`id`), KEY `idx_company_id` (`company_id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='车队管理';