重构车辆项目,还不可以添加数据,多数据源是死的
parent
7a30291286
commit
92ef1f8437
|
@ -19,6 +19,12 @@
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<!--rabbitMQ-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>muyu-common-system</artifactId>
|
<artifactId>muyu-common-system</artifactId>
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.muyu.business.config;
|
||||||
|
|
||||||
|
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
|
||||||
|
import org.springframework.amqp.support.converter.MessageConverter;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class RabbitmqConfig {
|
||||||
|
// 消息转换配置
|
||||||
|
@Bean
|
||||||
|
public MessageConverter jsonMessageConverter() {
|
||||||
|
return new Jackson2JsonMessageConverter();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,100 @@
|
||||||
|
package com.muyu.business.controller;
|
||||||
|
|
||||||
|
import com.muyu.business.domain.Entinfo;
|
||||||
|
import com.muyu.business.service.IEntinfoService;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
import com.muyu.common.log.annotation.Log;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多数据源 EntinfoController
|
||||||
|
*
|
||||||
|
* @author xiaohuang
|
||||||
|
* on 2024/6/7
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/entinfo")
|
||||||
|
public class EntinfoController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IEntinfoService entinfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询多数据源列表
|
||||||
|
*/
|
||||||
|
// @RequiresPermissions("system:entinfo:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<Entinfo>> list(Entinfo entinfo)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<Entinfo> list = entinfoService.selectEntinfoList(entinfo);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出多数据源列表
|
||||||
|
*/
|
||||||
|
// @RequiresPermissions("system:entinfo:export")
|
||||||
|
@Log(title = "多数据源", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, Entinfo entinfo)
|
||||||
|
{
|
||||||
|
List<Entinfo> list = entinfoService.selectEntinfoList(entinfo);
|
||||||
|
ExcelUtil<Entinfo> util = new ExcelUtil<Entinfo>(Entinfo.class);
|
||||||
|
util.exportExcel(response, list, "多数据源数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取多数据源详细信息
|
||||||
|
*/
|
||||||
|
// @RequiresPermissions("system:entinfo:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(entinfoService.selectEntinfoById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增多数据源
|
||||||
|
*/
|
||||||
|
// @RequiresPermissions("system:entinfo:add")
|
||||||
|
@Log(title = "多数据源", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public Result add(@RequestBody Entinfo entinfo)
|
||||||
|
{
|
||||||
|
return toAjax(entinfoService.insertEntinfo(entinfo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改多数据源
|
||||||
|
*/
|
||||||
|
// @RequiresPermissions("system:entinfo:edit")
|
||||||
|
@Log(title = "多数据源", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public Result edit(@RequestBody Entinfo entinfo)
|
||||||
|
{
|
||||||
|
return toAjax(entinfoService.updateEntinfo(entinfo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除多数据源
|
||||||
|
*/
|
||||||
|
// @RequiresPermissions("system:entinfo:remove")
|
||||||
|
@Log(title = "多数据源", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(entinfoService.deleteEntinfoByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.muyu.business.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多数据源对象 Entinfo
|
||||||
|
*
|
||||||
|
* @author xiaohuang
|
||||||
|
* on 2024/6/7
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("entinfo")
|
||||||
|
public class Entinfo extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源key
|
||||||
|
*/
|
||||||
|
@Excel(name = "数据源key")
|
||||||
|
private String entCode;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源ip
|
||||||
|
*/
|
||||||
|
@Excel(name = "数据源ip")
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源端口
|
||||||
|
*/
|
||||||
|
@Excel(name = "数据源端口")
|
||||||
|
private Integer port;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.muyu.business.job;
|
||||||
|
|
||||||
|
import com.muyu.common.redis.service.RedisService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ManyJob
|
||||||
|
*
|
||||||
|
* @author xiaohuang
|
||||||
|
* on 2024/6/7
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Log4j2
|
||||||
|
public class ManyJob {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisService redisService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.muyu.business.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.business.domain.Entinfo;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多数据源Mapper接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-06-06
|
||||||
|
*/
|
||||||
|
public interface EntinfoMapper extends BaseMapper<Entinfo>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询多数据源
|
||||||
|
*
|
||||||
|
* @param id 多数据源主键
|
||||||
|
* @return 多数据源
|
||||||
|
*/
|
||||||
|
public Entinfo selectEntinfoById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询多数据源列表
|
||||||
|
*
|
||||||
|
* @param entinfo 多数据源
|
||||||
|
* @return 多数据源集合
|
||||||
|
*/
|
||||||
|
public List<Entinfo> selectEntinfoList(Entinfo entinfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增多数据源
|
||||||
|
*
|
||||||
|
* @param entinfo 多数据源
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertEntinfo(Entinfo entinfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改多数据源
|
||||||
|
*
|
||||||
|
* @param entinfo 多数据源
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateEntinfo(Entinfo entinfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除多数据源
|
||||||
|
*
|
||||||
|
* @param id 多数据源主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteEntinfoById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除多数据源
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteEntinfoByIds(Long[] ids);
|
||||||
|
}
|
|
@ -1,25 +0,0 @@
|
||||||
package com.muyu.business.remote.factory;
|
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
|
||||||
import com.muyu.common.log.annotation.Log;
|
|
||||||
import com.muyu.common.log.enums.BusinessType;
|
|
||||||
import com.muyu.common.system.domain.SysUser;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* RemoteUserLoginFactory
|
|
||||||
*
|
|
||||||
* @author xiaohuang
|
|
||||||
* on 2024/6/4
|
|
||||||
*/
|
|
||||||
@FeignClient("muyu-system")
|
|
||||||
public interface RemoteUserLoginFactory {
|
|
||||||
|
|
||||||
@Log(title = "用户管理",businessType = BusinessType.IMPORT)
|
|
||||||
|
|
||||||
@PostMapping("/user")
|
|
||||||
public Result add (@Validated @RequestBody SysUser user);
|
|
||||||
}
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.muyu.business.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.business.domain.Entinfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多数据源 IEntinfoService
|
||||||
|
*
|
||||||
|
* @author xiaohuang
|
||||||
|
* on 2024/6/7
|
||||||
|
*/
|
||||||
|
public interface IEntinfoService extends IService<Entinfo> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询多数据源
|
||||||
|
*
|
||||||
|
* @param id 多数据源主键
|
||||||
|
* @return 多数据源
|
||||||
|
*/
|
||||||
|
public Entinfo selectEntinfoById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询多数据源列表
|
||||||
|
*
|
||||||
|
* @param entinfo 多数据源
|
||||||
|
* @return 多数据源集合
|
||||||
|
*/
|
||||||
|
public List<Entinfo> selectEntinfoList(Entinfo entinfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增多数据源
|
||||||
|
*
|
||||||
|
* @param entinfo 多数据源
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertEntinfo(Entinfo entinfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改多数据源
|
||||||
|
*
|
||||||
|
* @param entinfo 多数据源
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateEntinfo(Entinfo entinfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除多数据源
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的多数据源主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteEntinfoByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除多数据源信息
|
||||||
|
*
|
||||||
|
* @param id 多数据源主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteEntinfoById(Long id);
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.muyu.business.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.business.domain.Entinfo;
|
||||||
|
import com.muyu.business.mapper.EntinfoMapper;
|
||||||
|
import com.muyu.business.service.IEntinfoService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多数据源 EntinfoServiceImpl
|
||||||
|
*
|
||||||
|
* @author xiaohuang
|
||||||
|
* on 2024/6/7
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class EntinfoServiceImpl extends ServiceImpl<EntinfoMapper, Entinfo> implements IEntinfoService {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EntinfoMapper entinfoMapper;
|
||||||
|
}
|
|
@ -7,17 +7,15 @@ import com.muyu.common.core.web.controller.BaseController;
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
import com.muyu.common.log.annotation.Log;
|
import com.muyu.common.log.annotation.Log;
|
||||||
import com.muyu.common.log.enums.BusinessType;
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
import com.muyu.vehicle.domain.Group;
|
|
||||||
import com.muyu.vehicle.service.IGroupService;
|
import com.muyu.vehicle.service.IGroupService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import com.muyu.vehicle.domain.Group;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
/**
|
/**
|
||||||
* 围栏组Controller
|
* 围栏组Controller
|
||||||
*
|
|
||||||
* @author BingRui.Hou
|
|
||||||
* @date 2024-06-02
|
* @date 2024-06-02
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.muyu.vehicle.controller;
|
package com.muyu.vehicle.controller;
|
||||||
|
|
||||||
|
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
@ -13,38 +14,47 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆录入 VehicleController
|
* 车辆录入Controller
|
||||||
*
|
*
|
||||||
* @author xiaohuang
|
*
|
||||||
* on 2024/6/5
|
* @date 2024-05-27
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/vehicle")
|
@RequestMapping("/vehicle")
|
||||||
public class VehicleController extends BaseController {
|
public class VehicleController extends BaseController
|
||||||
|
{
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IVehicleService vehicleService;
|
private IVehicleService vehicleService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询车辆录入列表
|
* 查询车辆录入列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("list")
|
// @RequiresPermissions("system:vehicle:list")
|
||||||
public Result<TableDataInfo<Vehicle>> list(Vehicle vehicle)
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<Vehicle>> list(Vehicle vehicle)
|
||||||
{
|
{
|
||||||
startPage();
|
startPage();
|
||||||
List<Vehicle> list = vehicleService.selectVehicleList(vehicle);
|
List<Vehicle> list = vehicleService.selectVehicleList(vehicle);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出车辆录入列表
|
||||||
|
*/
|
||||||
|
// @RequiresPermissions("system:vehicle:export")
|
||||||
|
// @Log(title = "车辆录入", businessType = BusinessType.EXPORT)
|
||||||
|
// @PostMapping("/export")
|
||||||
|
// public void export(HttpServletResponse response, Vehicle vehicle)
|
||||||
|
// {
|
||||||
|
// List<Vehicle> list = vehicleService.selectVehicleList(vehicle);
|
||||||
|
// ExcelUtil<Vehicle> util = new ExcelUtil<Vehicle>(Vehicle.class);
|
||||||
|
// util.exportExcel(response, list, "车辆录入数据");
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取车辆录入详细信息
|
* 获取车辆录入详细信息
|
||||||
*/
|
*/
|
||||||
|
// @RequiresPermissions("system:vehicle:query")
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public Result getInfo(@PathVariable("id") Long id)
|
public Result getInfo(@PathVariable("id") Long id)
|
||||||
{
|
{
|
||||||
|
@ -54,6 +64,7 @@ public class VehicleController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 新增车辆录入
|
* 新增车辆录入
|
||||||
*/
|
*/
|
||||||
|
// @RequiresPermissions("system:vehicle:add")
|
||||||
@Log(title = "车辆录入", businessType = BusinessType.INSERT)
|
@Log(title = "车辆录入", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public Result add(@RequestBody Vehicle vehicle)
|
public Result add(@RequestBody Vehicle vehicle)
|
||||||
|
@ -64,6 +75,7 @@ public class VehicleController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 修改车辆录入
|
* 修改车辆录入
|
||||||
*/
|
*/
|
||||||
|
// @RequiresPermissions("system:vehicle:edit")
|
||||||
@Log(title = "车辆录入", businessType = BusinessType.UPDATE)
|
@Log(title = "车辆录入", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public Result edit(@RequestBody Vehicle vehicle)
|
public Result edit(@RequestBody Vehicle vehicle)
|
||||||
|
@ -74,12 +86,11 @@ public class VehicleController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 删除车辆录入
|
* 删除车辆录入
|
||||||
*/
|
*/
|
||||||
|
// @RequiresPermissions("system:vehicle:remove")
|
||||||
@Log(title = "车辆录入", businessType = BusinessType.DELETE)
|
@Log(title = "车辆录入", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public Result remove(@PathVariable Long[] ids)
|
public Result remove(@PathVariable Long[] ids)
|
||||||
{
|
{
|
||||||
return toAjax(vehicleService.deleteVehicleByIds(ids));
|
return toAjax(vehicleService.deleteVehicleByIds(ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,22 +16,21 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据源配置 ManyDataSource
|
* @author DongZl
|
||||||
*
|
* @description: 数据源配置
|
||||||
* @author xiaohuang
|
* @Date 2023-8-1 上午 11:05
|
||||||
* on 2024/6/5
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@Configuration
|
@Configuration
|
||||||
public class ManyDataSource {
|
public class ManyDataSource {
|
||||||
|
|
||||||
|
|
||||||
private List<EntInfo> dataSourceInfoList(){
|
private List<EntInfo> dataSourceInfoList(){
|
||||||
List<EntInfo> databaseNameList = new ArrayList<>(){{
|
List<EntInfo> databaseNameList = new ArrayList<>(){{
|
||||||
add(EntInfo.builder()
|
add(EntInfo.builder()
|
||||||
.entCode("test_1")
|
.entCode("test_1")
|
||||||
.ip("175.24.138.82")
|
.ip("175.24.138.82")
|
||||||
.port(6666)
|
.port(7777)
|
||||||
.build());
|
.build());
|
||||||
}};
|
}};
|
||||||
return databaseNameList;
|
return databaseNameList;
|
||||||
|
@ -49,8 +48,8 @@ public class ManyDataSource {
|
||||||
.stream()
|
.stream()
|
||||||
.map(entInfo-> DataSourceInfo.hostAndPortBuild(entInfo.getEntCode(),entInfo.getIp(),entInfo.getPort()))
|
.map(entInfo-> DataSourceInfo.hostAndPortBuild(entInfo.getEntCode(),entInfo.getIp(),entInfo.getPort()))
|
||||||
.forEach(dataSourceInfo -> {
|
.forEach(dataSourceInfo -> {
|
||||||
dataSourceMap.put(dataSourceInfo.getKey(), druidDataSourceFactory.create(dataSourceInfo));
|
dataSourceMap.put(dataSourceInfo.getKey(), druidDataSourceFactory.create(dataSourceInfo));
|
||||||
});
|
});
|
||||||
//设置动态数据源
|
//设置动态数据源
|
||||||
DynamicDataSource dynamicDataSource = new DynamicDataSource();
|
DynamicDataSource dynamicDataSource = new DynamicDataSource();
|
||||||
// dynamicDataSource.setDefaultTargetDataSource(masterDataSource());
|
// dynamicDataSource.setDefaultTargetDataSource(masterDataSource());
|
||||||
|
|
|
@ -10,7 +10,7 @@ import org.springframework.stereotype.Component;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* BingRui.Hou
|
||||||
*
|
*
|
||||||
* @Description 描述
|
* @Description 描述
|
||||||
* @ClassName DruidDataSourceFactory
|
* @ClassName DruidDataSourceFactory
|
||||||
|
|
|
@ -7,7 +7,7 @@ package com.muyu.vehicle.datasource.contents;
|
||||||
*/
|
*/
|
||||||
public class DatasourceContent {
|
public class DatasourceContent {
|
||||||
|
|
||||||
public final static String DATASOURCE_URL = "jdbc:mysql://{}:{}/ry-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8";
|
public final static String DATASOURCE_URL = "jdbc:mysql://{}:{}/zhiLian-cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8";
|
||||||
|
|
||||||
public final static String USER_NAME = "root";
|
public final static String USER_NAME = "root";
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import lombok.NoArgsConstructor;
|
||||||
* BingRui.Hou
|
* BingRui.Hou
|
||||||
*
|
*
|
||||||
* @Description 描述
|
* @Description 描述
|
||||||
* @ClassName EntInfo
|
* @ClassName Entinfo
|
||||||
* @Date 2024/06/04 14:34
|
* @Date 2024/06/04 14:34
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package com.muyu.vehicle.datasource.util;
|
package com.muyu.vehicle.datasource.util;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.alibaba.druid.pool.DruidDataSource;
|
import com.alibaba.druid.pool.DruidDataSource;
|
||||||
|
|
||||||
import com.muyu.vehicle.datasource.ManyDataSource;
|
import com.muyu.vehicle.datasource.ManyDataSource;
|
||||||
import com.muyu.vehicle.datasource.config.factory.DruidDataSourceFactory;
|
import com.muyu.vehicle.datasource.config.factory.DruidDataSourceFactory;
|
||||||
import com.muyu.vehicle.datasource.config.role.DynamicDataSource;
|
import com.muyu.vehicle.datasource.config.role.DynamicDataSource;
|
||||||
|
|
|
@ -10,7 +10,6 @@ import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
import org.apache.poi.ss.formula.functions.T;
|
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package com.muyu.vehicle.domain;
|
package com.muyu.vehicle.domain;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.muyu.common.core.annotation.Excel;
|
import com.muyu.common.core.annotation.Excel;
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -11,21 +12,19 @@ import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆录入对象 Vehicle
|
* 车辆录入对象 vehicle
|
||||||
*
|
*
|
||||||
* @author xiaohuang
|
* @author muyu
|
||||||
* on 2024/6/5
|
* @date 2024-05-27
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("vehicle")
|
@TableName("vehicle")
|
||||||
public class Vehicle extends BaseEntity {
|
public class Vehicle extends BaseEntity
|
||||||
|
{
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 车辆主键 */
|
/** 车辆主键 */
|
||||||
|
@ -66,5 +65,4 @@ public class Vehicle extends BaseEntity {
|
||||||
@Excel(name="围栏组ID")
|
@Excel(name="围栏组ID")
|
||||||
private Long groupId;
|
private Long groupId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,81 +1,54 @@
|
||||||
package com.muyu.vehicle.domain.vo;
|
package com.muyu.vehicle.domain.vo;
|
||||||
|
|
||||||
import lombok.*;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆录入对象 VehicleReq
|
* 车辆录入对象 vehicle
|
||||||
*
|
*
|
||||||
* @author xiaohuang
|
* @author muyu
|
||||||
* on 2024/6/5
|
* @date 2024-05-27
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@ToString
|
@ToString
|
||||||
public class VehicleReq {
|
public class VehicleReq
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/** 车辆主键 */
|
||||||
* 车辆主键
|
|
||||||
*/
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
/** 车辆vin */
|
||||||
/**
|
|
||||||
* 车辆vin
|
|
||||||
*/
|
|
||||||
private String number;
|
private String number;
|
||||||
|
|
||||||
|
/** 车辆类型 */
|
||||||
/**
|
|
||||||
* 车辆类型
|
|
||||||
*/
|
|
||||||
private Long typeId;
|
private Long typeId;
|
||||||
|
|
||||||
|
/** 电子围栏ID */
|
||||||
/**
|
|
||||||
* 电子围栏id
|
|
||||||
*/
|
|
||||||
private Long electonicId;
|
private Long electonicId;
|
||||||
|
|
||||||
|
/** 电机厂商 */
|
||||||
/**
|
|
||||||
* 电机厂商
|
|
||||||
*/
|
|
||||||
private String motor;
|
private String motor;
|
||||||
|
|
||||||
|
/** 电池厂商 */
|
||||||
/**
|
|
||||||
* 电池厂商
|
|
||||||
*/
|
|
||||||
private String battery;
|
private String battery;
|
||||||
|
|
||||||
|
/** 电机编号 */
|
||||||
/**
|
|
||||||
* 电机编号
|
|
||||||
*/
|
|
||||||
private Long motorNumber;
|
private Long motorNumber;
|
||||||
|
|
||||||
|
/** 电池编号 */
|
||||||
/**
|
|
||||||
* 电池编号
|
|
||||||
*/
|
|
||||||
private Long batteryNumber;
|
private Long batteryNumber;
|
||||||
|
|
||||||
|
/** 企业ID */
|
||||||
/**
|
|
||||||
* 企业id
|
|
||||||
*/
|
|
||||||
private Long businessId;
|
private Long businessId;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 企业名称
|
* 企业名称
|
||||||
*/
|
*/
|
||||||
private String businessNam;
|
private String businessNam;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,51 +1,65 @@
|
||||||
package com.muyu.vehicle.mapper;
|
package com.muyu.vehicle.mapper;
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.muyu.vehicle.domain.Vehicle;
|
import com.muyu.vehicle.domain.Vehicle;
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆录入mapper接口 VehicleMapper
|
* 车辆录入Mapper接口
|
||||||
*
|
*
|
||||||
* @author xiaohuang
|
* @author muyu
|
||||||
* on 2024/6/5
|
* @date 2024-05-27
|
||||||
*/
|
*/
|
||||||
public interface VehicleMapper extends BaseMapper<Vehicle> {
|
public interface VehicleMapper extends BaseMapper<Vehicle>
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询车辆录入
|
* 查询车辆录入
|
||||||
|
*
|
||||||
|
* @param id 车辆录入主键
|
||||||
|
* @return 车辆录入
|
||||||
*/
|
*/
|
||||||
public Vehicle selectVehicleById(Long id);
|
public Vehicle selectVehicleById(Long id);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询车辆录入列表
|
* 查询车辆录入列表
|
||||||
|
*
|
||||||
|
* @param vehicle 车辆录入
|
||||||
|
* @return 车辆录入集合
|
||||||
*/
|
*/
|
||||||
public List<Vehicle> selectVehicleList(Vehicle vehicle);
|
public List<Vehicle> selectVehicleList(Vehicle vehicle);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增车辆录入
|
* 新增车辆录入
|
||||||
|
*
|
||||||
|
* @param vehicle 车辆录入
|
||||||
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertVehicle(Vehicle vehicle);
|
public int insertVehicle(Vehicle vehicle);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改
|
* 修改车辆录入
|
||||||
|
*
|
||||||
|
* @param vehicle 车辆录入
|
||||||
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateVehicle(Vehicle vehicle);
|
public int updateVehicle(Vehicle vehicle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除车辆录入
|
||||||
|
*
|
||||||
|
* @param id 车辆录入主键
|
||||||
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteVehicleById(Long id);
|
public int deleteVehicleById(Long id);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 低量删除
|
* 批量删除车辆录入
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteVehicleByIds(Long[] ids);
|
public int deleteVehicleByIds(Long[] ids);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
package com.muyu.vehicle.service;
|
package com.muyu.vehicle.service;
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.vehicle.domain.Vehicle;
|
import com.muyu.vehicle.domain.Vehicle;
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆录入 IVehicleService
|
* 车辆录入Service接口
|
||||||
*
|
*
|
||||||
* @author xiaohuang
|
* @author muyu
|
||||||
* on 2024/6/5
|
* @date 2024-05-27
|
||||||
*/
|
*/
|
||||||
public interface IVehicleService extends IService<Vehicle> {
|
public interface IVehicleService extends IService<Vehicle>
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询车辆录入
|
* 查询车辆录入
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.muyu.vehicle.service.impl;
|
package com.muyu.vehicle.service.impl;
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
import com.muyu.common.core.utils.DateUtils;
|
import com.muyu.common.core.utils.DateUtils;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.common.system.domain.LoginUser;
|
import com.muyu.common.system.domain.LoginUser;
|
||||||
|
@ -16,31 +18,46 @@ import org.springframework.stereotype.Service;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆录入 VehicleServiceImpl
|
* 车辆录入Service业务层处理
|
||||||
*
|
*
|
||||||
* @author xiaohuang
|
* @author muyu
|
||||||
* on 2024/6/5
|
* @date 2024-05-27
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> implements IVehicleService {
|
public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle>
|
||||||
|
implements IVehicleService
|
||||||
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private VehicleMapper vehicleMapper;
|
private VehicleMapper vehicleMapper;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RemoteFileService remoteFileService;
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RemoteUserService remoteUserService;
|
private RemoteUserService remoteUserService;
|
||||||
|
|
||||||
|
// @Autowired
|
||||||
|
// private IBusinessService businessService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RemoteFileService remoteFileService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆录入
|
||||||
|
*
|
||||||
|
* @param id 车辆录入主键
|
||||||
|
* @return 车辆录入
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Vehicle selectVehicleById(Long id) {
|
public Vehicle selectVehicleById(Long id)
|
||||||
|
{
|
||||||
return vehicleMapper.selectVehicleById(id);
|
return vehicleMapper.selectVehicleById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆录入列表
|
||||||
|
*
|
||||||
|
* @param vehicle 车辆录入
|
||||||
|
* @return 车辆录入
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Vehicle> selectVehicleList(Vehicle vehicle)
|
public List<Vehicle> selectVehicleList(Vehicle vehicle)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue