tianwu.sun 3 ヶ月 前
コミット
4110c14969

+ 5 - 0
src/main/java/com/bootdo/datas/controller/DataController.java

@@ -152,6 +152,11 @@ public class DataController {
     @ResponseBody
     @RequiresPermissions("datas:data:remove")
     public R remove(Long id) {
+        //判断一下该条数据是否被风评系统使用
+        int cnt = gyDataService.countAaAssData(id);
+        if(cnt > 0){
+            return R.error("该条数据已经被风评系统使用,不能删除!");
+        }
         Long[] longArray = new Long[]{id};
         gyDataService.batchRemove(longArray);
         return R.ok();

+ 12 - 0
src/main/java/com/bootdo/datas/controller/DataSendProvinceController.java

@@ -143,6 +143,18 @@ public class DataSendProvinceController {
         }
     }
 
+    /**
+     * 删除
+     */
+    @PostMapping("/remove")
+    @ResponseBody
+    @RequiresPermissions("datas:dataSendProvince:remove")
+    public R remove(Long id) {
+        Long[] longArray = new Long[]{id};
+        gyDataService.batchRemove(longArray);
+        return R.ok();
+    }
+
     /**
      * @Description: 跳转批量导入页面
      * @Author: wangp

+ 2 - 0
src/main/java/com/bootdo/datas/dao/GyDataDao.java

@@ -46,4 +46,6 @@ public interface GyDataDao {
     int batchPhysicalDeletion(Long[] ids);
 
     GyDataImportDTO getRecoverData(Long id);
+
+    int countAaAssData(Long id);
 }

+ 2 - 0
src/main/java/com/bootdo/datas/service/GyDataService.java

@@ -46,4 +46,6 @@ public interface GyDataService {
     int batchPhysicalDeletion(Long id);
 
     void encryptExports(HttpServletResponse responses, String idValue) throws Exception;
+
+    int countAaAssData(Long id);
 }

+ 7 - 0
src/main/java/com/bootdo/datas/service/impl/GyDataServiceImpl.java

@@ -755,6 +755,11 @@ public class GyDataServiceImpl implements GyDataService {
         ExcelUtils.encryptExport(responses, EncryptExcelDO.class,list,bootdoConfig.getCrtPrival(),decFile,encFile);
     }
 
+    @Override
+    public int countAaAssData(Long id){
+        return gyDataDao.countAaAssData(id);
+    }
+
     /**
      * @Description: MultipartFile转file
      * @Author: wangp
@@ -786,6 +791,8 @@ public class GyDataServiceImpl implements GyDataService {
         return null;
     }
 
+
+
     public static void main(String[] args) {
         FileCryptTool.encryptFile("F:/dev-dys/sm2/sm2_client_enc_cert.crt", "F:/dev-dys/res/测试导入-河南.xlsx",
                 "F:/dev-dys/res/enc-测试导入加密文件-河南.xlsx");

+ 10 - 0
src/main/resources/mybatis/datas/GyDataMapper.xml

@@ -491,4 +491,14 @@
             #{id}
         </foreach>
     </delete>
+
+    <select id="countAaAssData" resultType="int">
+        SELECT
+        count(*)
+        FROM ra_ass_data b
+        <where>
+            b.gy_data_id =#{id}
+        </where>
+    </select>
+
 </mapper>

+ 26 - 1
src/main/resources/static/js/appjs/datas/dataSendProvince/data.js

@@ -86,7 +86,10 @@ myColumns.push(
             var e = '<a class="btn btn-primary btn-sm ' + s_edit_h + '" href="#" mce_href="#" title="详情" onclick="edit(\''
                 + row.id
                 + '\')"><i class="fa fa-book"></i></a> ';
-            return e;
+            var d = '<a class="btn btn-warning btn-sm ' + s_remove_h + '" href="#" title="删除"  mce_href="#" onclick="remove(\''
+                + row.id
+                + '\')"><i class="fa fa-remove"></i></a> ';
+            return e + d;
         }
     });
 
@@ -177,6 +180,28 @@ function edit(id) {
     });
 }
 
+function remove(id) {
+    layer.confirm('确定要删除选中的记录?', {
+        btn: ['确定', '取消']
+    }, function () {
+        $.ajax({
+            url: prefix + "/remove",
+            type: "post",
+            data: {
+                'id': id
+            },
+            success: function (r) {
+                if (r.code == 0) {
+                    layer.msg(r.msg);
+                    reLoad();
+                } else {
+                    layer.msg(r.msg);
+                }
+            }
+        });
+    })
+}
+
 
 //重置查询条件
 function reset() {

+ 12 - 12
src/main/resources/templates/datas/data/data.html

@@ -36,19 +36,19 @@
                 </div>
                 <div class="fixed-table-toolbar">
                     <div class="columns pull-left">
-                        <button shiro:hasPermission="datas:data:batchRemove" type="button" class="btn  btn-danger"
-                                onclick="batchRemove()">
-                            <i class="fa fa-trash" aria-hidden="true"></i> 删除
-                        </button>
-                        <button shiro:hasPermission="datas:data:add" type="button" class="btn  btn-warning"
-                                onclick="add()">
-                            <i class="fa fa-plus" aria-hidden="true"></i> 密文导入
-                        </button>
+<!--                        <button shiro:hasPermission="datas:data:batchRemove" type="button" class="btn  btn-danger"-->
+<!--                                onclick="batchRemove()">-->
+<!--                            <i class="fa fa-trash" aria-hidden="true"></i> 删除-->
+<!--                        </button>-->
+<!--                        <button shiro:hasPermission="datas:data:add" type="button" class="btn  btn-warning"-->
+<!--                                onclick="add()">-->
+<!--                            <i class="fa fa-plus" aria-hidden="true"></i> 密文导入-->
+<!--                        </button>-->
 
-                        <button shiro:hasPermission="datas:data:plainTextImport" type="button" class="btn  btn-primary"
-                                onclick="dataImport()">
-                            <i class="fa fa-plus" aria-hidden="true"></i> 明文导入
-                        </button>
+<!--                        <button shiro:hasPermission="datas:data:plainTextImport" type="button" class="btn  btn-primary"-->
+<!--                                onclick="dataImport()">-->
+<!--                            <i class="fa fa-plus" aria-hidden="true"></i> 明文导入-->
+<!--                        </button>-->
 
                         <button shiro:hasPermission="datas:data:encryptExports" type="button" class="btn  btn-warning"
                                 onclick="encryptExports()">

+ 14 - 9
src/main/resources/templates/datas/dataSendProvince/data.html

@@ -36,15 +36,15 @@
                 </div>
                 <div class="fixed-table-toolbar">
                     <div class="columns pull-left">
-                        <button shiro:hasPermission="datas:dataSendProvince:add" type="button" class="btn  btn-warning"
-                                onclick="add()">
-                            <i class="fa fa-plus" aria-hidden="true"></i> 密文导入
-                        </button>
+<!--                        <button shiro:hasPermission="datas:dataSendProvince:add" type="button" class="btn  btn-warning"-->
+<!--                                onclick="add()">-->
+<!--                            <i class="fa fa-plus" aria-hidden="true"></i> 密文导入-->
+<!--                        </button>-->
 
-                        <button shiro:hasPermission="datas:dataSendProvince:plainTextImport" type="button" class="btn  btn-primary"
-                                onclick="dataImport()">
-                            <i class="fa fa-plus" aria-hidden="true"></i> 明文导入
-                        </button>
+<!--                        <button shiro:hasPermission="datas:dataSendProvince:plainTextImport" type="button" class="btn  btn-primary"-->
+<!--                                onclick="dataImport()">-->
+<!--                            <i class="fa fa-plus" aria-hidden="true"></i> 明文导入-->
+<!--                        </button>-->
 
                         <button shiro:hasPermission="datas:dataSendProvince:encryptExports" type="button" class="btn  btn-warning"
                                 onclick="encryptExports()">
@@ -76,6 +76,7 @@
     <script type="text/javascript">
         var s_edit_h = 'hidden';
         var s_sendVerify_h = 'hidden';
+        var s_remove_h = 'hidden';
     </script>
 </div>
 <div shiro:hasPermission="datas:dataSendProvince:edit">
@@ -90,7 +91,11 @@
         s_sendVerify_h = '';
     </script>
 </div>
-
+<div shiro:hasPermission="datas:dataSendProvince:remove">
+    <script type="text/javascript">
+        var s_remove_h = '';
+    </script>
+</div>
 </div>
 <div th:include="include :: footer"></div>
 <script type="text/javascript" src="/js/plugins/distpicker/distpicker.data.min.js"></script>