飞行器管理

This commit is contained in:
sugus 2025-07-11 10:47:03 +08:00
parent 36e80570d2
commit 4af3731bfa
21 changed files with 520 additions and 15 deletions

View File

@ -27,7 +27,6 @@ import java.util.Arrays;
* <p> * <p>
* Mysql代码生成器 * Mysql代码生成器
* </p> * </p>
*
*/ */
public class MysqlGenerator extends SuperGenerator { public class MysqlGenerator extends SuperGenerator {
@ -36,10 +35,10 @@ public class MysqlGenerator extends SuperGenerator {
* MySQL generator * MySQL generator
* </p> * </p>
*/ */
public void generator(String tableName) { public void generator(String tableName, String tablePrefix, String modelName) {
// 代码生成器 // 代码生成器
AutoGenerator mpg = getAutoGenerator(tableName); AutoGenerator mpg = getAutoGenerator(tableName, tablePrefix, modelName);
mpg.execute(); mpg.execute();
if (tableName == null) { if (tableName == null) {
System.err.println(" Generator Success !"); System.err.println(" Generator Success !");
@ -51,9 +50,13 @@ public class MysqlGenerator extends SuperGenerator {
public static void main(String[] args) { public static void main(String[] args) {
MysqlGenerator mysqlGenerator = new MysqlGenerator(); MysqlGenerator mysqlGenerator = new MysqlGenerator();
// Arrays.asList("user","role","user_role").stream().forEach(table -> { Arrays.asList(
Arrays.asList("fms_ac_aircraft_device").stream().forEach(table -> { //表名去除前缀模块名
mysqlGenerator.generator(table); new String[]{"fms_ac_aircraft_device", "fms_ac_", "aircraft"},
new String[]{"fms_ac_aircraft_insurance", "fms_ac_", "aircraft"},
new String[]{"fms_ac_aircraft_maintenance", "fms_ac_", "aircraft"}
).forEach(pair -> {
mysqlGenerator.generator(pair[0], pair[1], pair[2]);
}); });
} }

View File

@ -1,6 +1,7 @@
package com.aircraft.generate; package com.aircraft.generate;
import com.aircraft.utils.StringUtils;
import com.baomidou.mybatisplus.annotation.DbType; import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.generator.AutoGenerator; import com.baomidou.mybatisplus.generator.AutoGenerator;
@ -40,7 +41,7 @@ public class SuperGenerator {
* *
* @return * @return
*/ */
protected InjectionConfig getInjectionConfig() { protected InjectionConfig getInjectionConfig(String moduleName) {
return new InjectionConfig() { return new InjectionConfig() {
@Override @Override
public void initMap() { public void initMap() {
@ -52,6 +53,9 @@ public class SuperGenerator {
// 自定义输出文件目录 // 自定义输出文件目录
@Override @Override
public String outputFile(TableInfo tableInfo) { public String outputFile(TableInfo tableInfo) {
if (StringUtils.isNoneBlank(moduleName)){
return getResourcePath() + "/mapper/" + moduleName + "/" + tableInfo.getEntityName() + "Mapper.xml";
}
return getResourcePath() + "/mapper/" + tableInfo.getEntityName() + "Mapper.xml"; return getResourcePath() + "/mapper/" + tableInfo.getEntityName() + "Mapper.xml";
} }
})); }));
@ -62,9 +66,10 @@ public class SuperGenerator {
* *
* @return * @return
*/ */
protected PackageConfig getPackageConfig() { protected PackageConfig getPackageConfig(String moduleName) {
return new PackageConfig() return new PackageConfig()
.setParent("com.aircraft.modules.system") .setParent("com.aircraft.modules")
.setModuleName(moduleName)
.setController("controller") .setController("controller")
.setEntity("domain") .setEntity("domain")
.setMapper("mapper") .setMapper("mapper")
@ -78,10 +83,10 @@ public class SuperGenerator {
* @param tableName * @param tableName
* @return * @return
*/ */
protected StrategyConfig getStrategyConfig(String tableName) { protected StrategyConfig getStrategyConfig(String tableName,String tablePrefix) {
return new StrategyConfig() return new StrategyConfig()
.setCapitalMode(false)// 全局大写命名 .setCapitalMode(false)// 全局大写命名
// .setTablePrefix("sys_")// 去除前缀 .setTablePrefix(tablePrefix)// 去除前缀
.setNaming(NamingStrategy.underline_to_camel)// 表名生成策略 .setNaming(NamingStrategy.underline_to_camel)// 表名生成策略
//.setInclude(new String[] { "user" }) // 需要生成的表 //.setInclude(new String[] { "user" }) // 需要生成的表
//自定义实体父类 //自定义实体父类
@ -213,18 +218,18 @@ public class SuperGenerator {
* @param tableName * @param tableName
* @return * @return
*/ */
protected AutoGenerator getAutoGenerator(String tableName) { protected AutoGenerator getAutoGenerator(String tableName,String tablePrefix,String moduleName) {
return new AutoGenerator() return new AutoGenerator()
// 全局配置 // 全局配置
.setGlobalConfig(getGlobalConfig()) .setGlobalConfig(getGlobalConfig())
// 数据源配置 // 数据源配置
.setDataSource(getDataSourceConfig()) .setDataSource(getDataSourceConfig())
// 策略配置 // 策略配置
.setStrategy(getStrategyConfig(tableName)) .setStrategy(getStrategyConfig(tableName,tablePrefix))
// 包配置 // 包配置
.setPackageInfo(getPackageConfig()) .setPackageInfo(getPackageConfig(moduleName))
// 注入自定义配置可以在 VM 中使用 cfg.abc 设置的值 // 注入自定义配置可以在 VM 中使用 cfg.abc 设置的值
.setCfg(getInjectionConfig()) .setCfg(getInjectionConfig(moduleName))
.setTemplate(getTemplateConfig()); .setTemplate(getTemplateConfig());
} }

View File

@ -0,0 +1,21 @@
package com.aircraft.modules.aircraft.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 飞行器设备表 前端控制器
* </p>
*
* @author cli
* @since 2025-07-11
*/
@RestController
@RequestMapping("/aircraft/aircraftDevice")
public class AircraftDeviceController {
}

View File

@ -0,0 +1,21 @@
package com.aircraft.modules.aircraft.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 飞行器保险表 前端控制器
* </p>
*
* @author cli
* @since 2025-07-11
*/
@RestController
@RequestMapping("/aircraft/aircraftInsurance")
public class AircraftInsuranceController {
}

View File

@ -0,0 +1,21 @@
package com.aircraft.modules.aircraft.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 飞行器维保表 前端控制器
* </p>
*
* @author cli
* @since 2025-07-11
*/
@RestController
@RequestMapping("/aircraft/aircraftMaintenance")
public class AircraftMaintenanceController {
}

View File

@ -0,0 +1,69 @@
package com.aircraft.modules.aircraft.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.aircraft.base.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 飞行器设备表
* </p>
*
* @author cli
* @since 2025-07-11
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("fms_ac_aircraft_device")
public class AircraftDevice extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private Long id;
/**
* 飞行器名称
*/
private String name;
/**
* 设备型号
*/
private String model;
/**
* 品牌DJISF
*/
private String brand;
/**
* 类型0-载物飞行1-载人飞行2-其他
*/
private Integer useType;
/**
* 区域id
*/
private Long areaId;
/**
* 景区id
*/
private Long scenicId;
/**
* 飞行员负责人id
*/
private Long employeesId;
/**
* 备注
*/
private String remark;
}

View File

@ -0,0 +1,50 @@
package com.aircraft.modules.aircraft.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.aircraft.base.BaseEntity;
import java.util.Date;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 飞行器保险表
* </p>
*
* @author cli
* @since 2025-07-11
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("fms_ac_aircraft_insurance")
public class AircraftInsurance extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private Long id;
/**
* 飞行器id
*/
private Long aircraftId;
/**
* 保险名称
*/
private String name;
/**
* 保险类型0-三方险1-设备险2-运营险
*/
private Integer insuranceType;
/**
* 截止日期
*/
private Date deadlineTime;
}

View File

@ -0,0 +1,44 @@
package com.aircraft.modules.aircraft.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.aircraft.base.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 飞行器维保表
* </p>
*
* @author cli
* @since 2025-07-11
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("fms_ac_aircraft_maintenance")
public class AircraftMaintenance extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
private Long id;
/**
* 飞行器id
*/
private Long aircraftId;
/**
* 飞行员负责人id
*/
private Long employeesId;
/**
* 维保类型0-例行检查1-电池损坏
*/
private Integer maintenanceType;
}

View File

@ -0,0 +1,16 @@
package com.aircraft.modules.aircraft.mapper;
import com.aircraft.modules.aircraft.domain.AircraftDevice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 飞行器设备表 Mapper 接口
* </p>
*
* @author cli
* @since 2025-07-11
*/
public interface AircraftDeviceMapper extends BaseMapper<AircraftDevice> {
}

View File

@ -0,0 +1,16 @@
package com.aircraft.modules.aircraft.mapper;
import com.aircraft.modules.aircraft.domain.AircraftInsurance;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 飞行器保险表 Mapper 接口
* </p>
*
* @author cli
* @since 2025-07-11
*/
public interface AircraftInsuranceMapper extends BaseMapper<AircraftInsurance> {
}

View File

@ -0,0 +1,16 @@
package com.aircraft.modules.aircraft.mapper;
import com.aircraft.modules.aircraft.domain.AircraftMaintenance;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 飞行器维保表 Mapper 接口
* </p>
*
* @author cli
* @since 2025-07-11
*/
public interface AircraftMaintenanceMapper extends BaseMapper<AircraftMaintenance> {
}

View File

@ -0,0 +1,16 @@
package com.aircraft.modules.aircraft.service;
import com.aircraft.modules.aircraft.domain.AircraftDevice;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 飞行器设备表 服务类
* </p>
*
* @author cli
* @since 2025-07-11
*/
public interface AircraftDeviceService extends IService<AircraftDevice> {
}

View File

@ -0,0 +1,16 @@
package com.aircraft.modules.aircraft.service;
import com.aircraft.modules.aircraft.domain.AircraftInsurance;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 飞行器保险表 服务类
* </p>
*
* @author cli
* @since 2025-07-11
*/
public interface AircraftInsuranceService extends IService<AircraftInsurance> {
}

View File

@ -0,0 +1,16 @@
package com.aircraft.modules.aircraft.service;
import com.aircraft.modules.aircraft.domain.AircraftMaintenance;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 飞行器维保表 服务类
* </p>
*
* @author cli
* @since 2025-07-11
*/
public interface AircraftMaintenanceService extends IService<AircraftMaintenance> {
}

View File

@ -0,0 +1,20 @@
package com.aircraft.modules.aircraft.service.impl;
import com.aircraft.modules.aircraft.domain.AircraftDevice;
import com.aircraft.modules.aircraft.mapper.AircraftDeviceMapper;
import com.aircraft.modules.aircraft.service.AircraftDeviceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 飞行器设备表 服务实现类
* </p>
*
* @author cli
* @since 2025-07-11
*/
@Service
public class AircraftDeviceServiceImpl extends ServiceImpl<AircraftDeviceMapper, AircraftDevice> implements AircraftDeviceService {
}

View File

@ -0,0 +1,20 @@
package com.aircraft.modules.aircraft.service.impl;
import com.aircraft.modules.aircraft.domain.AircraftInsurance;
import com.aircraft.modules.aircraft.mapper.AircraftInsuranceMapper;
import com.aircraft.modules.aircraft.service.AircraftInsuranceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 飞行器保险表 服务实现类
* </p>
*
* @author cli
* @since 2025-07-11
*/
@Service
public class AircraftInsuranceServiceImpl extends ServiceImpl<AircraftInsuranceMapper, AircraftInsurance> implements AircraftInsuranceService {
}

View File

@ -0,0 +1,20 @@
package com.aircraft.modules.aircraft.service.impl;
import com.aircraft.modules.aircraft.domain.AircraftMaintenance;
import com.aircraft.modules.aircraft.mapper.AircraftMaintenanceMapper;
import com.aircraft.modules.aircraft.service.AircraftMaintenanceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 飞行器维保表 服务实现类
* </p>
*
* @author cli
* @since 2025-07-11
*/
@Service
public class AircraftMaintenanceServiceImpl extends ServiceImpl<AircraftMaintenanceMapper, AircraftMaintenance> implements AircraftMaintenanceService {
}

View File

@ -0,0 +1,100 @@
package com.aircraft.modules.system.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.aircraft.base.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* <p>
* 飞行器设备表
* </p>
*
* @author cli
* @since 2025-07-09
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("fms_ac_aircraft_device")
public class AircraftDevice extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@NotNull(groups = Update.class)
@ApiModelProperty(value = "ID", hidden = true)
private Long id;
/**
* 飞行器名称
*/
@NotBlank
@ApiModelProperty(value = "飞行器名称")
private String name;
/**
* 设备型号
*/
@NotBlank
@ApiModelProperty(value = "设备型号")
private String model;
/**
* 品牌DJISF
*/
@NotBlank
@ApiModelProperty(value = "品牌DJISF")
private String brand;
/**
* 类型0-载物飞行1-载人飞行2-其他
*/
@NotBlank
@ApiModelProperty(value = "类型0-载物飞行1-载人飞行2-其他")
private Integer useType;
/**
* 区域id
*/
@NotNull
@ApiModelProperty(value = "区域id")
private Long areaId;
/**
* 景区id
*/
@NotNull
@ApiModelProperty(value = "景区id")
private Long scenicId;
/**
* 飞行员负责人id
*/
@NotNull
@ApiModelProperty(value = "行员负责人id")
private Long employeesId;
/**
* 备注
*/
@NotBlank
@Max(200)
@ApiModelProperty(value = "备注")
private String remark;
@NotNull
@ApiModelProperty("无人机图片")
private List<String> deviceImages;
}

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.aircraft.modules.aircraft.mapper.AircraftDeviceMapper">
</mapper>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.aircraft.modules.aircraft.mapper.AircraftInsuranceMapper">
</mapper>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.aircraft.modules.aircraft.mapper.AircraftMaintenanceMapper">
</mapper>