feat:业务平台车辆录入

master
hbr 2024-05-27 21:56:38 +08:00
parent f12baddae0
commit 2332d433c6
27 changed files with 910 additions and 96 deletions

View File

@ -217,6 +217,8 @@
<module>zhiLian-common</module>
<module>zhiLian-business</module>
<module>zhiLian-iotdb</module>
<module>zhiLian-vehicle</module>
<module>zhiLian-business/zhiLian-data-service</module>
</modules>
<packaging>pom</packaging>

View File

@ -20,98 +20,6 @@
zhiLian-business系统模块
</description>
<dependencies>
<dependency>
<groupId>com.zhiLian</groupId>
<artifactId>zhiLian-common-system</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<!-- ZhiLian Common DataSource -->
<dependency>
<groupId>com.zhiLian</groupId>
<artifactId>zhiLian-common-datasource</artifactId>
</dependency>
<!-- ZhiLian Common DataScope -->
<dependency>
<groupId>com.zhiLian</groupId>
<artifactId>zhiLian-common-datascope</artifactId>
</dependency>
<!-- ZhiLian Common Log -->
<dependency>
<groupId>com.zhiLian</groupId>
<artifactId>zhiLian-common-log</artifactId>
</dependency>
<!-- ZhiLian Common Swagger -->
<dependency>
<groupId>com.zhiLian</groupId>
<artifactId>zhiLian-common-swagger</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- 加入maven deploy插件当在deploy时忽略些model-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.zhiLian</groupId>
<artifactId>zhiLian-server</artifactId>
<version>3.6.3</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>zhiLian-data-service</artifactId>
<description>
zhiLian-data-service运营中心
</description>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.zhiLian</groupId>
<artifactId>zhiLian-common-system</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<!-- ZhiLian Common DataSource -->
<dependency>
<groupId>com.zhiLian</groupId>
<artifactId>zhiLian-common-datasource</artifactId>
</dependency>
<!-- ZhiLian Common DataScope -->
<dependency>
<groupId>com.zhiLian</groupId>
<artifactId>zhiLian-common-datascope</artifactId>
</dependency>
<!-- ZhiLian Common Log -->
<dependency>
<groupId>com.zhiLian</groupId>
<artifactId>zhiLian-common-log</artifactId>
</dependency>
<!-- ZhiLian Common Swagger -->
<dependency>
<groupId>com.zhiLian</groupId>
<artifactId>zhiLian-common-swagger</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- 加入maven deploy插件当在deploy时忽略些model-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,6 +1,5 @@
package com.zhiLian.business.service.impl;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhiLian.business.domain.Business;
@ -14,6 +13,7 @@ import com.zhiLian.common.system.remote.RemoteUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
@ -71,10 +71,15 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business>
System.out.println(business);
SysUser sysUser = SysUser.builder()
.userName(business.getName() + business.getId())
.password("admin123").nickName(business.getName()).userType(String.valueOf(business.getId())).build();
.password("admin123")
.nickName(business.getName())
.email(business.getBusinessEmail())
.phonenumber(business.getBusinessPhone())
.loginIp("111.229.102.61")
.userType(String.valueOf(business.getId()))
.build();
Result add = remoteUserService.add(sysUser);
System.out.println(sysUser);
return i;
}

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/zhiLian-data-business"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.zhiLian" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<root level="info">
<appender-ref ref="console"/>
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>
</configuration>

View File

