车联网企业
parent
9bff15c62d
commit
b2dac616d5
|
@ -16,7 +16,7 @@ import java.lang.annotation.*;
|
|||
// 表示通过aop框架暴露该代理对象,AopContext能够访问
|
||||
@EnableAspectJAutoProxy(exposeProxy = true)
|
||||
// 指定要扫描的Mapper类的包的路径
|
||||
@MapperScan("com.muyu.**.mapper")
|
||||
@MapperScan(value = {"com.muyu.**.mapper","com.xiaohuang.**.mapper"})
|
||||
// 开启线程异步执行
|
||||
@EnableAsync
|
||||
// 自动加载类
|
||||
|
|
|
@ -85,6 +85,11 @@ public class SysUser extends BaseEntity {
|
|||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 用户类型
|
||||
*/
|
||||
private String userType;
|
||||
|
||||
/**
|
||||
* 帐号状态(0正常 1停用)
|
||||
*/
|
||||
|
@ -323,6 +328,7 @@ public class SysUser extends BaseEntity {
|
|||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.append("dept", getDept())
|
||||
.append("userType",userType)
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
package com.muyu.common.system.remote;
|
||||
|
||||
|
||||
import com.muyu.common.core.constant.SecurityConstants;
|
||||
import com.muyu.common.core.constant.ServiceNameConstants;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.common.system.remote.factory.RemoteUserFallbackFactory;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import lombok.extern.java.Log;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 用户服务
|
||||
*
|
||||
* @author muyu
|
||||
* @author zhiLian
|
||||
*/
|
||||
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
|
||||
public interface RemoteUserService {
|
||||
|
@ -37,4 +40,7 @@ public interface RemoteUserService {
|
|||
*/
|
||||
@PostMapping("/user/register")
|
||||
public Result<Boolean> registerUserInfo (@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
@PostMapping("/user")
|
||||
public Result add (@Validated @RequestBody SysUser user);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.muyu.common.system.remote.factory;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.system.remote.RemoteUserService;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.common.system.remote.RemoteUserService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
|
@ -12,7 +12,7 @@ import org.springframework.stereotype.Component;
|
|||
/**
|
||||
* 用户服务降级处理
|
||||
*
|
||||
* @author muyu
|
||||
* @author zhiLian
|
||||
*/
|
||||
@Component
|
||||
public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserService> {
|
||||
|
@ -31,6 +31,13 @@ public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserServ
|
|||
public Result<Boolean> registerUserInfo (SysUser sysUser, String source) {
|
||||
return Result.error("注册用户失败:" + throwable.getMessage());
|
||||
}
|
||||
//好像写有 添加用户 远程调用是这个?不知道启动一下吧应该没问题OK 你先学 我自己再看看
|
||||
|
||||
@Override
|
||||
public Result add(SysUser user) {
|
||||
return Result.error("注册用户失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
<module>muyu-gen</module>
|
||||
<module>muyu-job</module>
|
||||
<module>muyu-file</module>
|
||||
<module>xiaohuang-business</module>
|
||||
<module>xiaohuang-vehicle</module>
|
||||
|
||||
</modules>
|
||||
|
||||
<artifactId>muyu-modules</artifactId>
|
||||
|
|
|
@ -0,0 +1,114 @@
|
|||
<?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.muyu</groupId>
|
||||
<artifactId>muyu-modules</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>xiaohuang-business</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>
|
||||
xiaohuang-business系统模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- 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>
|
||||
|
||||
<!-- MuYu Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-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>
|
|
@ -0,0 +1,24 @@
|
|||
package com.xiaohuang.business;
|
||||
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 启动 XiaoHuangApplication
|
||||
*
|
||||
* @author xiaohuang
|
||||
* on 2024/5/27
|
||||
*/
|
||||
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
public class XiaoHuangApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(XiaoHuangApplication.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
package com.xiaohuang.business.controller;
|
||||
|
||||
import com.xiaohuang.business.service.IBusinessService;
|
||||
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 com.xiaohuang.business.domain.Business;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业 BusinessController
|
||||
*
|
||||
* @author xiaohuang
|
||||
* on 2024/5/27
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/business")
|
||||
public class BusinessController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IBusinessService businessService;
|
||||
|
||||
/**
|
||||
* 查询企业列表
|
||||
*/
|
||||
// @RequiresPermissions("system:business:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<Business>> list(Business business)
|
||||
{
|
||||
startPage();
|
||||
List<Business> list = businessService.selectBusinessList(business);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出企业列表
|
||||
*/
|
||||
// @RequiresPermissions("system:business:export")
|
||||
@Log(title = "企业", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Business business)
|
||||
{
|
||||
List<Business> list = businessService.selectBusinessList(business);
|
||||
ExcelUtil<Business> util = new ExcelUtil<Business>(Business.class);
|
||||
util.exportExcel(response, list, "企业数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取企业详细信息
|
||||
*/
|
||||
// @RequiresPermissions("system:business:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(businessService.selectBusinessById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增企业
|
||||
*/
|
||||
// @RequiresPermissions("system:business:add")
|
||||
@Log(title = "企业", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public Result add(@RequestBody Business business)
|
||||
{
|
||||
return toAjax(businessService.insertBusiness(business));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改企业
|
||||
*/
|
||||
// @RequiresPermissions("system:business:edit")
|
||||
@Log(title = "企业", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public Result edit(@RequestBody Business business)
|
||||
{
|
||||
return toAjax(businessService.updateBusiness(business));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@Log(title = "企业", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(businessService.deleteBusinessByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
package com.xiaohuang.business.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
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;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Business
|
||||
*
|
||||
* @author xiaohuang
|
||||
* on 2024/5/27
|
||||
*/
|
||||
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("mapper.business")
|
||||
public class Business extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 企业主键 */
|
||||
@Excel(name = "企业主键")
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 企业名称 */
|
||||
@Excel(name = "企业名称")
|
||||
private String name;
|
||||
|
||||
/** 企业法定代表人 */
|
||||
@Excel(name = "企业法定代表人")
|
||||
private String businessPerson;
|
||||
|
||||
/** 营业编码 */
|
||||
@Excel(name = "营业编码")
|
||||
private String businessLincenseNumber;
|
||||
|
||||
/** 企业创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "企业创建时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date businessCreateTime;
|
||||
|
||||
/** 企业电话 */
|
||||
@Excel(name = "企业电话")
|
||||
private String businessPhone;
|
||||
|
||||
/** 企业邮箱 */
|
||||
@Excel(name = "企业邮箱")
|
||||
private String businessEmail;
|
||||
|
||||
/** 企业状态 */
|
||||
@Excel(name = "企业状态")
|
||||
private String businessStates;
|
||||
|
||||
/** 入驻车联网平台时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "入驻车联网平台时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date businessRegistrationDate;
|
||||
|
||||
/** 服务等级0/1/2 */
|
||||
@Excel(name = "服务等级0/1/2")
|
||||
private String serviceLevel;
|
||||
|
||||
/** 认证等级0/1 */
|
||||
@Excel(name = "认证等级0/1")
|
||||
private String authentication;
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package com.xiaohuang.business.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.xiaohuang.business.domain.Business;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业Mapper接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-05-26
|
||||
*/
|
||||
public interface BusinessMapper extends BaseMapper<Business>
|
||||
{
|
||||
/**
|
||||
* 查询企业
|
||||
*
|
||||
* @param id 企业主键
|
||||
* @return 企业
|
||||
*/
|
||||
public Business selectBusinessById(Long id);
|
||||
|
||||
/**
|
||||
* 查询企业列表
|
||||
*
|
||||
* @param business 企业
|
||||
* @return 企业集合
|
||||
*/
|
||||
public List<Business> selectBusinessList(Business business);
|
||||
|
||||
/**
|
||||
* 新增企业
|
||||
*
|
||||
* @param business 企业
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBusiness(Business business);
|
||||
|
||||
/**
|
||||
* 修改企业
|
||||
*
|
||||
* @param business 企业
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBusiness(Business business);
|
||||
|
||||
/**
|
||||
* 删除企业
|
||||
*
|
||||
* @param id 企业主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBusinessById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除企业
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBusinessByIds(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.xiaohuang.business.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xiaohuang.business.domain.Business;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* IBusinessService
|
||||
*
|
||||
* @author xiaohuang
|
||||
* on 2024/5/27
|
||||
*/
|
||||
public interface IBusinessService extends IService<Business> {
|
||||
/**
|
||||
* 查询企业
|
||||
*
|
||||
* @param id 企业主键
|
||||
* @return 企业
|
||||
*/
|
||||
public Business selectBusinessById(Long id);
|
||||
|
||||
/**
|
||||
* 查询企业列表
|
||||
*
|
||||
* @param business 企业
|
||||
* @return 企业集合
|
||||
*/
|
||||
public List<Business> selectBusinessList(Business business);
|
||||
|
||||
/**
|
||||
* 新增企业
|
||||
*
|
||||
* @param business 企业
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBusiness(Business business);
|
||||
|
||||
/**
|
||||
* 修改企业
|
||||
*
|
||||
* @param business 企业
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBusiness(Business business);
|
||||
|
||||
/**
|
||||
* 批量删除企业
|
||||
*
|
||||
* @param ids 需要删除的企业主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBusinessByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除企业信息
|
||||
*
|
||||
* @param id 企业主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBusinessById(Long id);
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
package com.xiaohuang.business.service.impl;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
import com.muyu.common.system.remote.RemoteUserService;
|
||||
import com.xiaohuang.business.domain.Business;
|
||||
import com.xiaohuang.business.mapper.BusinessMapper;
|
||||
import com.xiaohuang.business.service.IBusinessService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* BusinessServiceImpl
|
||||
*
|
||||
* @author xiaohuang
|
||||
* on 2024/5/27
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business> implements IBusinessService {
|
||||
|
||||
@Autowired
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
/**
|
||||
* 查询企业
|
||||
*
|
||||
* @param id 企业主键
|
||||
* @return 企业
|
||||
*/
|
||||
@Override
|
||||
public Business selectBusinessById(Long id)
|
||||
{
|
||||
return this.baseMapper.selectBusinessById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询企业列表
|
||||
*
|
||||
* @param business 企业
|
||||
* @return 企业
|
||||
*/
|
||||
@Override
|
||||
public List<Business> selectBusinessList(Business business)
|
||||
{
|
||||
return this.baseMapper.selectBusinessList(business);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertBusiness(Business business)
|
||||
{
|
||||
business.setCreateTime(DateUtils.getNowDate());
|
||||
int i = this.baseMapper.insertBusiness(business);
|
||||
System.out.println(business);
|
||||
SysUser sysUser = SysUser.builder()
|
||||
.userName(business.getName() + business.getId())
|
||||
.password("admin123")
|
||||
.nickName(business.getName())
|
||||
.email(business.getBusinessEmail())
|
||||
.phonenumber(business.getBusinessPhone())
|
||||
.loginIp("175.24.138.82")
|
||||
.userType(String.valueOf(business.getId()))
|
||||
.build();
|
||||
Result add = remoteUserService.add(sysUser);
|
||||
System.out.println(sysUser);
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改企业
|
||||
*
|
||||
* @param business 企业
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBusiness(Business business)
|
||||
{
|
||||
business.setUpdateTime(DateUtils.getNowDate());
|
||||
return this.baseMapper.updateBusiness(business);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除企业
|
||||
*
|
||||
* @param ids 需要删除的企业主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBusinessByIds(Long[] ids)
|
||||
{
|
||||
return this.baseMapper.deleteBusinessByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除企业信息
|
||||
*
|
||||
* @param id 企业主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBusinessById(Long id)
|
||||
{
|
||||
return this.baseMapper.deleteBusinessById(id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,28 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9104
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: xiaohuang-business
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 175.24.138.82:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 175.24.138.82:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
logging:
|
||||
level:
|
||||
com.xiaohuang.business.mapper: DEBUG
|
|
@ -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/xiaohuang-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>
|
|
@ -0,0 +1,121 @@
|
|||
<?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.xiaohuang.business.mapper.BusinessMapper">
|
||||
|
||||
<resultMap type="com.xiaohuang.business.domain.Business" id="BusinessResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="businessPerson" column="business_person" />
|
||||
<result property="businessLincenseNumber" column="business_lincense_number" />
|
||||
<result property="businessCreateTime" column="business_create_time" />
|
||||
<result property="businessPhone" column="business_phone" />
|
||||
<result property="businessEmail" column="business_email" />
|
||||
<result property="businessStates" column="business_states" />
|
||||
<result property="businessRegistrationDate" column="business_registration_date" />
|
||||
<result property="serviceLevel" column="service_level" />
|
||||
<result property="authentication" column="authentication" />
|
||||
<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="selectBusinessVo">
|
||||
select id, name, business_person, business_lincense_number, business_create_time, business_phone, business_email, business_states, business_registration_date, service_level, authentication, remark, create_by, create_time, update_by, update_time from business
|
||||
</sql>
|
||||
|
||||
<select id="selectBusinessList" parameterType="com.xiaohuang.business.domain.Business" resultMap="BusinessResult">
|
||||
<include refid="selectBusinessVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="businessPerson != null and businessPerson != ''"> and business_person = #{businessPerson}</if>
|
||||
<if test="businessLincenseNumber != null and businessLincenseNumber != ''"> and business_lincense_number = #{businessLincenseNumber}</if>
|
||||
<if test="businessCreateTime != null "> and business_create_time = #{businessCreateTime}</if>
|
||||
<if test="businessPhone != null and businessPhone != ''"> and business_phone = #{businessPhone}</if>
|
||||
<if test="businessEmail != null and businessEmail != ''"> and business_email = #{businessEmail}</if>
|
||||
<if test="businessStates != null and businessStates != ''"> and business_states = #{businessStates}</if>
|
||||
<if test="businessRegistrationDate != null "> and business_registration_date = #{businessRegistrationDate}</if>
|
||||
<if test="serviceLevel != null and serviceLevel != ''"> and service_level = #{serviceLevel}</if>
|
||||
<if test="authentication != null and authentication != ''"> and authentication = #{authentication}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBusinessById" parameterType="Long" resultMap="BusinessResult">
|
||||
<include refid="selectBusinessVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertBusiness" parameterType="com.xiaohuang.business.domain.Business" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into business
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">name,</if>
|
||||
<if test="businessPerson != null">business_person,</if>
|
||||
<if test="businessLincenseNumber != null">business_lincense_number,</if>
|
||||
<if test="businessCreateTime != null">business_create_time,</if>
|
||||
<if test="businessPhone != null">business_phone,</if>
|
||||
<if test="businessEmail != null">business_email,</if>
|
||||
<if test="businessStates != null">business_states,</if>
|
||||
<if test="businessRegistrationDate != null">business_registration_date,</if>
|
||||
<if test="serviceLevel != null">service_level,</if>
|
||||
<if test="authentication != null">authentication,</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="name != null">#{name},</if>
|
||||
<if test="businessPerson != null">#{businessPerson},</if>
|
||||
<if test="businessLincenseNumber != null">#{businessLincenseNumber},</if>
|
||||
<if test="businessCreateTime != null">#{businessCreateTime},</if>
|
||||
<if test="businessPhone != null">#{businessPhone},</if>
|
||||
<if test="businessEmail != null">#{businessEmail},</if>
|
||||
<if test="businessStates != null">#{businessStates},</if>
|
||||
<if test="businessRegistrationDate != null">#{businessRegistrationDate},</if>
|
||||
<if test="serviceLevel != null">#{serviceLevel},</if>
|
||||
<if test="authentication != null">#{authentication},</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="updateBusiness" parameterType="com.xiaohuang.business.domain.Business">
|
||||
update business
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="businessPerson != null">business_person = #{businessPerson},</if>
|
||||
<if test="businessLincenseNumber != null">business_lincense_number = #{businessLincenseNumber},</if>
|
||||
<if test="businessCreateTime != null">business_create_time = #{businessCreateTime},</if>
|
||||
<if test="businessPhone != null">business_phone = #{businessPhone},</if>
|
||||
<if test="businessEmail != null">business_email = #{businessEmail},</if>
|
||||
<if test="businessStates != null">business_states = #{businessStates},</if>
|
||||
<if test="businessRegistrationDate != null">business_registration_date = #{businessRegistrationDate},</if>
|
||||
<if test="serviceLevel != null">service_level = #{serviceLevel},</if>
|
||||
<if test="authentication != null">authentication = #{authentication},</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="deleteBusinessById" parameterType="Long">
|
||||
delete from business where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBusinessByIds" parameterType="String">
|
||||
delete from business where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -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.muyu</groupId>
|
||||
<artifactId>muyu</artifactId>
|
||||
<version>3.6.3</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>xiaohuang-vehicle</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>
|
||||
xiaohuang-vehicle业务模块系统
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- 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>
|
||||
|
||||
<!-- MuYu Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-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>
|
|
@ -0,0 +1,24 @@
|
|||
package com.xiaohuang.vehicle;
|
||||
|
||||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableMyFeignClients;
|
||||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* XiaoHuangVehicleApplication
|
||||
*
|
||||
* @author xiaohuang
|
||||
* on 2024/5/28
|
||||
*/
|
||||
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
public class XiaoHuangVehicleApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(XiaoHuangVehicleApplication.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
package com.xiaohuang.vehicle.controller;
|
||||
|
||||
|
||||
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 com.xiaohuang.vehicle.domain.Vehicle;
|
||||
import com.xiaohuang.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));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package com.xiaohuang.vehicle.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 车辆录入对象 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;
|
||||
|
||||
/** 车辆主键 */
|
||||
@TableId(type = IdType.AUTO)
|
||||
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;
|
||||
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package com.xiaohuang.vehicle.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.xiaohuang.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);
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package com.xiaohuang.vehicle.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xiaohuang.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);
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
package com.xiaohuang.vehicle.service.impl;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import com.xiaohuang.vehicle.domain.Vehicle;
|
||||
import com.xiaohuang.vehicle.mapper.VehicleMapper;
|
||||
import com.xiaohuang.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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,32 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9212
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: xiaohuang-vehicle
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 175.24.138.82:8848
|
||||
# 命名空间
|
||||
#namespace: xiaohuang
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 175.24.138.82:8848
|
||||
# 命名空间
|
||||
#namespace: xiaohuang
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
logging:
|
||||
level:
|
||||
com.xiaohuang.vehicle.mapper: DEBUG
|
|
@ -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/xiaohuang-vehicle"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<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>
|
|
@ -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.xiaohuang.vehicle.mapper.VehicleMapper">
|
||||
|
||||
<resultMap type="com.xiaohuang.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.xiaohuang.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.xiaohuang.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.xiaohuang.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>
|
Loading…
Reference in New Issue