fix(): 代码合并
parent
9e94cf5674
commit
97994a0452
|
@ -7,7 +7,7 @@ nacos:
|
||||||
addr: 47.101.53.251:8848
|
addr: 47.101.53.251:8848
|
||||||
user-name: nacos
|
user-name: nacos
|
||||||
password: nacos
|
password: nacos
|
||||||
namespace: yzl
|
namespace: four
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class RabbitMQConsumerUtil {
|
||||||
* @param message
|
* @param message
|
||||||
* @param channel
|
* @param channel
|
||||||
*/
|
*/
|
||||||
@RabbitListener(queuesToDeclare = @Queue(name = "basic"))
|
// @RabbitListener(queuesToDeclare = @Queue(name = "basic"))
|
||||||
public void rabbitMQBasicConsumer(String data ,Message message , Channel channel) {
|
public void rabbitMQBasicConsumer(String data ,Message message , Channel channel) {
|
||||||
log.info("当前时间:{} :RabbitMQConsumerUtil : {}", new Date(), message);
|
log.info("当前时间:{} :RabbitMQConsumerUtil : {}", new Date(), message);
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -33,9 +33,10 @@
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-common-security</artifactId>
|
<artifactId>cloud-common-security</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -6,17 +6,17 @@ import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration;
|
||||||
import com.muyu.cloud.common.many.datasource.constents.DatasourceContent;
|
import com.muyu.cloud.common.many.datasource.constents.DatasourceContent;
|
||||||
import com.muyu.cloud.common.many.datasource.domain.model.DataSourceInfo;
|
import com.muyu.cloud.common.many.datasource.domain.model.DataSourceInfo;
|
||||||
import com.muyu.cloud.common.many.datasource.factory.DruidDataSourceFactory;
|
import com.muyu.cloud.common.many.datasource.factory.DruidDataSourceFactory;
|
||||||
|
import com.muyu.cloud.common.many.datasource.init.InitDataSource;
|
||||||
import com.muyu.cloud.common.many.datasource.role.DynamicDataSource;
|
import com.muyu.cloud.common.many.datasource.role.DynamicDataSource;
|
||||||
|
import com.muyu.cloud.common.saas.domain.Datasource;
|
||||||
import com.muyu.cloud.common.saas.domain.model.EntInfo;
|
import com.muyu.cloud.common.saas.domain.model.EntInfo;
|
||||||
import com.muyu.cloud.common.saas.exception.SaaSException;
|
import com.muyu.cloud.common.saas.exception.SaaSException;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.utils.SpringUtils;
|
import com.muyu.common.core.utils.SpringUtils;
|
||||||
import com.muyu.common.system.domain.Datasource;
|
|
||||||
import com.muyu.common.system.domain.SysUser;
|
|
||||||
import com.muyu.common.system.remote.RemoteSaaSService;
|
import com.muyu.common.system.remote.RemoteSaaSService;
|
||||||
import com.muyu.common.system.remote.RemoteUserService;
|
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration;
|
import org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.ApplicationArguments;
|
import org.springframework.boot.ApplicationArguments;
|
||||||
import org.springframework.boot.ApplicationRunner;
|
import org.springframework.boot.ApplicationRunner;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
|
@ -29,8 +29,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 多数据源
|
* @Author: DongZeLiang
|
||||||
* @author liuwu
|
|
||||||
* @date: 2024/6/3
|
* @date: 2024/6/3
|
||||||
* @Description: 多数据源
|
* @Description: 多数据源
|
||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
|
@ -39,9 +38,14 @@ import java.util.Map;
|
||||||
@Component
|
@Component
|
||||||
@AutoConfiguration(before = {MybatisPlusAutoConfiguration.class, MybatisAutoConfiguration.class})
|
@AutoConfiguration(before = {MybatisPlusAutoConfiguration.class, MybatisAutoConfiguration.class})
|
||||||
public class ManyDataSource implements ApplicationRunner{
|
public class ManyDataSource implements ApplicationRunner{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private InitDataSource initDataSource;
|
||||||
|
|
||||||
|
|
||||||
private List<EntInfo> dataSourceInfoList(){
|
private List<EntInfo> dataSourceInfoList(){
|
||||||
RemoteSaaSService remoteSaaSService = SpringUtils.getBean(RemoteSaaSService.class);
|
RemoteSaaSService remoteSaaSService = SpringUtils.getBean(RemoteSaaSService.class);
|
||||||
Result<List<Datasource>> tableDataInfoResult = remoteSaaSService.findDatabaseList();
|
Result<List<Datasource>> tableDataInfoResult = initDataSource.initDatasource();
|
||||||
if (tableDataInfoResult==null){
|
if (tableDataInfoResult==null){
|
||||||
throw new SaaSException("saas远调数据源错误");
|
throw new SaaSException("saas远调数据源错误");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package com.muyu.cloud.common.many.datasource.constents;
|
package com.muyu.cloud.common.many.datasource.constents;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据源常量
|
* @author DongZl
|
||||||
* @author liuwu
|
|
||||||
* @description: 数据源常量
|
* @description: 数据源常量
|
||||||
* @Date 2023-8-1 上午 11:02
|
* @Date 2023-8-1 上午 11:02
|
||||||
*/
|
*/
|
||||||
|
@ -17,8 +16,4 @@ public class DatasourceContent {
|
||||||
public final static String IP = "47.101.53.251";
|
public final static String IP = "47.101.53.251";
|
||||||
|
|
||||||
public final static Integer PORT = 3306;
|
public final static Integer PORT = 3306;
|
||||||
|
|
||||||
public static String getDatasourceUrl(String databaseName) {
|
|
||||||
return String.format(DATASOURCE_URL,USER_NAME,PASSWORD,IP,PORT, databaseName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,7 @@ import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据源实体类
|
* @author DongZl
|
||||||
* @author liuwu
|
|
||||||
* @description: 数据源实体类
|
* @description: 数据源实体类
|
||||||
* @Date 2023-8-1 上午 11:15
|
* @Date 2023-8-1 上午 11:15
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -8,8 +8,7 @@ import org.springframework.stereotype.Component;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Druid工厂
|
* @Author: DongZeLiang
|
||||||
* @author liuwu
|
|
||||||
* @date: 2024/6/3
|
* @date: 2024/6/3
|
||||||
* @Description: Druid工厂
|
* @Description: Druid工厂
|
||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
|
|
|
@ -6,7 +6,7 @@ import org.springframework.util.Assert;
|
||||||
/**
|
/**
|
||||||
* 数据源切换处理
|
* 数据源切换处理
|
||||||
*
|
*
|
||||||
* @author liuwu
|
* @author Dongzl
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class DynamicDataSourceHolder {
|
public class DynamicDataSourceHolder {
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.muyu.cloud.common.many.datasource.init;
|
||||||
|
|
||||||
|
|
||||||
|
import com.muyu.cloud.common.saas.domain.Datasource;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.sql.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Log4j2
|
||||||
|
public class InitDataSource {
|
||||||
|
|
||||||
|
public static final String USER="root";
|
||||||
|
public static final String PASSWORD="Lw030106";
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@Primary
|
||||||
|
public Result<List<Datasource>> initDatasource(){
|
||||||
|
ArrayList<Datasource> list = new ArrayList<>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
DriverManager.registerDriver(new com.mysql.cj.jdbc.Driver());
|
||||||
|
Connection connection= DriverManager.getConnection("jdbc:mysql://47.101.53.251:3306/datasource?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT&useSSL=false",USER,PASSWORD);
|
||||||
|
String sql="select * from `datasource` ";
|
||||||
|
|
||||||
|
Statement stmt = connection.createStatement();
|
||||||
|
ResultSet rs = stmt.executeQuery(sql);
|
||||||
|
|
||||||
|
while (rs.next()){
|
||||||
|
Datasource datasource = new Datasource();
|
||||||
|
datasource.setId(rs.getInt("id"));
|
||||||
|
datasource.setFirmName(rs.getString("firm_name"));
|
||||||
|
datasource.setDatabaseName(rs.getString("database_name"));
|
||||||
|
list.add(datasource);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return Result.success(list);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,8 +1,7 @@
|
||||||
package com.muyu.cloud.common.saas.contents;
|
package com.muyu.cloud.common.saas.contents;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SAAS常量
|
* @Author: DongZeLiang
|
||||||
* @author liuwu
|
|
||||||
* @date: 2024/6/3
|
* @date: 2024/6/3
|
||||||
* @Description: SAAS常量
|
* @Description: SAAS常量
|
||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
|
|
|
@ -6,7 +6,7 @@ import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: liuwu
|
* @Author: DongZeLiang
|
||||||
* @date: 2024/6/3
|
* @date: 2024/6/3
|
||||||
* @Description: 企业信息
|
* @Description: 企业信息
|
||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
|
|
|
@ -4,8 +4,7 @@ package com.muyu.cloud.common.saas.exception;
|
||||||
import com.muyu.common.core.exception.ServiceException;
|
import com.muyu.common.core.exception.ServiceException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SaaS异常类
|
* @Author: DongZeLiang
|
||||||
* @author liuwu
|
|
||||||
* @date: 2024/6/3
|
* @date: 2024/6/3
|
||||||
* @Description: SaaS异常类
|
* @Description: SaaS异常类
|
||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
package com.muyu.cloud.common.saas.interceptor;
|
package com.muyu.cloud.common.saas.interceptor;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
|
||||||
import com.muyu.cloud.common.saas.contents.SaaSConstant;
|
|
||||||
import com.muyu.cloud.common.many.datasource.holder.DynamicDataSourceHolder;
|
import com.muyu.cloud.common.many.datasource.holder.DynamicDataSourceHolder;
|
||||||
import com.muyu.cloud.common.saas.exception.SaaSException;
|
|
||||||
import com.muyu.cloud.common.many.datasource.role.DynamicDataSource;
|
import com.muyu.cloud.common.many.datasource.role.DynamicDataSource;
|
||||||
|
import com.muyu.cloud.common.saas.contents.SaaSConstant;
|
||||||
|
import com.muyu.cloud.common.saas.exception.SaaSException;
|
||||||
import com.muyu.common.core.utils.ServletUtils;
|
import com.muyu.common.core.utils.ServletUtils;
|
||||||
import com.muyu.common.core.utils.SpringUtils;
|
import com.muyu.common.core.utils.SpringUtils;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
@ -14,8 +13,7 @@ import org.springframework.web.servlet.AsyncHandlerInterceptor;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SAAS拦截器
|
* @Author: DongZeLiang
|
||||||
* @author liuwu
|
|
||||||
* @date: 2024/6/3
|
* @date: 2024/6/3
|
||||||
* @Description: SAAS拦截器
|
* @Description: SAAS拦截器
|
||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
com.muyu.cloud.common.saas.interceptor.WebMvcSaaSConfig
|
||||||
|
com.muyu.cloud.common.many.datasource.ManyDataSource
|
||||||
|
com.muyu.cloud.common.many.datasource.factory.DruidDataSourceFactory
|
|
@ -55,7 +55,6 @@ public class MqConsumer {
|
||||||
/**
|
/**
|
||||||
* -----------------------------------以下为异步业务操作----------------------------
|
* -----------------------------------以下为异步业务操作----------------------------
|
||||||
*/
|
*/
|
||||||
List<SysCarVo> carList = sysCarCacheService.get("carList");
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -29,6 +29,7 @@ public class AddDatabaseListener implements EventListener {
|
||||||
values.add((String) value);
|
values.add((String) value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -52,6 +52,13 @@
|
||||||
<artifactId>kafka-clients</artifactId>
|
<artifactId>kafka-clients</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
|
<version>3.5.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -106,6 +106,7 @@
|
||||||
<groupId>com.muyu</groupId>
|
<groupId>com.muyu</groupId>
|
||||||
<artifactId>cloud-common-xxl</artifactId>
|
<artifactId>cloud-common-xxl</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.iotdb</groupId>
|
<groupId>org.apache.iotdb</groupId>
|
||||||
<artifactId>service-rpc</artifactId>
|
<artifactId>service-rpc</artifactId>
|
||||||
|
|
|
@ -21,8 +21,6 @@ import java.util.List;
|
||||||
* @Date 2024/9/29 12:06
|
* @Date 2024/9/29 12:06
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/carType")
|
@RequestMapping("/carType")
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.muyu.server.service.CarTypeService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,7 +23,7 @@ import java.util.List;
|
||||||
@Service
|
@Service
|
||||||
public class CarTypeServiceImpl extends ServiceImpl<CarTypeMapper, CarType> implements CarTypeService{
|
public class CarTypeServiceImpl extends ServiceImpl<CarTypeMapper, CarType> implements CarTypeService{
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private CarTypeMapper carTypeMapper;
|
private CarTypeMapper carTypeMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?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.muyu.server.mapper.CarTypeMapper">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -6,7 +6,7 @@
|
||||||
1.在mybats的开发中namespace有特殊的意思,一定要是对应接口的全限定名
|
1.在mybats的开发中namespace有特殊的意思,一定要是对应接口的全限定名
|
||||||
通过namespace可以简历mapper.xml和接口之间的关系(名字不重要,位置不重要)
|
通过namespace可以简历mapper.xml和接口之间的关系(名字不重要,位置不重要)
|
||||||
-->
|
-->
|
||||||
<mapper namespace="com.muyu.server.mapper.EnterpriseMapper">
|
<mapper namespace="com.muyu.server.mapper.EnterpriseDao">
|
||||||
|
|
||||||
<!--查询企业信息-->
|
<!--查询企业信息-->
|
||||||
<select id="selectEnterprise" resultType="HashMap" parameterType="Map">
|
<select id="selectEnterprise" resultType="HashMap" parameterType="Map">
|
||||||
|
@ -27,19 +27,18 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!--新增企业信息-->
|
<!--新增企业信息-->
|
||||||
<insert id="insert" parameterType="com.muyu.server.mapper.EnterpriseMapper">
|
<insert id="insert" parameterType="com.muyu.server.mapper.EnterpriseDao">
|
||||||
insert into tb_enterprise
|
insert into tb_enterprise
|
||||||
set enterprise_name = #{enterpriseName},
|
set enterprise_name = #{enterpriseName},
|
||||||
enterprise_car_count = #{enterpriseCarCount},
|
enterprise_car_count = #{enterpriseCarCount},
|
||||||
enterprise_fence_count = #{enterpriseFenceCount},
|
enterprise_fence_count = #{enterpriseFenceCount}
|
||||||
enterprise_database_name=#{enterpriseDatabaseName}
|
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--根据编号查询企业信息-->
|
<!--根据编号查询企业信息-->
|
||||||
<select id="searchById" resultType="java.util.HashMap">
|
<select id="searchById" resultType="java.util.HashMap">
|
||||||
select enterprise_id,enterprise_name,enterprise_car_count,enterprise_fence_count,enterprise_database_name
|
select enterprise_id,enterprise_name,enterprise_car_count,enterprise_fence_count
|
||||||
from tb_enterprise
|
from tb_enterprise
|
||||||
where enterprise_id = #{enterpriseId}
|
where enterprise_id = #{enterpriseId}
|
||||||
</select>
|
</select>
|
||||||
|
@ -48,8 +47,7 @@
|
||||||
update tb_enterprise
|
update tb_enterprise
|
||||||
set enterprise_name = #{enterpriseName},
|
set enterprise_name = #{enterpriseName},
|
||||||
enterprise_car_count = #{enterpriseCarCount},
|
enterprise_car_count = #{enterpriseCarCount},
|
||||||
enterprise_fence_count = #{enterpriseFenceCount},
|
enterprise_fence_count = #{enterpriseFenceCount}
|
||||||
enterprise_database_name=#{enterpriseDatabaseName}
|
|
||||||
where enterprise_id = #{enterpriseId} and enterprise_id != 0
|
where enterprise_id = #{enterpriseId} and enterprise_id != 0
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
|
@ -77,5 +77,7 @@
|
||||||
<select id="findCarByVin" resultType="com.muyu.common.domain.SysCar">
|
<select id="findCarByVin" resultType="com.muyu.common.domain.SysCar">
|
||||||
select * from sys_car where car_vin=#{carVin}
|
select * from sys_car where car_vin=#{carVin}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectByCarVin" resultType="com.muyu.common.domain.SysCar">
|
||||||
|
select * from sys_car where car_cin=#{carVin}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?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.muyu.server.mapper.TemplateNeedMapper">
|
||||||
|
|
||||||
|
<select id="selectByTemplateId" resultType="com.muyu.common.domain.MessageTemplateType">
|
||||||
|
SELECT * FROM `message_template_type` WHERE template_id=#{templateId}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,140 @@
|
||||||
|
<?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.muyu.server.mapper.SysCarFaultMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.muyu.common.domain.SysCarFault" id="SysCarFaultResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="faultCode" column="fault_code" />
|
||||||
|
<result property="faultName" column="fault_name" />
|
||||||
|
<result property="typeId" column="type_id" />
|
||||||
|
<result property="faultLabel" column="fault_label" />
|
||||||
|
<result property="faultBit" column="fault_bit" />
|
||||||
|
<result property="faultValue" column="fault_value" />
|
||||||
|
<result property="faultRank" column="fault_rank" />
|
||||||
|
<result property="faultDesc" column="fault_desc" />
|
||||||
|
<result property="faultMinThreshold" column="fault_min_threshold" />
|
||||||
|
<result property="faultMaxThreshold" column="fault_max_threshold" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="warnStatus" column="warn_status" />
|
||||||
|
<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" />
|
||||||
|
<result property="carTypeId" column="car_type_id"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectSysCarFaultVo">
|
||||||
|
select id, fault_code, fault_name, type_id, fault_label, fault_bit, fault_value, fault_rank, fault_desc, fault_min_threshold, fault_max_threshold, status, warn_status, remark, create_by, create_time, update_by, update_time,car_type_id from sys_car_fault
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectSysCarFaultList" parameterType="com.muyu.common.domain.SysCarFault" resultMap="SysCarFaultResult">
|
||||||
|
<include refid="selectSysCarFaultVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="faultCode != null and faultCode != ''"> and fault_code = #{faultCode}</if>
|
||||||
|
<if test="faultBit != null and faultBit != ''"> and fault_bit = #{faultBit}</if>
|
||||||
|
<if test="faultRank != null "> and fault_rank = #{faultRank}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSysCarFaultById" parameterType="Long" resultMap="SysCarFaultResult">
|
||||||
|
<include refid="selectSysCarFaultVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
<select id="selectSysCarFaultIds" resultMap="SysCarFaultResult">
|
||||||
|
<include refid="selectSysCarFaultVo"/>
|
||||||
|
where id in
|
||||||
|
<foreach collection="array" item="id" index="index" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertSysCarFault" parameterType="com.muyu.common.domain.SysCarFault" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into sys_car_fault
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="faultCode != null and faultCode != ''">fault_code,</if>
|
||||||
|
<if test="faultName != null">fault_name,</if>
|
||||||
|
<if test="typeId != null">type_id,</if>
|
||||||
|
<if test="faultLabel != null">fault_label,</if>
|
||||||
|
<if test="faultBit != null">fault_bit,</if>
|
||||||
|
<if test="faultValue != null">fault_value,</if>
|
||||||
|
<if test="faultRank != null">fault_rank,</if>
|
||||||
|
<if test="faultDesc != null">fault_desc,</if>
|
||||||
|
<if test="faultMinThreshold != null">fault_min_threshold,</if>
|
||||||
|
<if test="faultMaxThreshold != null">fault_max_threshold,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="warnStatus != null">warn_status,</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>
|
||||||
|
<if test="carTypeId !=null">car_type_id</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="faultCode != null and faultCode != ''">#{faultCode},</if>
|
||||||
|
<if test="faultName != null">#{faultName},</if>
|
||||||
|
<if test="typeId != null">#{typeId},</if>
|
||||||
|
<if test="faultLabel != null">#{faultLabel},</if>
|
||||||
|
<if test="faultBit != null">#{faultBit},</if>
|
||||||
|
<if test="faultValue != null">#{faultValue},</if>
|
||||||
|
<if test="faultRank != null">#{faultRank},</if>
|
||||||
|
<if test="faultDesc != null">#{faultDesc},</if>
|
||||||
|
<if test="faultMinThreshold != null">#{faultMinThreshold},</if>
|
||||||
|
<if test="faultMaxThreshold != null">#{faultMaxThreshold},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="warnStatus != null">#{warnStatus},</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>
|
||||||
|
<if test="carTypeId != null">#{catTypeId}</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateSysCarFault" parameterType="com.muyu.common.domain.SysCarFault">
|
||||||
|
update sys_car_fault
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="faultCode != null and faultCode != ''">fault_code = #{faultCode},</if>
|
||||||
|
<if test="faultName != null">fault_name = #{faultName},</if>
|
||||||
|
<if test="typeId != null">type_id = #{typeId},</if>
|
||||||
|
<if test="faultLabel != null">fault_label = #{faultLabel},</if>
|
||||||
|
<if test="faultBit != null">fault_bit = #{faultBit},</if>
|
||||||
|
<if test="faultValue != null">fault_value = #{faultValue},</if>
|
||||||
|
<if test="faultRank != null">fault_rank = #{faultRank},</if>
|
||||||
|
<if test="faultDesc != null">fault_desc = #{faultDesc},</if>
|
||||||
|
<if test="faultMinThreshold != null">fault_min_threshold = #{faultMinThreshold},</if>
|
||||||
|
<if test="faultMaxThreshold != null">fault_max_threshold = #{faultMaxThreshold},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="warnStatus != null">warn_status = #{warnStatus},</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>
|
||||||
|
<if test="carTypeId !=null">car_type_id=#{catTypeId}</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteSysCarFaultById" parameterType="Long">
|
||||||
|
delete from sys_car_fault where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteSysCarFaultByIds" parameterType="String">
|
||||||
|
delete from sys_car_fault where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<update id="enableWarningsById" parameterType="Long">
|
||||||
|
update sys_car_fault set warn_status = 0 where id = #{id}
|
||||||
|
</update>
|
||||||
|
<update id="disableWarningsById" parameterType="Long">
|
||||||
|
update sys_car_fault set warn_status = 1 where id = #{id}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?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.muyu.server.mapper.DataTypeMapper">
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?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.muyu.server.mapper.MessageTemplateTypeMapper">
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?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.muyu.server.mapper.TemplateMapper">
|
||||||
|
|
||||||
|
<select id="templateList" resultType="com.muyu.common.domain.Template">
|
||||||
|
select * from t_template
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findTemplateByName" resultType="com.muyu.common.domain.Template">
|
||||||
|
select * from t_template where template_name=#{typeName}
|
||||||
|
</select>
|
||||||
|
<select id="findTemplateById" resultType="com.muyu.common.domain.MessageTemplateType">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
message_template_type
|
||||||
|
WHERE
|
||||||
|
template_id = #{templateId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue