Quellcode durchsuchen

增加员工逻辑删除

zangguocen vor 3 Jahren
Ursprung
Commit
7de1d7a501

+ 23 - 14
yijia-station/src/main/java/com/yijia/station/domain/StationPersonnel.java

@@ -9,7 +9,7 @@ import java.util.List;
 
 /**
  * 油站员工信息对象 station_personnel
- * 
+ *
  * @author yijia
  * @date 2020-12-09
  */
@@ -43,6 +43,15 @@ public class StationPersonnel extends BaseEntity
     /** 员工手机号 */
     @Excel(name = "员工手机号")
     private String personnelPhone;
+    private String delFlag;
+
+    public String getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(String delFlag) {
+        this.delFlag = delFlag;
+    }
 
     private List<String> stationIdList;
 
@@ -59,61 +68,61 @@ public class StationPersonnel extends BaseEntity
         this.personnelId = personnelId;
     }
 
-    public Long getPersonnelId() 
+    public Long getPersonnelId()
     {
         return personnelId;
     }
-    public void setPersonnelName(String personnelName) 
+    public void setPersonnelName(String personnelName)
     {
         this.personnelName = personnelName;
     }
 
-    public String getPersonnelName() 
+    public String getPersonnelName()
     {
         return personnelName;
     }
-    public void setGunNo(String gunNo) 
+    public void setGunNo(String gunNo)
     {
         this.gunNo = gunNo;
     }
 
-    public String getGunNo() 
+    public String getGunNo()
     {
         return gunNo;
     }
-    public void setStationId(Long stationId) 
+    public void setStationId(Long stationId)
     {
         this.stationId = stationId;
     }
 
-    public Long getStationId() 
+    public Long getStationId()
     {
         return stationId;
     }
-    public void setStationName(String stationName) 
+    public void setStationName(String stationName)
     {
         this.stationName = stationName;
     }
 
-    public String getStationName() 
+    public String getStationName()
     {
         return stationName;
     }
-    public void setQrCode(String qrCode) 
+    public void setQrCode(String qrCode)
     {
         this.qrCode = qrCode;
     }
 
-    public String getQrCode() 
+    public String getQrCode()
     {
         return qrCode;
     }
-    public void setPersonnelPhone(String personnelPhone) 
+    public void setPersonnelPhone(String personnelPhone)
     {
         this.personnelPhone = personnelPhone;
     }
 
-    public String getPersonnelPhone() 
+    public String getPersonnelPhone()
     {
         return personnelPhone;
     }

+ 14 - 11
yijia-station/src/main/resources/mapper/station/StationPersonnelMapper.xml

@@ -12,31 +12,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="stationName"    column="station_name"    />
         <result property="qrCode"    column="qr_code"    />
         <result property="personnelPhone"    column="personnel_phone"    />
+        <result property="delFlag"    column="del_flag"    />
     </resultMap>
 
     <sql id="selectStationPersonnelVo">
-     	select personnel_id, personnel_name, gun_no, station_id, d.dept_name as station_name, qr_code, personnel_phone
+     	select personnel_id, personnel_name, gun_no, station_id, d.dept_name as station_name, qr_code, personnel_phone,p.del_flag
         from station_personnel p join  sys_dept d on  p.station_id = d.dept_id
     </sql>
 
     <select id="selectStationPersonnelList" parameterType="StationPersonnel" resultMap="StationPersonnelResult">
         <include refid="selectStationPersonnelVo"/>
-        <where>
-            <if test="personnelName != null  and personnelName != ''"> and personnel_name like concat('%', #{personnelName}, '%')</if>
-            <if test="gunNo != null  and gunNo != ''"> and gun_no = #{gunNo}</if>
-            <if test="stationId != null "> and station_id = #{stationId}</if>
+         where  p.del_flag ='0'
+            <if test="personnelName != null  and personnelName != ''"> and p.personnel_name like concat('%', #{personnelName}, '%')</if>
+            <if test="gunNo != null  and gunNo != ''"> and p.gun_no = #{gunNo}</if>
+            <if test="stationId != null "> and p.station_id = #{stationId}</if>
             <if test="stationName != null  and stationName != ''"> and d.dept_name like concat('%', #{stationName}, '%')</if>
             <if test="qrCode != null  and qrCode != ''"> and qr_code = #{qrCode}</if>
             <if test="personnelPhone != null  and personnelPhone != ''"> and personnel_phone = #{personnelPhone}</if>
             <if test="stationIdList != null ">
-                and station_id in
+                and p.station_id in
                 <foreach item="item" index="index" collection="stationIdList"
                          open="(" separator="," close=")">
                     #{item}
                 </foreach>
             </if>
-        </where>
-        order by personnel_id desc
+            order by personnel_id desc
     </select>
 
     <select id="selectStationPersonnelById" parameterType="Long" resultMap="StationPersonnelResult">
@@ -53,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="stationId != null">station_id,</if>
             <if test="qrCode != null">qr_code,</if>
             <if test="personnelPhone != null">personnel_phone,</if>
+            <if test="delFlag != null">del_flag,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="personnelId != null">#{personnelId},</if>
@@ -61,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="stationId != null">#{stationId},</if>
             <if test="qrCode != null">#{qrCode},</if>
             <if test="personnelPhone != null">#{personnelPhone},</if>
+            <if test="delFlag != null">#{delFlag},</if>
          </trim>
     </insert>
 
@@ -72,8 +74,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="stationId != null">station_id = #{stationId},</if>
             <if test="qrCode != null">qr_code = #{qrCode},</if>
             <if test="personnelPhone != null">personnel_phone = #{personnelPhone},</if>
+            <if test="delFlag != null">del_flag = #{delFlag},</if>
         </trim>
-        where personnel_id = #{personnelId}
+         where personnel_id = #{personnelId}
     </update>
 
     <delete id="deleteStationPersonnelById" parameterType="Long">
@@ -81,8 +84,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteStationPersonnelByIds" parameterType="String">
-        delete from station_personnel where personnel_id in
-        <foreach item="personnelId" collection="array" open="(" separator="," close=")">
+        update station_personnel set del_flag = '1' where personnel_id in
+        <foreach collection="array" item="personnelId" open="(" separator="," close=")">
             #{personnelId}
         </foreach>
     </delete>