Administrator пре 1 година
родитељ
комит
1bb48fe43e

+ 12 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/InvestigateTable.java

@@ -22,6 +22,10 @@ public class InvestigateTable extends BaseEntity
 
     /** id */
     private Long investigateTableId;
+    /**
+     * 只在查询时候使用
+     */
+    private String investigateTableIds;
 
     /** 考察名称 */
     @Excel(name = "考察名称")
@@ -60,6 +64,14 @@ public class InvestigateTable extends BaseEntity
     /** 考察配置组接待指南 */
     private String investigateDispositionIdsJieDai;
 
+    public String getInvestigateTableIds() {
+        return investigateTableIds;
+    }
+
+    public void setInvestigateTableIds(String investigateTableIds) {
+        this.investigateTableIds = investigateTableIds;
+    }
+
     public String getInvestigateDispositionIdsJieDai() {
         return investigateDispositionIdsJieDai;
     }

+ 4 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/InvestigateTableMapper.java

@@ -26,6 +26,10 @@ public interface InvestigateTableMapper
      * @return 考察主集合
      */
     public List<InvestigateTable> selectInvestigateTableList(InvestigateTable investigateTable);
+    /**
+     *     查询考察团全部信息
+     */
+    public List<InvestigateTable> selectInvestigateTableListALL(InvestigateTable investigateTable);
 
     /**
      * 新增考察主

+ 24 - 12
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/InvestigateTableServiceImpl.java

@@ -16,6 +16,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.InvestigateDisposition;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.PageUtils;
 import com.ruoyi.common.utils.SendSmsUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.file.FileUploadUtils;
@@ -84,14 +85,26 @@ public class InvestigateTableServiceImpl implements IInvestigateTableService {
      */
     @Override
     public TableDataInfo selectInvestigateTableListData(InvestigateTable investigateTable) {
+        //先去查询分页的考察团id;
         List<InvestigateTable> investigateTables = investigateTableMapper.selectInvestigateTableList(investigateTable);
-        List<InvestigateTable> investigateTables1 = investigateTableMapper.selectInvestigateTableList(investigateTable);
-
+        List<InvestigateTable> investigateTablesAll = new ArrayList<>();
+        if (investigateTables != null && investigateTables.size() > 0) {
+            StringBuilder sb = new StringBuilder("");
+            //获取考察团的id
+            for (InvestigateTable table : investigateTables) {
+                Long investigateTableId = table.getInvestigateTableId();
+                sb.append(investigateTableId).append(",");
+            }
+            String substring = sb.substring(0,sb.length() - 1);
+            //查询考察团全部信息
+            investigateTable.setInvestigateTableIds(substring);
+            investigateTablesAll = investigateTableMapper.selectInvestigateTableListALL(investigateTable);
+        }
         TableDataInfo rspData = new TableDataInfo();
         rspData.setCode(HttpStatus.SUCCESS);
         rspData.setMsg("查询成功");
-        rspData.setRows(investigateTables);
-        rspData.setTotal(new PageInfo(investigateTables1).getSize());
+        rspData.setRows(investigateTablesAll);
+        rspData.setTotal(new PageInfo(investigateTableMapper.selectInvestigateTableList(investigateTable)).getSize());
         return rspData;
     }
 
