Эх сурвалжийг харах

Merge remote-tracking branch 'origin/master'

Administrator 3 жил өмнө
parent
commit
37aa7a22ad
19 өөрчлөгдсөн 351 нэмэгдсэн , 54 устгасан
  1. 37 0
      boman-api/boman-domain/src/main/java/com/boman/domain/dto/ImportDto.java
  2. 49 0
      boman-api/boman-domain/src/main/java/com/boman/domain/dto/ImportFileDto.java
  3. 54 2
      boman-api/boman-domain/src/main/java/com/boman/domain/entity/StatisticReport.java
  4. 18 0
      boman-api/boman-domain/src/main/java/com/boman/domain/entity/StatisticReportPersonnel.java
  5. 5 10
      boman-report/src/main/java/com/boman/report/controller/ImportController.java
  6. 6 10
      boman-report/src/main/java/com/boman/report/controller/StatisticReportController.java
  7. 2 1
      boman-report/src/main/java/com/boman/report/mapper/StatisticReportMapper.java
  8. 2 0
      boman-report/src/main/java/com/boman/report/mapper/StatisticReportPersonnelMapper.java
  9. 3 1
      boman-report/src/main/java/com/boman/report/service/IImportServcie.java
  10. 2 0
      boman-report/src/main/java/com/boman/report/service/StatisticReportPersonnelService.java
  11. 1 1
      boman-report/src/main/java/com/boman/report/service/StatisticReportService.java
  12. 39 7
      boman-report/src/main/java/com/boman/report/service/impl/ImportServiceImpl.java
  13. 6 0
      boman-report/src/main/java/com/boman/report/service/impl/StatisticReportPersonnelImpl.java
  14. 14 8
      boman-report/src/main/java/com/boman/report/service/impl/StatisticReportServiceImpl.java
  15. 7 2
      boman-report/src/main/resources/mapper/StatisticReportMapper.xml
  16. 47 3
      boman-report/src/main/resources/mapper/StatisticReportPersonnelMapper.xml
  17. 48 1
      boman-web-core/src/main/java/com/boman/web/core/mapper/StandardMapper.java
  18. 10 7
      boman-web-core/src/main/java/com/boman/web/core/service/TableServiceCmdService.java
  19. 1 1
      boman-web-core/src/main/java/com/boman/web/core/service/delete/BaseDeleteServiceImpl.java

+ 37 - 0
boman-api/boman-domain/src/main/java/com/boman/domain/dto/ImportDto.java

@@ -0,0 +1,37 @@
+package com.boman.domain.dto;
+
+import com.alibaba.fastjson.JSONObject;
+
+
+public class ImportDto {
+
+    private ImportFileDto file;
+
+    private Long personnelId;
+
+    private String tableName;
+
+    public ImportFileDto getFile() {
+        return file;
+    }
+
+    public void setFile(ImportFileDto file) {
+        this.file = file;
+    }
+
+    public Long getPersonnelId() {
+        return personnelId;
+    }
+
+    public void setPersonnelId(Long personnelId) {
+        this.personnelId = personnelId;
+    }
+
+    public String getTableName() {
+        return tableName;
+    }
+
+    public void setTableName(String tableName) {
+        this.tableName = tableName;
+    }
+}

+ 49 - 0
boman-api/boman-domain/src/main/java/com/boman/domain/dto/ImportFileDto.java

@@ -0,0 +1,49 @@
+package com.boman.domain.dto;
+
+public class ImportFileDto {
+    private String name;
+    private String status;
+    private String uid;
+    private String absolutePath;
+    private String originalName;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getUid() {
+        return uid;
+    }
+
+    public void setUid(String uid) {
+        this.uid = uid;
+    }
+
+    public String getAbsolutePath() {
+        return absolutePath;
+    }
+
+    public void setAbsolutePath(String absolutePath) {
+        this.absolutePath = absolutePath;
+    }
+
+    public String getOriginalName() {
+        return originalName;
+    }
+
+    public void setOriginalName(String originalName) {
+        this.originalName = originalName;
+    }
+}

+ 54 - 2
boman-api/boman-domain/src/main/java/com/boman/domain/entity/StatisticReport.java