@ -241,6 +241,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
// 新增用户岗位关联
insertUserPost(user);
// 新增用户与角色管理
if (user.getRoleId()==null&& user.getRoleId().equals("")){
user.setRoleId(Long.valueOf(2));
insertUserRole(user);
return rows;
}
insertUserRole(user);
return rows;
}

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.zhiLian</groupId>
<artifactId>zhiLian-server</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>zhiLian-vehicle</artifactId>
<packaging>pom</packaging>
<modules>
<module>zhiLian-vehicle-service</module>
</modules>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.zhiLian</groupId>
<artifactId>zhiLian-vehicle</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>zhiLian-vehicle-service</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<description>
zhiLian-vehicle-service业务系统模块
</description>
<dependencies>
<dependency>
<groupId>com.zhiLian</groupId>
<artifactId>zhiLian-common-system</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<!-- ZhiLian Common DataSource -->
<dependency>
<groupId>com.zhiLian</groupId>
<artifactId>zhiLian-common-datasource</artifactId>
</dependency>
<!-- ZhiLian Common DataScope -->
<dependency>
<groupId>com.zhiLian</groupId>
<artifactId>zhiLian-common-datascope</artifactId>
</dependency>
<!-- ZhiLian Common Log -->
<dependency>
<groupId>com.zhiLian</groupId>
<artifactId>zhiLian-common-log</artifactId>
</dependency>
<!-- ZhiLian Common Swagger -->
<dependency>
<groupId>com.zhiLian</groupId>
<artifactId>zhiLian-common-swagger</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- 加入maven deploy插件当在deploy时忽略些model-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,26 @@
package com.zhiLian.vehicle;
import com.zhiLian.common.security.annotation.EnableCustomConfig;
import com.zhiLian.common.security.annotation.EnableMyFeignClients;
import com.zhiLian.common.swagger.annotation.EnableCustomSwagger2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* BingRui.Hou
*
* @Description
* @ClassName VehicleApplication
* @Date 2024/05/27 19:33
*/
@EnableCustomConfig
@EnableCustomSwagger2
@EnableMyFeignClients
@SpringBootApplication
public class ZhiLianVehicleApplication {
public static void main (String[] args) {
SpringApplication.run(ZhiLianVehicleApplication.class, args);
}
}

View File

@ -0,0 +1,99 @@
package com.zhiLian.vehicle.controller;
import com.zhiLian.common.core.domain.Result;
import com.zhiLian.common.core.utils.poi.ExcelUtil;
import com.zhiLian.common.core.web.controller.BaseController;
import com.zhiLian.common.core.web.page.TableDataInfo;
import com.zhiLian.common.log.annotation.Log;
import com.zhiLian.common.log.enums.BusinessType;
import com.zhiLian.vehicle.domain.Vehicle;
import com.zhiLian.vehicle.service.IVehicleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* Controller
*
* @author muyu
* @date 2024-05-27
*/
@RestController
@RequestMapping("/vehicle")
public class VehicleController extends BaseController
{
@Autowired
private IVehicleService vehicleService;
/**
*
*/
// @RequiresPermissions("system:vehicle:list")
@GetMapping("/list")
public Result<TableDataInfo<Vehicle>> list(Vehicle vehicle)
{
startPage();
List<Vehicle> list = vehicleService.selectVehicleList(vehicle);
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}")
public Result getInfo(@PathVariable("id") Long id)
{
return success(vehicleService.selectVehicleById(id));
}
/**
*
*/
// @RequiresPermissions("system:vehicle:add")
@Log(title = "车辆录入", businessType = BusinessType.INSERT)
@PostMapping
public Result add(@RequestBody Vehicle vehicle)
{
return toAjax(vehicleService.insertVehicle(vehicle));
}
/**
*
*/
// @RequiresPermissions("system:vehicle:edit")
@Log(title = "车辆录入", businessType = BusinessType.UPDATE)
@PutMapping
public Result edit(@RequestBody Vehicle vehicle)
{
return toAjax(vehicleService.updateVehicle(vehicle));
}
/**
*
*/
// @RequiresPermissions("system:vehicle:remove")
@Log(title = "车辆录入", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public Result remove(@PathVariable Long[] ids)
{
return toAjax(vehicleService.deleteVehicleByIds(ids));
}
}

View File

@ -0,0 +1,65 @@
package com.zhiLian.vehicle.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zhiLian.common.core.annotation.Excel;
import com.zhiLian.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* vehicle
*
* @author muyu
* @date 2024-05-27
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("vehicle")
public class Vehicle extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 车辆主键 */
private Long id;
/** 车辆vin */
@Excel(name = "车辆vin")
private Long number;
/** 车辆类型 */
@Excel(name = "车辆类型")
private Long typeId;
/** 电子围栏ID */
@Excel(name = "电子围栏ID")
private Long electonicId;
/** 电机厂商 */
@Excel(name = "电机厂商")
private String motor;
/** 电池厂商 */
@Excel(name = "电池厂商")
private String battery;
/** 电机编号 */
@Excel(name = "电机编号")
private Long motorNumber;
/** 电池编号 */
@Excel(name = "电池编号")
private Long batteryNumber;
/** 企业ID */
@Excel(name = "企业ID")
private Long enterpriseId;
}

