|
@@ -2,6 +2,7 @@ package com.ruoyi.zzb.zdcx.service;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.ruoyi.common.annotation.DataSource;
|
|
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
|
@@ -14,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
@Slf4j
|
|
|
@Service
|
|
@@ -114,6 +116,7 @@ public class ZdcxService {
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
+ @Transactional
|
|
|
public boolean insertStandardInfo(Zdcx zdcx, SysUser user){
|
|
|
// 录入人信息
|
|
|
zdcx.setCreateUserId(String.valueOf(user.getUserId()));
|
|
@@ -147,4 +150,47 @@ public class ZdcxService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据参数修改一条制度规范信息
|
|
|
+ * @param
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ public boolean updateStandardInfo(Zdcx zdcx){
|
|
|
+ String docId = zdcx.getDocId();
|
|
|
+ UpdateWrapper<Zdcx> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.eq("DOC_ID", docId);
|
|
|
+ int updateRows = zdcxMapper.update(zdcx, updateWrapper);
|
|
|
+ if(updateRows > 0){
|
|
|
+ log.info("【制度查询】制度规范信息修改成功 文书号:{}", docId);
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("数据库【制度查询】制度规范信息记录未修改 文书号:" + docId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据docIds(文书号数组)删除一/多条制度规范信息
|
|
|
+ * @param docIds
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ public boolean delDataByDocId(String[] docIds){
|
|
|
+ int delRowsCount = 0;
|
|
|
+ for (String docId : docIds) {
|
|
|
+ QueryWrapper<Zdcx> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("DOC_ID", docId);
|
|
|
+ int delRows = zdcxMapper.delete(queryWrapper);
|
|
|
+ delRowsCount += delRows;
|
|
|
+ }
|
|
|
+ if(delRowsCount == docIds.length){
|
|
|
+ log.info("制度规范信息删除成功 已删除的文书号:{},删除的数据条数:{}", docIds.toString(), delRowsCount);
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("数据库制度规范信息记录未删除或不存在 删除失败的文书号:" + docIds.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|