Browse Source

Merge remote-tracking branch 'origin/master'

AJNB 1 month ago
parent
commit
708bc11a2b

+ 29 - 0
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/enterprise/base/controller/TECompareobjectController.java

@@ -1,8 +1,12 @@
 package com.ruoyi.system.enterprise.base.controller;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.io.IOException;
 import javax.servlet.http.HttpServletResponse;
+
+import com.ruoyi.system.enterprise.base.domain.TECompareobjectGroup;
+import com.ruoyi.system.enterprise.base.service.ITECompareobjectGroupService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -34,6 +38,8 @@ public class TECompareobjectController extends BaseController
 {
     @Autowired
     private ITECompareobjectService tECompareobjectService;
+    @Autowired
+    private ITECompareobjectGroupService tECompareobjectGroupService;
 
     /**
      * 查询对照-对象列表
@@ -44,9 +50,32 @@ public class TECompareobjectController extends BaseController
     {
         startPage();
         List<TECompareobject> list = tECompareobjectService.selectTECompareobjectList(tECompareobject);
+
         return getDataTable(list);
     }
 
+    @RequiresPermissions("system.base:compareobject:init")
+    @GetMapping("/init/{id}")
+    public TableDataInfo list(@PathVariable("id")String CompareId)
+    {
+        startPage();
+        TECompareobject tECompareobject = new TECompareobject();
+        tECompareobject.setEnterpirseId(CompareId);
+
+        TECompareobjectGroup teCompareobjectGroup = new TECompareobjectGroup();
+        teCompareobjectGroup.setCompareId(CompareId);
+        System.out.println("tECompareobject.gettEnterpirseId"+tECompareobject.getEnterpirseId());
+        System.out.println("teCompareobjectGroup.setCompareId(CompareId)"+teCompareobjectGroup.getCompareId());
+
+        List<TECompareobject> objectlist = tECompareobjectService.selectTECompareobjectList(tECompareobject);
+        List<TECompareobjectGroup> grouplist = tECompareobjectGroupService.selectTECompareobjectGroupList(teCompareobjectGroup);
+
+        List alllist = new ArrayList();
+        alllist.add(objectlist);
+        alllist.add(grouplist);
+        return getDataTable(alllist);
+    }
+
     /**
      * 导出对照-对象列表
      */

+ 8 - 1
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/enterprise/base/controller/TECompareobjectDetailController.java

@@ -81,7 +81,14 @@ public class TECompareobjectDetailController extends BaseController
     public AjaxResult add(@RequestBody TECompareobjectDetail tECompareobjectDetail)
     {
 
-        return toAjax(tECompareobjectDetailService.insertTECompareobjectDetail(tECompareobjectDetail));
+        int result = tECompareobjectDetailService.insertTECompareobjectDetail(tECompareobjectDetail);
+        if (result > 0) {
+            // 获取新增数据的 ID,可以从插入的对象中获取
+            String id = tECompareobjectDetail.getId();
+            return AjaxResult.success("新增成功", id);
+        } else {
+            return AjaxResult.error("新增失败");
+        }
     }
 
     /**

+ 35 - 0
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/enterprise/base/controller/TECompareobjectGroupController.java

@@ -1,8 +1,13 @@
 package com.ruoyi.system.enterprise.base.controller;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.io.IOException;
 import javax.servlet.http.HttpServletResponse;
+
+import com.ruoyi.system.enterprise.base.domain.TECompareobjectInstance;
+import com.ruoyi.system.enterprise.base.service.ITECompareobjectInstanceService;
+import org.apache.xmlbeans.impl.xb.xsdschema.All;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -34,6 +39,8 @@ public class TECompareobjectGroupController extends BaseController
 {
     @Autowired
     private ITECompareobjectGroupService tECompareobjectGroupService;
+    @Autowired
+    private ITECompareobjectInstanceService tECompareobjectInstanceService;
 
     /**
      * 查询实例小组列表
@@ -47,6 +54,34 @@ public class TECompareobjectGroupController extends BaseController
         List<TECompareobjectGroup> list = tECompareobjectGroupService.selectTECompareobjectGroupList(tECompareobjectGroup);
         return getDataTable(list);
     }
+    /**
+     * 局部初始化实例小组列表
+     */
+    @RequiresPermissions("system.base:group:listgroup")
+    @GetMapping("/listgroup/{id}")
+    public TableDataInfo list(@PathVariable("id")String CompareId)
+    {
+//        System.out.println(tECompareobjectGroup+"前端传过来的小组的数据");
+        System.out.println("CompareId这是多少"+CompareId);
+        startPage();
+        TECompareobjectGroup tECompareobjectGroup = new TECompareobjectGroup();
+        tECompareobjectGroup.setId(CompareId);
+
+        TECompareobjectInstance tECompareobjectInstance = new TECompareobjectInstance();
+        tECompareobjectInstance.setGroupId(CompareId);
+
+        System.out.println("tECompareobjectGroup这是什么"+tECompareobjectGroup);
+        List<TECompareobjectInstance> Instancelist = tECompareobjectInstanceService.selectTECompareobjectInstanceList(tECompareobjectInstance);
+        TECompareobjectGroup Grouplist = tECompareobjectGroupService.selectTECompareobjectGroupById(CompareId);
+
+
+        List AllList = new ArrayList();
+        AllList.add(Instancelist);
+        AllList.add(Grouplist);
+
+
+        return getDataTable(AllList);
+    }
 
     /**
      * 导出实例小组列表

+ 8 - 1
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/enterprise/base/controller/TECompareobjectInstanceController.java

@@ -79,7 +79,14 @@ public class TECompareobjectInstanceController extends BaseController
     @PostMapping
     public AjaxResult add(@RequestBody TECompareobjectInstance tECompareobjectInstance)
     {
-        return toAjax(tECompareobjectInstanceService.insertTECompareobjectInstance(tECompareobjectInstance));
+        int result = tECompareobjectInstanceService.insertTECompareobjectInstance(tECompareobjectInstance);
+        if (result > 0) {
+            // 获取新增数据的 ID,可以从插入的对象中获取
+            String id = tECompareobjectInstance.getId();
+            return AjaxResult.success("新增成功", id);
+        } else {
+            return AjaxResult.error("新增失败");
+        }
     }
 
     /**

+ 5 - 0
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/enterprise/base/mapper/TECompareobjectGroupMapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.system.enterprise.base.mapper;
 
 import java.util.List;
 import com.ruoyi.system.enterprise.base.domain.TECompareobjectGroup;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 实例小组Mapper接口
@@ -58,4 +59,8 @@ public interface TECompareobjectGroupMapper
      * @return 结果
      */
     public int deleteTECompareobjectGroupByIds(String[] ids);
+
+
+
+    List<TECompareobjectGroup> findByCompareId(@Param("compareId") String compareId);
 }

