文档库--跟新log
This commit is contained in:
+258
-74
@@ -16,6 +16,8 @@ import com.jero.modules.document.entity.BussDocumentLibraryEO;
|
||||
import com.jero.modules.document.enums.FieldTypeEnum;
|
||||
import com.jero.modules.document.mapper.BussDocumentLibraryEOMapper;
|
||||
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
|
||||
import com.jero.modules.log.entity.BussLogEO;
|
||||
import com.jero.modules.log.service.IBussLogEOService;
|
||||
import com.jero.modules.oss.entity.OSSFile;
|
||||
import com.jero.modules.oss.service.IOSSFileService;
|
||||
import com.jero.modules.subscribe.entity.OnlCgformSubscribe;
|
||||
@@ -27,14 +29,17 @@ import com.jero.modules.tag.service.impl.OnlCgformAreaServiceImpl;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
@@ -63,6 +68,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
private IOnlCgformCollectionService iOnlCgformCollectionService;
|
||||
@Autowired
|
||||
private IOnlCgformSubscribeService iOnlCgformSubscribeService;
|
||||
@Autowired
|
||||
private IBussLogEOService iBussLogEOService;
|
||||
|
||||
|
||||
/**
|
||||
@@ -432,101 +439,246 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
* @param map
|
||||
*/
|
||||
public void updateInfo(Map<String, Object> map) {
|
||||
//判断该条数据是否订阅
|
||||
|
||||
map.remove("cut");
|
||||
//字段属性
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue());
|
||||
//时间类型字段
|
||||
List<OnlCgformField> fieldDateList = fieldList.stream()
|
||||
.filter(e -> FieldTypeEnum.DATE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
//文件类型字段
|
||||
List<OnlCgformField> fieldFileList = fieldList.stream()
|
||||
.filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
//下拉单选或下拉多选
|
||||
List<OnlCgformField> fieldPullList = fieldList.stream()
|
||||
.filter(e -> FieldTypeEnum.LIST.getValue().equals(e.getFieldShowType())
|
||||
|| FieldTypeEnum.LIST_MULTI.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
|
||||
String id = (String) map.get("id");
|
||||
//通过id查询数据
|
||||
LambdaQueryWrapper<BussDocumentLibraryEO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BussDocumentLibraryEO::getId, id);
|
||||
List<Map<String, Object>> dataList = bussDocumentLibraryEOMapper.selectMaps(queryWrapper);
|
||||
//更新log
|
||||
updateLog(map,dataList,fieldList,fieldDateList,fieldFileList,fieldPullList);
|
||||
//判断该条数据是否订阅
|
||||
|
||||
|
||||
//处理修改代替标准,发送通知
|
||||
sendMessage(map);
|
||||
//处理修改代替标准,发送通知
|
||||
sendMessage(map,dataList);
|
||||
|
||||
//字段属性
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.DOCUMENT_LIBRARY.getValue());
|
||||
//时间类型字段
|
||||
List<OnlCgformField> fieldDateList = fieldList.stream().filter(e -> FieldTypeEnum.DATE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
//文件类型字段
|
||||
List<OnlCgformField> fieldFileList = fieldList.stream().filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
//字段
|
||||
StringBuilder fieldsBuilder = new StringBuilder();
|
||||
//数据值
|
||||
StringBuilder valuesBuilder = new StringBuilder();
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
|
||||
//字段
|
||||
StringBuilder fieldsBuilder = new StringBuilder();
|
||||
//数据值
|
||||
StringBuilder valuesBuilder = new StringBuilder();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
if (ObjectUtils.isNotEmpty(value)) {
|
||||
//处理修改人和修改时间
|
||||
if ("update_by".equals(key)) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
value = sysUser.getUsername();
|
||||
}
|
||||
List<OnlCgformField> fieldDate = fieldDateList.stream().filter(e -> entry.getKey().equals(e.getDbFieldName())).collect(Collectors.toList());
|
||||
//处理时间类型
|
||||
if (fieldDate.size() != 0) {
|
||||
if (ObjectUtils.isNotEmpty(value)) {
|
||||
value = "str_to_date('" + value + "','%Y-%m-%d %H:%i:%s')";
|
||||
}
|
||||
valuesBuilder.append(value + ",");
|
||||
} else {
|
||||
//处理文件类型
|
||||
List<OnlCgformField> fieldFile = fieldFileList.stream().filter(e -> entry.getKey().equals(e.getDbFieldName())).collect(Collectors.toList());
|
||||
if (fieldFile.size() != 0 && ObjectUtils.isNotEmpty(value)) {
|
||||
|
||||
String valueTemp = UUID.randomUUID().toString().replace("-", "");
|
||||
//修改文件表关联信息connect_id
|
||||
List<OSSFile> oSSFileList = new ArrayList<>();
|
||||
for (String fileId : value.toString().split(",")) {
|
||||
OSSFile ossFile = new OSSFile();
|
||||
ossFile.setId(fileId);
|
||||
ossFile.setConnectId(valueTemp);
|
||||
oSSFileList.add(ossFile);
|
||||
}
|
||||
iOSSFileService.updateFileInfo(oSSFileList);
|
||||
valuesBuilder.append("'" + valueTemp + "'" + ",");
|
||||
} else {
|
||||
valuesBuilder.append("'" + value + "'" + ",");
|
||||
}
|
||||
}
|
||||
fieldsBuilder.append(key + ",");
|
||||
}
|
||||
}
|
||||
String insertField = fieldsBuilder.substring(0, fieldsBuilder.length() - 1);
|
||||
String insertValue = valuesBuilder.substring(0, valuesBuilder.length() - 1);
|
||||
|
||||
//编辑数据采用先删除在新增的方法
|
||||
//删除文件
|
||||
LambdaQueryWrapper<BussDocumentLibraryEO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(BussDocumentLibraryEO::getId, (String) map.get("id"));
|
||||
List<Map<String, Object>> mapList = bussDocumentLibraryEOMapper.selectMaps(lambdaQueryWrapper);
|
||||
|
||||
List<String> connectIdList = new ArrayList<>();
|
||||
for (OnlCgformField onlCgformField : fieldFileList) {
|
||||
String connectId = (String) mapList.get(0).get(onlCgformField.getDbFieldName());
|
||||
if (StringUtils.isNotBlank(connectId)) {
|
||||
connectIdList.add(connectId);
|
||||
}
|
||||
}
|
||||
|
||||
//删除文件
|
||||
iOSSFileService.deleteByConnectIdList(connectIdList);
|
||||
//删除文档库数据
|
||||
bussDocumentLibraryEOMapper.deleteById((String) map.get("id"));
|
||||
bussDocumentLibraryEOMapper.insertInfo(insertField, insertValue);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新log
|
||||
* @param map
|
||||
*/
|
||||
private void updateLog(Map<String, Object> map,
|
||||
List<Map<String, Object>> dataList,
|
||||
List<OnlCgformField> fieldList,
|
||||
List<OnlCgformField> fieldDateList,
|
||||
List<OnlCgformField> fieldFileList,
|
||||
List<OnlCgformField> fieldPullList){
|
||||
Map<String,Object> mapTemp = new HashMap<>();
|
||||
mapCopy(map,mapTemp);
|
||||
//时间类型的字段
|
||||
List<String> fieldDate = fieldDateList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
||||
//文件类型的字段
|
||||
List<String> fieldFile = fieldFileList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
||||
//下拉类型的字段
|
||||
List<String> fieldPull = fieldPullList.stream().map(OnlCgformField::getDbFieldName).collect(Collectors.toList());
|
||||
|
||||
//数据字典
|
||||
List<SysDictItem> sysDictItems = sysDictItemServiceImpl.selectItemsAll();
|
||||
//下拉选处理数据字典
|
||||
for (Map.Entry<String, Object> entry : dataList.get(0).entrySet()) {
|
||||
List<OnlCgformField> collect = fieldPullList.stream()
|
||||
.filter(e -> entry.getKey().equals(e.getDictField()))
|
||||
.collect(Collectors.toList());
|
||||
//下拉选处理数据字典
|
||||
dictItem(sysDictItems, entry, collect);
|
||||
}
|
||||
for (Map.Entry<String, Object> entry : mapTemp.entrySet()) {
|
||||
List<OnlCgformField> collect = fieldPullList.stream()
|
||||
.filter(e -> entry.getKey().equals(e.getDictField()))
|
||||
.collect(Collectors.toList());
|
||||
//下拉选处理数据字典
|
||||
dictItem(sysDictItems, entry, collect);
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
dataList.get(0).entrySet().forEach(entry ->{
|
||||
String key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
if (ObjectUtils.isNotEmpty(value)) {
|
||||
//处理修改人和修改时间
|
||||
if ("update_by".equals(key)) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
value = sysUser.getUsername();
|
||||
//字段中文名
|
||||
List<OnlCgformField> fields = fieldList.stream().filter(e -> e.getDbFieldName().equals(key)).collect(Collectors.toList());
|
||||
String dbFieldTxt = fields.get(0).getDbFieldTxt();
|
||||
if(value == null){
|
||||
value = "";
|
||||
}
|
||||
for (Map.Entry<String, Object> entryTemp : mapTemp.entrySet()) {
|
||||
String keyTemp = entryTemp.getKey();
|
||||
Object valueTemp = entryTemp.getValue();
|
||||
if(valueTemp == null){
|
||||
valueTemp = "";
|
||||
}
|
||||
if ("update_time".equals(key)) {
|
||||
value = new Date();
|
||||
}
|
||||
List<OnlCgformField> fieldDate = fieldDateList.stream().filter(e -> entry.getKey().equals(e.getDbFieldName())).collect(Collectors.toList());
|
||||
//处理时间类型
|
||||
if (fieldDate.size() != 0) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
if (ObjectUtils.isNotEmpty(value)) {
|
||||
value = "str_to_date('" + sdf.format(new Date()) + "','%Y-%m-%d %H:%i:%s')";
|
||||
}
|
||||
valuesBuilder.append(value + ",");
|
||||
} else {
|
||||
//处理文件类型
|
||||
List<OnlCgformField> fieldFile = fieldFileList.stream().filter(e -> entry.getKey().equals(e.getDbFieldName())).collect(Collectors.toList());
|
||||
if (fieldFile.size() != 0 && ObjectUtils.isNotEmpty(value)) {
|
||||
if(!"create_time".equals(key) && !"update_time".equals(key)){
|
||||
if(key.equals(keyTemp)){
|
||||
if(fieldDate.contains(key)){
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
if(ObjectUtils.isNotEmpty(value)){
|
||||
value = sdf.format(value);
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(valueTemp)){
|
||||
try {
|
||||
valueTemp = sdf.format(sdf.parse((String) valueTemp));
|
||||
} catch (ParseException e) {
|
||||
}
|
||||
}
|
||||
//处理时间类型字段
|
||||
if(ObjectUtils.isNotEmpty(value)){
|
||||
if(ObjectUtils.isNotEmpty(valueTemp) && !value.equals(valueTemp)){
|
||||
sb.append(dbFieldTxt+"由"+value+"改为"+valueTemp+",");
|
||||
}else if(ObjectUtils.isEmpty(valueTemp)){
|
||||
sb.append(dbFieldTxt+"由"+value+"改为空"+",");
|
||||
}
|
||||
}else{
|
||||
if(ObjectUtils.isNotEmpty(valueTemp)){
|
||||
sb.append(dbFieldTxt+"改为"+valueTemp+",");
|
||||
}
|
||||
}
|
||||
|
||||
String valueTemp = UUID.randomUUID().toString().replace("-", "");
|
||||
//修改文件表关联信息connect_id
|
||||
List<OSSFile> oSSFileList = new ArrayList<>();
|
||||
for (String fileId : value.toString().split(",")) {
|
||||
OSSFile ossFile = new OSSFile();
|
||||
ossFile.setId(fileId);
|
||||
ossFile.setConnectId(valueTemp);
|
||||
oSSFileList.add(ossFile);
|
||||
}else if(fieldFile.contains(key)){
|
||||
//处理文件类型字段
|
||||
List<String> fileNameList = new ArrayList<>();
|
||||
List<String> fileNameListTemp = new ArrayList<>();
|
||||
//之前的文件
|
||||
if(ObjectUtils.isNotEmpty(value)){
|
||||
List<OSSFile> fileInfos = iOSSFileService.getFileInfosByConnectId((String) value);
|
||||
fileNameList = fileInfos.stream().map(OSSFile::getFileName).collect(Collectors.toList());
|
||||
}
|
||||
//修改的文件
|
||||
if(ObjectUtils.isNotEmpty(valueTemp)){
|
||||
List<OSSFile> fileInfosTemp = iOSSFileService.getFileInfosByConnectId((String) valueTemp);
|
||||
fileNameListTemp = fileInfosTemp.stream().map(OSSFile::getFileName).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
if(ObjectUtils.isNotEmpty(value)){
|
||||
boolean checkDiffrent = checkDiffrent(fileNameList, fileNameListTemp);
|
||||
|
||||
if(fileNameListTemp.size() != 0 && !checkDiffrent){
|
||||
sb.append(dbFieldTxt+"由"+StringUtils.join(fileNameList, ",")+"改为"+StringUtils.join(fileNameListTemp, ",")+",");
|
||||
}else if(fileNameListTemp.size() == 0){
|
||||
sb.append(dbFieldTxt+"由"+StringUtils.join(fileNameList, ",")+"改为空"+",");
|
||||
}
|
||||
}else{
|
||||
if(fileNameListTemp.size() != 0){
|
||||
sb.append(dbFieldTxt+"改为"+StringUtils.join(fileNameListTemp, ",")+",");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//其他类型
|
||||
if(ObjectUtils.isNotEmpty(value)){
|
||||
if(ObjectUtils.isNotEmpty(valueTemp) && !value.equals(valueTemp)){
|
||||
sb.append(dbFieldTxt+"由"+value+"改为"+valueTemp+",");
|
||||
}else if(ObjectUtils.isEmpty(valueTemp)){
|
||||
sb.append(dbFieldTxt+"由"+value+"改为空"+",");
|
||||
}
|
||||
}else{
|
||||
if(ObjectUtils.isNotEmpty(valueTemp)){
|
||||
sb.append(dbFieldTxt+"改为"+valueTemp+",");
|
||||
}
|
||||
}
|
||||
}
|
||||
iOSSFileService.updateFileInfo(oSSFileList);
|
||||
valuesBuilder.append("'" + valueTemp + "'" + ",");
|
||||
} else {
|
||||
valuesBuilder.append("'" + value + "'" + ",");
|
||||
}
|
||||
}
|
||||
fieldsBuilder.append(key + ",");
|
||||
}
|
||||
});
|
||||
if(StringUtils.isNotBlank(sb)){
|
||||
String content = sb.substring(0, sb.length() - 1);
|
||||
BussLogEO bussLogEO = new BussLogEO();
|
||||
bussLogEO.setContent(content);
|
||||
iBussLogEOService.add(bussLogEO);
|
||||
}
|
||||
String insertField = fieldsBuilder.substring(0, fieldsBuilder.length() - 1);
|
||||
String insertValue = valuesBuilder.substring(0, valuesBuilder.length() - 1);
|
||||
//编辑数据采用先删除在新增的方法
|
||||
//删除文件
|
||||
LambdaQueryWrapper<BussDocumentLibraryEO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(BussDocumentLibraryEO::getId, (String) map.get("id"));
|
||||
List<Map<String, Object>> mapList = bussDocumentLibraryEOMapper.selectMaps(lambdaQueryWrapper);
|
||||
|
||||
List<String> connectIdList = new ArrayList<>();
|
||||
for (OnlCgformField onlCgformField : fieldFileList) {
|
||||
String connectId = (String) mapList.get(0).get(onlCgformField.getDbFieldName());
|
||||
if (StringUtils.isNotBlank(connectId)) {
|
||||
connectIdList.add(connectId);
|
||||
}
|
||||
}
|
||||
//删除文件
|
||||
iOSSFileService.deleteByConnectIdList(connectIdList);
|
||||
//删除文档库数据
|
||||
bussDocumentLibraryEOMapper.deleteById((String) map.get("id"));
|
||||
bussDocumentLibraryEOMapper.insertInfo(insertField, insertValue);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理修改代替标准,发送通知
|
||||
* @param map
|
||||
*/
|
||||
private void sendMessage(Map<String, Object> map) {
|
||||
private void sendMessage(Map<String, Object> map,List<Map<String, Object>> dataList) {
|
||||
//处理修改代替标准,发送通知
|
||||
String id = (String) map.get("id");
|
||||
//修改时前端传参
|
||||
String replaceStandard = (String) map.get("replace_standard");
|
||||
//通过id查询数据
|
||||
LambdaQueryWrapper<BussDocumentLibraryEO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BussDocumentLibraryEO::getId, id);
|
||||
List<Map<String, Object>> dataList = bussDocumentLibraryEOMapper.selectMaps(queryWrapper);
|
||||
if(dataList.size() != 0){
|
||||
//代替标准(根据id查询出来的)
|
||||
String replaceStandardTemp = (String) dataList.get(0).get("replace_standard");
|
||||
@@ -753,6 +905,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
* @param collect
|
||||
*/
|
||||
private void dictItem(List<SysDictItem> sysDictItems, Map.Entry<String, Object> entry, List<OnlCgformField> collect) {
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
//通过dictField判断字段是否为下拉选(不为空则为下拉选)
|
||||
if (collect.size() != 0 && StringUtils.isNotBlank(collect.get(0).getDictField())) {
|
||||
String value = (String) entry.getValue();
|
||||
@@ -821,4 +974,35 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
lambdaQueryWrapper.in(OnlCgformSubscribe::getDocumentId,id);
|
||||
iOnlCgformSubscribeService.remove(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断两个集合元素是否完全一致
|
||||
* @param list
|
||||
* @param list1
|
||||
* @return
|
||||
*/
|
||||
private static boolean checkDiffrent(List<String> list, List<String> list1) {
|
||||
if (list.size() != list1.size()) {
|
||||
return false;
|
||||
}else{
|
||||
for (String str : list) {
|
||||
if (!list1.contains(str)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void mapCopy(Map map,Map mapResult){
|
||||
if(map == null){
|
||||
return;
|
||||
}
|
||||
Iterator<Map.Entry<String, Object>> iterator = map.entrySet().iterator();
|
||||
while (iterator.hasNext()){
|
||||
Map.Entry entry = iterator.next();
|
||||
Object key = entry.getKey();
|
||||
mapResult.put(key,map.get(key) != null ?map.get(key):"");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+170
@@ -0,0 +1,170 @@
|
||||
package com.jero.modules.log.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.log.entity.BussLogEO;
|
||||
import com.jero.modules.log.service.IBussLogEOService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 更新log表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-02-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="更新log表")
|
||||
@RestController
|
||||
@RequestMapping("/log/bussLogEO")
|
||||
@Slf4j
|
||||
public class BussLogEOController extends JeroController<BussLogEO, IBussLogEOService> {
|
||||
@Autowired
|
||||
private IBussLogEOService bussLogEOService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param bussLogEO
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "更新log表-分页列表查询")
|
||||
@ApiOperation(value="更新log表-分页列表查询", notes="更新log表-分页列表查询")
|
||||
@PostMapping(value = "/page")
|
||||
public Result<?> queryPageList(BussLogEO bussLogEO,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<BussLogEO> queryWrapper = QueryGenerator.initQueryWrapper(bussLogEO, req.getParameterMap());
|
||||
Page<BussLogEO> page = new Page<BussLogEO>(pageNo, pageSize);
|
||||
IPage<BussLogEO> pageList = bussLogEOService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "更新log表-列表查询")
|
||||
@ApiOperation(value="更新log表-列表查询", notes="更新log表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<BussLogEO>> queryList() {
|
||||
List<BussLogEO> list = bussLogEOService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param bussLogEO
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "更新log表-添加")
|
||||
@ApiOperation(value="更新log表-添加", notes="更新log表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody BussLogEO bussLogEO) {
|
||||
bussLogEOService.add(bussLogEO);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param bussLogEO
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "更新log表-编辑")
|
||||
@ApiOperation(value="更新log表-编辑", notes="更新log表-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody BussLogEO bussLogEO) {
|
||||
bussLogEOService.editById(bussLogEO);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "更新log表-通过id删除")
|
||||
@ApiOperation(value="更新log表-通过id删除", notes="更新log表-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
bussLogEOService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "更新log表-批量删除")
|
||||
@ApiOperation(value="更新log表-批量删除", notes="更新log表-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.bussLogEOService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "更新log表-通过id查询")
|
||||
@ApiOperation(value="更新log表-通过id查询", notes="更新log表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
BussLogEO bussLogEO = bussLogEOService.queryById(id);
|
||||
if(bussLogEO==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(bussLogEO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param bussLogEO
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, BussLogEO bussLogEO) {
|
||||
return super.exportXls(request, bussLogEO, BussLogEO.class, "更新log表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, BussLogEO.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.jero.modules.log.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 更新log表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-02-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("buss_log")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="buss_log对象", description="更新log表")
|
||||
public class BussLogEO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private java.lang.String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
|
||||
/**文档id*/
|
||||
@Excel(name = "文档id", width = 15)
|
||||
@ApiModelProperty(value = "文档id")
|
||||
private java.lang.String documentId;
|
||||
|
||||
/**日志内容*/
|
||||
@Excel(name = "日志内容", width = 15)
|
||||
@ApiModelProperty(value = "日志内容")
|
||||
private java.lang.String content;
|
||||
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.jero.modules.log.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.jero.modules.log.entity.BussLogEO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 更新log表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-02-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface BussLogEOMapper extends BaseMapper<BussLogEO> {
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.modules.log.mapper.BussLogEOMapper">
|
||||
<resultMap id="BussLogEOResultMap" type="com.jero.modules.log.entity.BussLogEO">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="document_id" property="documentId" />
|
||||
<result column="content" property="content" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.jero.modules.log.service;
|
||||
|
||||
import com.jero.modules.log.entity.BussLogEO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 更新log表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-02-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IBussLogEOService extends IService<BussLogEO> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param bussLogEO
|
||||
* @return
|
||||
*/
|
||||
void add(BussLogEO bussLogEO);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param bussLogEO
|
||||
* @return
|
||||
*/
|
||||
void editById(BussLogEO bussLogEO);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
BussLogEO queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<BussLogEO> queryList();
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
package com.jero.modules.log.service.impl;
|
||||
|
||||
import com.jero.modules.log.entity.BussLogEO;
|
||||
import com.jero.modules.log.mapper.BussLogEOMapper;
|
||||
import com.jero.modules.log.service.IBussLogEOService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
/**
|
||||
* @Description: 更新log表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-02-24
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class BussLogEOServiceImpl extends ServiceImpl<BussLogEOMapper, BussLogEO> implements IBussLogEOService {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param bussLogEO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(BussLogEO bussLogEO) {
|
||||
Date now = new Date();
|
||||
bussLogEO.setCreateTime(now);
|
||||
bussLogEO.setUpdateTime(now);
|
||||
save(bussLogEO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param bussLogEO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(BussLogEO bussLogEO) {
|
||||
Date now = new Date();
|
||||
bussLogEO.setUpdateTime(now);
|
||||
saveOrUpdate(bussLogEO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public BussLogEO queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BussLogEO> queryList() {
|
||||
return list();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user