Commit 93c06e5182ad8aaed3bdb5f4a839d22b0d3fa5d4

Authored by 2c2c2c
1 parent 946fbbae

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

trash-ui/src/views/unit/carInfo/info.vue
... ... @@ -109,7 +109,11 @@
109 109 </el-select>
110 110 </el-col>
111 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 117 </el-col>
114 118 <el-col :span="19" v-if="volumeOrLWH==='长宽高'">
115 119 <el-row>
... ... @@ -683,6 +687,13 @@ export default {
683 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 697 this.form.drivers = this.drivers.join(",");
687 698 this.roadTransport.forEach(item => {
688 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 38 public TableDataInfo list(CarInfoVo carInfo)
39 39 {
40 40 startPage();
  41 + carInfo.setIsDel(1);
41 42 List<CarInfoVo> list = carInfoService.selectCarInfoList(carInfo);
42 43 return getDataTable(list);
43 44 }
... ... @@ -50,6 +51,7 @@ public class CarInfoController extends BaseController
50 51 @GetMapping("/export")
51 52 public AjaxResult export(CarInfoVo carInfo)
52 53 {
  54 + carInfo.setIsDel(1);
53 55 List<CarInfoVo> list = carInfoService.selectCarInfoList(carInfo);
54 56 ExcelUtil<CarInfoVo> util = new ExcelUtil<CarInfoVo>(CarInfoVo.class);
55 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 119 @Excel(name = "二维码")
120 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 132 public String getLengthWidthHeight() {
123 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 35 <result property="updateBy" column="update_by" />
36 36 <result property="creditStatus" column="credit_status" />
37 37 <result property="qrCode" column="qr_code" />
  38 + <result property="isDel" column="is_del" />
38 39 </resultMap>
39 40  
40 41 <resultMap type="CarInfoVo" id="CarInfoVoResult">
... ... @@ -73,7 +74,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
73 74 </resultMap>
74 75  
75 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 78 </sql>
78 79  
79 80 <sql id="selectCarInfoForCompanyVo">
... ... @@ -119,7 +120,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
119 120  
120 121 <select id="selectCarInfoList" parameterType="CarInfoVo" resultMap="CarInfoVoResult">
121 122 <include refid="selectCarInfoForCompanyVo"/>
122   - <where>
  123 + <where>
123 124 <if test="companyName != null and companyName != ''"> and c.name like concat('%',#{companyName},'%')</if>
124 125 <if test="carType != null and carType != ''"> and car_type = #{carType}</if>
125 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 143 <if test="drivers != null and drivers != ''"> and drivers = #{drivers}</if>
143 144 <if test="status != null "> and car.status = #{status}</if>
144 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 147 </where>
146 148 </select>
147 149  
148 150 <select id="selectCarInfoById" parameterType="Long" resultMap="CarInfoResult">
149 151 <include refid="selectCarInfoVo"/>
150   - where id = #{id}
  152 + where id = #{id} and is_del = 1
151 153 </select>
152 154  
153 155  
154 156 <select id="selectByCompanyId" parameterType="Long" resultMap="CarInfoVoResult">
155 157 <include refid="selectCarInfoForCompanyVo"/>
156   - where car.company_id=#{companyId}
  158 + where car.company_id=#{companyId} and is_del = 1
157 159 </select>
158 160  
159 161  
... ... @@ -189,6 +191,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
189 191 <if test="creditStatus != null">credit_status,</if>
190 192 <if test="qrCode != null">qr_code,</if>
191 193 <if test="lengthWidthHeight != null">length_width_height,</if>
  194 + <if test="isDel != null">is_del,</if>
192 195 </trim>
193 196 <trim prefix="values (" suffix=")" suffixOverrides=",">
194 197 <if test="companyId != null">#{companyId},</if>
... ... @@ -220,6 +223,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
220 223 <if test="creditStatus != null">#{creditStatus},</if>
221 224 <if test="qrCode != null">#{qrCode},</if>
222 225 <if test="lengthWidthHeight != null">#{lengthWidthHeight},</if>
  226 + <if test="isDel != null">#{isDel},</if>
223 227 </trim>
224 228 </insert>
225 229  
... ... @@ -255,16 +259,17 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
255 259 <if test="creditStatus != null">credit_status = #{creditStatus},</if>
256 260 <if test="qrCode != null">qr_code = #{qrCode},</if>
257 261 <if test="lengthWidthHeight != null">length_width_height = #{lengthWidthHeight},</if>
  262 + <if test="isDel != null">is_del = #{isDel},</if>
258 263 </trim>
259 264 where id = #{id}
260 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 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 273 <foreach item="id" collection="array" open="(" separator="," close=")">
269 274 #{id}
270 275 </foreach>
... ...