车辆删除还原

This commit is contained in:
zc
2026-01-05 15:17:26 +08:00
parent 5ee30c4e91
commit 945ef99da8
11 changed files with 55 additions and 14 deletions

View File

@@ -56,9 +56,11 @@ public class CarInfoController extends BaseController
*/
@RequiresPermissions("system:carInfo:list")
@GetMapping("/list")
public TableDataInfo list(CarInfo carInfo)
{
public TableDataInfo list(CarInfo carInfo) {
startPage();
if (StrUtil.isBlank(carInfo.getDelFlag())) {
carInfo.setDelFlag("0");
}
List<CarInfo> list = carInfoService.selectCarInfoList(carInfo);
return getDataTable(list);
}
@@ -69,8 +71,10 @@ public class CarInfoController extends BaseController
@RequiresPermissions("system:carInfo:export")
@Log(title = "车辆信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CarInfo carInfo)
{
public void export(HttpServletResponse response, CarInfo carInfo) {
if (StrUtil.isBlank(carInfo.getDelFlag())) {
carInfo.setDelFlag("0");
}
List<CarInfo> list = carInfoService.selectCarInfoList(carInfo);
ExcelUtil<CarInfo> util = new ExcelUtil<CarInfo>(CarInfo.class);
util.exportExcel(response, list, "车辆信息数据");
@@ -190,10 +194,19 @@ public class CarInfoController extends BaseController
@DeleteMapping("/{customerIds}")
public AjaxResult remove(@PathVariable Long[] customerIds)
{
//carParkRecordService.deleteCarParkRecordByCustomerIds(customerIds);
return toAjax(carInfoService.deleteCarInfoByCustomerIds(customerIds));
}
/**
* 还原删除车辆信息
*/
@RequiresPermissions("system:delCarInfo:restore")
@Log(title = "车辆还原", businessType = BusinessType.UPDATE)
@PostMapping("/restore")
public AjaxResult restore(@RequestBody List<Long> customerIds) {
return toAjax(carInfoService.restore(customerIds));
}
/**
* 获取企业模块|菜单权限树
*/

View File

@@ -46,7 +46,7 @@ public class CarParkController extends BaseController
}
/**
* 查询车场信息下拉数据
* 查询车场信息详情
*/
@RequiresPermissions("system:carPark:list")
@GetMapping("/getCarParkSelect/{id}")

View File

@@ -1,6 +1,7 @@
package com.dcsoft.system.vehicle.mapper;
import com.dcsoft.system.vehicle.domain.CarInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -63,4 +64,11 @@ public interface CarInfoMapper
public CarInfo selectCarInfoByCarNo(String plate);
CarInfo selectCarInfoByPlate(String plate);
/**
* 还原删除车辆信息
*
* @param customerIds 需要还原的车辆信息主键集合
* @return 结果
*/
int restore(@Param("list") List<Long> customerIds);
}

View File

@@ -1,6 +1,7 @@
package com.dcsoft.system.vehicle.mapper;
import com.dcsoft.system.vehicle.domain.CarParkRecord;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -62,7 +63,7 @@ public interface CarParkRecordMapper
public int deleteCarParkRecordByParkId(Long parkId);
public int deleteCarParkRecordByCustomerIds(Long[] ids);
public int deleteCarParkRecordByCustomerIds(@Param("list") List<Long> ids);
public int deleteCarParkRecordByCustomerId(Long[] ids);

View File

@@ -76,4 +76,11 @@ public interface ICarInfoService
String importData(List<CarInfo> userList, boolean updateSupport, String operName);
CarInfo selectCarInfoByPlate(String plate);
/**
* 还原删除车辆信息
*
* @param customerIds 需要还原的车辆信息主键集合
* @return 结果
*/
int restore(List<Long> customerIds);
}

View File

@@ -62,7 +62,7 @@ public interface ICarParkRecordService
public int deleteCarParkRecordByParkId(Long parkId);
public int deleteCarParkRecordByCustomerIds(Long[] customerIds);
public int deleteCarParkRecordByCustomerIds(List<Long> customerIds);
public int deleteCarParkRecordByCustomerId(Long customerId);

View File

@@ -330,6 +330,12 @@ public class CarInfoServiceImpl implements ICarInfoService
return carInfoMapper.selectCarInfoByPlate(plate);
}
@Override
public int restore(List<Long> customerIds) {
carParkRecordMapper.deleteCarParkRecordByCustomerIds(customerIds);
return carInfoMapper.restore(customerIds);
}
public static boolean checkPlateNumberFormat(String content) {
String pattern = "([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼]{1}(([A-HJ-Z]{1}[A-HJ-NP-Z0-9]{5})|([A-HJ-Z]{1}(([ADF]{1}[A-HJ-NP-Z0-9]{1}[0-9]{4})|([0-9]{5}[ADF]{1})))|([A-HJ-Z]{1}[A-D0-9]{1}[0-9]{3}警)))|([0-9]{6}使)|((([沪粤川云桂鄂陕蒙藏黑辽渝]{1}A)|鲁B|闽D|蒙E|蒙H)[0-9]{4}领)|(WJ[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼·•]{1}[0-9]{4}[TDSHBXJ0-9]{1})|([VKHBSLJNGCE]{1}[A-DJ-PR-TVY]{1}[0-9]{5})";
return Pattern.matches(pattern, content);

View File

@@ -99,7 +99,7 @@ public class CarParkRecordServiceImpl implements ICarParkRecordService
}
@Override
public int deleteCarParkRecordByCustomerIds(Long[] ids)
public int deleteCarParkRecordByCustomerIds(List<Long> ids)
{
return carParkRecordMapper.deleteCarParkRecordByCustomerIds(ids);
}

View File

@@ -8,7 +8,6 @@ import com.dcsoft.system.vehicle.service.ICarParkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

View File

@@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectCarInfoList" parameterType="CarInfo" resultMap="CarInfoResult">
<include refid="selectCarInfoVo"/>
<where>
1=1 and ci.del_flag=0
<if test="delFlag != null and delFlag != ''"> ci.del_flag = #{delFlag}</if>
<if test="enableTime != null "> and ci.enable_time = #{enableTime}</if>
<if test="overdueTime != null "> and ci.overdue_time = #{overdueTime}</if>
<if test="enable != null and enable != ''"> and ci.enable = #{enable}</if>
@@ -54,6 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="peopleId != null "> and ci.people_id = #{peopleId}</if>
<if test="peopleName != null "> and p.name = #{peopleName}</if>
<if test="unit != null "> and ci.unit = #{unit}</if>
<if test="parkId != null "> and ci.park_id = #{parkId}</if>
</where>
</select>
@@ -156,6 +157,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{customerId}
</foreach>
</update>
<update id="restore" parameterType="Long">
update car_info set del_flag = '0' where customer_id in
<foreach collection="list" item="customerId" open="(" separator="," close=")">
#{customerId}
</foreach>
</update>
<select id="selectCarInfoByCarNo" parameterType="String" resultMap="CarInfoResult">
<include refid="selectCarInfoVo"/>

View File

@@ -83,9 +83,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<update id="deleteCarParkRecordByCustomerIds" parameterType="String">
update car_park_record set sync=0 where customer_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
<update id="deleteCarParkRecordByCustomerIds" parameterType="Long">
update car_park_record set sync='0' where sync = '2' and customer_id in
<foreach item="id" collection="list" open="(" separator="," close=")">
#{id}
</foreach>
</update>