浏览代码

LY 工作票 索引 联动

ly 2 年之前
父节点
当前提交
8c9279a642

+ 3 - 0
master/src/main/java/com/ruoyi/project/ehs/mapper/TJobticketMapper.java

@@ -3,6 +3,7 @@ package com.ruoyi.project.ehs.mapper;
 import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
 import com.ruoyi.project.common.domain.DataEntity;
 import com.ruoyi.project.ehs.domain.TJobticket;
+import com.ruoyi.project.invoice.domain.TInvoiceTag;
 
 import java.util.List;
 import java.util.Map;
@@ -84,4 +85,6 @@ public interface TJobticketMapper
     int countXp(TJobticket tJobticket);
 
     int updateTJobticketStatus(TJobticket tJobticket);
+
+    int updateTag(TInvoiceTag oldTag);
 }

+ 1 - 0
master/src/main/java/com/ruoyi/project/invoice/controller/TInvoiceTagController.java

@@ -112,6 +112,7 @@ public class TInvoiceTagController extends BaseController {
     @Log(title = "工作票索引", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@RequestBody TInvoiceTag tInvoiceTag) {
+
         return toAjax(tInvoiceTagService.updateTInvoiceTag(tInvoiceTag));
     }
 

+ 11 - 0
master/src/main/java/com/ruoyi/project/invoice/domain/TInvoiceTag.java

@@ -27,6 +27,9 @@ public class TInvoiceTag extends BaseEntity
     @Excel(name = "索引")
     private String tag;
 
+    /** 索引 */
+    private String tagNew;
+
     /** 排序 */
     @Excel(name = "排序")
     private Long sort;
@@ -180,6 +183,14 @@ public class TInvoiceTag extends BaseEntity
         Children = children;
     }
 
+    public String getTagNew() {
+        return tagNew;
+    }
+
+    public void setTagNew(String tagNew) {
+        this.tagNew = tagNew;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 7 - 0
master/src/main/java/com/ruoyi/project/invoice/mapper/TInvoiceWorkcontentMapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.project.invoice.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
+import com.ruoyi.project.invoice.domain.TInvoiceTag;
 import com.ruoyi.project.invoice.domain.TInvoiceWorkcontent;
 
 import java.util.List;
@@ -72,4 +73,10 @@ public interface TInvoiceWorkcontentMapper extends BaseMapper<TInvoiceWorkconten
     List<TInvoiceWorkcontent> selectTInvoiceWorkcontentBybookingticketId(Long bookingticketId);
 
     int countXp(TInvoiceWorkcontent tInvoiceWorkcontent);
+
+    /**
+     *联动更新tag
+     *
+     */
+    public int updateTag(TInvoiceTag oldTag);
 }

+ 19 - 2
master/src/main/java/com/ruoyi/project/invoice/service/impl/TInvoiceTagServiceImpl.java

@@ -1,12 +1,18 @@
 package com.ruoyi.project.invoice.service.impl;
 
 import java.util.List;
+
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.project.ehs.mapper.TJobticketMapper;
+import com.ruoyi.project.invoice.mapper.TInvoiceWorkcontentMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.project.invoice.mapper.TInvoiceTagMapper;
 import com.ruoyi.project.invoice.domain.TInvoiceTag;
 import com.ruoyi.project.invoice.service.ITInvoiceTagService;
 
+import javax.annotation.Resource;
+
 /**
  * 工作票索引Service业务层处理
  *
@@ -16,9 +22,12 @@ import com.ruoyi.project.invoice.service.ITInvoiceTagService;
 @Service
 public class TInvoiceTagServiceImpl implements ITInvoiceTagService
 {
-    @Autowired
+    @Resource
     private TInvoiceTagMapper tInvoiceTagMapper;
-
+    @Resource
+    private TInvoiceWorkcontentMapper tInvoiceWorkcontentMapper;
+    @Resource
+    private TJobticketMapper tJobticketMapper;
     /**
      * 查询工作票索引
      *
@@ -64,6 +73,14 @@ public class TInvoiceTagServiceImpl implements ITInvoiceTagService
     @Override
     public int updateTInvoiceTag(TInvoiceTag tInvoiceTag)
     {
+        TInvoiceTag oldTag = tInvoiceTagMapper.selectTInvoiceTagById(tInvoiceTag.getId());
+        if (oldTag.getTag().equals(tInvoiceTag.getTag()) || StringUtils.isEmpty(tInvoiceTag.getTag())) {
+            return tInvoiceTagMapper.updateTInvoiceTag(tInvoiceTag);
+        }else {
+            oldTag.setTagNew(tInvoiceTag.getTag());
+            tInvoiceWorkcontentMapper.updateTag(oldTag);
+            tJobticketMapper.updateTag(oldTag);
+        }
         return tInvoiceTagMapper.updateTInvoiceTag(tInvoiceTag);
     }
 

+ 4 - 0
master/src/main/resources/mybatis/ehs/TJobticketMapper.xml

@@ -370,4 +370,8 @@
         GROUP BY ZYPZT
         order by dataName
     </select>
+
+    <update id="updateTag" parameterType="TInvoiceTag">
+        update t_jobticket set tag = #{tagNew} where tag = #{tag}
+    </update>
 </mapper>

+ 6 - 6
master/src/main/resources/mybatis/invoice/TInvoiceTagMapper.xml

@@ -99,15 +99,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where id = #{id}
     </update>
 
-    <update id="deleteTInvoiceTagById" parameterType="Long">
-        update t_invoice_tag set del_flag = 2 where id = #{id}
-    </update>
+    <delete id="deleteTInvoiceTagById" parameterType="Long">
+        delete from t_invoice_tag where id = #{id}
+    </delete>
 
-    <update id="deleteTInvoiceTagByIds" parameterType="String">
-        update t_invoice_tag set del_flag = 2 where id in
+    <delete id="deleteTInvoiceTagByIds" parameterType="String">
+        delete from t_invoice_tag where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
-    </update>
+    </delete>
 
 </mapper>

+ 5 - 0
master/src/main/resources/mybatis/invoice/TInvoiceWorkcontentMapper.xml

@@ -197,4 +197,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </update>
 
+    <update id="updateTag" parameterType="TInvoiceTag">
+        update t_invoice_workcontent set tag = #{tagNew} where tag = #{tag}
+    </update>
+
+
 </mapper>