fix(violation):修复违章记录添加逻辑和查询重复问题- 调整HjmViolationController中车辆编号校验逻辑的位置
- 在HjmViolationMapper.xml的关联查询中添加DISTINCT关键字去重 - 确保违章记录保存前进行车辆存在性验证 - 优化返回结果处理逻辑避免重复数据产生
This commit is contained in:
@@ -70,7 +70,6 @@ public class HjmViolationController extends BaseController {
|
|||||||
User loginUser = getLoginUser();
|
User loginUser = getLoginUser();
|
||||||
if (loginUser != null) {
|
if (loginUser != null) {
|
||||||
hjmViolation.setUserId(loginUser.getUserId());
|
hjmViolation.setUserId(loginUser.getUserId());
|
||||||
}
|
|
||||||
final HjmCar car = hjmCarService.getByCode(hjmViolation.getCode());
|
final HjmCar car = hjmCarService.getByCode(hjmViolation.getCode());
|
||||||
if (ObjUtil.isEmpty(car)) {
|
if (ObjUtil.isEmpty(car)) {
|
||||||
return fail("车辆编号不存在");
|
return fail("车辆编号不存在");
|
||||||
@@ -79,6 +78,7 @@ public class HjmViolationController extends BaseController {
|
|||||||
hjmViolationService.send(hjmViolation);
|
hjmViolationService.send(hjmViolation);
|
||||||
return success("添加成功");
|
return success("添加成功");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return fail("添加失败");
|
return fail("添加失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<!-- 关联查询sql -->
|
<!-- 关联查询sql -->
|
||||||
<sql id="selectSql">
|
<sql id="selectSql">
|
||||||
SELECT a.*,b.image
|
SELECT DISTINCT a.*,b.image
|
||||||
FROM hjm_violation a
|
FROM hjm_violation a
|
||||||
LEFT JOIN hjm_car b ON a.code = b.code
|
LEFT JOIN hjm_car b ON a.code = b.code
|
||||||
LEFT JOIN gxwebsoft_core.sys_organization c ON b.organization_id = c.organization_id
|
LEFT JOIN gxwebsoft_core.sys_organization c ON b.organization_id = c.organization_id
|
||||||
|
|||||||
Reference in New Issue
Block a user