姜永辉 2 سال پیش
والد
کامیت
2614e34216

+ 0 - 2
src/main/java/com/dk/mdm/controller/mst/StaffController.java

@@ -67,7 +67,6 @@ public class StaffController{
      */
     @ApiOperation(value = "新建员工", notes = "新建员工")
     @PostMapping({"insert"})
-    @Transactional(rollbackFor = Exception.class)
     public ResponseResultVO<?> insert(@RequestBody StaffVO staffVO) {
         return staffService.insert(staffVO);
     }
@@ -79,7 +78,6 @@ public class StaffController{
      */
     @ApiOperation(value = "编辑员工", notes = "编辑员工")
     @PostMapping({"update"})
-    @Transactional(rollbackFor = Exception.class)
     public ResponseResultVO<Boolean> update(@RequestBody StaffVO staffVO) {
         return staffService.update(staffVO);
     }

+ 21 - 23
src/main/java/com/dk/mdm/mapper/mst/StaffMapper.xml

@@ -74,13 +74,23 @@
         </where>
     </sql>
 
-    <sql id="idsForeach">
-        <!-- 根据主键staffId批量操作 -->
-        WHERE staff_id in
-        <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
-            #{item}
-        </foreach>
-    </sql>
+    <!-- 根据主键修改 -->
+<!--    <update id="update">-->
+<!--        update dkic_b.t_mst_staff-->
+<!--         <set>-->
+<!--            <if test="staffCode != null">staff_code = #{staffCode},</if>-->
+<!--            <if test="staffName != null" >staff_name = #{staffName},</if>-->
+<!--            <if test="staffPhone != null">staff_phone = #{staffPhone},</if>-->
+<!--            <if test="orgId != null">org_id = #{orgId},</if>-->
+<!--            <if test="roleIds != null">role_ids = #{roleIds},</if>-->
+<!--            <if test="remarks != null">remarks = #{remarks},</if>-->
+<!--            <if test="flgCanLogin != null">flg_can_login = #{flgCanLogin},</if>-->
+<!--            <if test="updateUserId != null">update_user_id = #{updateUserId},</if>-->
+<!--            <if test="updateUserName != null">update_user_name = #{updateUserName},</if>-->
+<!--            <if test="updateTime != null">update_time = #{updateTime},</if>-->
+<!--         </set>-->
+<!--        where staff_id = #{staffId}::uuid-->
+<!--    </update>-->
 
     <!-- 查询表t_mst_staff,(条件查询+分页)列表 -->
     <select id="selectByCond" resultMap="BaseResultMap">
@@ -109,27 +119,15 @@
     <select id="selectById" resultMap="BaseResultMap">
         SELECT
         <include refid="Base_Column_List"/>
+        , org.org_name
         FROM dkic_b.t_mst_staff t
+        LEFT JOIN dkic_b.t_mst_org org
+        ON t.org_Id = org.org_Id
         WHERE t.staff_id = #{staffId}::uuid
     </select>
 
-    <!-- 根据主键锁定表t_mst_staff的一行数据 -->
-    <select id="selectByIdForUpdate" resultMap="BaseResultMap">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM dkic_b.t_mst_staff t
-        WHERE t.staff_id  = #{staffId}
-        for update
-    </select>
 
-    <!-- 根据主键锁定表t_mst_staff的多行数据 -->
-    <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM dkic_b.t_mst_staff t
-        <include refid="idsForeach"/>
-        for update
-    </select>
+
 
     <insert id="insertBatch">
         insert into dkic_b.t_mst_staff

+ 4 - 2
src/main/java/com/dk/mdm/service/mst/StaffService.java

@@ -1,5 +1,6 @@
 package com.dk.mdm.service.mst;
 
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.dk.common.infrastructure.annotaiton.Pagination;
 import com.dk.common.model.pojo.PageList;
 import com.dk.common.response.ResponseCodeEnum;
@@ -19,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
 import java.util.List;
+import java.util.UUID;
 
 /**
  * @desc   : 员工API接口
@@ -86,8 +88,8 @@ public class StaffService extends BaseService<Staff> {
 	public ResponseResultVO<Boolean> update(StaffVO staffVO) {
 		// 转化实体
 		Staff staff = staffConvert.convertToPo(staffVO);
-
-		return super.update(staff);
+		return ResponseResultUtil.success(super.update(staff,new UpdateWrapper<Staff>().lambda().eq(Staff::getStaffId,
+				UUID.fromString(staff.getStaffId())))) ;
 	}
 
 	/**