@@ -1,8 +1,6 @@
 package com.boman.domain.entity;
 
 import com.boman.domain.BaseEntity;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import org.springframework.format.annotation.DateTimeFormat;
 
 import java.sql.Date;
 import java.util.List;
@@ -21,6 +19,12 @@ public class StatisticReport extends BaseEntity {
     private String status;
     private String repUploadFile;
     private String isDel;
+    private Long personnelId;
+    private String tableName;
+    private Long deptId;
+    private String deptName;
+    private Long userId;
+    private String userName;
     private List<StatisticReportPersonnel> personnels;
 
     public Long getId() {
@@ -126,4 +130,52 @@ public class StatisticReport extends BaseEntity {
     public void seteTime(String eTime) {
         this.eTime = eTime;
     }
+
+    public Long getPersonnelId() {
+        return personnelId;
+    }
+
+    public void setPersonnelId(Long personnelId) {
+        this.personnelId = personnelId;
+    }
+
+    public String getTableName() {
+        return tableName;
+    }
+
+    public void setTableName(String tableName) {
+        this.tableName = tableName;
+    }
+
+    public Long getDeptId() {
+        return deptId;
+    }
+
+    public void setDeptId(Long deptId) {
+        this.deptId = deptId;
+    }
+
+    public String getDeptName() {
+        return deptName;
+    }
+
+    public void setDeptName(String deptName) {
+        this.deptName = deptName;
+    }
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
 }

+ 18 - 0
boman-api/boman-domain/src/main/java/com/boman/domain/entity/StatisticReportPersonnel.java

@@ -17,6 +17,8 @@ public class StatisticReportPersonnel  extends BaseEntity {
   private String isDel;
   private String status;
   private String createBy;
+  private String sTime;
+  private String eTime;
   private java.sql.Timestamp createTime;
   private String updateBy;
   private java.sql.Timestamp updateTime;
@@ -139,4 +141,20 @@ public class StatisticReportPersonnel  extends BaseEntity {
   public void setStatus(String status) {
     this.status = status;
   }
+
+  public String getsTime() {
+    return sTime;
+  }
+
+  public void setsTime(String sTime) {
+    this.sTime = sTime;
+  }
+
+  public String geteTime() {
+    return eTime;
+  }
+
+  public void seteTime(String eTime) {
+    this.eTime = eTime;
+  }
 }

+ 5 - 10
boman-report/src/main/java/com/boman/report/controller/ImportController.java

@@ -1,14 +1,10 @@
 package com.boman.report.controller;
 
 import com.boman.domain.dto.AjaxResult;
+import com.boman.domain.dto.ImportDto;
 import com.boman.report.service.IImportServcie;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.util.List;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * 报表导入
@@ -23,14 +19,13 @@ public class ImportController {
     /**
      * 功能描述: 导入接口
      *
-     * @param multipartFiles MultipartFile
-     * @param tableName     tableName
+     * @param importDto     tableName
      * @return void
      */
     @PostMapping("/import")
-    public AjaxResult importData(List<MultipartFile> multipartFiles, String tableName) {
+    public AjaxResult importData(@RequestBody ImportDto importDto) {
         try {
-            return importServcie.importData(multipartFiles, tableName);
+            return importServcie.importData(importDto.getFile(), importDto.getPersonnelId(), importDto.getTableName());
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 6 - 10
boman-report/src/main/java/com/boman/report/controller/StatisticReportController.java

@@ -3,15 +3,11 @@ package com.boman.report.controller;
 import com.boman.common.core.web.controller.BaseController;
 import com.boman.common.core.web.page.TableDataInfo;
 import com.boman.domain.dto.AjaxResult;
-import com.boman.domain.entity.StatisticReportPersonnel;
 import com.boman.report.service.StatisticReportService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.data.repository.query.Param;
+import org.springframework.web.bind.annotation.*;
 import com.boman.domain.entity.StatisticReport;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
 
@@ -30,22 +26,22 @@ public class StatisticReportController extends BaseController {
      * @return
      */
     @GetMapping("/datas")
-    public AjaxResult datas() {
-        return AjaxResult.success(reportService.datas());
+    public AjaxResult datas(@Param("reportName") String reportName) {
+        return AjaxResult.success(reportService.datas(reportName));
     }
 
     /**
      * 列表
      * @return
      */
-    @RequestMapping("/list")
+    @PostMapping("/list")
     public TableDataInfo list(@RequestBody StatisticReport report) {
         startPage();
         List<StatisticReport> list = reportService.selectList(report);
         return getDataTable(list);
     }
 
-    @RequestMapping("/saveOrUpdate")
+    @PostMapping("/saveOrUpdate")
     public AjaxResult saveOrUpdate(@RequestBody StatisticReport report) {
         return reportService.saveOrUpdate(report);
     }

+ 2 - 1
boman-report/src/main/java/com/boman/report/mapper/StatisticReportMapper.java

@@ -7,6 +7,7 @@ import com.boman.domain.entity.vo.StatisticReportVo;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author shiqian
@@ -15,7 +16,7 @@ import java.util.List;
 @Repository
 public interface StatisticReportMapper {
 
-    List<StatisticReportDto> selectReportInfo(String userName);
+    List<StatisticReportDto> selectReportInfo(Map<String, String> params);
 
     List<StatisticReport> selectList(StatisticReport report);
 

+ 2 - 0
boman-report/src/main/java/com/boman/report/mapper/StatisticReportPersonnelMapper.java

@@ -16,6 +16,8 @@ public interface StatisticReportPersonnelMapper {
 
     int insert(StatisticReportPersonnel personnel);
 
+    int updateStatus(StatisticReportPersonnel personnel);
+
     List<StatisticReportPersonnel> selectByStatisticId(Long id);
 
     List<StatisticReportPersonnel> selectList(StatisticReportPersonnel personnel);

+ 3 - 1
boman-report/src/main/java/com/boman/report/service/IImportServcie.java

@@ -1,12 +1,14 @@
 package com.boman.report.service;
 
+import com.alibaba.fastjson.JSONObject;
 import com.boman.domain.dto.AjaxResult;
+import com.boman.domain.dto.ImportFileDto;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.util.List;
 
 public interface IImportServcie {
 
-    AjaxResult importData(List<MultipartFile> multipartFiles, String tableName) throws Exception;
+    AjaxResult importData(ImportFileDto fileDto, Long personnelId, String tableName) throws Exception;
 
 }

+ 2 - 0
boman-report/src/main/java/com/boman/report/service/StatisticReportPersonnelService.java

@@ -14,5 +14,7 @@ public interface StatisticReportPersonnelService {
 
     int insert(List<StatisticReportPersonnel> personnels);
 
+    int updateStatus(StatisticReportPersonnel personnel);
+
     List<StatisticReportPersonnel> selectList(StatisticReportPersonnel personnel);
 }

+ 1 - 1
boman-report/src/main/java/com/boman/report/service/StatisticReportService.java

@@ -20,7 +20,7 @@ import java.util.List;
  **/
 public interface StatisticReportService {
 
-    Map<String, Object> datas();
+    Map<String, Object> datas(String name);
 
     List<StatisticReport> selectList(StatisticReport report);
 

+ 39 - 7
boman-report/src/main/java/com/boman/report/service/impl/ImportServiceImpl.java

@@ -1,5 +1,7 @@
 package com.boman.report.service.impl;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.boman.common.core.utils.StringUtils;
 import com.boman.common.core.utils.obj.ObjectUtils;
@@ -10,15 +12,22 @@ import com.boman.domain.GenTable;
 import com.boman.domain.GenTableColumn;
 import com.boman.domain.dto.AjaxResult;
 import com.boman.domain.dto.ImportExcelDto;
+import com.boman.domain.dto.ImportFileDto;
+import com.boman.domain.entity.StatisticReportPersonnel;
 import com.boman.report.mapper.ImportMapper;
 import com.boman.report.service.IImportServcie;
+import com.boman.report.service.StatisticReportPersonnelService;
 import com.boman.web.core.api.RemoteObjService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.File;
+import java.io.FileInputStream;
 import java.util.*;
 
 /**
@@ -40,25 +49,33 @@ public class ImportServiceImpl implements IImportServcie {
     private RedisService redisService;
     @Autowired
     private RemoteObjService remoteObjService;
+    @Autowired
+    private StatisticReportPersonnelService personnelService;
 
     @Override
-    public AjaxResult importData(List<MultipartFile> multipartFiles, String tableName) throws Exception {
-        Objects.requireNonNull(multipartFiles, "未上传文件!");
+    @Transactional(isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class)
+    public AjaxResult importData(ImportFileDto fileDto, Long personnelId, String tableName) throws Exception {
+        Objects.requireNonNull(fileDto, "未上传文件!");
         ObjectUtils.requireNonNull(tableName, "表名为空!");
         GenTable genTable = redisService.getCacheObject(RedisKey.TABLE_INFO + tableName);
         Map<String, GenTableColumn> columnMap = this.genImportColumn(genTable.getColumns());
         List<GenTableColumn> columns = genColumData(tableName, columnMap);
         this.genBaseData(columns,  columnMap);
         ExcelUtil<JSONObject> util = new ExcelUtil<>(JSONObject.class);
-        List<JSONObject> list = new ArrayList<>();
-        for(MultipartFile multipartFile : multipartFiles) {
-            list.addAll(util.importCommonExcel("", multipartFile.getInputStream(), columns));
-        }
+
+        String realPath = getFileRealPath(fileDto);
+        File file = new File(realPath);
+        List<JSONObject> list = util.importCommonExcel("", new FileInputStream(file), columns);
         ImportExcelDto dto = new ImportExcelDto();
         dto.setDataList(list);
         dto.setTableName(tableName);
         remoteObjService.importCommonData(dto);
-        
+        // 上传成功后需要修改上报人的状态
+        StatisticReportPersonnel personnel = new StatisticReportPersonnel();
+        personnel.setId(personnelId);
+        personnel.setStatus("2");
+        personnel.setUploadFile(fileDto.toString());
+        personnelService.updateStatus(personnel);
         return AjaxResult.success();
     }
 
@@ -165,4 +182,19 @@ public class ImportServiceImpl implements IImportServcie {
         columns.add(columnMap.get(UPDATE_BY));
         columns.add(columnMap.get(UPDATE_TIME));
     }
+
+    private String getFileRealPath(ImportFileDto fileJson) {
+        return "";
+    }
+
+    public static void main(String[] args) {
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("name", "发文表.xlsx");
+        jsonObject.put("name", "发文表.xlsx");
+        jsonObject.put("status", null);
+        jsonObject.put("uid", null);
+        jsonObject.put("absolutePath", "c:\\file/2021/08/25/1629873633185.xlsx");
+        jsonObject.put("originalName", "发文表.xlsx");
+        System.out.println(jsonObject.toJSONString());
+    }
 }

+ 6 - 0
boman-report/src/main/java/com/boman/report/service/impl/StatisticReportPersonnelImpl.java

@@ -45,6 +45,12 @@ public class StatisticReportPersonnelImpl implements StatisticReportPersonnelSer
         return personnels.size();
     }
 
+    @Override
+    @Transactional(isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class)
+    public int updateStatus(StatisticReportPersonnel personnel) {
+        return personnelMapper.updateStatus(personnel);
+    }
+
     @Override
     public List<StatisticReportPersonnel> selectList(StatisticReportPersonnel personnel) {
         personnel.setUserName(SecurityUtils.getUsername());

+ 14 - 8
boman-report/src/main/java/com/boman/report/service/impl/StatisticReportServiceImpl.java

@@ -3,6 +3,7 @@ package com.boman.report.service.impl;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.TypeReference;
 import com.boman.common.core.utils.CollectUtils;
+import com.boman.common.core.utils.StringUtils;
 import com.boman.domain.SysFile;
 import com.boman.domain.dto.AjaxResult;
 import com.boman.domain.dto.StatisticReportDto;
@@ -118,9 +119,14 @@ public class StatisticReportServiceImpl implements StatisticReportService {
     }
 
     @Override
-    public Map<String, Object> datas() {
+    public Map<String, Object> datas(String name) {
         Map<String, Object> result = new HashMap<>();
-        List<StatisticReportDto> reportDtos = statisticReportMapper.selectReportInfo(SecurityUtils.getUsername());
+        Map<String, String> params = CollectUtils.newHashMap();
+        if(StringUtils.isNotEmpty(name)) {
+            params.put("name", name);
+        }
+        params.put("userName", SecurityUtils.getUsername());
+        List<StatisticReportDto> reportDtos = statisticReportMapper.selectReportInfo(params);
         result.put("reports", reportDtos);
         return result;
     }
@@ -157,14 +163,14 @@ public class StatisticReportServiceImpl implements StatisticReportService {
 
     private void genReport(StatisticReport report, String type) {
         Date now = new Date();
-        if(type.equals(INSERT)) {
-            report.setCreateBy(SecurityUtils.getUsername());
+        String username = SecurityUtils.getUsername();
+        if (type.equals(INSERT)) {
+            report.setCreateBy(username);
             report.setCreateTime(now);
-            report.setUpdateTime(now);
-        }else{
-            report.setUpdateBy(SecurityUtils.getUsername());
-            report.setUpdateTime(now);
         }
+
+        report.setUpdateBy(username);
+        report.setUpdateTime(now);
     }
 
     private void genReportPersonal(StatisticReport report) {

+ 7 - 2
boman-report/src/main/resources/mapper/StatisticReportMapper.xml

@@ -141,7 +141,12 @@
         where id = #{id}
     </update>
 
-    <select id="selectReportInfo" resultMap="ReportDtoResult" parameterType="java.lang.String">
-        select id, name from  jimu_report where create_by = #{userName} order by create_by desc
+    <select id="selectReportInfo" resultMap="ReportDtoResult" parameterType="java.util.Map">
+        select id, name from  jimu_report where
+             create_by = #{userName}
+            <if test="name != null and name != ''">
+                AND lower(name) like lower(concat('%', #{name}, '%'))
+            </if>
+            order by create_by desc
     </select>
 </mapper>

+ 47 - 3
boman-report/src/main/resources/mapper/StatisticReportPersonnelMapper.xml

@@ -21,9 +21,40 @@
         <result property="updateTime" column="update_time"/>
     </resultMap>
 
-    <select id="selectList" parameterType="com.boman.domain.entity.StatisticReportPersonnel" resultMap="StatisticReportPersonnelResult">
-        SELECT r.* FROM  statistic_report_personnel p
-        JOIN statistic_report r on r.id = p.statistic_id AND r.is_del = 'N' and r.`status` = '2'
+    <resultMap type="com.boman.domain.entity.StatisticReport" id="StatisticReportResult">
+        <id property="id" column="id"/>
+        <result property="reportName" column="report_name"/>
+        <result property="reportId" column="report_id"/>
+        <result property="templateName" column="template_name"/>
+        <result property="startTime" column="start_time"/>
+        <result property="endTime" column="end_time"/>
+        <result property="reportStatus" column="report_status"/>
+        <result property="status" column="status"/>
+        <result property="repUploadFile" column="rep_upload_file"/>
+        <result property="personnelId" column="personnel_id" />
+        <result property="tableName" column="table_name" />
+        <result property="deptId" column="dept_id"/>
+        <result property="deptName" column="dept_name"/>
+        <result property="userId" column="user_id"/>
+        <result property="userName" column="user_name"/>
+        <result property="remark" column="remark"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="isDel" column="is_del"/>
+    </resultMap>
+
+    <select id="selectList" parameterType="com.boman.domain.entity.StatisticReportPersonnel" resultMap="StatisticReportResult">
+        SELECT  r.*, p.id AS personnel_id, db.db_code as table_name,
+               p.dept_id,p.dept_name,p.user_id,p.user_name
+        FROM
+            statistic_report_personnel p
+        JOIN statistic_report r ON r.id = p.statistic_id
+        JOIN jimu_report t on t.id = r.report_id
+        JOIN jimu_report_db db on db.jimu_report_id = t.id
+        AND r.is_del = 'N'
+        AND r.`status` = '2'
         <where>
             <if test="createBy != null and createBy != ''">
                 AND p.create_by = #{createBy}
@@ -34,6 +65,15 @@
             <if test="userName != null and userName != ''">
                 AND p.user_name = #{userName}
             </if>
+            <if test="sTime != null and sTime != ''">
+                AND date_format(r.start_time, '%Y-%m-%d') &lt;= #{sTime}
+            </if>
+            <if test="eTime != null and eTime != ''">
+                AND date_format(r.end_time, '%Y-%m-%d') &gt;= #{eTime}
+            </if>
+            <if test="status != null and status != ''">
+                AND r.status = #{status}
+            </if>
         </where>
     </select>
 
@@ -44,6 +84,10 @@
         </foreach>
     </delete>
 
+    <update id="updateStatus" parameterType="com.boman.domain.entity.StatisticReportPersonnel">
+        update statistic_report_personnel set status = #{status},upload_file=#{uploadFile} where id = #{id}
+    </update>
+
     <insert id="insert" parameterType="com.boman.domain.entity.StatisticReportPersonnel">
         insert into statistic_report_personnel
         <trim prefix="(" suffix=")" suffixOverrides=",">

+ 48 - 1
boman-web-core/src/main/java/com/boman/web/core/mapper/StandardMapper.java

@@ -71,7 +71,7 @@ public interface StandardMapper {
             , @Param("foreignKeyList") List<Long> foreignKeyList, @Param("model") JSONObject models);
 
     /**
-     * 功能描述: 通用修改  {@link SqlProvider#update(java.util.Map)}
+     * 功能描述: 通用修改
      *
      * @param tableName      tableName
      * @param packCommitData packCommitData
@@ -82,6 +82,19 @@ public interface StandardMapper {
     int update(@Param("tableName") String tableName, @Param("packCommitData") JSONObject packCommitData
             , @Param("packColCondition") JSONObject packColCondition, @Param("condition") JSONObject condition);
 
+    /**
+     * 功能描述: 逻辑删除 {@link SqlProvider#objectLogicDelete(java.util.Map)}
+     *
+     * @param tableName tableName
+     * @param pkName    pkName
+     * @param idList    idList
+     * @param model     model
+     * @return int
+     */
+    @UpdateProvider(type = SqlProvider.class, method = "objectLogicDelete")
+    int objectLogicDelete(@Param("tableName") String tableName, @Param("pkName") String pkName
+            , @Param("idList") List<Long> idList, @Param("model") JSONObject model);
+
 
     /* ***************************************************** select ******************************************************/
     @Select("select max(${pkName}) from ${tableName}")
@@ -312,6 +325,7 @@ public interface StandardMapper {
             String pkName = (String) para.get("pkName");
             List<Long> idList = (List<Long>) para.get("idList");
             JSONObject models = (JSONObject) para.get("model");
+            JSONObject packCommitData = (JSONObject) para.get("packCommitData");
 
             StringBuilder wholeSql = new StringBuilder();
             wholeSql.append("update ").append(tableName).append(" set ");
@@ -321,6 +335,17 @@ public interface StandardMapper {
                 wholeSql.append(key).append(" = ").append(value).append(" , ");
             }
 
+            for (Map.Entry<String, Object> entry : packCommitData.entrySet()) {
+                String key = entry.getKey();
+                Object valueObj = entry.getValue();
+                List<String> types = ((List<String>) valueObj);
+                /** {@link com.boman.web.core.utils.ColumnUtils.packColCondition} 这里是拼参数的地方 **/
+                Object value = types.get(0);
+                String queryType = types.get(1);
+                String columnType = types.get(2);
+                wholeSql.append(key).append(covert(queryType, columnType, key, value)).append(" , ");
+            }
+
             wholeSql = new StringBuilder(StringUtils.substringBeforeLast(wholeSql.toString(), ","));
             wholeSql.append(" where ").append(pkName).append(" in ( ");
 
@@ -362,6 +387,28 @@ public interface StandardMapper {
             return sqlStr;
         }
 
+        public String objectLogicDelete(Map<String, Object> para) {
+            String tableName = (String) para.get("tableName");
+            String pkName = (String) para.get("pkName");
+            List<String> idList = (List<String>) para.get("idList");
+            JSONObject model = (JSONObject) para.get("model");
+
+            StringBuilder wholeSql = new StringBuilder();
+            wholeSql.append("update ").append(tableName).append(" set ");
+
+            for (Map.Entry<String, Object> entry : model.entrySet()) {
+                Object valueObj = entry.getValue();
+                wholeSql.append(entry.getKey()).append(" = ").append("'").append(valueObj.toString()).append("'").append(" , ");
+            }
+
+            wholeSql = new StringBuilder(StringUtils.substringBeforeLast(wholeSql.toString(), " , "));
+            wholeSql.append(" where ").append(pkName).append(" in ( ").append(ColumnUtils.joinList1(idList)).append(" ) ");
+
+            String sqlStr = wholeSql.toString();
+            LOGGER.info("逻辑删除sql语句为: {} \r\n 提交的数据为: {} \r\n idList: {}", sqlStr, model, idList);
+            return sqlStr;
+        }
+
         public String updateByForeignKey(Map<String, Object> para) {
             String tableName = (String) para.get("tableName");
             String foreignKeyName = (String) para.get("foreignKeyName");

+ 10 - 7
boman-web-core/src/main/java/com/boman/web/core/service/TableServiceCmdService.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
 import com.aliyuncs.exceptions.ClientException;
+import com.boman.common.core.utils.DateUtils;
 import com.boman.common.core.utils.SecurityUtils;
 import com.boman.common.core.utils.StringUtils;
 import com.boman.common.core.utils.collection.CollectionUtils;
@@ -291,17 +292,19 @@ public class TableServiceCmdService {
      * @return com.boman.domain.dto.AjaxResult
      */
     public AjaxResult objectLogicDelete(FormDataDto dto) {
-        requireNonNull(dto.getTable(), "tableName = [" + dto.getTable() + "] 此表不存在");
+        String tableName = requireNonNull(dto.getTable(), "tableName = [" + dto.getTable() + "] 此表不存在");
         Long[] idArr = CollectionUtils.listToArray(dto.getIdList());
         requireNonNull(idArr, "objectLogicDelete idArr is empty");
 
         // 拿到pkName
-        GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, dto.getTable());
+        GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, tableName);
         String pkName = IdUtils.getPkName(genTable.getColumns());
 
         List<RowResult> result = Lists.newArrayListWithCapacity(idArr.length);
-        JSONObject jsonObject = new JSONObject();
-        jsonObject.put(dto.getLogicDelName(), dto.getLogicDelValue());
+        JSONObject model = new JSONObject();
+        model.put(dto.getLogicDelName(), dto.getLogicDelValue());
+        model.put(UPDATE_TIME, DateUtils.getTime());
+        model.put(UPDATE_BY, SecurityUtils.getUsername());
 
         RowResult rowResult;
         for (Long id : idArr) {
@@ -312,14 +315,14 @@ public class TableServiceCmdService {
                 continue;
             }
 
-            rowResult = deleteService.objectLogicDelete(new Long[]{id}, dto.getTable(), pkName, jsonObject);
+            rowResult = deleteService.objectLogicDelete(new Long[]{id}, tableName, pkName, model);
             if (!rowResult.isOk()) {
-                LOGGER.info("逻辑删除失败, tableName: {}, id: {}, 操作人: {}", tableContext.getTableName(), id, getCurrentUsername());
+                LOGGER.info("逻辑删除失败, tableName: {}, id: {}, 操作人: {}", tableName, id, getCurrentUsername());
                 result.add(rowResult);
                 continue;
             }
 
-            LOGGER.info("逻辑删除成功, tableName: {}, id: {}, 操作人: {}", tableContext.getTableName(), id, getCurrentUsername());
+            LOGGER.info("逻辑删除成功, tableName: {}, id: {}, 操作人: {}", tableName, id, getCurrentUsername());
             Boolean stopProcess = dto.getStopProcess();
             if (BooleanUtils.isTrue(stopProcess)) {
                 ProcessDto processDto = new ProcessDto();

+ 1 - 1
boman-web-core/src/main/java/com/boman/web/core/service/delete/BaseDeleteServiceImpl.java

@@ -73,7 +73,7 @@ public class BaseDeleteServiceImpl implements IBaseDeleteService {
      */
     @Override
     public RowResult objectLogicDelete(Long[] idArr, String tableName, String pkName, JSONObject model) {
-        int delete = mapper.updateByIdList(tableName, pkName, Arrays.asList(idArr), model);
+        int delete = mapper.objectLogicDelete(tableName, pkName, Arrays.asList(idArr), model);
         return delete > 0 ? RowResult.ok() : RowResult.fail();
     }