View File

@ -0,0 +1,64 @@
package com.zhiLian.vehicle.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhiLian.vehicle.domain.Vehicle;
import java.util.List;
/**
* Mapper
*
* @author muyu
* @date 2024-05-27
*/
public interface VehicleMapper extends BaseMapper<Vehicle>
{
/**
*
*
* @param id
* @return
*/
public Vehicle selectVehicleById(Long id);
/**
*
*
* @param vehicle
* @return
*/
public List<Vehicle> selectVehicleList(Vehicle vehicle);
/**
*
*
* @param vehicle
* @return
*/
public int insertVehicle(Vehicle vehicle);
/**
*
*
* @param vehicle
* @return
*/
public int updateVehicle(Vehicle vehicle);
/**
*
*
* @param id
* @return
*/
public int deleteVehicleById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteVehicleByIds(Long[] ids);
}

View File

@ -0,0 +1,65 @@
package com.zhiLian.vehicle.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhiLian.vehicle.domain.Vehicle;
import java.util.List;
/**
* Service
*
* @author muyu
* @date 2024-05-27
*/
public interface IVehicleService extends IService<Vehicle>
{
/**
*
*
* @param id
* @return
*/
public Vehicle selectVehicleById(Long id);
/**
*
*
* @param vehicle
* @return
*/
public List<Vehicle> selectVehicleList(Vehicle vehicle);
/**
*
*
* @param vehicle
* @return
*/
public int insertVehicle(Vehicle vehicle);
/**
*
*
* @param vehicle
* @return
*/
public int updateVehicle(Vehicle vehicle);
/**
*
*
* @param ids
* @return
*/
public int deleteVehicleByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteVehicleById(Long id);
}

View File

