feat():连接车辆类型与模板

psr
yuan 2024-09-23 10:59:43 +08:00
parent b3ce3825ad
commit 833e554722
17 changed files with 273 additions and 2 deletions

3
.gitignore vendored
View File

@ -12,6 +12,8 @@ out
######################################################################
# IDE
### STS ###
.apt_generated
.classpath
@ -26,6 +28,7 @@ logs
*.iws
*.iml
*.ipr
*.yml
### JRebel ###
rebel.xml

View File

@ -21,6 +21,7 @@
<module>cloud-common-xxl</module>
<module>cloud-common-rabbit</module>
<module>cloud-common-saas</module>
<module>cloud-common-wechat</module>
</modules>
<artifactId>cloud-common</artifactId>

View File

@ -5,8 +5,9 @@ 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.security.annotation.RequiresPermissions;
import com.muyu.common.security.utils.SecurityUtils;
import com.muyu.warn.domain.WarnRule;
import com.muyu.warn.domain.car.CarMessageType;
import com.muyu.warn.domain.car.resp.CarMessageResp;
import com.muyu.warn.service.WarnRuleService;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.validation.annotation.Validated;
@ -103,4 +104,17 @@ public class WarnRuleController extends BaseController
warnRuleService.removeBatchByIds(Arrays.asList(ids));
return success();
}
/**
*
*/
@RequiresPermissions("platform:rule:msg")
@GetMapping("/msg/{id}")
public Result<List<CarMessageResp>> findByMsg(@PathVariable("id") Long id)
{
return success(warnRuleService.findByMsg(id));
}
}

View File

@ -5,7 +5,7 @@ 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.security.annotation.RequiresPermissions;
import com.muyu.common.security.utils.SecurityUtils;
import com.muyu.warn.domain.car.CartType;
import com.muyu.warn.domain.WarnStrategy;
import com.muyu.warn.service.WarnStrategyService;
import jakarta.servlet.http.HttpServletResponse;
@ -103,4 +103,11 @@ public class WarnStrategyController extends BaseController
warnStrategyService.removeBatchByIds(Arrays.asList(ids));
return success();
}
@RequiresPermissions("platform:strategy:cartype")
@PostMapping("/findByCarType")
public Result<List<CartType>> findByCarType(){
return Result.success(warnStrategyService.findByCarType());
}
}

View File

@ -0,0 +1,48 @@
package com.muyu.warn.domain.car;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author
* @Packagecom.muyu.warn.domain.car
* @Projectcloud-server-8
* @nameCarMessageType
* @Date2024/9/22 3:08
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CarMessage {
/**
*
*/
private Integer carMessageId ;
/**
*
*/
private Integer carMessageCarype ;
/**
*
*/
private Integer carMessageType ;
/**
*
*/
private Integer carMessageStartIndex ;
/**
*
*/
private Integer carMessageEndIndex ;
/**
* ( )
*/
private String messageTypeClass ;
/**
* (0 1)
*/
private Integer carMessageState ;
}

View File

@ -0,0 +1,36 @@
package com.muyu.warn.domain.car;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author
* @Packagecom.muyu.warn.domain.car
* @Projectcloud-server-8
* @nameCarMessage
* @Date2024/9/22 3:07
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CarMessageType {
/**
*
*/
private Integer messageTypeId ;
/**
*
*/
private String messageTypeCode ;
/**
*
*/
private String messageTypeName ;
/**
*
*/
private String messageTypeBelongs ;
}

View File

@ -0,0 +1,32 @@
package com.muyu.warn.domain.car;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author
* @Packagecom.muyu.warn.domain
* @Projectcloud-server-8
* @nameCartType
* @Date2024/9/21 7:38
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CartType {
/**
* ID
*/
private String carTypeId ;
/**
*
*/
private String carTypeName ;
/**
* ID
*/
private String carTypeRules ;
}

View File

@ -0,0 +1,54 @@
package com.muyu.warn.domain.car.resp;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author
* @Packagecom.muyu.warn.domain.car
* @Projectcloud-server-8
* @nameresp
* @Date2024/9/22 7:12
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CarMessageResp {
/**
*
*/
private Integer carMessageId ;
/**
*
*/
private Integer carMessageCartype ;
/**
*
*/
private Integer carMessageType ;
/**
*
*/
private String messageTypeName ;
/**
*
*/
private Integer carMessageStartIndex ;
/**
*
*/
private Integer carMessageEndIndex ;
/**
* ( )
*/
private String messageTypeClass ;
/**
* (0 1)
*/
private Integer carMessageState ;
}