+ 15 - 0
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/enterprise/base/service/impl/TECompareobjectGroupServiceImpl.java

@@ -55,6 +55,21 @@ public class TECompareobjectGroupServiceImpl implements ITECompareobjectGroupSer
     public int insertTECompareobjectGroup(TECompareobjectGroup tECompareobjectGroup)
     {
         tECompareobjectGroup.setId(UUID.fastUUID().toString());
+        // 获取当前年份
+        int currentYear = java.time.Year.now().getValue();
+        System.out.println(tECompareobjectGroup);
+        TECompareobjectGroup temp = new TECompareobjectGroup();
+        temp.setCompareId(tECompareobjectGroup.getCompareId());
+
+        // 根据 compare_id 查询已有数据以确定 team_code 的自增序列值
+        List<TECompareobjectGroup> existingData = tECompareobjectGroupMapper.selectTECompareobjectGroupList(temp);
+//        System.out.println(existingData.get(0)+"这是我要看的狗屎");
+        int sequence = existingData.size() > 0? Integer.parseInt(existingData.get(existingData.size()-1).getTeamCode().split("-")[1]) + 1 : 1;
+        String newTeamCode = currentYear + "-" + String.format("%02d", sequence);
+
+        tECompareobjectGroup.setTeamCode(newTeamCode);
+
+
         return tECompareobjectGroupMapper.insertTECompareobjectGroup(tECompareobjectGroup);
     }
 

+ 1 - 1
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/base/TECompareobjectDetailMapper.xml

@@ -36,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         order by seq ASC
     </select>
         
-    <insert id="insertTECompareobjectDetail" parameterType="TECompareobjectDetail">
+    <insert id="insertTECompareobjectDetail" parameterType="TECompareobjectDetail" useGeneratedKeys="true" keyProperty="id">
         insert into t_e_compareobject_detail
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="id != null and id != ''">id,</if>

+ 7 - 2
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/base/TECompareobjectGroupMapper.xml

@@ -26,13 +26,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="endDate != null "> and end_date = #{endDate}</if>
             <if test="repeated != null "> and repeated = #{repeated}</if>
         </where>
-        order by team_code DESC
+        order by team_code ASC
     </select>
     
     <select id="selectTECompareobjectGroupById" parameterType="String" resultMap="TECompareobjectGroupResult">
         <include refid="selectTECompareobjectGroupVo"/>
         where id = #{id}
-        order by team_code DESC
+        order by team_code ASC
+    </select>
+
+    <select id="findByCompareId" resultType="com.ruoyi.system.enterprise.base.domain.TECompareobjectGroup">
+        <include refid="selectTECompareobjectGroupVo"/>
+        WHERE compare_id = #{compareId}
     </select>
         
     <insert id="insertTECompareobjectGroup" parameterType="TECompareobjectGroup">

+ 1 - 1
ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/base/TECompareobjectInstanceMapper.xml

@@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         order by seq ASC
     </select>
         
-    <insert id="insertTECompareobjectInstance" parameterType="TECompareobjectInstance">
+    <insert id="insertTECompareobjectInstance" parameterType="TECompareobjectInstance" useGeneratedKeys="true" keyProperty="id">
         insert into t_e_compareobject_instance
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="id != null and id != ''">id,</if>