Commit 93c06e5182ad8aaed3bdb5f4a839d22b0d3fa5d4

Authored by 2c2c2c
1 parent 946fbbae

车辆管理,物理删除改为逻辑删除

trash-ui/src/views/unit/carInfo/info.vue
@@ -109,7 +109,11 @@ @@ -109,7 +109,11 @@
109 </el-select> 109 </el-select>
110 </el-col> 110 </el-col>
111 <el-col :span="19" v-if="volumeOrLWH==='体积'"> 111 <el-col :span="19" v-if="volumeOrLWH==='体积'">
112 - <el-input v-model="form.containerVolume" placeholder="请输入车辆体积" /> 112 + <el-select v-model="form.containerVolume" placeholder="请选择体积" style="width: 100%;">
  113 + <el-option label="4" value="4"/>
  114 + <el-option label="6" value="6" />
  115 + <el-option label="8" value="8" />
  116 + </el-select>
113 </el-col> 117 </el-col>
114 <el-col :span="19" v-if="volumeOrLWH==='长宽高'"> 118 <el-col :span="19" v-if="volumeOrLWH==='长宽高'">
115 <el-row> 119 <el-row>
@@ -683,6 +687,13 @@ export default { @@ -683,6 +687,13 @@ export default {
683 type: 'warning' 687 type: 'warning'
684 }); 688 });
685 } 689 }
  690 + if(this.form.containerVolume!=null&&this.form.containerVolume!==""){
  691 + return this.$message({
  692 + message: '请选择车辆体积!',
  693 + type: 'warning'
  694 + });
  695 + }
  696 +