View File

@ -2,7 +2,12 @@ package com.muyu.warn.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.warn.domain.WarnRule;
import com.muyu.warn.domain.car.CarMessageType;
import com.muyu.warn.domain.car.resp.CarMessageResp;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Author
@ -14,4 +19,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface WarnRuleMapper extends BaseMapper<WarnRule> {
List<CarMessageResp> findByMsg(@Param("id") Long id);
}

View File

@ -1,9 +1,12 @@
package com.muyu.warn.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.warn.domain.car.CartType;
import com.muyu.warn.domain.WarnStrategy;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Author
* @Packagecom.muyu.warn.controller
@ -14,4 +17,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface WarnStrategyMapper extends BaseMapper<WarnStrategy> {
List<CartType> findByCarType();
}

View File

@ -2,6 +2,8 @@ package com.muyu.warn.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.warn.domain.WarnRule;
import com.muyu.warn.domain.car.CarMessageType;
import com.muyu.warn.domain.car.resp.CarMessageResp;
import java.util.List;
@ -36,4 +38,10 @@ public interface WarnRuleService extends IService<WarnRule> {
*/
Boolean checkIdUnique(WarnRule warnRule);
/**
*
* @param id
* @return
*/
List<CarMessageResp> findByMsg(Long id);
}

View File

@ -1,6 +1,7 @@
package com.muyu.warn.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.warn.domain.car.CartType;
import com.muyu.warn.domain.WarnStrategy;
import java.util.List;
@ -36,4 +37,5 @@ public interface WarnStrategyService extends IService<WarnStrategy> {
*/
Boolean checkIdUnique(WarnStrategy warnStrategy);
List<CartType> findByCarType();
}

View File

@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.common.core.utils.StringUtils;
import com.muyu.warn.domain.WarnRule;
import com.muyu.warn.domain.car.CarMessageType;
import com.muyu.warn.domain.car.resp.CarMessageResp;
import com.muyu.warn.mapper.WarnRuleMapper;
import com.muyu.warn.service.WarnRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
@ -23,6 +26,8 @@ public class WarnRuleServiceImpl
extends ServiceImpl<WarnRuleMapper, WarnRule>
implements WarnRuleService {
@Autowired private WarnRuleMapper warnRuleMapper;
/**
*
*
@ -85,4 +90,9 @@ public class WarnRuleServiceImpl
return this.count(queryWrapper) > 0;
}
@Override
public List<CarMessageResp> findByMsg(Long id) {
return warnRuleMapper.findByMsg(id);
}
}

View File

@ -3,9 +3,11 @@ package com.muyu.warn.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.common.core.utils.StringUtils;
import com.muyu.warn.domain.car.CartType;
import com.muyu.warn.domain.WarnStrategy;
import com.muyu.warn.mapper.WarnStrategyMapper;
import com.muyu.warn.service.WarnStrategyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
@ -23,6 +25,8 @@ public class WarnStrategyServiceImpl
extends ServiceImpl<WarnStrategyMapper, WarnStrategy>
implements WarnStrategyService {
@Autowired private WarnStrategyMapper warnStrategyMapper;
/**
*
*
@ -73,4 +77,9 @@ public class WarnStrategyServiceImpl
return this.count(queryWrapper) > 0;
}
@Override
public List<CartType> findByCarType() {
return warnStrategyMapper.findByCarType();
}
}

View File

@ -0,0 +1,22 @@
<?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.warn.mapper.WarnRuleMapper">
<select id="findByMsg" resultType="com.muyu.warn.domain.car.resp.CarMessageResp">
SELECT
cm.car_message_id,
cm.car_message_cartype,
cm.car_message_type,
cmt.message_type_name,
cm.car_message_start_index,
cm.car_message_end_index,
cm.message_type_class,
cm.car_message_state
FROM
car_message cm
LEFT JOIN car_message_type cmt ON cm.car_message_type = cmt.message_type_id
WHERE
cm.car_message_cartype = #{id}
</select>
</mapper>

View File

@ -0,0 +1,14 @@
<?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.warn.mapper.WarnStrategyMapper">
<select id="findByCarType" resultType="com.muyu.warn.domain.car.CartType">
select
car_type_id,
car_type_name,
car_type_rules
from
car_type
</select>
</mapper>

View File

@ -13,6 +13,7 @@
<module>cloud-modules-gen</module>
<module>cloud-modules-file</module>
<module>cloud-modules-warn</module>
<module>cloud-test</module>
</modules>
<artifactId>cloud-modules</artifactId>