@@ -124,13 +137,13 @@ public class InvestigateTableServiceImpl implements IInvestigateTableService {
 
         if (investigateDispositionTableList != null && investigateDispositionTableList.size() > 0) {
 
-            insertInvestigateDispositionTable(investigateTableId,investigateDispositionTableList);
+            insertInvestigateDispositionTable(investigateTableId, investigateDispositionTableList);
         }
         //单独查询考察点信息,新增到关联表
         String investigateDispositionIds = investigateTable.getInvestigateDispositionIds();
         List<InvestigateDispositionTable> investigateDispositionTableListKaoCha = new ArrayList<>();
-        if (StringUtils.isNotEmpty(investigateDispositionIds)){
-            for (String  investigateDispositionId: investigateDispositionIds.split(",")) {
+        if (StringUtils.isNotEmpty(investigateDispositionIds)) {
+            for (String investigateDispositionId : investigateDispositionIds.split(",")) {
                 InvestigateDispositionTable investigateDispositionTable = new InvestigateDispositionTable();
                 investigateDispositionTable.setInvestigateTableId(investigateTableId);
                 InvestigateDisposition investigateDisposition = investigateDispositionMapper.selectInvestigateDispositionByInvestigateDispositionId(Long.parseLong(investigateDispositionId));
@@ -153,7 +166,7 @@ public class InvestigateTableServiceImpl implements IInvestigateTableService {
      * @return 结果
      */
 
-    private void insertInvestigateDispositionTable(Long investigateTableId,List<InvestigateDispositionTable> investigateDispositionTableList) {
+    private void insertInvestigateDispositionTable(Long investigateTableId, List<InvestigateDispositionTable> investigateDispositionTableList) {
         for (InvestigateDispositionTable investigateDispositionTable : investigateDispositionTableList) {
             investigateDispositionTable.setInvestigateTableId(investigateTableId);
             //获取HTML文件
@@ -269,7 +282,6 @@ public class InvestigateTableServiceImpl implements IInvestigateTableService {
         }
 
 
-
         //删除原先的考察配置与考察主表关联表信息
         investigateDispositionTableMapper.deleteInvestigateDispositionTableByInvestigateTableId(investigateTable.getInvestigateTableId());
 
@@ -279,15 +291,15 @@ public class InvestigateTableServiceImpl implements IInvestigateTableService {
         if (investigateDispositionTableList != null && investigateDispositionTableList.size() > 0) {
             for (InvestigateDispositionTable investigateDispositionTable : investigateDispositionTableList) {
                 String url = investigateDispositionTable.getUrl();
-                String  path=  url.replace("/profile",getProfile());
+                String path = url.replace("/profile", getProfile());
                 //todo 删除服务器文件
                 try {
-                    Runtime.getRuntime().exec("rm -f "+path);
+                    Runtime.getRuntime().exec("rm -f " + path);
                 } catch (IOException e) {
                     e.printStackTrace();
                 }
             }
-            insertInvestigateDispositionTable(investigateTableId,investigateDispositionTableList);
+            insertInvestigateDispositionTable(investigateTableId, investigateDispositionTableList);
         }
 
         return investigateTableMapper.updateInvestigateTable(investigateTable);

+ 33 - 7
ruoyi-system/src/main/resources/mapper/system/InvestigateTableMapper.xml

@@ -62,6 +62,33 @@
     </sql>
 
     <select id="selectInvestigateTableList" parameterType="InvestigateTable" resultMap="InvestigateTableResult">
+        SELECT
+        t.investigate_table_id,
+        t.investigate_name,
+        t.content,
+        t.end_time,
+        t.begin_time,
+        t.investigate_disposition_ids,
+        t.investigate_disposition_ids_jie_dai,
+        t.CIPHER,
+        t.create_by,
+        t.create_time,
+        t.update_by,
+        t.update_time
+        FROM
+        investigate_table t
+        <where>
+            <if test="investigateName != null  and investigateName != ''">and t.investigate_name like concat('%',
+                #{investigateName}, '%')
+            </if>
+            <if test="content != null  and content != ''">and t.content = #{content}</if>
+            <if test="endTime != null ">and t.end_time = #{endTime}</if>
+            <if test="cipher != null  and cipher != ''">and t.cipher = #{cipher}</if>
+        </where>
+        order by t.create_time desc
+    </select>
+
+    <select id="selectInvestigateTableListALL" parameterType="InvestigateTable" resultMap="InvestigateTableResult">
         SELECT
         t.investigate_table_id,
         t.investigate_name,
@@ -91,14 +118,13 @@
         left join investigate_user u on t.investigate_table_id = u.investigate_id
         left join investigate_disposition_table idt on idt.investigate_table_id = t.investigate_table_id
         <where>
-            <if test="investigateName != null  and investigateName != ''">and t.investigate_name like concat('%',
-                #{investigateName}, '%')
-            </if>
-            <if test="content != null  and content != ''">and t.content = #{content}</if>
-            <if test="endTime != null ">and t.end_time = #{endTime}</if>
-            <if test="cipher != null  and cipher != ''">and t.cipher = #{cipher}</if>
+            <if test="investigateTableIds != null">
+            and t.investigate_table_id in
+                <foreach collection="investigateTableIds.split(',')" item="id" index="index" open="(" close=")" separator=",">
+                    #{id}
+                </foreach>
+        </if>
         </where>
-        order by t.create_time desc
     </select>
 
     <select id="selectInvestigateTableById" parameterType="Long" resultMap="InvestigateTableResult">