@ -0,0 +1,100 @@
package com.zhiLian.vehicle.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhiLian.common.core.utils.DateUtils;
import com.zhiLian.vehicle.domain.Vehicle;
import com.zhiLian.vehicle.mapper.VehicleMapper;
import com.zhiLian.vehicle.service.IVehicleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
*
* @author muyu
* @date 2024-05-27
*/
@Service
public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle>
implements IVehicleService
{
@Autowired
private VehicleMapper vehicleMapper;
/**
*
*
* @param id
* @return
*/
@Override
public Vehicle selectVehicleById(Long id)
{
return vehicleMapper.selectVehicleById(id);
}
/**
*
*
* @param vehicle
* @return
*/
@Override
public List<Vehicle> selectVehicleList(Vehicle vehicle)
{
return vehicleMapper.selectVehicleList(vehicle);
}
/**
*
*
* @param vehicle
* @return
*/
@Override
public int insertVehicle(Vehicle vehicle)
{
vehicle.setCreateTime(DateUtils.getNowDate());
return vehicleMapper.insertVehicle(vehicle);
}
/**
*
*
* @param vehicle
* @return
*/
@Override
public int updateVehicle(Vehicle vehicle)
{
vehicle.setUpdateTime(DateUtils.getNowDate());
return vehicleMapper.updateVehicle(vehicle);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteVehicleByIds(Long[] ids)
{
return vehicleMapper.deleteVehicleByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteVehicleById(Long id)
{
return vehicleMapper.deleteVehicleById(id);
}
}

View File

@ -0,0 +1,2 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}

View File

@ -0,0 +1,32 @@
# Tomcat
server:
port: 9212
# Spring
spring:
application:
# 应用名称
name: zhiLian-vehicle
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 111.229.102.61:8848
# 命名空间
namespace: zhiLian
config:
# 配置中心地址
server-addr: 111.229.102.61:8848
# 命名空间
namespace: zhiLian
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
logging:
level:
com.zhiLian.vehicle.mapper: DEBUG

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/zhiLian-business"/>
<property name="log.path" value="logs/zhiLian-vehicle"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>

View File

@ -0,0 +1,113 @@
<?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.zhiLian.vehicle.mapper.VehicleMapper">
<resultMap type="com.zhiLian.vehicle.domain.Vehicle" id="VehicleResult">
<result property="id" column="id" />
<result property="number" column="number" />
<result property="typeId" column="type_id" />
<result property="electonicId" column="electonic_id" />
<result property="motor" column="motor" />
<result property="battery" column="battery" />
<result property="motorNumber" column="motor_number" />
<result property="batteryNumber" column="battery_number" />
<result property="enterpriseId" column="enterprise_id" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectVehicleVo">
select id, number, type_id, electonic_id, motor, battery, motor_number, battery_number, enterprise_id, remark, create_by, create_time, update_by, update_time from vehicle
</sql>
<select id="selectVehicleList" parameterType="com.zhiLian.vehicle.domain.Vehicle" resultMap="VehicleResult">
<include refid="selectVehicleVo"/>
<where>
<if test="number != null "> and number = #{number}</if>
<if test="typeId != null "> and type_id = #{typeId}</if>
<if test="electonicId != null "> and electonic_id = #{electonicId}</if>
<if test="motor != null and motor != ''"> and motor = #{motor}</if>
<if test="battery != null and battery != ''"> and battery = #{battery}</if>
<if test="motorNumber != null "> and motor_number = #{motorNumber}</if>
<if test="batteryNumber != null "> and battery_number = #{batteryNumber}</if>
<if test="enterpriseId != null "> and enterprise_id = #{enterpriseId}</if>
</where>
</select>
<select id="selectVehicleById" parameterType="Long" resultMap="VehicleResult">
<include refid="selectVehicleVo"/>
where id = #{id}
</select>
<insert id="insertVehicle" parameterType="com.zhiLian.vehicle.domain.Vehicle">
insert into vehicle
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="number != null">number,</if>
<if test="typeId != null">type_id,</if>
<if test="electonicId != null">electonic_id,</if>
<if test="motor != null">motor,</if>
<if test="battery != null">battery,</if>
<if test="motorNumber != null">motor_number,</if>
<if test="batteryNumber != null">battery_number,</if>
<if test="enterpriseId != null">enterprise_id,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="number != null">#{number},</if>
<if test="typeId != null">#{typeId},</if>
<if test="electonicId != null">#{electonicId},</if>
<if test="motor != null">#{motor},</if>
<if test="battery != null">#{battery},</if>
<if test="motorNumber != null">#{motorNumber},</if>
<if test="batteryNumber != null">#{batteryNumber},</if>
<if test="enterpriseId != null">#{enterpriseId},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateVehicle" parameterType="com.zhiLian.vehicle.domain.Vehicle">
update vehicle
<trim prefix="SET" suffixOverrides=",">
<if test="number != null">number = #{number},</if>
<if test="typeId != null">type_id = #{typeId},</if>
<if test="electonicId != null">electonic_id = #{electonicId},</if>
<if test="motor != null">motor = #{motor},</if>
<if test="battery != null">battery = #{battery},</if>
<if test="motorNumber != null">motor_number = #{motorNumber},</if>
<if test="batteryNumber != null">battery_number = #{batteryNumber},</if>
<if test="enterpriseId != null">enterprise_id = #{enterpriseId},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteVehicleById" parameterType="Long">
delete from vehicle where id = #{id}
</delete>
<delete id="deleteVehicleByIds" parameterType="String">
delete from vehicle where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>