686 this.form.drivers = this.drivers.join(","); 697 this.form.drivers = this.drivers.join(",");
687 this.roadTransport.forEach(item => { 698 this.roadTransport.forEach(item => {
688 if (item.raw != null) { 699 if (item.raw != null) {
trash-unit/src/main/java/com/trash/carInfo/controller/CarInfoController.java
@@ -38,6 +38,7 @@ public class CarInfoController extends BaseController @@ -38,6 +38,7 @@ public class CarInfoController extends BaseController
38 public TableDataInfo list(CarInfoVo carInfo) 38 public TableDataInfo list(CarInfoVo carInfo)
39 { 39 {
40 startPage(); 40 startPage();
  41 + carInfo.setIsDel(1);
41 List<CarInfoVo> list = carInfoService.selectCarInfoList(carInfo); 42 List<CarInfoVo> list = carInfoService.selectCarInfoList(carInfo);
42 return getDataTable(list); 43 return getDataTable(list);
43 } 44 }
@@ -50,6 +51,7 @@ public class CarInfoController extends BaseController @@ -50,6 +51,7 @@ public class CarInfoController extends BaseController
50 @GetMapping("/export") 51 @GetMapping("/export")
51 public AjaxResult export(CarInfoVo carInfo) 52 public AjaxResult export(CarInfoVo carInfo)
52 { 53 {
  54 + carInfo.setIsDel(1);
53 List<CarInfoVo> list = carInfoService.selectCarInfoList(carInfo); 55 List<CarInfoVo> list = carInfoService.selectCarInfoList(carInfo);
54 ExcelUtil<CarInfoVo> util = new ExcelUtil<CarInfoVo>(CarInfoVo.class); 56 ExcelUtil<CarInfoVo> util = new ExcelUtil<CarInfoVo>(CarInfoVo.class);
55 return util.exportExcel(list, "carInfo"); 57 return util.exportExcel(list, "carInfo");
trash-unit/src/main/java/com/trash/carInfo/domain/CarInfo.java
@@ -119,6 +119,16 @@ public class CarInfo extends BaseEntity @@ -119,6 +119,16 @@ public class CarInfo extends BaseEntity
119 @Excel(name = "二维码") 119 @Excel(name = "二维码")
120 private String qrCode; 120 private String qrCode;
121 121
  122 + private int isDel;
  123 +
  124 + public int getIsDel() {
  125 + return isDel;
  126 + }
  127 +
  128 + public void setIsDel(int isDel) {
  129 + this.isDel = isDel;
  130 + }
  131 +
122 public String getLengthWidthHeight() { 132 public String getLengthWidthHeight() {
123 return lengthWidthHeight; 133 return lengthWidthHeight;
124 } 134 }
trash-unit/src/main/resources/mapper/unit/CarInfoMapper.xml
@@ -35,6 +35,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -35,6 +35,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
35 <result property="updateBy" column="update_by" /> 35 <result property="updateBy" column="update_by" />
36 <result property="creditStatus" column="credit_status" /> 36 <result property="creditStatus" column="credit_status" />
37 <result property="qrCode" column="qr_code" /> 37 <result property="qrCode" column="qr_code" />
  38 + <result property="isDel" column="is_del" />
38 </resultMap> 39 </resultMap>
39 40
40 <resultMap type="CarInfoVo" id="CarInfoVoResult"> 41 <resultMap type="CarInfoVo" id="CarInfoVoResult">
@@ -73,7 +74,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -73,7 +74,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
73 </resultMap> 74 </resultMap>
74 75
75 <sql id="selectCarInfoVo"> 76 <sql id="selectCarInfoVo">
76 - select id, company_id, car_type, car_code, car_brank, emission_standard, road_transport_date, driving_license_date, enter_date, farme_number, car_identification, container_volume, car_color, car_equipment, remark, road_transport, driving_license, car_front, car_left, car_behind, car_right, drivers, status, create_time, create_by, update_time, update_by, credit_status, qr_code from car_info 77 + select id, company_id, car_type, car_code, car_brank, emission_standard, road_transport_date, driving_license_date, enter_date, farme_number, car_identification, container_volume, car_color, car_equipment, remark, road_transport, driving_license, car_front, car_left, car_behind, car_right, drivers, status, create_time, create_by, update_time, update_by, credit_status, qr_code,is_del from car_info
77 </sql> 78 </sql>
78 79
79 <sql id="selectCarInfoForCompanyVo"> 80 <sql id="selectCarInfoForCompanyVo">
@@ -119,7 +120,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -119,7 +120,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
119 120
120 <select id="selectCarInfoList" parameterType="CarInfoVo" resultMap="CarInfoVoResult"> 121 <select id="selectCarInfoList" parameterType="CarInfoVo" resultMap="CarInfoVoResult">
121 <include refid="selectCarInfoForCompanyVo"/> 122 <include refid="selectCarInfoForCompanyVo"/>
122 - <where> 123 + <where>
123 <if test="companyName != null and companyName != ''"> and c.name like concat('%',#{companyName},'%')</if> 124 <if test="companyName != null and companyName != ''"> and c.name like concat('%',#{companyName},'%')</if>
124 <if test="carType != null and carType != ''"> and car_type = #{carType}</if> 125 <if test="carType != null and carType != ''"> and car_type = #{carType}</if>
125 <if test="carCode != null and carCode != ''"> and car_code like concat('%',#{carCode},'%')</if> 126 <if test="carCode != null and carCode != ''"> and car_code like concat('%',#{carCode},'%')</if>
@@ -142,18 +143,19 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -142,18 +143,19 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
142 <if test="drivers != null and drivers != ''"> and drivers = #{drivers}</if> 143 <if test="drivers != null and drivers != ''"> and drivers = #{drivers}</if>
143 <if test="status != null "> and car.status = #{status}</if> 144 <if test="status != null "> and car.status = #{status}</if>
144 <if test="creditStatus != null and creditStatus != ''"> and car.credit_status = #{creditStatus}</if> 145 <if test="creditStatus != null and creditStatus != ''"> and car.credit_status = #{creditStatus}</if>
  146 + <if test="isDel != null and isDel != ''"> and car.is_del = #{isDel}</if>
145 </where> 147 </where>
146 </select> 148 </select>
147 149
148 <select id="selectCarInfoById" parameterType="Long" resultMap="CarInfoResult"> 150 <select id="selectCarInfoById" parameterType="Long" resultMap="CarInfoResult">
149 <include refid="selectCarInfoVo"/> 151 <include refid="selectCarInfoVo"/>
150 - where id = #{id} 152 + where id = #{id} and is_del = 1
151 </select> 153 </select>
152 154
153 155
154 <select id="selectByCompanyId" parameterType="Long" resultMap="CarInfoVoResult"> 156 <select id="selectByCompanyId" parameterType="Long" resultMap="CarInfoVoResult">
155 <include refid="selectCarInfoForCompanyVo"/> 157 <include refid="selectCarInfoForCompanyVo"/>
156 - where car.company_id=#{companyId} 158 + where car.company_id=#{companyId} and is_del = 1
157 </select> 159 </select>
158 160
159 161
@@ -189,6 +191,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -189,6 +191,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
189 <if test="creditStatus != null">credit_status,</if> 191 <if test="creditStatus != null">credit_status,</if>
190 <if test="qrCode != null">qr_code,</if> 192 <if test="qrCode != null">qr_code,</if>
191 <if test="lengthWidthHeight != null">length_width_height,</if> 193 <if test="lengthWidthHeight != null">length_width_height,</if>
  194 + <if test="isDel != null">is_del,</if>
192 </trim> 195 </trim>
193 <trim prefix="values (" suffix=")" suffixOverrides=","> 196 <trim prefix="values (" suffix=")" suffixOverrides=",">
194 <if test="companyId != null">#{companyId},</if> 197 <if test="companyId != null">#{companyId},</if>
@@ -220,6 +223,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -220,6 +223,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
220 <if test="creditStatus != null">#{creditStatus},</if> 223 <if test="creditStatus != null">#{creditStatus},</if>
221 <if test="qrCode != null">#{qrCode},</if> 224 <if test="qrCode != null">#{qrCode},</if>
222 <if test="lengthWidthHeight != null">#{lengthWidthHeight},</if> 225 <if test="lengthWidthHeight != null">#{lengthWidthHeight},</if>
  226 + <if test="isDel != null">#{isDel},</if>
223 </trim> 227 </trim>
224 </insert> 228 </insert>
225 229
@@ -255,16 +259,17 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot; @@ -255,16 +259,17 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
255 <if test="creditStatus != null">credit_status = #{creditStatus},</if> 259 <if test="creditStatus != null">credit_status = #{creditStatus},</if>
256 <if test="qrCode != null">qr_code = #{qrCode},</if> 260 <if test="qrCode != null">qr_code = #{qrCode},</if>
257 <if test="lengthWidthHeight != null">length_width_height = #{lengthWidthHeight},</if> 261 <if test="lengthWidthHeight != null">length_width_height = #{lengthWidthHeight},</if>
  262 + <if test="isDel != null">is_del = #{isDel},</if>
258 </trim> 263 </trim>
259 where id = #{id} 264 where id = #{id}
260 </update> 265 </update>
261 266
262 - <delete id="deleteCarInfoById" parameterType="Long">  
263 - delete from car_info where id = #{id}  
264 - </delete> 267 + <update id="deleteCarInfoById" parameterType="Long">
  268 + update car_info set is_del = 0 where id = #{id}
  269 + </update>
265 270
266 <delete id="deleteCarInfoByIds" parameterType="String"> 271 <delete id="deleteCarInfoByIds" parameterType="String">
267 - delete from car_info where id in 272 + update car_info set is_del = 0 where id in
268 <foreach item="id" collection="array" open="(" separator="," close=")"> 273 <foreach item="id" collection="array" open="(" separator="," close=")">
269 #{id} 274 #{id}
270 </foreach> 275 </foreach>