Commit 5233fc8d7978309207ca3aba5bd5c5c9918f5407

Authored by 2c2c2c
1 parent dfe949d2

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

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/java/com/trash/carInfo/domain/vo/CarInfoVo.java
... ... @@ -7,8 +7,6 @@ public class CarInfoVo extends CarInfo {
7 7  
8 8 private String driversName;
9 9  
10   - private String isDel;
11   -
12 10 public String getCompanyName() {
13 11 return companyName;
14 12 }
... ... @@ -25,11 +23,4 @@ public class CarInfoVo extends CarInfo {
25 23 this.driversName = driversName;
26 24 }
27 25  
28   - public String getIsDel() {
29   - return isDel;
30   - }
31   -
32   - public void setIsDel(String isDel) {
33   - this.isDel = isDel;
34   - }
35 26 }
... ...
trash-unit/src/main/resources/mapper/unit/CarInfoMapper.xml
... ... @@ -35,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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">
... ... @@ -70,11 +71,10 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
70 71 <result property="qrCode" column="qr_code" />
71 72 <result property="companyName" column="companyName" />
72 73 <result property="driversName" column="driversName" />
73   - <result property="is_del" column="isDel" />
74 74 </resultMap>
75 75  
76 76 <sql id="selectCarInfoVo">
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 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
78 78 </sql>
79 79  
80 80 <sql id="selectCarInfoForCompanyVo">
... ... @@ -120,7 +120,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
120 120  
121 121 <select id="selectCarInfoList" parameterType="CarInfoVo" resultMap="CarInfoVoResult">
122 122 <include refid="selectCarInfoForCompanyVo"/>
123   - <where>
  123 + <where>
124 124 <if test="companyName != null and companyName != ''"> and c.name like concat('%',#{companyName},'%')</if>
125 125 <if test="carType != null and carType != ''"> and car_type = #{carType}</if>
126 126 <if test="carCode != null and carCode != ''"> and car_code like concat('%',#{carCode},'%')</if>
... ... @@ -143,19 +143,19 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
143 143 <if test="drivers != null and drivers != ''"> and drivers = #{drivers}</if>
144 144 <if test="status != null "> and car.status = #{status}</if>
145 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>
  146 + <if test="isDel != null and isDel != ''"> and car.is_del = #{isDel}</if>
147 147 </where>
148 148 </select>
149 149  
150 150 <select id="selectCarInfoById" parameterType="Long" resultMap="CarInfoResult">
151 151 <include refid="selectCarInfoVo"/>
152   - where id = #{id}
  152 + where id = #{id} and is_del = 1
153 153 </select>
154 154  
155 155  
156 156 <select id="selectByCompanyId" parameterType="Long" resultMap="CarInfoVoResult">
157 157 <include refid="selectCarInfoForCompanyVo"/>
158   - where car.company_id=#{companyId}
  158 + where car.company_id=#{companyId} and is_del = 1
159 159 </select>
160 160  
161 161  
... ... @@ -191,6 +191,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
191 191 <if test="creditStatus != null">credit_status,</if>
192 192 <if test="qrCode != null">qr_code,</if>
193 193 <if test="lengthWidthHeight != null">length_width_height,</if>
  194 + <if test="isDel != null">is_del,</if>
194 195 </trim>
195 196 <trim prefix="values (" suffix=")" suffixOverrides=",">
196 197 <if test="companyId != null">#{companyId},</if>
... ... @@ -222,6 +223,7 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
222 223 <if test="creditStatus != null">#{creditStatus},</if>
223 224 <if test="qrCode != null">#{qrCode},</if>
224 225 <if test="lengthWidthHeight != null">#{lengthWidthHeight},</if>
  226 + <if test="isDel != null">#{isDel},</if>
225 227 </trim>
226 228 </insert>
227 229  
... ... @@ -257,20 +259,21 @@ PUBLIC &quot;-//mybatis.org//DTD Mapper 3.0//EN&quot;
257 259 <if test="creditStatus != null">credit_status = #{creditStatus},</if>
258 260 <if test="qrCode != null">qr_code = #{qrCode},</if>
259 261 <if test="lengthWidthHeight != null">length_width_height = #{lengthWidthHeight},</if>
  262 + <if test="isDel != null">is_del = #{isDel},</if>
260 263 </trim>
261 264 where id = #{id}
262 265 </update>
263 266  
264   - <delete id="deleteCarInfoById" parameterType="Long">
265   - delete from car_info where id = #{id}
266   - </delete>
  267 + <update id="deleteCarInfoById" parameterType="Long">
  268 + update car_info set is_del = 0 where id = #{id}
  269 + </update>
267 270  
268   - <delete id="deleteCarInfoByIds" parameterType="String">
269   - delete from car_info where id in
  271 + <update id="deleteCarInfoByIds" parameterType="String">
  272 + update car_info set is_del = 0 where id in
270 273 <foreach item="id" collection="array" open="(" separator="," close=")">
271 274 #{id}
272 275 </foreach>
273   - </delete>
  276 + </update>
274 277  
275 278  
276 279 <insert id="addCarDriverRelation" parameterType="CarDriverRelation">
... ...