Commit 3f961945 authored by sml's avatar sml

操作日志提交

parent 35a165e6
package com.jz.common.annotation;
import java.lang.annotation.*;
/**
* 操作日志切面注解
* @author ybz
* @Title: SysOperationLogAnnotation
*/
@Retention(RetentionPolicy.RUNTIME)//元注解,定义注解被保留策略,一般有三种策略
//1、RetentionPolicy.SOURCE 注解只保留在源文件中,在编译成class文件的时候被遗弃
//2、RetentionPolicy.CLASS 注解被保留在class中,但是在jvm加载的时候北欧抛弃,这个是默认的声明周期
//3、RetentionPolicy.RUNTIME 注解在jvm加载的时候仍被保留
@Target({ElementType.METHOD}) //定义了注解声明在哪些元素之前
@Documented
public @interface SysOperationLogAnnotation {
//定义成员
String descrption() default "" ;//描述
String actionType() default "" ;//操作的类型,1、添加 2、修改 3、删除 4、查询
}
package com.jz.common.aspect;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import com.alibaba.fastjson.JSONObject;
import com.jz.common.annotation.SysOperationLogAnnotation;
import com.jz.common.utils.HttpRequestUtil;
import com.jz.common.utils.web.SessionUtils;
import com.jz.dmp.modules.model.DmpOptLog;
import com.jz.dmp.modules.service.DmpOptLogService;
/**系统操作日志
* @author ybz
*
*/
@Aspect
@Component
public class SysOperationLogAspect {
private static Logger logger = LoggerFactory.getLogger(SysOperationLogAspect.class);
@Autowired
private DmpOptLogService dmpOptLogService;
@Pointcut("@annotation( com.jz.common.annotation.SysOperationLogAnnotation)")
public void sysOperationLogPointCut(){
}
@Around("sysOperationLogPointCut()")
public Object saveSysOperationLog(ProceedingJoinPoint pjp) throws Throwable{
System.out.println("=============== 保存操作日志 ===============");
//参数准备
Date optTime = new Date();
//保存日志
DmpOptLog dmpOptLog = new DmpOptLog();
//设置操作时间
dmpOptLog.setOptTime(optTime);
dmpOptLog.setCreateTime(optTime);
//从切面织入点处通过反射机制获取织入点处的方法
MethodSignature signature = (MethodSignature) pjp.getSignature();
//获取切入点所在的方法
Method method = signature.getMethod();
//获取操作
SysOperationLogAnnotation operationLogAnnotation = method.getAnnotation(SysOperationLogAnnotation.class);
if (operationLogAnnotation != null) {
String optType = operationLogAnnotation.actionType();
String optDesc = operationLogAnnotation.descrption();
dmpOptLog.setOptType(optType);//保存获取的操作
dmpOptLog.setOptDesc(optDesc);
}
//获取请求的类名
String className = pjp.getTarget().getClass().getName();
//获取请求的方法名
String methodName = method.getName();
dmpOptLog.setMethod(className + "." + methodName);
//请求的参数
String[] argNames = signature.getParameterNames(); // 参数名
Object[] argObjs = pjp.getArgs() ;
Map<String, Object> paramMap = new HashMap<String, Object>();
for (int index=0; index<argNames.length; index++) {
String argName = argNames[index];
Object argObj = argObjs[index];
if (argObj instanceof HttpServletRequest) {
continue;
}
paramMap.put(argName, argObj);
}
dmpOptLog.setRequestParam(JSONObject.toJSONString(paramMap));
// 保存操作用户信息
String userId = SessionUtils.getCurrentUserId();
dmpOptLog.setUserId(Integer.parseInt(userId));
dmpOptLog.setUserName(SessionUtils.getCurrentUserName());
dmpOptLog.setCreateUserId(Integer.parseInt(userId));
//设置ip
String optIp = "";
try {
// 获取request
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
optIp = HttpRequestUtil.getNginxRealIp(request);
} catch (Exception e) {
e.printStackTrace();
logger.info("ip获取异常:"+e.getMessage());
}
dmpOptLog.setOptIp(optIp);
Object obj;
try {
obj = pjp.proceed();
dmpOptLog.setOptResult(JSONObject.toJSONString(obj));
//调用service保存SysLog实体类到数据库
try {
dmpOptLogService.add(dmpOptLog, null);
} catch (Exception e) {
logger.info("插入操作日志异常。e:"+e.getMessage());
e.printStackTrace();
}
} catch (Throwable e1) {
e1.printStackTrace();
dmpOptLog.setOptResult(e1.getMessage());
dmpOptLog.setRemark("系统异常");
//调用service保存SysLog实体类到数据库
try {
dmpOptLogService.add(dmpOptLog, null);
} catch (Exception e) {
logger.info("插入操作日志异常。e:"+e.getMessage());
e.printStackTrace();
}
throw e1;
}
return obj;
}
}
...@@ -117,6 +117,7 @@ public class AzkabanApiUtils2 { ...@@ -117,6 +117,7 @@ public class AzkabanApiUtils2 {
} }
System.err.println("----sessionId="+sessionId); System.err.println("----sessionId="+sessionId);
LOGGER.info("----sessionId="+sessionId);
return sessionId; //SessionUtils.getSession().getId(); return sessionId; //SessionUtils.getSession().getId();
} }
......
...@@ -432,6 +432,10 @@ public class FlowParseTool { ...@@ -432,6 +432,10 @@ public class FlowParseTool {
contents = new ArrayList<>(); contents = new ArrayList<>();
FlowNode flowNode = iterator.next().getValue(); FlowNode flowNode = iterator.next().getValue();
String nodeType = flowNode.getNodeType(); String nodeType = flowNode.getNodeType();
if ("start".equalsIgnoreCase(nodeType)) {
azkabanJobType = "command";
azkabanJobCommand = "command= echo '============================> start'";
}
if ("shell".equalsIgnoreCase(nodeType)) { if ("shell".equalsIgnoreCase(nodeType)) {
// shell // shell
azkabanJobType = "command"; azkabanJobType = "command";
...@@ -467,11 +471,16 @@ public class FlowParseTool { ...@@ -467,11 +471,16 @@ public class FlowParseTool {
//hdfs //hdfs
azkabanJobType = "command"; azkabanJobType = "command";
azkabanJobCommand = generateExecutorToolCommand(taskId, flowNode.getNodeName(), false); azkabanJobCommand = generateExecutorToolCommand(taskId, flowNode.getNodeName(), false);
}else if ("stop".equalsIgnoreCase(nodeType)) {
azkabanJobType = "command";
azkabanJobCommand = "command= echo '============================> end'";
} }
//子流程类型 //子流程类型
contents.add("type=" + azkabanJobType); contents.add("type=" + azkabanJobType);
contents.add(azkabanJobCommand); if (!StringUtils.isEmpty(azkabanJobCommand)) {
contents.add(azkabanJobCommand);
}
String dependenciesNodeName = flowNode.getDependedNodeName(); String dependenciesNodeName = flowNode.getDependedNodeName();
if (StringUtils.isNotBlank(dependenciesNodeName)) { if (StringUtils.isNotBlank(dependenciesNodeName)) {
...@@ -511,7 +520,7 @@ public class FlowParseTool { ...@@ -511,7 +520,7 @@ public class FlowParseTool {
* @throws * @throws
*/ */
public static String generateExecutorToolCommand(Integer taskId, String jobId, boolean isSingle) { public static String generateExecutorToolCommand(Integer taskId, String jobId, boolean isSingle) {
String command = "command= java -jar jz-dmp-service.jar "+taskId+" "+jobId+" "+isSingle; String command = "command= java -jar /app/bigdata-app/dmp_cmdexecutortool/jz-dmp-cmdexectool.jar "+taskId+" "+jobId+" "+isSingle;
return command; return command;
} }
......
...@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.jz.common.annotation.MethodCallLogPrint; import com.jz.common.annotation.MethodCallLogPrint;
import com.jz.common.annotation.SysOperationLogAnnotation;
import com.jz.common.bean.BaseBeanResponse; import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse; import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse; import com.jz.common.bean.PageInfoResponse;
...@@ -45,6 +46,7 @@ public class DmpDevelopTaskController { ...@@ -45,6 +46,7 @@ public class DmpDevelopTaskController {
*/ */
@RequestMapping(method = RequestMethod.POST, value = "/findListWithPage") @RequestMapping(method = RequestMethod.POST, value = "/findListWithPage")
@ApiOperation(value = "分頁列表查询任务开发", notes = "分頁列表查询任务开发") @ApiOperation(value = "分頁列表查询任务开发", notes = "分頁列表查询任务开发")
@SysOperationLogAnnotation(actionType = "分頁列表查询任务开发", descrption = "分頁列表查询任务开发")
public PageInfoResponse<DmpDevelopTaskDto> findListWithPage(@RequestBody DmpDevelopTaskRequest dmpDevelopTaskRequest, HttpServletRequest httpRequest){ public PageInfoResponse<DmpDevelopTaskDto> findListWithPage(@RequestBody DmpDevelopTaskRequest dmpDevelopTaskRequest, HttpServletRequest httpRequest){
PageInfoResponse<DmpDevelopTaskDto> pageInfo = new PageInfoResponse<DmpDevelopTaskDto>(); PageInfoResponse<DmpDevelopTaskDto> pageInfo = new PageInfoResponse<DmpDevelopTaskDto>();
try { try {
...@@ -125,6 +127,7 @@ public class DmpDevelopTaskController { ...@@ -125,6 +127,7 @@ public class DmpDevelopTaskController {
@RequestMapping(method = RequestMethod.GET, value = "/flowSubmit") @RequestMapping(method = RequestMethod.GET, value = "/flowSubmit")
@ApiOperation(value = "任务流程发布接口", notes = "任务流程发布接口") @ApiOperation(value = "任务流程发布接口", notes = "任务流程发布接口")
@ApiImplicitParam(name = "treeId", value = "发布任务树主键") @ApiImplicitParam(name = "treeId", value = "发布任务树主键")
@MethodCallLogPrint
public BaseResponse flowSubmit(@RequestParam(value = "treeId", required = true) Long treeId, HttpServletRequest httpRequest){ public BaseResponse flowSubmit(@RequestParam(value = "treeId", required = true) Long treeId, HttpServletRequest httpRequest){
BaseResponse baseResponse = new BaseResponse(); BaseResponse baseResponse = new BaseResponse();
......
package com.jz.dmp.modules.controller.bean;
import java.util.List;
import com.jz.dmp.modules.model.DmpOptLog;
/**
* @author ybz
*
*/
public class DmpOptLogBatch {
private List<DmpOptLog> dmpOptLogs;
public List<DmpOptLog> getDmpOptLogs() {
return dmpOptLogs;
}
public void setDmpOptLogs(List<DmpOptLog> dmpOptLogs) {
this.dmpOptLogs = dmpOptLogs;
}
}
package com.jz.dmp.modules.controller.bean;
import com.jz.dmp.modules.model.DmpOptLog;
import io.swagger.annotations.ApiModel;
/**操作日志表Dto
* @author ybz
*
*/
@ApiModel(value = "操作日志表Dto", description = "操作日志表Dto")
public class DmpOptLogDto extends DmpOptLog {
}
package com.jz.dmp.modules.controller.bean;
import java.util.Date;
import com.jz.common.annotation.FieldAssist;
import com.jz.common.bean.BasePageBean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**操作日志表参数请求封装
* @author ybz
*
*/
@ApiModel(value = "操作日志表参数请求封装", description = "操作日志表参数请求封装")
public class DmpOptLogRequest extends BasePageBean {
/**
* 主键
*/
@ApiModelProperty(value = "主键")
@FieldAssist(orderBy = "log.opt_id")
private Integer optId;
/**
* 操作人ID
*/
@ApiModelProperty(value = "操作人ID")
@FieldAssist(orderBy = "log.user_id")
private Integer userId;
/**
* 操作人姓名
*/
@ApiModelProperty(value = "操作人姓名")
@FieldAssist(orderBy = "log.user_name")
private String userName;
/**
* 操作时间起
*/
@ApiModelProperty(value = "操作时间起")
private Date optTimeStart;
/**
* 操作时间止
*/
@ApiModelProperty(value = "操作时间止")
private Date optTimeEnd;
/**
* 操作类型
*/
@ApiModelProperty(value = "操作类型")
@FieldAssist(orderBy = "log.opt_type")
private String optType;
/**
* 操作描述
*/
@ApiModelProperty(value = "操作描述")
@FieldAssist(orderBy = "log.opt_desc")
private String optDesc;
/**
* 操作方法
*/
@ApiModelProperty(value = "操作方法")
@FieldAssist(orderBy = "log.method")
private String method;
/**
* 请求参数
*/
@ApiModelProperty(value = "请求参数")
@FieldAssist(orderBy = "log.request_param")
private String requestParam;
/**
* 操作结果
*/
@ApiModelProperty(value = "操作结果")
@FieldAssist(orderBy = "log.opt_result")
private String optResult;
/**
* IP地址
*/
@ApiModelProperty(value = "IP地址")
@FieldAssist(orderBy = "log.opt_ip")
private String optIp;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
@FieldAssist(orderBy = "log.remark")
private String remark;
/**
* 数据状态(0:删除,1,未删除)
*/
@ApiModelProperty(value = "数据状态(0:删除,1,未删除)")
@FieldAssist(orderBy = "log.data_status")
private String dataStatus;
/**
* 创建用户ID
*/
@ApiModelProperty(value = "创建用户ID")
@FieldAssist(orderBy = "log.create_user_id")
private Integer createUserId;
/**
* 创建时间起
*/
@ApiModelProperty(value = "创建时间起")
private Date createTimeStart;
/**
* 创建时间止
*/
@ApiModelProperty(value = "创建时间止")
private Date createTimeEnd;
/**
* 修改用户ID
*/
@ApiModelProperty(value = "修改用户ID")
@FieldAssist(orderBy = "log.update_user_id")
private Integer updateUserId;
/**
* 修改时间起
*/
@ApiModelProperty(value = "修改时间起")
private Date updateTimeStart;
/**
* 修改时间止
*/
@ApiModelProperty(value = "修改时间止")
private Date updateTimeEnd;
public Integer getOptId() {
return optId;
}
public void setOptId(Integer optId) {
this.optId = optId;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public Date getOptTimeStart() {
return optTimeStart;
}
public void setOptTimeStart(Date optTimeStart) {
this.optTimeStart = optTimeStart;
}
public Date getOptTimeEnd() {
return optTimeEnd;
}
public void setOptTimeEnd(Date optTimeEnd) {
this.optTimeEnd = optTimeEnd;
}
public String getOptType() {
return optType;
}
public void setOptType(String optType) {
this.optType = optType;
}
public String getOptDesc() {
return optDesc;
}
public void setOptDesc(String optDesc) {
this.optDesc = optDesc;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public String getRequestParam() {
return requestParam;
}
public void setRequestParam(String requestParam) {
this.requestParam = requestParam;
}
public String getOptResult() {
return optResult;
}
public void setOptResult(String optResult) {
this.optResult = optResult;
}
public String getOptIp() {
return optIp;
}
public void setOptIp(String optIp) {
this.optIp = optIp;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getDataStatus() {
return dataStatus;
}
public void setDataStatus(String dataStatus) {
this.dataStatus = dataStatus;
}
public Integer getCreateUserId() {
return createUserId;
}
public void setCreateUserId(Integer createUserId) {
this.createUserId = createUserId;
}
public Date getCreateTimeStart() {
return createTimeStart;
}
public void setCreateTimeStart(Date createTimeStart) {
this.createTimeStart = createTimeStart;
}
public Date getCreateTimeEnd() {
return createTimeEnd;
}
public void setCreateTimeEnd(Date createTimeEnd) {
this.createTimeEnd = createTimeEnd;
}
public Integer getUpdateUserId() {
return updateUserId;
}
public void setUpdateUserId(Integer updateUserId) {
this.updateUserId = updateUserId;
}
public Date getUpdateTimeStart() {
return updateTimeStart;
}
public void setUpdateTimeStart(Date updateTimeStart) {
this.updateTimeStart = updateTimeStart;
}
public Date getUpdateTimeEnd() {
return updateTimeEnd;
}
public void setUpdateTimeEnd(Date updateTimeEnd) {
this.updateTimeEnd = updateTimeEnd;
}
}
package com.jz.dmp.modules.controller.bean;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.BeanUtils;
import com.jz.dmp.modules.model.DmpOptLog;
public class MyDmpOptLogConverter {
private static MyDmpOptLogConverter instance;
private MyDmpOptLogConverter() {};
public synchronized static MyDmpOptLogConverter INSTANCE() {
if (instance==null) {
instance = new MyDmpOptLogConverter();
}
return instance;
}
public DmpOptLogDto domain2dto(DmpOptLog dmpOptLog) {
DmpOptLogDto dmpOptLogDto = new DmpOptLogDto();
BeanUtils.copyProperties(dmpOptLog, dmpOptLogDto);
return dmpOptLogDto;
}
public List<DmpOptLogDto> domain2dto(List<DmpOptLog> dmpOptLogs) {
List<DmpOptLogDto> dmpOptLogDtos = new ArrayList<DmpOptLogDto>();
dmpOptLogs.stream().forEach(x -> {
dmpOptLogDtos.add(domain2dto(x));
});
return dmpOptLogDtos;
}
public DmpOptLog dto2domain(DmpOptLogDto dmpOptLogDto) {
DmpOptLog dmpOptLog = new DmpOptLog();
BeanUtils.copyProperties(dmpOptLogDto, dmpOptLog);
return dmpOptLog;
}
public List<DmpOptLog> dto2domain(List<DmpOptLogDto> dmpOptLogDtos) {
List<DmpOptLog> dmpOptLogs = new ArrayList<DmpOptLog>();
dmpOptLogDtos.stream().forEach(x -> {
dmpOptLogs.add(domain2dto(x));
});
return dmpOptLogs;
}
}
package com.jz.dmp.modules.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.jz.dmp.modules.controller.bean.DmpOptLogDto;
import com.jz.dmp.modules.model.DmpOptLog;
/**操作日志表 mapper
* @author ybz
*
*/
public interface DmpOptLogMapper {
/**新增操作日志表
* @param dmpOptLog
* @return
* @throws Exception
*/
public int insert(DmpOptLog dmpOptLog)throws Exception;
/**选择性增加操作日志表
* @param dmpOptLog
* @return
* @throws Exception
*/
public int insertSelective(DmpOptLog dmpOptLog)throws Exception;
/**主键修改操作日志表
* @param dmpOptLog
* @return
* @throws Exception
*/
public int updateByPrimaryKey(DmpOptLog dmpOptLog)throws Exception;
/**选择性修改操作日志表
* @param dmpOptLog
* @return
* @throws Exception
*/
public int updateByPrimaryKeySelective(DmpOptLog dmpOptLog)throws Exception;
/**主键查询操作日志表
* @param optId
* @return
* @throws Exception
*/
public DmpOptLog selectByPrimaryKey(Integer optId)throws Exception;
/**主键删除操作日志表
* @param optId
* @return
* @throws Exception
*/
public int deleteByPrimaryKey(Integer optId)throws Exception;
/**主键软删除操作日志表
* @param optId
* @return
* @throws Exception
*/
public int softDeleteByPrimaryKey(Integer optId)throws Exception;
/**主键删除操作日志表
* @param optId
* @return
* @throws Exception
*/
public int delete(Map<String, Object> param)throws Exception;
/**主键软删除操作日志表
* @param optId
* @return
* @throws Exception
*/
public int softDelete(Map<String, Object> param)throws Exception;
/**条件查询操作日志表
* @param param
* @return
* @throws Exception
*/
public List<DmpOptLogDto> findList(Map<String, Object> param)throws Exception;
/**主键查询操作日志表
* @param optId
* @return
* @throws Exception
*/
public DmpOptLogDto findById(Integer optId)throws Exception;
/**批量新增操作日志表
* @param dmpOptLogs
* @throws Exception
*/
public void insertBatch(List<DmpOptLog> dmpOptLogs)throws Exception;
/**
* @Title: deleteByIds
* @Description: TODO(批量删除)
* @param @param idList
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
public void deleteByIds(@Param("idList")List<Integer> idList)throws Exception;
/**
* @Title: softDeleteByIds
* @Description: TODO(批量软删除)
* @param @param idList
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
public void softDeleteByIds(@Param("idList")List<Integer> idList)throws Exception;
}
package com.jz.dmp.modules.model;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**操作日志表
* @author ybz
*
*/
@ApiModel(value = "操作日志表", description = "操作日志表")
public class DmpOptLog implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@ApiModelProperty(value = "主键")
private Integer optId;
/**
* 操作人ID
*/
@ApiModelProperty(value = "操作人ID")
private Integer userId;
/**
* 操作人姓名
*/
@ApiModelProperty(value = "操作人姓名")
private String userName;
/**
* 操作时间
*/
@ApiModelProperty(value = "操作时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date optTime;
/**
* 操作类型
*/
@ApiModelProperty(value = "操作类型")
private String optType;
/**
* 操作描述
*/
@ApiModelProperty(value = "操作描述")
private String optDesc;
/**
* 操作方法
*/
@ApiModelProperty(value = "操作方法")
private String method;
/**
* 请求参数
*/
@ApiModelProperty(value = "请求参数")
private String requestParam;
/**
* 操作结果
*/
@ApiModelProperty(value = "操作结果")
private String optResult;
/**
* IP地址
*/
@ApiModelProperty(value = "IP地址")
private String optIp;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String remark;
/**
* 数据状态(0:删除,1,未删除)
*/
@ApiModelProperty(value = "数据状态(0:删除,1,未删除)")
private String dataStatus;
/**
* 创建用户ID
*/
@ApiModelProperty(value = "创建用户ID")
private Integer createUserId;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 修改用户ID
*/
@ApiModelProperty(value = "修改用户ID")
private Integer updateUserId;
/**
* 修改时间
*/
@ApiModelProperty(value = "修改时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
public Integer getOptId() {
return optId;
}
public void setOptId(Integer optId) {
this.optId = optId;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public Date getOptTime() {
return optTime;
}
public void setOptTime(Date optTime) {
this.optTime = optTime;
}
public String getOptType() {
return optType;
}
public void setOptType(String optType) {
this.optType = optType;
}
public String getOptDesc() {
return optDesc;
}
public void setOptDesc(String optDesc) {
this.optDesc = optDesc;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public String getRequestParam() {
return requestParam;
}
public void setRequestParam(String requestParam) {
this.requestParam = requestParam;
}
public String getOptResult() {
return optResult;
}
public void setOptResult(String optResult) {
this.optResult = optResult;
}
public String getOptIp() {
return optIp;
}
public void setOptIp(String optIp) {
this.optIp = optIp;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getDataStatus() {
return dataStatus;
}
public void setDataStatus(String dataStatus) {
this.dataStatus = dataStatus;
}
public Integer getCreateUserId() {
return createUserId;
}
public void setCreateUserId(Integer createUserId) {
this.createUserId = createUserId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getUpdateUserId() {
return updateUserId;
}
public void setUpdateUserId(Integer updateUserId) {
this.updateUserId = updateUserId;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
package com.jz.dmp.modules.service;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse;
import com.jz.dmp.modules.controller.bean.DmpOptLogBatch;
import com.jz.dmp.modules.controller.bean.DmpOptLogDto;
import com.jz.dmp.modules.controller.bean.DmpOptLogRequest;
import com.jz.dmp.modules.model.DmpOptLog;
/**
* 操作日志表服务接口
* @author ybz
*
*/
public interface DmpOptLogService {
/**条件分頁查询所有操作日志表
* @param dmpOptLogRequest
* @param httpRequest
* @return
* @throws Exception
*/
public PageInfoResponse<DmpOptLogDto> findListWithPage(DmpOptLogRequest dmpOptLogRequest, HttpServletRequest httpRequest)throws Exception;
/**条件查询所有操作日志表
* @param dmpOptLogRequest
* @param httpRequest
* @return
* @throws Exception
*/
public BaseBeanResponse<DmpOptLogDto> findList(DmpOptLogRequest dmpOptLogRequest, HttpServletRequest httpRequest)throws Exception;
/**新增操作日志表
* @param dmpOptLog
* @param httpRequest
* @return
* @throws Exception
*/
public BaseBeanResponse<DmpOptLog> add(DmpOptLog dmpOptLog, HttpServletRequest httpRequest)throws Exception;
/**主键查询操作日志表
* @param optId
* @param httpRequest
* @return
* @throws Exception
*/
public BaseBeanResponse<DmpOptLogDto> findById(Integer optId, HttpServletRequest httpRequest)throws Exception;
/**修改操作日志表
* @param dmpOptLog
* @param httpRequest
* @return
* @throws Exception
*/
public BaseBeanResponse<DmpOptLog> edit(DmpOptLog dmpOptLog, HttpServletRequest httpRequest)throws Exception;
/**新增或修改操作日志表
* @param dmpOptLog
* @param httpRequest
* @return
* @throws Exception
*/
public BaseBeanResponse<DmpOptLog> addOrEdit(DmpOptLog dmpOptLog, HttpServletRequest httpRequest)throws Exception;
/**主键删除操作日志表
* @param optId
* @param httpRequest
* @return
* @throws Exception
*/
public BaseResponse deleteById(Integer optId, HttpServletRequest httpRequest)throws Exception;
/**主键软删除操作日志表
* @param optId
* @param httpRequest
* @return
* @throws Exception
*/
public BaseResponse softDeleteById(Integer optId, HttpServletRequest httpRequest)throws Exception;
/**条件删除操作日志表
* @param dmpOptLogRequest
* @param httpRequest
* @return
* @throws Exception
*/
public BaseResponse delete(DmpOptLogRequest dmpOptLogRequest, HttpServletRequest httpRequest)throws Exception;
/**条件软删除操作日志表
* @param dmpOptLogRequest
* @param httpRequest
* @return
* @throws Exception
*/
public BaseResponse softDelete(DmpOptLogRequest dmpOptLogRequest, HttpServletRequest httpRequest)throws Exception;
/**批量新增操作日志表
* @param dmpOptLogVo
* @param httpRequest
* @return
* @throws Exception
*/
public BaseBeanResponse<DmpOptLogBatch> addBatch(DmpOptLogBatch dmpOptLogBatch, HttpServletRequest httpRequest)throws Exception;
/**
* @Title: deleteByIds
* @Description: TODO(根据主键批量删除)
* @param @param idList
* @param @param httpRequest
* @param @return
* @param @throws Exception 参数
* @return BaseResponse 返回类型
* @throws
*/
public BaseResponse deleteByIds(List<Integer> idList, HttpServletRequest httpRequest)throws Exception;
/**
* @Title: softDeleteByIds
* @Description: TODO(根据主键批量软删除)
* @param @param idList
* @param @param httpRequest
* @param @return
* @param @throws Exception 参数
* @return BaseResponse 返回类型
* @throws
*/
public BaseResponse softDeleteByIds(List<Integer> idList, HttpServletRequest httpRequest)throws Exception;
}
...@@ -1331,10 +1331,12 @@ public class DmpDevelopTaskServiceImpl extends BaseService implements DmpDevelop ...@@ -1331,10 +1331,12 @@ public class DmpDevelopTaskServiceImpl extends BaseService implements DmpDevelop
updateDevelopTask.setPublishVersion(queryDmpDevelopTask.getVersion()); updateDevelopTask.setPublishVersion(queryDmpDevelopTask.getVersion());
dmpDevelopTaskDao.update(updateDevelopTask); dmpDevelopTaskDao.update(updateDevelopTask);
} baseResponse.setCode(StatuConstant.SUCCESS_CODE);
baseResponse.setMessage("工作流程保存发布成功");
baseResponse.setCode(StatuConstant.SUCCESS_CODE); } else {
baseResponse.setMessage("工作流程保存发布成功"); baseResponse.setCode(StatuConstant.SUCCESS_CODE);
baseResponse.setMessage(baseResponsePublish.getMessage());
}
return baseResponse; return baseResponse;
} }
......
package com.jz.dmp.modules.service.impl;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
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.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.StatuConstant;
import com.jz.common.persistence.BaseService;
import com.jz.dmp.modules.controller.bean.DmpOptLogBatch;
import com.jz.dmp.modules.controller.bean.DmpOptLogDto;
import com.jz.dmp.modules.controller.bean.DmpOptLogRequest;
import com.jz.dmp.modules.dao.DmpOptLogMapper;
import com.jz.dmp.modules.model.DmpOptLog;
import com.jz.dmp.modules.service.DmpOptLogService;
/**
* 操作日志表服务的实现?
*
* @author ybz
*
*/
@Service("dmpOptLogService")
public class DmpOptLogServiceImpl extends BaseService implements DmpOptLogService {
private static Logger logger = LoggerFactory.getLogger(DmpOptLogServiceImpl.class);
@Autowired
private DmpOptLogMapper dmpOptLogMapper;
/*
* (non-Javadoc)
*
* @see
* com.ycxc.vmts.service.DmpOptLogService#findListWithPage(com.ycxc.vmts.controller.
* bean.DmpOptLogRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
public PageInfoResponse<DmpOptLogDto> findListWithPage(DmpOptLogRequest dmpOptLogRequest, HttpServletRequest httpRequest)
throws Exception {
PageInfoResponse<DmpOptLogDto> pageInfoResponse = new PageInfoResponse<>();
Map<String, Object> param = new HashMap<>();
//主键
if (dmpOptLogRequest.getOptId() != null) {
param.put("optId", dmpOptLogRequest.getOptId());
}
//操作人ID
if (dmpOptLogRequest.getUserId() != null) {
param.put("userId", dmpOptLogRequest.getUserId());
}
//操作人姓名
if (!StringUtils.isEmpty(dmpOptLogRequest.getUserName())) {
param.put("userName", dmpOptLogRequest.getUserName());
}
//操作时间起
if (dmpOptLogRequest.getOptTimeStart() != null) {
param.put("optTimeStart", dmpOptLogRequest.getOptTimeStart());
}
//操作时间止
if (dmpOptLogRequest.getOptTimeEnd() != null) {
param.put("optTimeEnd", dmpOptLogRequest.getOptTimeEnd());
}
//操作类型
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptType())) {
param.put("optType", dmpOptLogRequest.getOptType());
}
//操作描述
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptDesc())) {
param.put("optDesc", dmpOptLogRequest.getOptDesc());
}
//操作方法
if (!StringUtils.isEmpty(dmpOptLogRequest.getMethod())) {
param.put("method", dmpOptLogRequest.getMethod());
}
//请求参数
if (!StringUtils.isEmpty(dmpOptLogRequest.getRequestParam())) {
param.put("requestParam", dmpOptLogRequest.getRequestParam());
}
//操作结果
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptResult())) {
param.put("optResult", dmpOptLogRequest.getOptResult());
}
//IP地址
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptIp())) {
param.put("optIp", dmpOptLogRequest.getOptIp());
}
//备注
if (!StringUtils.isEmpty(dmpOptLogRequest.getRemark())) {
param.put("remark", dmpOptLogRequest.getRemark());
}
//数据状态(0:删除,1,未删除)
if (!StringUtils.isEmpty(dmpOptLogRequest.getDataStatus())) {
param.put("dataStatus", dmpOptLogRequest.getDataStatus());
}
//创建用户ID
if (dmpOptLogRequest.getCreateUserId() != null) {
param.put("createUserId", dmpOptLogRequest.getCreateUserId());
}
//创建时间起
if (dmpOptLogRequest.getCreateTimeStart() != null) {
param.put("createTimeStart", dmpOptLogRequest.getCreateTimeStart());
}
//创建时间止
if (dmpOptLogRequest.getCreateTimeEnd() != null) {
param.put("createTimeEnd", dmpOptLogRequest.getCreateTimeEnd());
}
//修改用户ID
if (dmpOptLogRequest.getUpdateUserId() != null) {
param.put("updateUserId", dmpOptLogRequest.getUpdateUserId());
}
//修改时间起
if (dmpOptLogRequest.getUpdateTimeStart() != null) {
param.put("updateTimeStart", dmpOptLogRequest.getUpdateTimeStart());
}
//修改时间止
if (dmpOptLogRequest.getUpdateTimeEnd() != null) {
param.put("updateTimeEnd", dmpOptLogRequest.getUpdateTimeEnd());
}
//加上可用标识(未软删除)
param.put("dataStatu", "1");
String obderByStr = dmpOptLogRequest.takeOrderByStr(DmpOptLogRequest.class);
Page page = null;
if (obderByStr==null) {
page = PageHelper.startPage(dmpOptLogRequest.getPageNum(), dmpOptLogRequest.getPageSize());
} else {
page = PageHelper.startPage(dmpOptLogRequest.getPageNum(), dmpOptLogRequest.getPageSize(), obderByStr);
}
List<DmpOptLogDto> list = dmpOptLogMapper.findList(param);
PageInfo<DmpOptLogDto> pageInfo = new PageInfo<>(list);
pageInfoResponse.setCode(StatuConstant.SUCCESS_CODE);
pageInfoResponse.setMessage("查询成功");
pageInfoResponse.setData(pageInfo);
return pageInfoResponse;
}
/*
* (non-Javadoc)
*
* @see
* com.ycxc.vmts.service.DmpOptLogService#findList(com.ycxc.vmts.controller.
* bean.DmpOptLogRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
public BaseBeanResponse<DmpOptLogDto> findList(DmpOptLogRequest dmpOptLogRequest, HttpServletRequest httpRequest)
throws Exception {
BaseBeanResponse<DmpOptLogDto> baseBeanResponse = new BaseBeanResponse<>();
Map<String, Object> param = new HashMap<>();
//主键
if (dmpOptLogRequest.getOptId() != null) {
param.put("optId", dmpOptLogRequest.getOptId());
}
//操作人ID
if (dmpOptLogRequest.getUserId() != null) {
param.put("userId", dmpOptLogRequest.getUserId());
}
//操作人姓名
if (!StringUtils.isEmpty(dmpOptLogRequest.getUserName())) {
param.put("userName", dmpOptLogRequest.getUserName());
}
//操作时间起
if (dmpOptLogRequest.getOptTimeStart() != null) {
param.put("optTimeStart", dmpOptLogRequest.getOptTimeStart());
}
//操作时间止
if (dmpOptLogRequest.getOptTimeEnd() != null) {
param.put("optTimeEnd", dmpOptLogRequest.getOptTimeEnd());
}
//操作类型
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptType())) {
param.put("optType", dmpOptLogRequest.getOptType());
}
//操作描述
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptDesc())) {
param.put("optDesc", dmpOptLogRequest.getOptDesc());
}
//操作方法
if (!StringUtils.isEmpty(dmpOptLogRequest.getMethod())) {
param.put("method", dmpOptLogRequest.getMethod());
}
//请求参数
if (!StringUtils.isEmpty(dmpOptLogRequest.getRequestParam())) {
param.put("requestParam", dmpOptLogRequest.getRequestParam());
}
//操作结果
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptResult())) {
param.put("optResult", dmpOptLogRequest.getOptResult());
}
//IP地址
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptIp())) {
param.put("optIp", dmpOptLogRequest.getOptIp());
}
//备注
if (!StringUtils.isEmpty(dmpOptLogRequest.getRemark())) {
param.put("remark", dmpOptLogRequest.getRemark());
}
//数据状态(0:删除,1,未删除)
if (!StringUtils.isEmpty(dmpOptLogRequest.getDataStatus())) {
param.put("dataStatus", dmpOptLogRequest.getDataStatus());
}
//创建用户ID
if (dmpOptLogRequest.getCreateUserId() != null) {
param.put("createUserId", dmpOptLogRequest.getCreateUserId());
}
//创建时间起
if (dmpOptLogRequest.getCreateTimeStart() != null) {
param.put("createTimeStart", dmpOptLogRequest.getCreateTimeStart());
}
//创建时间止
if (dmpOptLogRequest.getCreateTimeEnd() != null) {
param.put("createTimeEnd", dmpOptLogRequest.getCreateTimeEnd());
}
//修改用户ID
if (dmpOptLogRequest.getUpdateUserId() != null) {
param.put("updateUserId", dmpOptLogRequest.getUpdateUserId());
}
//修改时间起
if (dmpOptLogRequest.getUpdateTimeStart() != null) {
param.put("updateTimeStart", dmpOptLogRequest.getUpdateTimeStart());
}
//修改时间止
if (dmpOptLogRequest.getUpdateTimeEnd() != null) {
param.put("updateTimeEnd", dmpOptLogRequest.getUpdateTimeEnd());
}
//加上可用标识(未软删除)
param.put("dataStatu", "1");
List<DmpOptLogDto> list = dmpOptLogMapper.findList(param);
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("查询成功");
baseBeanResponse.setDatas(list);
return baseBeanResponse;
}
/*
* (non-Javadoc)
*
* @see
* com.ycxc.vmts.service.DmpOptLogService#add(com.ycxc.vmts.entity.DmpOptLog,
* javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor = Exception.class)
public BaseBeanResponse<DmpOptLog> add(DmpOptLog dmpOptLog, HttpServletRequest httpRequest) throws Exception {
BaseBeanResponse<DmpOptLog> baseBeanResponse = new BaseBeanResponse<>();
/*$*setOptIdCodeReplace*$*/
// 创建人
dmpOptLog.setCreateUserId(getHttpRequestUserId(httpRequest));
// 创建时间
dmpOptLog.setCreateTime(new Date());
dmpOptLogMapper.insertSelective(dmpOptLog);
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("新增成功");
baseBeanResponse.setData(dmpOptLog);
return baseBeanResponse;
}
/*
* (non-Javadoc)
*
* @see
* com.ycxc.vmts.service.DmpOptLogService#edit(com.ycxc.vmts.entity.DmpOptLog,
* javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor = Exception.class)
public BaseBeanResponse<DmpOptLog> edit(DmpOptLog dmpOptLog, HttpServletRequest httpRequest) throws Exception {
BaseBeanResponse<DmpOptLog> baseBeanResponse = new BaseBeanResponse<>();
// 修改人
dmpOptLog.setUpdateUserId(getHttpRequestUserId(httpRequest));
// 修改时间
dmpOptLog.setUpdateTime(new Date());
dmpOptLogMapper.updateByPrimaryKeySelective(dmpOptLog);
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("修改成功");
baseBeanResponse.setData(dmpOptLog);
return baseBeanResponse;
}
/*
* (non-Javadoc)
*
* @see
* com.ycxc.vmts.service.DmpOptLogService#addOrEdit(com.ycxc.vmts.entity.DmpOptLog,
* javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor = Exception.class)
public BaseBeanResponse<DmpOptLog> addOrEdit(DmpOptLog dmpOptLog, HttpServletRequest httpRequest) throws Exception {
BaseBeanResponse<DmpOptLog> baseBeanResponse = new BaseBeanResponse<>();
Integer optId = dmpOptLog.getOptId();
if (null==optId) {//新增
// 创建人
dmpOptLog.setCreateUserId(getHttpRequestUserId(httpRequest));
// 创建时间
dmpOptLog.setCreateTime(new Date());
dmpOptLogMapper.insertSelective(dmpOptLog);
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("新增成功");
baseBeanResponse.setData(dmpOptLog);
} else {//修改
// 修改人
dmpOptLog.setUpdateUserId(getHttpRequestUserId(httpRequest));
// 修改时间
dmpOptLog.setUpdateTime(new Date());
dmpOptLogMapper.updateByPrimaryKeySelective(dmpOptLog);
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("修改成功");
baseBeanResponse.setData(dmpOptLog);
}
return baseBeanResponse;
}
/*
* (non-Javadoc)
*
* @see
* com.ycxc.vmts.service.DmpOptLogService#findById(com.ycxc.vmts.controller.
* bean.DmpOptLogRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
public BaseBeanResponse<DmpOptLogDto> findById(Integer optId, HttpServletRequest httpRequest)
throws Exception {
BaseBeanResponse<DmpOptLogDto> baseBeanResponse = new BaseBeanResponse<>();
DmpOptLogDto dmpOptLogDto = dmpOptLogMapper.findById(optId);
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("查询成功");
baseBeanResponse.setData(dmpOptLogDto);
return baseBeanResponse;
}
/*
* (non-Javadoc)
*
* @see
* com.ycxc.vmts.service.DmpOptLogService#deleteById(com.ycxc.vmts.controller.
* bean.DmpOptLogRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor = Exception.class)
public BaseResponse deleteById(Integer optId, HttpServletRequest httpRequest) throws Exception {
BaseResponse baseResponse = new BaseResponse();
dmpOptLogMapper.deleteByPrimaryKey(optId);
baseResponse.setCode(StatuConstant.SUCCESS_CODE);
baseResponse.setMessage("删除成功");
return baseResponse;
}
/*
* (non-Javadoc)
*
* @see
* com.ycxc.vmts.service.DmpOptLogService#deleteById(com.ycxc.vmts.controller.
* bean.DmpOptLogRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor = Exception.class)
public BaseResponse softDeleteById(Integer optId, HttpServletRequest httpRequest) throws Exception {
BaseResponse baseResponse = new BaseResponse();
dmpOptLogMapper.softDeleteByPrimaryKey(optId);
baseResponse.setCode(StatuConstant.SUCCESS_CODE);
baseResponse.setMessage("软删除成功");
return baseResponse;
}
/*
* (non-Javadoc)
*
* @see
* com.ycxc.vmts.service.DmpOptLogService#deleteById(com.ycxc.vmts.controller.
* bean.DmpOptLogRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor = Exception.class)
public BaseResponse delete(DmpOptLogRequest dmpOptLogRequest, HttpServletRequest httpRequest) throws Exception {
BaseResponse baseResponse = new BaseResponse();
Map<String, Object> param = new HashMap<>();
//主键
if (dmpOptLogRequest.getOptId() != null) {
param.put("optId", dmpOptLogRequest.getOptId());
}
//操作人ID
if (dmpOptLogRequest.getUserId() != null) {
param.put("userId", dmpOptLogRequest.getUserId());
}
//操作人姓名
if (!StringUtils.isEmpty(dmpOptLogRequest.getUserName())) {
param.put("userName", dmpOptLogRequest.getUserName());
}
//操作时间起
if (dmpOptLogRequest.getOptTimeStart() != null) {
param.put("optTimeStart", dmpOptLogRequest.getOptTimeStart());
}
//操作时间止
if (dmpOptLogRequest.getOptTimeEnd() != null) {
param.put("optTimeEnd", dmpOptLogRequest.getOptTimeEnd());
}
//操作类型
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptType())) {
param.put("optType", dmpOptLogRequest.getOptType());
}
//操作描述
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptDesc())) {
param.put("optDesc", dmpOptLogRequest.getOptDesc());
}
//操作方法
if (!StringUtils.isEmpty(dmpOptLogRequest.getMethod())) {
param.put("method", dmpOptLogRequest.getMethod());
}
//请求参数
if (!StringUtils.isEmpty(dmpOptLogRequest.getRequestParam())) {
param.put("requestParam", dmpOptLogRequest.getRequestParam());
}
//操作结果
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptResult())) {
param.put("optResult", dmpOptLogRequest.getOptResult());
}
//IP地址
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptIp())) {
param.put("optIp", dmpOptLogRequest.getOptIp());
}
//备注
if (!StringUtils.isEmpty(dmpOptLogRequest.getRemark())) {
param.put("remark", dmpOptLogRequest.getRemark());
}
//数据状态(0:删除,1,未删除)
if (!StringUtils.isEmpty(dmpOptLogRequest.getDataStatus())) {
param.put("dataStatus", dmpOptLogRequest.getDataStatus());
}
//创建用户ID
if (dmpOptLogRequest.getCreateUserId() != null) {
param.put("createUserId", dmpOptLogRequest.getCreateUserId());
}
//创建时间起
if (dmpOptLogRequest.getCreateTimeStart() != null) {
param.put("createTimeStart", dmpOptLogRequest.getCreateTimeStart());
}
//创建时间止
if (dmpOptLogRequest.getCreateTimeEnd() != null) {
param.put("createTimeEnd", dmpOptLogRequest.getCreateTimeEnd());
}
//修改用户ID
if (dmpOptLogRequest.getUpdateUserId() != null) {
param.put("updateUserId", dmpOptLogRequest.getUpdateUserId());
}
//修改时间起
if (dmpOptLogRequest.getUpdateTimeStart() != null) {
param.put("updateTimeStart", dmpOptLogRequest.getUpdateTimeStart());
}
//修改时间止
if (dmpOptLogRequest.getUpdateTimeEnd() != null) {
param.put("updateTimeEnd", dmpOptLogRequest.getUpdateTimeEnd());
}
dmpOptLogMapper.delete(param);
baseResponse.setCode(StatuConstant.SUCCESS_CODE);
baseResponse.setMessage("删除成功");
return baseResponse;
}
/*
* (non-Javadoc)
*
* @see
* com.ycxc.vmts.service.DmpOptLogService#deleteById(com.ycxc.vmts.controller.
* bean.DmpOptLogRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor = Exception.class)
public BaseResponse softDelete(DmpOptLogRequest dmpOptLogRequest, HttpServletRequest httpRequest) throws Exception {
BaseResponse baseResponse = new BaseResponse();
Map<String, Object> param = new HashMap<>();
//主键
if (dmpOptLogRequest.getOptId() != null) {
param.put("optId", dmpOptLogRequest.getOptId());
}
//操作人ID
if (dmpOptLogRequest.getUserId() != null) {
param.put("userId", dmpOptLogRequest.getUserId());
}
//操作人姓名
if (!StringUtils.isEmpty(dmpOptLogRequest.getUserName())) {
param.put("userName", dmpOptLogRequest.getUserName());
}
//操作时间起
if (dmpOptLogRequest.getOptTimeStart() != null) {
param.put("optTimeStart", dmpOptLogRequest.getOptTimeStart());
}
//操作时间止
if (dmpOptLogRequest.getOptTimeEnd() != null) {
param.put("optTimeEnd", dmpOptLogRequest.getOptTimeEnd());
}
//操作类型
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptType())) {
param.put("optType", dmpOptLogRequest.getOptType());
}
//操作描述
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptDesc())) {
param.put("optDesc", dmpOptLogRequest.getOptDesc());
}
//操作方法
if (!StringUtils.isEmpty(dmpOptLogRequest.getMethod())) {
param.put("method", dmpOptLogRequest.getMethod());
}
//请求参数
if (!StringUtils.isEmpty(dmpOptLogRequest.getRequestParam())) {
param.put("requestParam", dmpOptLogRequest.getRequestParam());
}
//操作结果
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptResult())) {
param.put("optResult", dmpOptLogRequest.getOptResult());
}
//IP地址
if (!StringUtils.isEmpty(dmpOptLogRequest.getOptIp())) {
param.put("optIp", dmpOptLogRequest.getOptIp());
}
//备注
if (!StringUtils.isEmpty(dmpOptLogRequest.getRemark())) {
param.put("remark", dmpOptLogRequest.getRemark());
}
//数据状态(0:删除,1,未删除)
if (!StringUtils.isEmpty(dmpOptLogRequest.getDataStatus())) {
param.put("dataStatus", dmpOptLogRequest.getDataStatus());
}
//创建用户ID
if (dmpOptLogRequest.getCreateUserId() != null) {
param.put("createUserId", dmpOptLogRequest.getCreateUserId());
}
//创建时间起
if (dmpOptLogRequest.getCreateTimeStart() != null) {
param.put("createTimeStart", dmpOptLogRequest.getCreateTimeStart());
}
//创建时间止
if (dmpOptLogRequest.getCreateTimeEnd() != null) {
param.put("createTimeEnd", dmpOptLogRequest.getCreateTimeEnd());
}
//修改用户ID
if (dmpOptLogRequest.getUpdateUserId() != null) {
param.put("updateUserId", dmpOptLogRequest.getUpdateUserId());
}
//修改时间起
if (dmpOptLogRequest.getUpdateTimeStart() != null) {
param.put("updateTimeStart", dmpOptLogRequest.getUpdateTimeStart());
}
//修改时间止
if (dmpOptLogRequest.getUpdateTimeEnd() != null) {
param.put("updateTimeEnd", dmpOptLogRequest.getUpdateTimeEnd());
}
dmpOptLogMapper.softDelete(param);
baseResponse.setCode(StatuConstant.SUCCESS_CODE);
baseResponse.setMessage("软删除成功");
return baseResponse;
}
/*
* (non-Javadoc)
*
* @see
* com.ycxc.vmts.service.DmpOptLogService#addBatch(com.ycxc.vmts.controller.
* bean.DmpOptLogVo, javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor = Exception.class)
public BaseBeanResponse<DmpOptLogBatch> addBatch(DmpOptLogBatch dmpOptLogBatch, HttpServletRequest httpRequest)
throws Exception {
BaseBeanResponse<DmpOptLogBatch> baseBeanResponse = new BaseBeanResponse<>();
List<DmpOptLog> dmpOptLogs = dmpOptLogBatch.getDmpOptLogs();
if (CollectionUtils.isEmpty(dmpOptLogs)) {
baseBeanResponse.setCode(StatuConstant.FAILURE_CODE);
baseBeanResponse.setMessage("数据不能为空!");
return baseBeanResponse;
}
dmpOptLogs = dmpOptLogs.stream().map(dmpOptLog -> {
/*$*setOptIdCodeReplace*$*/
// 创建人
try {
dmpOptLog.setCreateUserId(getHttpRequestUserId(httpRequest));
} catch (Exception e) {
logger.info(e.getMessage());
e.printStackTrace();
}
// 创建时间
dmpOptLog.setCreateTime(new Date());
return dmpOptLog;
}).collect(Collectors.toList());
dmpOptLogMapper.insertBatch(dmpOptLogs);
baseBeanResponse.setCode(StatuConstant.SUCCESS_CODE);
baseBeanResponse.setMessage("批量新增成功");
baseBeanResponse.setData(dmpOptLogBatch);
return baseBeanResponse;
}
/**
*批量删除
*/
@Override
@Transactional(rollbackFor=Exception.class)
public BaseResponse deleteByIds(List<Integer> idList, HttpServletRequest httpRequest) throws Exception {
BaseResponse baseResponse = new BaseResponse();
dmpOptLogMapper.deleteByIds(idList);
baseResponse.setCode(StatuConstant.SUCCESS_CODE);
baseResponse.setMessage("删除成功");
return baseResponse;
}
/**
*批量软删除
*/
@Override
@Transactional(rollbackFor=Exception.class)
public BaseResponse softDeleteByIds(List<Integer> idList, HttpServletRequest httpRequest) throws Exception {
BaseResponse baseResponse = new BaseResponse();
dmpOptLogMapper.softDeleteByIds(idList);
baseResponse.setCode(StatuConstant.SUCCESS_CODE);
baseResponse.setMessage("软删除成功");
return baseResponse;
}
}
...@@ -5,6 +5,8 @@ import java.util.HashMap; ...@@ -5,6 +5,8 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -45,6 +47,9 @@ import com.jz.dmp.modules.service.projconfig.DmpProjectConfigInfoService; ...@@ -45,6 +47,9 @@ import com.jz.dmp.modules.service.projconfig.DmpProjectConfigInfoService;
*/ */
@Service @Service
public class FlowServiceImpl implements FlowService { public class FlowServiceImpl implements FlowService {
private static Logger logger = LoggerFactory.getLogger(FlowServiceImpl.class);
@Autowired @Autowired
private DmpProjectDao dmpProjectDao; private DmpProjectDao dmpProjectDao;
...@@ -102,6 +107,7 @@ public class FlowServiceImpl implements FlowService { ...@@ -102,6 +107,7 @@ public class FlowServiceImpl implements FlowService {
if (flowNodeChangeList == null || flowNodeChangeList.size() == 0) { if (flowNodeChangeList == null || flowNodeChangeList.size() == 0) {
baseResponse.setCode(StatuConstant.CODE_DATA_NOTMEET); baseResponse.setCode(StatuConstant.CODE_DATA_NOTMEET);
baseResponse.setMessage("流程节点数据没有变化,取消发布"); baseResponse.setMessage("流程节点数据没有变化,取消发布");
logger.info("流程节点数据没有变化,取消发布");
return baseResponse; return baseResponse;
} }
...@@ -136,7 +142,7 @@ public class FlowServiceImpl implements FlowService { ...@@ -136,7 +142,7 @@ public class FlowServiceImpl implements FlowService {
} }
baseResponse.setCode(StatuConstant.SUCCESS_CODE); baseResponse.setCode(StatuConstant.SUCCESS_CODE);
baseResponse.setCode("发布成功"); baseResponse.setMessage("发布成功");
return baseResponse; return baseResponse;
} }
......
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
VERSION = #{version}, VERSION = #{version},
</if> </if>
<if test="publishVersion != null and publishVersion != ''"> <if test="publishVersion != null and publishVersion != ''">
publish_version = #{publishVersion},, publish_version = #{publishVersion},
</if> </if>
<if test="isGziped != null"> <if test="isGziped != null">
IS_GZIPED = #{isGziped}, IS_GZIPED = #{isGziped},
......
<?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.jz.dmp.modules.dao.DmpOptLogMapper" >
<resultMap id="BaseResultMap" type="com.jz.dmp.modules.model.DmpOptLog">
<result column="opt_id" property="optId" jdbcType="INTEGER" />
<result column="user_id" property="userId" jdbcType="INTEGER" />
<result column="user_name" property="userName" jdbcType="VARCHAR" />
<result column="opt_time" property="optTime" jdbcType="TIMESTAMP" />
<result column="opt_type" property="optType" jdbcType="VARCHAR" />
<result column="opt_desc" property="optDesc" jdbcType="VARCHAR" />
<result column="method" property="method" jdbcType="VARCHAR" />
<result column="request_param" property="requestParam" jdbcType="LONGVARCHAR" />
<result column="opt_result" property="optResult" jdbcType="LONGVARCHAR" />
<result column="opt_ip" property="optIp" jdbcType="VARCHAR" />
<result column="remark" property="remark" jdbcType="VARCHAR" />
<result column="data_status" property="dataStatus" jdbcType="CHAR" />
<result column="create_user_id" property="createUserId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_user_id" property="updateUserId" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
</resultMap>
<resultMap id="BaseDtoResultMap" type="com.jz.dmp.modules.controller.bean.DmpOptLogDto" extends="BaseResultMap">
<!-- /*$BaseDtoResultMapContent$*/ -->
</resultMap>
<sql id="Base_Column_List">
log.opt_id, log.user_id, log.user_name, log.opt_time, log.opt_type,
log.opt_desc, log.method, log.request_param, log.opt_result, log.opt_ip,
log.remark, log.data_status, log.create_user_id, log.create_time, log.update_user_id,
log.update_time
</sql>
<sql id="BaseDto_Column_List">
<include refid="Base_Column_List" />
<!-- /*$BaseDtoColumnListContent$*/ -->
</sql>
<!-- 根据主键查询操作日志表 -->
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List" />
from dmp_opt_log log
where log.opt_id = #{optId,jdbcType=INTEGER}
AND log.data_status='1'
</select>
<!-- 根据主键删除操作日志表 -->
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from dmp_opt_log
where opt_id = #{optId,jdbcType=INTEGER}
</delete>
<!-- 根据主键软删除操作日志表 -->
<update id="softDeleteByPrimaryKey" parameterType="java.lang.String">
update dmp_opt_log
<set>
data_status = '0'
</set>
where opt_id = #{optId,jdbcType=INTEGER}
</update>
<!-- 条件删除操作日志表 -->
<delete id="delete" parameterType="java.lang.String">
delete from dmp_opt_log
<where>
<if test="optId != null" >
AND log.opt_id = #{optId,jdbcType=INTEGER}
</if>
<if test="userId != null" >
AND log.user_id = #{userId,jdbcType=INTEGER}
</if>
<if test="userName != null" >
AND log.user_name = #{userName,jdbcType=VARCHAR}
</if>
<if test="optTimeStart != null" >
AND log.opt_time >= #{optTimeStart,jdbcType=TIMESTAMP}
</if>
<if test="optTimeEnd != null" >
AND log.opt_time <![CDATA[ <= ]]> #{optTimeEnd,jdbcType=TIMESTAMP}
</if>
<if test="optType != null" >
AND log.opt_type = #{optType,jdbcType=VARCHAR}
</if>
<if test="optDesc != null" >
AND log.opt_desc = #{optDesc,jdbcType=VARCHAR}
</if>
<if test="method != null" >
AND log.method = #{method,jdbcType=VARCHAR}
</if>
<if test="requestParam != null" >
AND log.request_param = #{requestParam,jdbcType=LONGVARCHAR}
</if>
<if test="optResult != null" >
AND log.opt_result = #{optResult,jdbcType=LONGVARCHAR}
</if>
<if test="optIp != null" >
AND log.opt_ip = #{optIp,jdbcType=VARCHAR}
</if>
<if test="remark != null" >
AND log.remark = #{remark,jdbcType=VARCHAR}
</if>
<if test="dataStatus != null" >
AND log.data_status = #{dataStatus,jdbcType=CHAR}
</if>
<if test="createUserId != null" >
AND log.create_user_id = #{createUserId,jdbcType=INTEGER}
</if>
<if test="createTimeStart != null" >
AND log.create_time >= #{createTimeStart,jdbcType=TIMESTAMP}
</if>
<if test="createTimeEnd != null" >
AND log.create_time <![CDATA[ <= ]]> #{createTimeEnd,jdbcType=TIMESTAMP}
</if>
<if test="updateUserId != null" >
AND log.update_user_id = #{updateUserId,jdbcType=INTEGER}
</if>
<if test="updateTimeStart != null" >
AND log.update_time >= #{updateTimeStart,jdbcType=TIMESTAMP}
</if>
<if test="updateTimeEnd != null" >
AND log.update_time <![CDATA[ <= ]]> #{updateTimeEnd,jdbcType=TIMESTAMP}
</if>
AND data_status='1'
</where>
</delete>
<!-- 条件软删除操作日志表 -->
<update id="softDelete" parameterType="java.lang.String">
update dmp_opt_log
<set>
data_status = '0'
</set>
<where>
<if test="optId != null" >
AND log.opt_id = #{optId,jdbcType=INTEGER}
</if>
<if test="userId != null" >
AND log.user_id = #{userId,jdbcType=INTEGER}
</if>
<if test="userName != null" >
AND log.user_name = #{userName,jdbcType=VARCHAR}
</if>
<if test="optTimeStart != null" >
AND log.opt_time >= #{optTimeStart,jdbcType=TIMESTAMP}
</if>
<if test="optTimeEnd != null" >
AND log.opt_time <![CDATA[ <= ]]> #{optTimeEnd,jdbcType=TIMESTAMP}
</if>
<if test="optType != null" >
AND log.opt_type = #{optType,jdbcType=VARCHAR}
</if>
<if test="optDesc != null" >
AND log.opt_desc = #{optDesc,jdbcType=VARCHAR}
</if>
<if test="method != null" >
AND log.method = #{method,jdbcType=VARCHAR}
</if>
<if test="requestParam != null" >
AND log.request_param = #{requestParam,jdbcType=LONGVARCHAR}
</if>
<if test="optResult != null" >
AND log.opt_result = #{optResult,jdbcType=LONGVARCHAR}
</if>
<if test="optIp != null" >
AND log.opt_ip = #{optIp,jdbcType=VARCHAR}
</if>
<if test="remark != null" >
AND log.remark = #{remark,jdbcType=VARCHAR}
</if>
<if test="dataStatus != null" >
AND log.data_status = #{dataStatus,jdbcType=CHAR}
</if>
<if test="createUserId != null" >
AND log.create_user_id = #{createUserId,jdbcType=INTEGER}
</if>
<if test="createTimeStart != null" >
AND log.create_time >= #{createTimeStart,jdbcType=TIMESTAMP}
</if>
<if test="createTimeEnd != null" >
AND log.create_time <![CDATA[ <= ]]> #{createTimeEnd,jdbcType=TIMESTAMP}
</if>
<if test="updateUserId != null" >
AND log.update_user_id = #{updateUserId,jdbcType=INTEGER}
</if>
<if test="updateTimeStart != null" >
AND log.update_time >= #{updateTimeStart,jdbcType=TIMESTAMP}
</if>
<if test="updateTimeEnd != null" >
AND log.update_time <![CDATA[ <= ]]> #{updateTimeEnd,jdbcType=TIMESTAMP}
</if>
AND data_status='1'
</where>
</update>
<!-- 插入操作日志表 -->
<insert id="insert" parameterType="com.jz.dmp.modules.model.DmpOptLog">
insert into dmp_opt_log (
opt_id, user_id, user_name, opt_time, opt_type,
opt_desc, method, request_param, opt_result, opt_ip,
remark, data_status, create_user_id, create_time, update_user_id,
update_time
)
values (
#{optId,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{optTime,jdbcType=TIMESTAMP}, #{optType,jdbcType=VARCHAR},
#{optDesc,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, #{requestParam,jdbcType=LONGVARCHAR}, #{optResult,jdbcType=LONGVARCHAR}, #{optIp,jdbcType=VARCHAR},
#{remark,jdbcType=VARCHAR}, #{dataStatus,jdbcType=CHAR}, #{createUserId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateUserId,jdbcType=INTEGER},
#{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<!-- 批量新增操作日志表 -->
<insert id="insertBatch" parameterType="com.jz.dmp.modules.model.DmpOptLog">
insert into dmp_opt_log (
opt_id, user_id, user_name, opt_time, opt_type,
opt_desc, method, request_param, opt_result, opt_ip,
remark, data_status, create_user_id, create_time, update_user_id,
update_time
)
values
<foreach collection="list" item="item" separator=",">
(
#{item.optId,jdbcType=INTEGER}, #{item.userId,jdbcType=INTEGER}, #{item.userName,jdbcType=VARCHAR}, #{item.optTime,jdbcType=TIMESTAMP}, #{item.optType,jdbcType=VARCHAR},
#{item.optDesc,jdbcType=VARCHAR}, #{item.method,jdbcType=VARCHAR}, #{item.requestParam,jdbcType=LONGVARCHAR}, #{item.optResult,jdbcType=LONGVARCHAR}, #{item.optIp,jdbcType=VARCHAR},
#{item.remark,jdbcType=VARCHAR}, #{item.dataStatus,jdbcType=CHAR}, #{item.createUserId,jdbcType=INTEGER}, #{item.createTime,jdbcType=TIMESTAMP}, #{item.updateUserId,jdbcType=INTEGER},
#{item.updateTime,jdbcType=TIMESTAMP}
)
</foreach>
</insert>
<!-- 选择性插入操作日志表 -->
<insert id="insertSelective" parameterType="com.jz.dmp.modules.model.DmpOptLog">
insert into dmp_opt_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="optId != null" >
opt_id,
</if>
<if test="userId != null" >
user_id,
</if>
<if test="userName != null" >
user_name,
</if>
<if test="optTime != null" >
opt_time,
</if>
<if test="optType != null" >
opt_type,
</if>
<if test="optDesc != null" >
opt_desc,
</if>
<if test="method != null" >
method,
</if>
<if test="requestParam != null" >
request_param,
</if>
<if test="optResult != null" >
opt_result,
</if>
<if test="optIp != null" >
opt_ip,
</if>
<if test="remark != null" >
remark,
</if>
<if test="dataStatus != null" >
data_status,
</if>
<if test="createUserId != null" >
create_user_id,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="updateUserId != null" >
update_user_id,
</if>
<if test="updateTime != null" >
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="optId != null" >
#{optId,jdbcType=INTEGER},
</if>
<if test="userId != null" >
#{userId,jdbcType=INTEGER},
</if>
<if test="userName != null" >
#{userName,jdbcType=VARCHAR},
</if>
<if test="optTime != null" >
#{optTime,jdbcType=TIMESTAMP},
</if>
<if test="optType != null" >
#{optType,jdbcType=VARCHAR},
</if>
<if test="optDesc != null" >
#{optDesc,jdbcType=VARCHAR},
</if>
<if test="method != null" >
#{method,jdbcType=VARCHAR},
</if>
<if test="requestParam != null" >
#{requestParam,jdbcType=LONGVARCHAR},
</if>
<if test="optResult != null" >
#{optResult,jdbcType=LONGVARCHAR},
</if>
<if test="optIp != null" >
#{optIp,jdbcType=VARCHAR},
</if>
<if test="remark != null" >
#{remark,jdbcType=VARCHAR},
</if>
<if test="dataStatus != null" >
#{dataStatus,jdbcType=CHAR},
</if>
<if test="createUserId != null" >
#{createUserId,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateUserId != null" >
#{updateUserId,jdbcType=INTEGER},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<!-- 修改操作日志表 -->
<update id="updateByPrimaryKey" parameterType="com.jz.dmp.modules.model.DmpOptLog">
update dmp_opt_log set
opt_id = #{optId,jdbcType=INTEGER},
user_id = #{userId,jdbcType=INTEGER},
user_name = #{userName,jdbcType=VARCHAR},
opt_time = #{optTime,jdbcType=TIMESTAMP},
opt_type = #{optType,jdbcType=VARCHAR},
opt_desc = #{optDesc,jdbcType=VARCHAR},
method = #{method,jdbcType=VARCHAR},
request_param = #{requestParam,jdbcType=LONGVARCHAR},
opt_result = #{optResult,jdbcType=LONGVARCHAR},
opt_ip = #{optIp,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
data_status = #{dataStatus,jdbcType=CHAR},
create_user_id = #{createUserId,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_user_id = #{updateUserId,jdbcType=INTEGER},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where opt_id = #{optId,jdbcType=INTEGER}
</update>
<!-- 选择性修改操作日志表 -->
<update id="updateByPrimaryKeySelective" parameterType="com.jz.dmp.modules.model.DmpOptLog">
update dmp_opt_log
<set>
<if test="optId != null" >
opt_id = #{optId,jdbcType=INTEGER},
</if>
<if test="userId != null" >
user_id = #{userId,jdbcType=INTEGER},
</if>
<if test="userName != null" >
user_name = #{userName,jdbcType=VARCHAR},
</if>
<if test="optTime != null" >
opt_time = #{optTime,jdbcType=TIMESTAMP},
</if>
<if test="optType != null" >
opt_type = #{optType,jdbcType=VARCHAR},
</if>
<if test="optDesc != null" >
opt_desc = #{optDesc,jdbcType=VARCHAR},
</if>
<if test="method != null" >
method = #{method,jdbcType=VARCHAR},
</if>
<if test="requestParam != null" >
request_param = #{requestParam,jdbcType=LONGVARCHAR},
</if>
<if test="optResult != null" >
opt_result = #{optResult,jdbcType=LONGVARCHAR},
</if>
<if test="optIp != null" >
opt_ip = #{optIp,jdbcType=VARCHAR},
</if>
<if test="remark != null" >
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="dataStatus != null" >
data_status = #{dataStatus,jdbcType=CHAR},
</if>
<if test="createUserId != null" >
create_user_id = #{createUserId,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateUserId != null" >
update_user_id = #{updateUserId,jdbcType=INTEGER},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where opt_id = #{optId,jdbcType=INTEGER}
</update>
<!-- 条件查询操作日志表 -->
<select id="findList" resultMap="BaseDtoResultMap">
SELECT
<include refid="BaseDto_Column_List"/>
FROM dmp_opt_log log
<where>
<if test="optId != null" >
AND log.opt_id = #{optId,jdbcType=INTEGER}
</if>
<if test="userId != null" >
AND log.user_id = #{userId,jdbcType=INTEGER}
</if>
<if test="userName != null" >
AND log.user_name = #{userName,jdbcType=VARCHAR}
</if>
<if test="optTimeStart != null" >
AND log.opt_time >= #{optTimeStart,jdbcType=TIMESTAMP}
</if>
<if test="optTimeEnd != null" >
AND log.opt_time <![CDATA[ <= ]]> #{optTimeEnd,jdbcType=TIMESTAMP}
</if>
<if test="optType != null" >
AND log.opt_type = #{optType,jdbcType=VARCHAR}
</if>
<if test="optDesc != null" >
AND log.opt_desc = #{optDesc,jdbcType=VARCHAR}
</if>
<if test="method != null" >
AND log.method = #{method,jdbcType=VARCHAR}
</if>
<if test="requestParam != null" >
AND log.request_param = #{requestParam,jdbcType=LONGVARCHAR}
</if>
<if test="optResult != null" >
AND log.opt_result = #{optResult,jdbcType=LONGVARCHAR}
</if>
<if test="optIp != null" >
AND log.opt_ip = #{optIp,jdbcType=VARCHAR}
</if>
<if test="remark != null" >
AND log.remark = #{remark,jdbcType=VARCHAR}
</if>
<if test="dataStatus != null" >
AND log.data_status = #{dataStatus,jdbcType=CHAR}
</if>
<if test="createUserId != null" >
AND log.create_user_id = #{createUserId,jdbcType=INTEGER}
</if>
<if test="createTimeStart != null" >
AND log.create_time >= #{createTimeStart,jdbcType=TIMESTAMP}
</if>
<if test="createTimeEnd != null" >
AND log.create_time <![CDATA[ <= ]]> #{createTimeEnd,jdbcType=TIMESTAMP}
</if>
<if test="updateUserId != null" >
AND log.update_user_id = #{updateUserId,jdbcType=INTEGER}
</if>
<if test="updateTimeStart != null" >
AND log.update_time >= #{updateTimeStart,jdbcType=TIMESTAMP}
</if>
<if test="updateTimeEnd != null" >
AND log.update_time <![CDATA[ <= ]]> #{updateTimeEnd,jdbcType=TIMESTAMP}
</if>
</where>
</select>
<!-- 主键查询操作日志表 -->
<select id="findById" resultMap="BaseDtoResultMap">
select
<include refid="BaseDto_Column_List" />
from dmp_opt_log log
where log.opt_id = #{optId,jdbcType=INTEGER}
AND log.data_status='1'
</select>
<!-- 根据主键批量删除操作日志表 -->
<delete id="deleteByIds">
delete from dmp_opt_log
where opt_id in
<foreach collection="idList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<!-- 根据主键批量软删除操作日志表 -->
<update id="softDeleteByIds">
update dmp_opt_log
<set>
data_status = '0'
</set>
where opt_id in
<foreach collection="idList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment