parent
bd70252646
commit
e325e920e2
@ -0,0 +1,98 @@
|
||||
package ${basePackage}.action.ajax.system;
|
||||
|
||||
import com.fasterxml.jackson.core.TreeNode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import ${basePackage}.frame.auth.LocalData;
|
||||
import ${basePackage}.frame.base.BaseResponse;
|
||||
import ${basePackage}.frame.base.ErrorType;
|
||||
import ${basePackage}.frame.excel.WExcel;
|
||||
import ${basePackage}.frame.excel.exception.ReadErrorException;
|
||||
import ${basePackage}.frame.excel.exception.TemplateNotMatchException;
|
||||
import ${basePackage}.frame.utils.LogUtil;
|
||||
import ${basePackage}.frame.utils.MapperUtil;
|
||||
import ${basePackage}.frame.utils.ResponseUtil;
|
||||
import ${basePackage}.frame.utils.ValidationUtil;
|
||||
import ${basePackage}.module.system.ent.LogErr;
|
||||
import ${basePackage}.module.system.mgr.LogErrManager;
|
||||
import ${basePackage}.module.system.req.LogErrCreateRequest;
|
||||
import ${basePackage}.module.system.req.LogErrDeleteRequest;
|
||||
import ${basePackage}.module.system.req.LogErrFindRequest;
|
||||
import ${basePackage}.module.system.req.LogErrGetRequest;
|
||||
import ${basePackage}.module.system.req.LogErrUpdateRequest;
|
||||
import ${basePackage}.module.system.rsp.LogErrCreateResponse;
|
||||
import ${basePackage}.module.system.rsp.LogErrDeleteResponse;
|
||||
import ${basePackage}.module.system.rsp.LogErrFindResponse;
|
||||
import ${basePackage}.module.system.rsp.LogErrGetResponse;
|
||||
import ${basePackage}.module.system.rsp.LogErrUpdateResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class LogErrAjax {
|
||||
|
||||
@Autowired
|
||||
private LogErrManager logErrManager;
|
||||
|
||||
public LogErrCreateResponse create(LogErrCreateRequest request) {
|
||||
return logErrManager.create(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public LogErrDeleteResponse delete(LogErrDeleteRequest request) {
|
||||
return logErrManager.delete(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public LogErrUpdateResponse update(LogErrUpdateRequest request) {
|
||||
return logErrManager.update(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public LogErrFindResponse find(LogErrFindRequest request) {
|
||||
return logErrManager.find(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public LogErrGetResponse get(LogErrGetRequest request) {
|
||||
return logErrManager.get(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public Object template(){
|
||||
return ResponseUtil.apply(new WExcel<>(LogErr.class));
|
||||
}
|
||||
|
||||
public Object exports(TreeNode jsonParam) {
|
||||
LogErrFindRequest request = MapperUtil.toJava(jsonParam, LogErrFindRequest.class);
|
||||
LogErrFindResponse response = logErrManager.find(request, LocalData.getToken());
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
} else if (response.getTotalCount() == 0) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, "导出数据为空");
|
||||
return response;
|
||||
}
|
||||
return ResponseUtil.apply(new WExcel<>(LogErr.class).loadData(response.getResult()));
|
||||
}
|
||||
|
||||
public Object imports(MultipartFile file) {
|
||||
BaseResponse baseResponse = new BaseResponse();
|
||||
try {
|
||||
WExcel sheet = new WExcel<>(LogErr.class).loadData(file.getBytes(), new WExcel.Processor<LogErr>() {
|
||||
@Override
|
||||
public List<String> exec(LogErr o) {
|
||||
LogErrCreateRequest request = MapperUtil.map(o, LogErrCreateRequest.class);
|
||||
return ValidationUtil.validate(request);
|
||||
}
|
||||
});
|
||||
|
||||
if (sheet.hasError()) {
|
||||
return ResponseUtil.apply(sheet.getBytes(), sheet.getName() + "-检查.xlsx");
|
||||
} else {
|
||||
return baseResponse;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.dumpException(e);
|
||||
baseResponse.addError(ErrorType.BUSINESS_ERROR, "上传文件出错");
|
||||
} catch (TemplateNotMatchException | ReadErrorException e) {
|
||||
baseResponse.addError(ErrorType.BUSINESS_ERROR, e.getMessage());
|
||||
}
|
||||
return baseResponse;
|
||||
}
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
package ${basePackage}.module.system.ent;
|
||||
|
||||
import ${basePackage}.frame.base.BaseEntity;
|
||||
import ${basePackage}.frame.excel.annotation.ColumnDescription;
|
||||
import ${basePackage}.frame.excel.annotation.ColumnName;
|
||||
import ${basePackage}.frame.excel.annotation.SheetName;
|
||||
|
||||
/**
|
||||
* LOG_ERR - 错误日志
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-01-29
|
||||
*/
|
||||
@SheetName("错误日志")
|
||||
public class LogErr extends BaseEntity {
|
||||
|
||||
/**
|
||||
* LOG_ERR_TYPE - 错误类型
|
||||
*/
|
||||
@ColumnName("错误类型")
|
||||
@ColumnDescription("")
|
||||
private String logErrType;
|
||||
/**
|
||||
* TITLE - 错误标题
|
||||
*/
|
||||
@ColumnName("错误标题")
|
||||
@ColumnDescription("")
|
||||
private String title;
|
||||
/**
|
||||
* CONTENT - 错误内容
|
||||
*/
|
||||
@ColumnName("错误内容")
|
||||
@ColumnDescription("")
|
||||
private String content;
|
||||
/**
|
||||
* LOG_ERR_RESULT - 处理结果
|
||||
*/
|
||||
@ColumnName("处理结果")
|
||||
@ColumnDescription("")
|
||||
private String logErrResult;
|
||||
/**
|
||||
* ATTRIBUTE1 - 属性1
|
||||
*/
|
||||
@ColumnName("属性1")
|
||||
@ColumnDescription("")
|
||||
private String attribute1;
|
||||
/**
|
||||
* ATTRIBUTE2 - 属性2
|
||||
*/
|
||||
@ColumnName("属性2")
|
||||
@ColumnDescription("")
|
||||
private String attribute2;
|
||||
/**
|
||||
* ATTRIBUTE3 - 属性3
|
||||
*/
|
||||
@ColumnName("属性3")
|
||||
@ColumnDescription("")
|
||||
private String attribute3;
|
||||
|
||||
public String getLogErrType() {
|
||||
return this.logErrType;
|
||||
}
|
||||
|
||||
public void setLogErrType(String logErrType) {
|
||||
this.logErrType = logErrType;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return this.content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getLogErrResult() {
|
||||
return this.logErrResult;
|
||||
}
|
||||
|
||||
public void setLogErrResult(String logErrResult) {
|
||||
this.logErrResult = logErrResult;
|
||||
}
|
||||
|
||||
public String getAttribute1() {
|
||||
return this.attribute1;
|
||||
}
|
||||
|
||||
public void setAttribute1(String attribute1) {
|
||||
this.attribute1 = attribute1;
|
||||
}
|
||||
|
||||
public String getAttribute2() {
|
||||
return this.attribute2;
|
||||
}
|
||||
|
||||
public void setAttribute2(String attribute2) {
|
||||
this.attribute2 = attribute2;
|
||||
}
|
||||
|
||||
public String getAttribute3() {
|
||||
return this.attribute3;
|
||||
}
|
||||
|
||||
public void setAttribute3(String attribute3) {
|
||||
this.attribute3 = attribute3;
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package ${basePackage}.module.system.mgr;
|
||||
|
||||
import ${basePackage}.frame.base.Token;
|
||||
import ${basePackage}.module.system.req.LogErrCreateRequest;
|
||||
import ${basePackage}.module.system.req.LogErrDeleteRequest;
|
||||
import ${basePackage}.module.system.req.LogErrFindRequest;
|
||||
import ${basePackage}.module.system.req.LogErrGetRequest;
|
||||
import ${basePackage}.module.system.req.LogErrUpdateRequest;
|
||||
import ${basePackage}.module.system.rsp.LogErrCreateResponse;
|
||||
import ${basePackage}.module.system.rsp.LogErrDeleteResponse;
|
||||
import ${basePackage}.module.system.rsp.LogErrFindResponse;
|
||||
import ${basePackage}.module.system.rsp.LogErrGetResponse;
|
||||
import ${basePackage}.module.system.rsp.LogErrUpdateResponse;
|
||||
|
||||
/**
|
||||
* 错误日志
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-01-29
|
||||
*/
|
||||
public interface LogErrManager {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
LogErrCreateResponse create(LogErrCreateRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
LogErrDeleteResponse delete(LogErrDeleteRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
LogErrUpdateResponse update(LogErrUpdateRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
LogErrFindResponse find(LogErrFindRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
LogErrGetResponse get(LogErrGetRequest request, Token token);
|
||||
}
|
@ -0,0 +1,176 @@
|
||||
package ${basePackage}.module.system.mgr;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.github.pagehelper.util.StringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import ${basePackage}.frame.base.ErrorType;
|
||||
import ${basePackage}.frame.base.Token;
|
||||
import ${basePackage}.frame.utils.IDgenerator;
|
||||
import ${basePackage}.frame.utils.MapperUtil;
|
||||
import ${basePackage}.frame.utils.Message;
|
||||
import ${basePackage}.frame.utils.ValidationUtil;
|
||||
import ${basePackage}.module.system.mpr.LogErrMapper;
|
||||
import ${basePackage}.module.system.req.LogErrCreateRequest;
|
||||
import ${basePackage}.module.system.req.LogErrDeleteRequest;
|
||||
import ${basePackage}.module.system.req.LogErrFindRequest;
|
||||
import ${basePackage}.module.system.req.LogErrGetRequest;
|
||||
import ${basePackage}.module.system.req.LogErrUpdateRequest;
|
||||
import ${basePackage}.module.system.rsp.LogErrCreateResponse;
|
||||
import ${basePackage}.module.system.rsp.LogErrDeleteResponse;
|
||||
import ${basePackage}.module.system.rsp.LogErrFindResponse;
|
||||
import ${basePackage}.module.system.rsp.LogErrGetResponse;
|
||||
import ${basePackage}.module.system.rsp.LogErrUpdateResponse;
|
||||
|
||||
/**
|
||||
* LOG_ERR - 错误日志
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-01-29
|
||||
*/
|
||||
@Transactional
|
||||
@Service
|
||||
public class LogErrManagerImpl implements ${basePackage}.module.system.mgr.LogErrManager {
|
||||
|
||||
@Autowired
|
||||
private LogErrMapper logErrMapper;
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public LogErrCreateResponse create(LogErrCreateRequest request, Token token) {
|
||||
LogErrCreateResponse response = new LogErrCreateResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
long id = IDgenerator.nextId();
|
||||
${basePackage}.module.system.ent.LogErr entity = MapperUtil.map(request, ${basePackage}.module.system.ent.LogErr.class);
|
||||
entity.setId(id);
|
||||
|
||||
long result = logErrMapper.insert(entity, token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.CREATE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setId(id);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public LogErrDeleteResponse delete(LogErrDeleteRequest request, Token token) {
|
||||
LogErrDeleteResponse response = new LogErrDeleteResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
long result = logErrMapper.delete(request, token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.DELETE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setResult(result);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public LogErrUpdateResponse update(LogErrUpdateRequest request, Token token) {
|
||||
LogErrUpdateResponse response = new LogErrUpdateResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
long result = logErrMapper.update(request, token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.UPDATE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setResult(result);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public LogErrFindResponse find(LogErrFindRequest request, Token token) {
|
||||
LogErrFindResponse response = new LogErrFindResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
if (request.getPageSize() != 0) {
|
||||
PageHelper.startPage(request.getPageNumber(), request.getPageSize());
|
||||
}
|
||||
if (StringUtil.isNotEmpty(request.getSortKey())) {
|
||||
PageHelper.orderBy(request.getSortKey() + " " + request.getSortType());
|
||||
}
|
||||
PageInfo<${basePackage}.module.system.ent.LogErr> pageInfo = new PageInfo<>(logErrMapper.find(request, token));
|
||||
|
||||
response.setResult(pageInfo.getList());
|
||||
response.setTotalCount(pageInfo.getTotal());
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public LogErrGetResponse get(LogErrGetRequest request, Token token) {
|
||||
LogErrGetResponse response = new LogErrGetResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
${basePackage}.module.system.ent.LogErr po = logErrMapper.get(request, token);
|
||||
|
||||
if (po != null) {
|
||||
response.setLogErr(po);
|
||||
} else {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.GET_FAILURE);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package ${basePackage}.module.system.mpr;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import ${basePackage}.frame.base.Token;
|
||||
import ${basePackage}.module.system.req.LogErrDeleteRequest;
|
||||
import ${basePackage}.module.system.req.LogErrFindRequest;
|
||||
import ${basePackage}.module.system.req.LogErrGetRequest;
|
||||
import ${basePackage}.module.system.req.LogErrUpdateRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* LOG_ERR - 错误日志
|
||||
*
|
||||
* @author wangbing
|
||||
* @date 2020-01-29
|
||||
*/
|
||||
@Mapper
|
||||
public interface LogErrMapper {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long insert(@Param("request") ${basePackage}.module.system.ent.LogErr request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 批量插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long insertBatch(@Param("list") List<${basePackage}.module.system.ent.LogErr> request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long delete(@Param("request") LogErrDeleteRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long update(@Param("request") LogErrUpdateRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
List<${basePackage}.module.system.ent.LogErr> find(@Param("request") LogErrFindRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
${basePackage}.module.system.ent.LogErr get(@Param("request") LogErrGetRequest request, @Param("token") Token token);
|
||||
}
|
@ -0,0 +1,158 @@
|
||||
<?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="${basePackage}.module.system.mpr.LogErrMapper">
|
||||
|
||||
<sql id="table">`SYS_LOG_ERR`</sql>
|
||||
|
||||
<sql id="entityColumnList">
|
||||
`ID`,`LOG_ERR_TYPE`,`TITLE`,`CONTENT`,`LOG_ERR_RESULT`,`ATTRIBUTE1`,`ATTRIBUTE2`,`ATTRIBUTE3`,`ROW_VERSION`,`IS_DELETED`,`CREATE_BY`,`CREATE_TIME`,`LAST_UPDATE_BY`,`LAST_UPDATE_TIME`
|
||||
</sql>
|
||||
|
||||
<resultMap id="logErr" type="${basePackage}.module.system.ent.LogErr">
|
||||
<result column="ID" jdbcType="BIGINT" property="id"/>
|
||||
<result column="LOG_ERR_TYPE" jdbcType="VARCHAR" property="logErrType"/>
|
||||
<result column="TITLE" jdbcType="VARCHAR" property="title"/>
|
||||
<result column="CONTENT" jdbcType="VARCHAR" property="content"/>
|
||||
<result column="LOG_ERR_RESULT" jdbcType="VARCHAR" property="logErrResult"/>
|
||||
<result column="ATTRIBUTE1" jdbcType="VARCHAR" property="attribute1"/>
|
||||
<result column="ATTRIBUTE2" jdbcType="VARCHAR" property="attribute2"/>
|
||||
<result column="ATTRIBUTE3" jdbcType="VARCHAR" property="attribute3"/>
|
||||
<result column="ROW_VERSION" jdbcType="BIGINT" property="rowVersion"/>
|
||||
<result column="IS_DELETED" jdbcType="BIT" property="isDeleted"/>
|
||||
<result column="CREATE_BY" jdbcType="BIGINT" property="createBy"/>
|
||||
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="LAST_UPDATE_BY" jdbcType="BIGINT" property="lastUpdateBy"/>
|
||||
<result column="LAST_UPDATE_TIME" jdbcType="TIMESTAMP" property="lastUpdateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="find" resultMap="logErr">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
`IS_DELETED` = 0
|
||||
<if test="request.logErrType != null and request.logErrType != ''">
|
||||
AND `LOG_ERR_TYPE` = ${r'#'}{request.logErrType}
|
||||
</if>
|
||||
<if test="request.title != null and request.title != ''">
|
||||
AND `TITLE` = ${r'#'}{request.title}
|
||||
</if>
|
||||
<if test="request.logErrResult != null and request.logErrResult != ''">
|
||||
AND `LOG_ERR_RESULT` = ${r'#'}{request.logErrResult}
|
||||
</if>
|
||||
<if test="request.attribute1 != null and request.attribute1 != ''">
|
||||
AND `ATTRIBUTE1` = ${r'#'}{request.attribute1}
|
||||
</if>
|
||||
<if test="request.attribute2 != null and request.attribute2 != ''">
|
||||
AND `ATTRIBUTE2` = ${r'#'}{request.attribute2}
|
||||
</if>
|
||||
<if test="request.attribute3 != null and request.attribute3 != ''">
|
||||
AND `ATTRIBUTE3` = ${r'#'}{request.attribute3}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="search" resultMap="logErr">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
`IS_DELETED` = 0
|
||||
<if test="request.keyword != null and request.keyword != ''">
|
||||
1 = 2
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="insert">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
${r'#'}{request.id},
|
||||
${r'#'}{request.logErrType,jdbcType=VARCHAR},
|
||||
${r'#'}{request.title,jdbcType=VARCHAR},
|
||||
${r'#'}{request.content,jdbcType=VARCHAR},
|
||||
${r'#'}{request.logErrResult,jdbcType=VARCHAR},
|
||||
${r'#'}{request.attribute1,jdbcType=VARCHAR},
|
||||
${r'#'}{request.attribute2,jdbcType=VARCHAR},
|
||||
${r'#'}{request.attribute3,jdbcType=VARCHAR},
|
||||
0,
|
||||
0,
|
||||
${r'#'}{token.userId,jdbcType=NUMERIC},
|
||||
sysdate(),
|
||||
NULL,
|
||||
NULL
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="list" item= "item" index ="index" separator=",">
|
||||
(
|
||||
${r'#'}{item.id},
|
||||
${r'#'}{item.logErrType,jdbcType=VARCHAR},
|
||||
${r'#'}{item.title,jdbcType=VARCHAR},
|
||||
${r'#'}{item.content,jdbcType=VARCHAR},
|
||||
${r'#'}{item.logErrResult,jdbcType=VARCHAR},
|
||||
${r'#'}{item.attribute1,jdbcType=VARCHAR},
|
||||
${r'#'}{item.attribute2,jdbcType=VARCHAR},
|
||||
${r'#'}{item.attribute3,jdbcType=VARCHAR},
|
||||
0,
|
||||
0,
|
||||
${r'#'}{token.userId,jdbcType=NUMERIC},
|
||||
sysdate(),
|
||||
NULL,
|
||||
NULL
|
||||
)
|
||||
</foreach >
|
||||
</insert>
|
||||
|
||||
<update id="delete">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET `IS_DELETED` = 1
|
||||
WHERE `IS_DELETED` = 0
|
||||
AND `ID` = ${r'#'}{request.id}
|
||||
</update>
|
||||
|
||||
<update id="update">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET
|
||||
`LOG_ERR_TYPE` = ${r'#'}{request.logErrType,jdbcType=VARCHAR},
|
||||
`TITLE` = ${r'#'}{request.title,jdbcType=VARCHAR},
|
||||
`CONTENT` = ${r'#'}{request.content,jdbcType=VARCHAR},
|
||||
`LOG_ERR_RESULT` = ${r'#'}{request.logErrResult,jdbcType=VARCHAR},
|
||||
`ATTRIBUTE1` = ${r'#'}{request.attribute1,jdbcType=VARCHAR},
|
||||
`ATTRIBUTE2` = ${r'#'}{request.attribute2,jdbcType=VARCHAR},
|
||||
`ATTRIBUTE3` = ${r'#'}{request.attribute3,jdbcType=VARCHAR},
|
||||
`ROW_VERSION` = `ROW_VERSION` + 1,
|
||||
`LAST_UPDATE_BY` = ${r'#'}{token.userId},
|
||||
`LAST_UPDATE_TIME` = sysdate()
|
||||
WHERE
|
||||
`IS_DELETED` = 0
|
||||
AND `ID` = ${r'#'}{request.id}
|
||||
AND `ROW_VERSION` = ${r'#'}{request.rowVersion}
|
||||
</update>
|
||||
|
||||
<select id="get" resultMap="logErr">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
`IS_DELETED` = 0
|
||||
AND `ID` = ${r'#'}{request.id}
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,117 @@
|
||||
package ${basePackage}.module.system.req;
|
||||
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import ${basePackage}.frame.base.BaseRequest;
|
||||
import ${basePackage}.frame.validation.Dict;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* LogErrCreateRequest - 错误日志新增
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-01-29
|
||||
*/
|
||||
public class LogErrCreateRequest extends BaseRequest {
|
||||
|
||||
/**
|
||||
* 错误类型
|
||||
*/
|
||||
@Dict(name = "LOG_ERR_TYPE")
|
||||
private String logErrType;
|
||||
|
||||
/**
|
||||
* 错误标题
|
||||
*/
|
||||
@NotEmpty(message = "[title]错误标题不能为空")
|
||||
@Length(min = 0, max = 50, message = "[title]错误标题长度不合法(0-50)")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 错误内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 处理结果
|
||||
*/
|
||||
@NotNull(message = "[logErrResult]处理结果不能为NULL")
|
||||
@Dict(name = "LOG_ERR_RESULT")
|
||||
private String logErrResult;
|
||||
|
||||
/**
|
||||
* 属性1
|
||||
*/
|
||||
@Length(min = 0, max = 50, message = "[attribute1]属性1长度不合法(0-50)")
|
||||
private String attribute1;
|
||||
|
||||
/**
|
||||
* 属性2
|
||||
*/
|
||||
@Length(min = 0, max = 50, message = "[attribute2]属性2长度不合法(0-50)")
|
||||
private String attribute2;
|
||||
|
||||
/**
|
||||
* 属性3
|
||||
*/
|
||||
@Length(min = 0, max = 50, message = "[attribute3]属性3长度不合法(0-50)")
|
||||
private String attribute3;
|
||||
|
||||
public String getLogErrType() {
|
||||
return this.logErrType;
|
||||
}
|
||||
|
||||
public void setLogErrType(String logErrType) {
|
||||
this.logErrType = logErrType;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return this.content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getLogErrResult() {
|
||||
return this.logErrResult;
|
||||
}
|
||||
|
||||
public void setLogErrResult(String logErrResult) {
|
||||
this.logErrResult = logErrResult;
|
||||
}
|
||||
|
||||
public String getAttribute1() {
|
||||
return this.attribute1;
|
||||
}
|
||||
|
||||
public void setAttribute1(String attribute1) {
|
||||
this.attribute1 = attribute1;
|
||||
}
|
||||
|
||||
public String getAttribute2() {
|
||||
return this.attribute2;
|
||||
}
|
||||
|
||||
public void setAttribute2(String attribute2) {
|
||||
this.attribute2 = attribute2;
|
||||
}
|
||||
|
||||
public String getAttribute3() {
|
||||
return this.attribute3;
|
||||
}
|
||||
|
||||
public void setAttribute3(String attribute3) {
|
||||
this.attribute3 = attribute3;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package ${basePackage}.module.system.req;
|
||||
|
||||
import ${basePackage}.frame.base.BaseUpdateRequest;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* LogErrDeleteRequest - 错误日志删除
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-01-29
|
||||
*/
|
||||
public class LogErrDeleteRequest extends BaseUpdateRequest {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "[id]主键不能为空")
|
||||
private long id;
|
||||
|
||||
public long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
package ${basePackage}.module.system.req;
|
||||
|
||||
import ${basePackage}.frame.base.BaseFindRequest;
|
||||
import ${basePackage}.frame.validation.Dict;
|
||||
|
||||
/**
|
||||
* LogErrRequest - 错误日志查询
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-01-29
|
||||
*/
|
||||
public class LogErrFindRequest extends BaseFindRequest {
|
||||
|
||||
/**
|
||||
* 错误类型
|
||||
*/
|
||||
@Dict(name = "LOG_ERR_TYPE")
|
||||
private String logErrType;
|
||||
|
||||
/**
|
||||
* 错误标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 处理结果
|
||||
*/
|
||||
@Dict(name = "LOG_ERR_RESULT")
|
||||
private String logErrResult;
|
||||
|
||||
/**
|
||||
* 属性1
|
||||
*/
|
||||
private String attribute1;
|
||||
|
||||
/**
|
||||
* 属性2
|
||||
*/
|
||||
private String attribute2;
|
||||
|
||||
/**
|
||||
* 属性3
|
||||
*/
|
||||
private String attribute3;
|
||||
|
||||
public String getLogErrType() {
|
||||
return this.logErrType;
|
||||
}
|
||||
|
||||
public void setLogErrType(String logErrType) {
|
||||
this.logErrType = logErrType;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getLogErrResult() {
|
||||
return this.logErrResult;
|
||||
}
|
||||
|
||||
public void setLogErrResult(String logErrResult) {
|
||||
this.logErrResult = logErrResult;
|
||||
}
|
||||
|
||||
public String getAttribute1() {
|
||||
return this.attribute1;
|
||||
}
|
||||
|
||||
public void setAttribute1(String attribute1) {
|
||||
this.attribute1 = attribute1;
|
||||
}
|
||||
|
||||
public String getAttribute2() {
|
||||
return this.attribute2;
|
||||
}
|
||||
|
||||
public void setAttribute2(String attribute2) {
|
||||
this.attribute2 = attribute2;
|
||||
}
|
||||
|
||||
public String getAttribute3() {
|
||||
return this.attribute3;
|
||||
}
|
||||
|
||||
public void setAttribute3(String attribute3) {
|
||||
this.attribute3 = attribute3;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package ${basePackage}.module.system.req;
|
||||
|
||||
import ${basePackage}.frame.base.BaseRequest;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* LogErrGetRequest - 错误日志获取
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-01-29
|
||||
*/
|
||||
public class LogErrGetRequest extends BaseRequest {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "[id]主键不能为空")
|
||||
private long id;
|
||||
|
||||
public long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
package ${basePackage}.module.system.req;
|
||||
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import ${basePackage}.frame.base.BaseUpdateRequest;
|
||||
import ${basePackage}.frame.validation.Dict;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* LogErrUpdateRequest - 错误日志更新
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-01-29
|
||||
*/
|
||||
public class LogErrUpdateRequest extends BaseUpdateRequest {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "[id]主键不能为NULL")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 错误类型
|
||||
*/
|
||||
@Dict(name = "LOG_ERR_TYPE")
|
||||
private String logErrType;
|
||||
|
||||
/**
|
||||
* 错误标题
|
||||
*/
|
||||
@NotEmpty(message = "[title]错误标题不能为空")
|
||||
@Length(min = 0, max = 50, message = "[title]错误标题长度不合法(0-50)")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 错误内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 处理结果
|
||||
*/
|
||||
@NotNull(message = "[logErrResult]处理结果不能为NULL")
|
||||
@Dict(name = "LOG_ERR_RESULT")
|
||||
private String logErrResult;
|
||||
|
||||
/**
|
||||
* 属性1
|
||||
*/
|
||||
@Length(min = 0, max = 50, message = "[attribute1]属性1长度不合法(0-50)")
|
||||
private String attribute1;
|
||||
|
||||
/**
|
||||
* 属性2
|
||||
*/
|
||||
@Length(min = 0, max = 50, message = "[attribute2]属性2长度不合法(0-50)")
|
||||
private String attribute2;
|
||||
|
||||
/**
|
||||
* 属性3
|
||||
*/
|
||||
@Length(min = 0, max = 50, message = "[attribute3]属性3长度不合法(0-50)")
|
||||
private String attribute3;
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLogErrType() {
|
||||
return this.logErrType;
|
||||
}
|
||||
|
||||
public void setLogErrType(String logErrType) {
|
||||
this.logErrType = logErrType;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return this.content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getLogErrResult() {
|
||||
return this.logErrResult;
|
||||
}
|
||||
|
||||
public void setLogErrResult(String logErrResult) {
|
||||
this.logErrResult = logErrResult;
|
||||
}
|
||||
|
||||
public String getAttribute1() {
|
||||
return this.attribute1;
|
||||
}
|
||||
|
||||
public void setAttribute1(String attribute1) {
|
||||
this.attribute1 = attribute1;
|
||||
}
|
||||
|
||||
public String getAttribute2() {
|
||||
return this.attribute2;
|
||||
}
|
||||
|
||||
public void setAttribute2(String attribute2) {
|
||||
this.attribute2 = attribute2;
|
||||
}
|
||||
|
||||
public String getAttribute3() {
|
||||
return this.attribute3;
|
||||
}
|
||||
|
||||
public void setAttribute3(String attribute3) {
|
||||
this.attribute3 = attribute3;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package ${basePackage}.module.system.rsp;
|
||||
|
||||
import ${basePackage}.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* LogErrCreateResponse - 错误日志
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-01-29
|
||||
*/
|
||||
public class LogErrCreateResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package ${basePackage}.module.system.rsp;
|
||||
|
||||
import ${basePackage}.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* LogErrDeleteResponse - 错误日志
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-01-29
|
||||
*/
|
||||
public class LogErrDeleteResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 删除数目
|
||||
*/
|
||||
private Long result;
|
||||
|
||||
public Long getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public void setResult(Long result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package ${basePackage}.module.system.rsp;
|
||||
|
||||
import ${basePackage}.frame.base.BaseFindResponse;
|
||||
|
||||
/**
|
||||
* LogErrFindResponse - 错误日志
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-01-29
|
||||
*/
|
||||
public class LogErrFindResponse extends BaseFindResponse<${basePackage}.module.system.ent.LogErr> {
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package ${basePackage}.module.system.rsp;
|
||||
|
||||
import ${basePackage}.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* LogErrGetResponse - 错误日志
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-01-29
|
||||
*/
|
||||
public class LogErrGetResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 错误日志
|
||||
*/
|
||||
private ${basePackage}.module.system.ent.LogErr logErr;
|
||||
|
||||
public ${basePackage}.module.system.ent.LogErr getLogErr() {
|
||||
return this.logErr;
|
||||
}
|
||||
|
||||
public void setLogErr(${basePackage}.module.system.ent.LogErr logErr) {
|
||||
this.logErr = logErr;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package ${basePackage}.module.system.rsp;
|
||||
|
||||
import ${basePackage}.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* LogErrUpdateResponse - 错误日志
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-01-29
|
||||
*/
|
||||
public class LogErrUpdateResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 更新数目
|
||||
*/
|
||||
private Long result;
|
||||
|
||||
public Long getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public void setResult(Long result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
-- ----------------------------
|
||||
-- Table structure for LOG_ERR - 错误日志
|
||||
-- Target : MySQL
|
||||
-- Author : wangbing
|
||||
-- Date: : 2020-01-29
|
||||
-- ----------------------------
|
||||
CREATE TABLE `SYS_LOG_ERR` (
|
||||
`ID` BIGINT(20) NOT NULL COMMENT '主键',
|
||||
`LOG_ERR_TYPE` VARCHAR(20) COMMENT '错误类型',
|
||||
`TITLE` VARCHAR(50) NOT NULL COMMENT '错误标题',
|
||||
`CONTENT` TEXT COMMENT '错误内容',
|
||||
`LOG_ERR_RESULT` VARCHAR(20) NOT NULL COMMENT '处理结果',
|
||||
`ATTRIBUTE1` VARCHAR(50) COMMENT '属性1',
|
||||
`ATTRIBUTE2` VARCHAR(50) COMMENT '属性2',
|
||||
`ATTRIBUTE3` VARCHAR(50) COMMENT '属性3',
|
||||
`ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本',
|
||||
`IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除',
|
||||
`CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户',
|
||||
`CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间',
|
||||
`LAST_UPDATE_BY` BIGINT(20) DEFAULT NULL COMMENT '最后更新用户',
|
||||
`LAST_UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '最后更新时间',
|
||||
PRIMARY KEY (`ID`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='错误日志';
|
@ -0,0 +1,293 @@
|
||||
<div id="app" v-cloak>
|
||||
<el-card class="box-card">
|
||||
<el-form class="search" :inline="true" :model="vm" ref="vm" label-position="right" label-width="90px">
|
||||
<el-form-item label="错误类型" prop="logErrType">
|
||||
<el-input-dict v-model="vm.logErrType" clearable size="small" placeholder="请输入错误类型" dict-name="LOG_ERR_TYPE" ></el-input-dict>
|
||||
</el-form-item>
|
||||
<el-form-item label="错误标题" prop="title">
|
||||
<el-input v-model="vm.title" clearable size="small" placeholder="请输入错误标题"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="处理结果" prop="logErrResult">
|
||||
<el-input-dict v-model="vm.logErrResult" clearable size="small" placeholder="请输入处理结果" dict-name="LOG_ERR_RESULT" ></el-input-dict>
|
||||
</el-form-item>
|
||||
<el-form-item label="属性1" prop="attribute1">
|
||||
<el-input v-model="vm.attribute1" clearable size="small" placeholder="请输入属性1"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="属性2" prop="attribute2">
|
||||
<el-input v-model="vm.attribute2" clearable size="small" placeholder="请输入属性2"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="属性3" prop="attribute3">
|
||||
<el-input v-model="vm.attribute3" clearable size="small" placeholder="请输入属性3"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" size="small" icon="el-icon-search" @click="onSearch">搜索</el-button>
|
||||
<el-button type="warning" size="small" icon="el-icon-refresh-left" @click="onReset('vm')">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-button type="success" size="small" icon="el-icon-plus" @click="onCreate">新增</el-button>
|
||||
|
||||
<el-button type="warning" size="small" icon="el-icon-download" @click="onExport">导出</el-button>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-button-group style="float: right;">
|
||||
<el-tooltip effect="dark" content="Excel模板下载" placement="bottom">
|
||||
<el-button size="small" icon="el-icon-date" @click="onTemplate"></el-button>
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip effect="dark" content="Excel导入" placement="bottom">
|
||||
<el-button size="small" icon="el-icon-upload2" @click="onImport"></el-button>
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip effect="dark" content="批量删除" placement="bottom">
|
||||
<el-button size="small" icon="el-icon-delete" @click="onBitchDelete"></el-button>
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip effect="dark" content="刷新" placement="bottom">
|
||||
<el-button size="small" icon="el-icon-refresh" @click="onFind"></el-button>
|
||||
</el-tooltip>
|
||||
</el-button-group>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
class="data"
|
||||
@selection-change="onSelectionChange"
|
||||
empty-text="无数据"
|
||||
:data="result"
|
||||
size="mini">
|
||||
<el-table-column
|
||||
align="center"
|
||||
type="selection"
|
||||
width="45">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="id"
|
||||
label="主键"
|
||||
width="140">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="logErrType"
|
||||
|
||||
|
||||
label="错误类型">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="title"
|
||||
|
||||
|
||||
label="错误标题">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="content"
|
||||
|
||||
|
||||
label="错误内容">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="logErrResult"
|
||||
|
||||
|
||||
label="处理结果">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="attribute1"
|
||||
|
||||
|
||||
label="属性1">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="attribute2"
|
||||
|
||||
|
||||
label="属性2">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="attribute3"
|
||||
|
||||
|
||||
label="属性3">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="createTime"
|
||||
width="140"
|
||||
label="创建时间">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
fixed="right"
|
||||
width="120"
|
||||
label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-dropdown size="mini" split-button type="primary" @click="onCommand(['edit',scope.row])"
|
||||
@command="onCommand">
|
||||
<i class="el-icon-edit"></i>编辑
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item :command="['delete',scope.row]" icon="el-icon-delete">删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-pagination
|
||||
background
|
||||
v-if="vm.totalCount > vm.pageSize"
|
||||
style="margin-top: 10px"
|
||||
@current-change="onPageChange"
|
||||
:current-page="vm.pageNumber"
|
||||
:page-size="vm.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="vm.totalCount">
|
||||
</el-pagination>
|
||||
</el-card>
|
||||
|
||||
<el-dialog
|
||||
:custom-class="'dialog'"
|
||||
:title="form.title"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="form.dialog">
|
||||
<el-form class="form" :model="form" :inline="true" :rules="formRules" ref="form" label-position="right" label-width="90px">
|
||||
<el-form-item label="错误类型" prop="logErrType">
|
||||
<el-input-dict v-model="form.logErrType" clearable size="small" placeholder="请输入错误类型" dict-name="LOG_ERR_TYPE" ></el-input-dict>
|
||||
</el-form-item>
|
||||
<el-form-item label="错误标题" prop="title">
|
||||
<el-input v-model="form.title" clearable size="small" placeholder="请输入错误标题"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="错误内容" prop="content">
|
||||
<el-input v-model="form.content" clearable size="small" placeholder="请输入错误内容"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="处理结果" prop="logErrResult">
|
||||
<el-input-dict v-model="form.logErrResult" clearable size="small" placeholder="请输入处理结果" dict-name="LOG_ERR_RESULT" ></el-input-dict>
|
||||
</el-form-item>
|
||||
<el-form-item label="属性1" prop="attribute1">
|
||||
<el-input v-model="form.attribute1" clearable size="small" placeholder="请输入属性1"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="属性2" prop="attribute2">
|
||||
<el-input v-model="form.attribute2" clearable size="small" placeholder="请输入属性2"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="属性3" prop="attribute3">
|
||||
<el-input v-model="form.attribute3" clearable size="small" placeholder="请输入属性3"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button size="small" @click="form.dialog = false">取 消</el-button>
|
||||
<el-button size="small" type="primary" @click="onSave">保存</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
<script>
|
||||
var app = new Vue({
|
||||
mixins: [mixin],
|
||||
el: "#app",
|
||||
data: {
|
||||
module: 'system',
|
||||
target: 'logErr',
|
||||
vm: {//条件及分页参数
|
||||
logErrType: "",
|
||||
title: "",
|
||||
logErrResult: "",
|
||||
attribute1: "",
|
||||
attribute2: "",
|
||||
attribute3: "",
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
totalCount: 0,
|
||||
sortKey:'CREATE_TIME',
|
||||
sortType:'DESC'
|
||||
},
|
||||
form: {//待提交表单
|
||||
title: "",
|
||||
dialog: false,
|
||||
id: '',
|
||||
logErrType: "",
|
||||
title: "",
|
||||
content: "",
|
||||
logErrResult: "",
|
||||
attribute1: "",
|
||||
attribute2: "",
|
||||
attribute3: "",
|
||||
rowVersion: ""
|
||||
},
|
||||
formRules: {
|
||||
logErrType: [
|
||||
],
|
||||
title: [
|
||||
{required: true, message: '错误标题不能为空', trigger: 'blur'},
|
||||
{min: 1, max: 50, message: '错误标题长度在 1 到 50 个字符', trigger: 'blur'}
|
||||
],
|
||||
content: [
|
||||
],
|
||||
logErrResult: [
|
||||
{required: true, message: '处理结果不能为空', trigger: 'blur'},
|
||||
],
|
||||
attribute1: [
|
||||
{min: 1, max: 50, message: '属性1长度在 1 到 50 个字符', trigger: 'blur'}
|
||||
],
|
||||
attribute2: [
|
||||
{min: 1, max: 50, message: '属性2长度在 1 到 50 个字符', trigger: 'blur'}
|
||||
],
|
||||
attribute3: [
|
||||
{min: 1, max: 50, message: '属性3长度在 1 到 50 个字符', trigger: 'blur'}
|
||||
],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onCreate: function () {
|
||||
this.form.title = "错误日志新增";
|
||||
this.form.dialog = true;
|
||||
this.form.id = "";
|
||||
this.form.logErrType = "";
|
||||
this.form.title = "";
|
||||
this.form.content = "";
|
||||
this.form.logErrResult = "";
|
||||
this.form.attribute1 = "";
|
||||
this.form.attribute2 = "";
|
||||
this.form.attribute3 = "";
|
||||
},
|
||||
onCommand: function (arg) {
|
||||
const cmd = arg[0];
|
||||
const item = arg[1];
|
||||
switch (cmd) {
|
||||
case "edit":
|
||||
this.form.title = "错误日志编辑";
|
||||
this.form.dialog = true;
|
||||
this.form.id = item.id;
|
||||
this.form.logErrType = item.logErrType;
|
||||
this.form.title = item.title;
|
||||
this.form.content = item.content;
|
||||
this.form.logErrResult = item.logErrResult;
|
||||
this.form.attribute1 = item.attribute1;
|
||||
this.form.attribute2 = item.attribute2;
|
||||
this.form.attribute3 = item.attribute3;
|
||||
this.form.rowVersion = item.rowVersion;
|
||||
break;
|
||||
case "delete":
|
||||
this.onDelete(item);
|
||||
break;
|
||||
default:
|
||||
nav.w("未找到对应的命令");
|
||||
break;
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted: function () {
|
||||
this.onFind();
|
||||
},
|
||||
})
|
||||
</script>
|
@ -0,0 +1,154 @@
|
||||
package ${basePackage}.system;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import ${basePackage}.frame.base.Token;
|
||||
import ${basePackage}.module.system.mgr.LogErrManager;
|
||||
import ${basePackage}.module.system.req.LogErrCreateRequest;
|
||||
import ${basePackage}.module.system.req.LogErrDeleteRequest;
|
||||
import ${basePackage}.module.system.req.LogErrFindRequest;
|
||||
import ${basePackage}.module.system.req.LogErrGetRequest;
|
||||
import ${basePackage}.module.system.req.LogErrUpdateRequest;
|
||||
import ${basePackage}.module.system.rsp.LogErrCreateResponse;
|
||||
import ${basePackage}.module.system.rsp.LogErrDeleteResponse;
|
||||
import ${basePackage}.module.system.rsp.LogErrFindResponse;
|
||||
import ${basePackage}.module.system.rsp.LogErrGetResponse;
|
||||
import ${basePackage}.module.system.rsp.LogErrUpdateResponse;
|
||||
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
|
||||
/**
|
||||
* LogErrTest - - 错误日志测试用例
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-01-29
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@Transactional
|
||||
public class LogErrTest {
|
||||
|
||||
@Autowired
|
||||
private Token token;
|
||||
|
||||
@Autowired
|
||||
private LogErrManager logErrManager;
|
||||
|
||||
@Test
|
||||
public void testCreate() {
|
||||
LogErrCreateRequest request = new LogErrCreateRequest();
|
||||
request.setLogErrType("code");
|
||||
request.setTitle("错误标题");
|
||||
request.setContent("content");
|
||||
request.setLogErrResult("code");
|
||||
request.setAttribute1("属性1");
|
||||
request.setAttribute2("属性2");
|
||||
request.setAttribute3("属性3");
|
||||
|
||||
LogErrCreateResponse response = logErrManager.create(request,token);
|
||||
|
||||
assertTrue(!response.hasError());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDelete() {
|
||||
|
||||
//创建数据
|
||||
LogErrCreateRequest createRequest = new LogErrCreateRequest();
|
||||
createRequest.setLogErrType("code");
|
||||
createRequest.setTitle("错误标题");
|
||||
createRequest.setContent("content");
|
||||
createRequest.setLogErrResult("code");
|
||||
createRequest.setAttribute1("属性1");
|
||||
createRequest.setAttribute2("属性2");
|
||||
createRequest.setAttribute3("属性3");
|
||||
|
||||
LogErrCreateResponse createResponse = logErrManager.create(createRequest,token);
|
||||
|
||||
assertTrue(!createResponse.hasError() && createResponse.getId() > 0);
|
||||
//删除数据
|
||||
LogErrDeleteRequest request = new LogErrDeleteRequest();
|
||||
request.setId(createResponse.getId());
|
||||
|
||||
LogErrDeleteResponse response = logErrManager.delete(request,token);
|
||||
|
||||
assertTrue(!response.hasError() && response.getResult() == 1L);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdate() {
|
||||
//创建数据
|
||||
LogErrCreateRequest createRequest = new LogErrCreateRequest();
|
||||
createRequest.setLogErrType("code");
|
||||
createRequest.setTitle("错误标题");
|
||||
createRequest.setContent("content");
|
||||
createRequest.setLogErrResult("code");
|
||||
createRequest.setAttribute1("属性1");
|
||||
createRequest.setAttribute2("属性2");
|
||||
createRequest.setAttribute3("属性3");
|
||||
|
||||
LogErrCreateResponse createResponse = logErrManager.create(createRequest, token);
|
||||
|
||||
assertTrue(!createResponse.hasError());
|
||||
|
||||
//更新数据
|
||||
LogErrUpdateRequest request = new LogErrUpdateRequest();
|
||||
request.setId(createResponse.getId());
|
||||
request.setLogErrType("code");
|
||||
request.setTitle("错误标题");
|
||||
request.setContent("content");
|
||||
request.setLogErrResult("code");
|
||||
request.setAttribute1("属性1");
|
||||
request.setAttribute2("属性2");
|
||||
request.setAttribute3("属性3");
|
||||
|
||||
LogErrUpdateResponse response = logErrManager.update(request,token);
|
||||
|
||||
assertTrue(!response.hasError() && response.getResult() == 1L);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFind() {
|
||||
LogErrFindRequest request = new LogErrFindRequest();
|
||||
request.setLogErrType("code");
|
||||
request.setTitle("错误标题");
|
||||
request.setLogErrResult("code");
|
||||
request.setAttribute1("属性1");
|
||||
request.setAttribute2("属性2");
|
||||
request.setAttribute3("属性3");
|
||||
|
||||
LogErrFindResponse response = logErrManager.find(request,token);
|
||||
|
||||
assertTrue(!response.hasError());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGet() {
|
||||
//创建数据
|
||||
LogErrCreateRequest createRequest = new LogErrCreateRequest();
|
||||
createRequest.setLogErrType("code");
|
||||
createRequest.setTitle("错误标题");
|
||||
createRequest.setContent("content");
|
||||
createRequest.setLogErrResult("code");
|
||||
createRequest.setAttribute1("属性1");
|
||||
createRequest.setAttribute2("属性2");
|
||||
createRequest.setAttribute3("属性3");
|
||||
|
||||
LogErrCreateResponse createResponse = logErrManager.create(createRequest, token);
|
||||
|
||||
assertTrue(!createResponse.hasError());
|
||||
|
||||
//获得数据
|
||||
LogErrGetRequest request = new LogErrGetRequest();
|
||||
request.setId(createResponse.getId());
|
||||
|
||||
LogErrGetResponse response = logErrManager.get(request,token);
|
||||
|
||||
assertTrue(!response.hasError() && response.getLogErr() != null);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue