parent
f0d7c8d778
commit
37622277e9
@ -0,0 +1,86 @@
|
||||
package xyz.wbsite.module.system.ent;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseEntity;
|
||||
|
||||
/**
|
||||
* SEQUENCE - 序列
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-06-25
|
||||
*/
|
||||
public class Sequence extends BaseEntity {
|
||||
|
||||
/**
|
||||
* SEQ_NAME - 序列名称
|
||||
*/
|
||||
private String seqName;
|
||||
/**
|
||||
* SEQ_NOTE - 序列备注
|
||||
*/
|
||||
private String seqNote;
|
||||
/**
|
||||
* YEAR - 年
|
||||
*/
|
||||
private String year;
|
||||
/**
|
||||
* MONTH - 月
|
||||
*/
|
||||
private String month;
|
||||
/**
|
||||
* DATE - 日
|
||||
*/
|
||||
private String date;
|
||||
/**
|
||||
* NEXT_VALUE - 下一个值
|
||||
*/
|
||||
private Integer nextValue;
|
||||
|
||||
public String getSeqName() {
|
||||
return this.seqName;
|
||||
}
|
||||
|
||||
public void setSeqName(String seqName) {
|
||||
this.seqName = seqName;
|
||||
}
|
||||
|
||||
public String getSeqNote() {
|
||||
return this.seqNote;
|
||||
}
|
||||
|
||||
public void setSeqNote(String seqNote) {
|
||||
this.seqNote = seqNote;
|
||||
}
|
||||
|
||||
public String getYear() {
|
||||
return this.year;
|
||||
}
|
||||
|
||||
public void setYear(String year) {
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public String getMonth() {
|
||||
return this.month;
|
||||
}
|
||||
|
||||
public void setMonth(String month) {
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public String getDate() {
|
||||
return this.date;
|
||||
}
|
||||
|
||||
public void setDate(String date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public Integer getNextValue() {
|
||||
return this.nextValue;
|
||||
}
|
||||
|
||||
public void setNextValue(Integer nextValue) {
|
||||
this.nextValue = nextValue;
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package xyz.wbsite.module.system.mgr;
|
||||
|
||||
import xyz.wbsite.frame.auth.Token;
|
||||
import xyz.wbsite.module.system.req.SequenceCreateRequest;
|
||||
import xyz.wbsite.module.system.req.SequenceDeleteRequest;
|
||||
import xyz.wbsite.module.system.req.SequenceFindRequest;
|
||||
import xyz.wbsite.module.system.req.SequenceGetRequest;
|
||||
import xyz.wbsite.module.system.req.SequenceUpdateRequest;
|
||||
import xyz.wbsite.module.system.rsp.SequenceCreateResponse;
|
||||
import xyz.wbsite.module.system.rsp.SequenceDeleteResponse;
|
||||
import xyz.wbsite.module.system.rsp.SequenceFindResponse;
|
||||
import xyz.wbsite.module.system.rsp.SequenceGetResponse;
|
||||
import xyz.wbsite.module.system.rsp.SequenceUpdateResponse;
|
||||
|
||||
/**
|
||||
* 序列
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-06-25
|
||||
*/
|
||||
public interface SequenceManager {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
SequenceCreateResponse create(SequenceCreateRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
SequenceDeleteResponse delete(SequenceDeleteRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
SequenceUpdateResponse update(SequenceUpdateRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
SequenceFindResponse find(SequenceFindRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
SequenceGetResponse get(SequenceGetRequest request, Token token);
|
||||
}
|
@ -0,0 +1,176 @@
|
||||
package xyz.wbsite.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 xyz.wbsite.frame.auth.Token;
|
||||
import xyz.wbsite.frame.base.ErrorType;
|
||||
import xyz.wbsite.frame.utils.IDgenerator;
|
||||
import xyz.wbsite.frame.utils.MapperUtil;
|
||||
import xyz.wbsite.frame.utils.Message;
|
||||
import xyz.wbsite.frame.utils.ValidationUtil;
|
||||
import xyz.wbsite.module.system.ent.Sequence;
|
||||
import xyz.wbsite.module.system.req.SequenceCreateRequest;
|
||||
import xyz.wbsite.module.system.req.SequenceDeleteRequest;
|
||||
import xyz.wbsite.module.system.req.SequenceFindRequest;
|
||||
import xyz.wbsite.module.system.req.SequenceGetRequest;
|
||||
import xyz.wbsite.module.system.req.SequenceUpdateRequest;
|
||||
import xyz.wbsite.module.system.rsp.SequenceCreateResponse;
|
||||
import xyz.wbsite.module.system.rsp.SequenceDeleteResponse;
|
||||
import xyz.wbsite.module.system.rsp.SequenceFindResponse;
|
||||
import xyz.wbsite.module.system.rsp.SequenceGetResponse;
|
||||
import xyz.wbsite.module.system.rsp.SequenceUpdateResponse;
|
||||
|
||||
/**
|
||||
* SEQUENCE - 序列
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-06-25
|
||||
*/
|
||||
@Transactional
|
||||
@Service
|
||||
public class SequenceManagerImpl implements xyz.wbsite.module.system.mgr.SequenceManager {
|
||||
|
||||
@Autowired
|
||||
private xyz.wbsite.module.system.mpr.SequenceMapper sequenceMapper;
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public SequenceCreateResponse create(SequenceCreateRequest request, Token token) {
|
||||
SequenceCreateResponse response = new SequenceCreateResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
long id = IDgenerator.nextId();
|
||||
Sequence entity = MapperUtil.map(request, Sequence.class);
|
||||
entity.setId(id);
|
||||
|
||||
long result = sequenceMapper.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 SequenceDeleteResponse delete(SequenceDeleteRequest request, Token token) {
|
||||
SequenceDeleteResponse response = new SequenceDeleteResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
long result = sequenceMapper.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 SequenceUpdateResponse update(SequenceUpdateRequest request, Token token) {
|
||||
SequenceUpdateResponse response = new SequenceUpdateResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
long result = sequenceMapper.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 SequenceFindResponse find(SequenceFindRequest request, Token token) {
|
||||
SequenceFindResponse response = new SequenceFindResponse();
|
||||
|
||||
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<Sequence> pageInfo = new PageInfo<>(sequenceMapper.find(request, token));
|
||||
|
||||
response.setResult(pageInfo.getList());
|
||||
response.setTotalCount(pageInfo.getTotal());
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public SequenceGetResponse get(SequenceGetRequest request, Token token) {
|
||||
SequenceGetResponse response = new SequenceGetResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
Sequence po = sequenceMapper.get(request, token);
|
||||
|
||||
if (po != null) {
|
||||
response.setSequence(po);
|
||||
} else {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.GET_FAILURE);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
@ -0,0 +1,143 @@
|
||||
<?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="xyz.wbsite.module.system.mpr.RoleResMapper">
|
||||
|
||||
<sql id="table">"SYS_ROLE_RES"</sql>
|
||||
|
||||
<sql id="entityColumnList">
|
||||
"ID","ROLE_ID","ROLE_CODE","RES_ID","RES_CODE","ROW_VERSION","IS_DELETED","CREATE_BY","CREATE_TIME","LAST_UPDATE_BY","LAST_UPDATE_TIME"
|
||||
</sql>
|
||||
|
||||
<resultMap id="roleRes" type="xyz.wbsite.module.system.ent.RoleRes">
|
||||
<result column="ID" jdbcType="BIGINT" property="id"/>
|
||||
<result column="ROLE_ID" jdbcType="BIGINT" property="roleId"/>
|
||||
<result column="ROLE_CODE" jdbcType="VARCHAR" property="roleCode"/>
|
||||
<result column="RES_ID" jdbcType="BIGINT" property="resId"/>
|
||||
<result column="RES_CODE" jdbcType="VARCHAR" property="resCode"/>
|
||||
<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="roleRes">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
"IS_DELETED" = 0
|
||||
<if test="request.roleId != null and request.roleId != 0">
|
||||
AND ROLE_ID = #{request.roleId}
|
||||
</if>
|
||||
<if test="request.roleCode != null and request.roleCode != ''">
|
||||
AND ROLE_CODE = #{request.roleCode}
|
||||
</if>
|
||||
<if test="request.resId != null and request.resId != 0">
|
||||
AND RES_ID = #{request.resId}
|
||||
</if>
|
||||
<if test="request.resCode != null and request.resCode != ''">
|
||||
AND RES_CODE = #{request.resCode}
|
||||
</if>
|
||||
<if test="request.startDate != null">
|
||||
AND "CREATE_TIME" >= #{request.startDate}
|
||||
</if>
|
||||
<if test="request.endDate != null">
|
||||
AND #{request.endDate} >= "CREATE_TIME"
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="search" resultMap="roleRes">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
"IS_DELETED" = 0
|
||||
</select>
|
||||
|
||||
<insert id="insert">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
#{request.id},
|
||||
#{request.roleId,jdbcType=BIGINT},
|
||||
#{request.roleCode,jdbcType=VARCHAR},
|
||||
#{request.resId,jdbcType=BIGINT},
|
||||
#{request.resCode,jdbcType=VARCHAR},
|
||||
0,
|
||||
0,
|
||||
#{token.userId,jdbcType=NUMERIC},
|
||||
datetime('now','localtime'),
|
||||
NULL,
|
||||
NULL
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="list" item= "item" index ="index" separator=",">
|
||||
(
|
||||
#{item.id},
|
||||
#{item.roleId,jdbcType=BIGINT},
|
||||
#{item.roleCode,jdbcType=VARCHAR},
|
||||
#{item.resId,jdbcType=BIGINT},
|
||||
#{item.resCode,jdbcType=VARCHAR},
|
||||
0,
|
||||
0,
|
||||
#{token.userId,jdbcType=NUMERIC},
|
||||
datetime('now','localtime'),
|
||||
NULL,
|
||||
NULL
|
||||
)
|
||||
</foreach >
|
||||
</insert>
|
||||
|
||||
<update id="delete">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET "IS_DELETED" = 1
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" = #{request.id}
|
||||
</update>
|
||||
|
||||
<update id="update">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET
|
||||
ROLE_ID = #{request.roleId,jdbcType=BIGINT},
|
||||
ROLE_CODE = #{request.roleCode,jdbcType=VARCHAR},
|
||||
RES_ID = #{request.resId,jdbcType=BIGINT},
|
||||
RES_CODE = #{request.resCode,jdbcType=VARCHAR},
|
||||
"ROW_VERSION" = "ROW_VERSION" + 1,
|
||||
"LAST_UPDATE_BY" = #{token.userId},
|
||||
"LAST_UPDATE_TIME" = datetime('now','localtime')
|
||||
WHERE
|
||||
"IS_DELETED" = 0
|
||||
AND "ID" = #{request.id}
|
||||
AND "ROW_VERSION" = #{request.rowVersion}
|
||||
</update>
|
||||
|
||||
<select id="get" resultMap="roleRes">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
IS_DELETED = 0
|
||||
AND ID = #{request.id}
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,143 @@
|
||||
<?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="xyz.wbsite.module.system.mpr.SequenceMapper">
|
||||
|
||||
<sql id="table">"SYS_SEQUENCE"</sql>
|
||||
|
||||
<sql id="entityColumnList">
|
||||
"ID","SEQ_NAME","SEQ_NOTE","YEAR","MONTH","DATE","NEXT_VALUE","ROW_VERSION","IS_DELETED","CREATE_BY","CREATE_TIME","LAST_UPDATE_BY","LAST_UPDATE_TIME"
|
||||
</sql>
|
||||
|
||||
<resultMap id="sequence" type="xyz.wbsite.module.system.ent.Sequence">
|
||||
<result column="ID" jdbcType="BIGINT" property="id"/>
|
||||
<result column="SEQ_NAME" jdbcType="VARCHAR" property="seqName"/>
|
||||
<result column="SEQ_NOTE" jdbcType="VARCHAR" property="seqNote"/>
|
||||
<result column="YEAR" jdbcType="VARCHAR" property="year"/>
|
||||
<result column="MONTH" jdbcType="VARCHAR" property="month"/>
|
||||
<result column="DATE" jdbcType="VARCHAR" property="date"/>
|
||||
<result column="NEXT_VALUE" jdbcType="INTEGER" property="nextValue"/>
|
||||
<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="sequence">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
"IS_DELETED" = 0
|
||||
<if test="request.seqName != null and request.seqName != ''">
|
||||
AND SEQ_NAME = #{request.seqName}
|
||||
</if>
|
||||
<if test="request.year != null and request.year != ''">
|
||||
AND YEAR = #{request.year}
|
||||
</if>
|
||||
<if test="request.month != null and request.month != ''">
|
||||
AND MONTH = #{request.month}
|
||||
</if>
|
||||
<if test="request.date != null and request.date != ''">
|
||||
AND DATE = #{request.date}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="search" resultMap="sequence">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
"IS_DELETED" = 0
|
||||
</select>
|
||||
|
||||
<insert id="insert">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
#{request.id},
|
||||
#{request.seqName,jdbcType=VARCHAR},
|
||||
#{request.seqNote,jdbcType=VARCHAR},
|
||||
#{request.year,jdbcType=VARCHAR},
|
||||
#{request.month,jdbcType=VARCHAR},
|
||||
#{request.date,jdbcType=VARCHAR},
|
||||
#{request.nextValue,jdbcType=INTEGER},
|
||||
0,
|
||||
0,
|
||||
#{token.userId,jdbcType=NUMERIC},
|
||||
datetime('now','localtime'),
|
||||
NULL,
|
||||
NULL
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" index="index" separator=",">
|
||||
(
|
||||
#{item.id},
|
||||
#{item.seqName,jdbcType=VARCHAR},
|
||||
#{item.seqNote,jdbcType=VARCHAR},
|
||||
#{item.year,jdbcType=VARCHAR},
|
||||
#{item.month,jdbcType=VARCHAR},
|
||||
#{item.date,jdbcType=VARCHAR},
|
||||
#{item.nextValue,jdbcType=INTEGER},
|
||||
0,
|
||||
0,
|
||||
#{token.userId,jdbcType=NUMERIC},
|
||||
datetime('now','localtime'),
|
||||
NULL,
|
||||
NULL
|
||||
)
|
||||
</foreach >
|
||||
</insert>
|
||||
|
||||
<update id="delete">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET "IS_DELETED" = 1
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" = #{request.id}
|
||||
</update>
|
||||
|
||||
<update id="update">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET
|
||||
SEQ_NAME = #{request.seqName,jdbcType=VARCHAR},
|
||||
SEQ_NOTE = #{request.seqNote,jdbcType=VARCHAR},
|
||||
YEAR = #{request.year,jdbcType=VARCHAR},
|
||||
MONTH = #{request.month,jdbcType=VARCHAR},
|
||||
DATE = #{request.date,jdbcType=VARCHAR},
|
||||
NEXT_VALUE = #{request.nextValue,jdbcType=INTEGER},
|
||||
"ROW_VERSION" = "ROW_VERSION" + 1,
|
||||
"LAST_UPDATE_BY" = #{token.userId},
|
||||
"LAST_UPDATE_TIME" = datetime('now','localtime')
|
||||
WHERE "IS_DELETED" = 0
|
||||
AND "ID" = #{request.id}
|
||||
AND "ROW_VERSION" = #{request.rowVersion}
|
||||
</update>
|
||||
|
||||
<select id="get" resultMap="sequence">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE IS_DELETED = 0
|
||||
AND ID = #{request.id}
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,76 @@
|
||||
package xyz.wbsite.module.system.mpr;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import xyz.wbsite.frame.auth.Token;
|
||||
import xyz.wbsite.module.system.ent.Sequence;
|
||||
import xyz.wbsite.module.system.req.SequenceDeleteRequest;
|
||||
import xyz.wbsite.module.system.req.SequenceFindRequest;
|
||||
import xyz.wbsite.module.system.req.SequenceGetRequest;
|
||||
import xyz.wbsite.module.system.req.SequenceUpdateRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* SEQUENCE - 序列
|
||||
*
|
||||
* @author wangbing
|
||||
* @date 2020-06-25
|
||||
*/
|
||||
@Mapper
|
||||
public interface SequenceMapper {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long insert(@Param("request") Sequence request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 批量插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long insertBatch(@Param("list") List<Sequence> request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long delete(@Param("request") SequenceDeleteRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long update(@Param("request") SequenceUpdateRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
List<Sequence> find(@Param("request") SequenceFindRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
Sequence get(@Param("request") SequenceGetRequest request, @Param("token") Token token);
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
package xyz.wbsite.module.system.req;
|
||||
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import xyz.wbsite.frame.base.BaseRequest;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* SequenceCreateRequest - 序列新增
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-06-25
|
||||
*/
|
||||
public class SequenceCreateRequest extends BaseRequest {
|
||||
|
||||
/**
|
||||
* 序列名称.
|
||||
*/
|
||||
@NotBlank(message = "[seqName]序列名称不能为空")
|
||||
@Length(min = 0, max = 50, message = "[seqName]序列名称长度不合法(0-50)")
|
||||
private String seqName;
|
||||
|
||||
/**
|
||||
* 序列备注.
|
||||
*/
|
||||
@Length(min = 0, max = 50, message = "[seqNote]序列备注长度不合法(0-50)")
|
||||
private String seqNote;
|
||||
|
||||
/**
|
||||
* 年.
|
||||
*/
|
||||
@Length(min = 0, max = 4, message = "[year]年长度不合法(0-4)")
|
||||
private String year;
|
||||
|
||||
/**
|
||||
* 月.
|
||||
*/
|
||||
@Length(min = 0, max = 2, message = "[month]月长度不合法(0-2)")
|
||||
private String month;
|
||||
|
||||
/**
|
||||
* 日.
|
||||
*/
|
||||
@Length(min = 0, max = 2, message = "[date]日长度不合法(0-2)")
|
||||
private String date;
|
||||
|
||||
/**
|
||||
* 下一个值.
|
||||
*/
|
||||
@NotNull(message = "[nextValue]下一个值不能为NULL")
|
||||
private Integer nextValue;
|
||||
|
||||
public String getSeqName() {
|
||||
return this.seqName;
|
||||
}
|
||||
|
||||
public void setSeqName(String seqName) {
|
||||
this.seqName = seqName;
|
||||
}
|
||||
|
||||
public String getSeqNote() {
|
||||
return this.seqNote;
|
||||
}
|
||||
|
||||
public void setSeqNote(String seqNote) {
|
||||
this.seqNote = seqNote;
|
||||
}
|
||||
|
||||
public String getYear() {
|
||||
return this.year;
|
||||
}
|
||||
|
||||
public void setYear(String year) {
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public String getMonth() {
|
||||
return this.month;
|
||||
}
|
||||
|
||||
public void setMonth(String month) {
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public String getDate() {
|
||||
return this.date;
|
||||
}
|
||||
|
||||
public void setDate(String date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public Integer getNextValue() {
|
||||
return this.nextValue;
|
||||
}
|
||||
|
||||
public void setNextValue(Integer nextValue) {
|
||||
this.nextValue = nextValue;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package xyz.wbsite.module.system.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseRequest;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* SequenceDeleteRequest - 序列删除
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-06-25
|
||||
*/
|
||||
public class SequenceDeleteRequest 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,93 @@
|
||||
package xyz.wbsite.module.system.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseFindRequest;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* SequenceFindRequest - 序列查询
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-06-25
|
||||
*/
|
||||
public class SequenceFindRequest extends BaseFindRequest {
|
||||
|
||||
/**
|
||||
* 序列名称.
|
||||
*/
|
||||
private String seqName;
|
||||
|
||||
/**
|
||||
* 年.
|
||||
*/
|
||||
private String year;
|
||||
|
||||
/**
|
||||
* 月.
|
||||
*/
|
||||
private String month;
|
||||
|
||||
/**
|
||||
* 日.
|
||||
*/
|
||||
private String date;
|
||||
|
||||
/**
|
||||
* 开始日期
|
||||
*/
|
||||
private Date startDate;
|
||||
|
||||
/**
|
||||
* 结束日期
|
||||
*/
|
||||
private Date endDate;
|
||||
|
||||
public String getSeqName() {
|
||||
return this.seqName;
|
||||
}
|
||||
|
||||
public void setSeqName(String seqName) {
|
||||
this.seqName = seqName;
|
||||
}
|
||||
|
||||
public String getYear() {
|
||||
return this.year;
|
||||
}
|
||||
|
||||
public void setYear(String year) {
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public String getMonth() {
|
||||
return this.month;
|
||||
}
|
||||
|
||||
public void setMonth(String month) {
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public String getDate() {
|
||||
return this.date;
|
||||
}
|
||||
|
||||
public void setDate(String date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public Date getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Date startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package xyz.wbsite.module.system.req;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseRequest;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* SequenceGetRequest - 序列获取
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-06-25
|
||||
*/
|
||||
public class SequenceGetRequest 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,116 @@
|
||||
package xyz.wbsite.module.system.req;
|
||||
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import xyz.wbsite.frame.base.BaseUpdateRequest;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* SequenceUpdateRequest - 序列更新
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-06-25
|
||||
*/
|
||||
public class SequenceUpdateRequest extends BaseUpdateRequest {
|
||||
|
||||
/**
|
||||
* 主键.
|
||||
*/
|
||||
@NotNull(message = "[id]主键不能为NULL")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 序列名称.
|
||||
*/
|
||||
@NotBlank(message = "[seqName]序列名称不能为空")
|
||||
@Length(min = 0, max = 50, message = "[seqName]序列名称长度不合法(0-50)")
|
||||
private String seqName;
|
||||
|
||||
/**
|
||||
* 序列备注.
|
||||
*/
|
||||
@Length(min = 0, max = 50, message = "[seqNote]序列备注长度不合法(0-50)")
|
||||
private String seqNote;
|
||||
|
||||
/**
|
||||
* 年.
|
||||
*/
|
||||
@Length(min = 0, max = 4, message = "[year]年长度不合法(0-4)")
|
||||
private String year;
|
||||
|
||||
/**
|
||||
* 月.
|
||||
*/
|
||||
@Length(min = 0, max = 2, message = "[month]月长度不合法(0-2)")
|
||||
private String month;
|
||||
|
||||
/**
|
||||
* 日.
|
||||
*/
|
||||
@Length(min = 0, max = 2, message = "[date]日长度不合法(0-2)")
|
||||
private String date;
|
||||
|
||||
/**
|
||||
* 下一个值.
|
||||
*/
|
||||
@NotNull(message = "[nextValue]下一个值不能为NULL")
|
||||
private Integer nextValue;
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSeqName() {
|
||||
return this.seqName;
|
||||
}
|
||||
|
||||
public void setSeqName(String seqName) {
|
||||
this.seqName = seqName;
|
||||
}
|
||||
|
||||
public String getSeqNote() {
|
||||
return this.seqNote;
|
||||
}
|
||||
|
||||
public void setSeqNote(String seqNote) {
|
||||
this.seqNote = seqNote;
|
||||
}
|
||||
|
||||
public String getYear() {
|
||||
return this.year;
|
||||
}
|
||||
|
||||
public void setYear(String year) {
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
public String getMonth() {
|
||||
return this.month;
|
||||
}
|
||||
|
||||
public void setMonth(String month) {
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public String getDate() {
|
||||
return this.date;
|
||||
}
|
||||
|
||||
public void setDate(String date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public Integer getNextValue() {
|
||||
return this.nextValue;
|
||||
}
|
||||
|
||||
public void setNextValue(Integer nextValue) {
|
||||
this.nextValue = nextValue;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package xyz.wbsite.module.system.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* SequenceCreateResponse - 序列
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-06-25
|
||||
*/
|
||||
public class SequenceCreateResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package xyz.wbsite.module.system.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* SequenceDeleteResponse - 序列
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-06-25
|
||||
*/
|
||||
public class SequenceDeleteResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 删除数目
|
||||
*/
|
||||
private Long result;
|
||||
|
||||
public Long getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public void setResult(Long result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package xyz.wbsite.module.system.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseFindResponse;
|
||||
import xyz.wbsite.module.system.ent.Sequence;
|
||||
|
||||
/**
|
||||
* SequenceFindResponse - 序列
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-06-25
|
||||
*/
|
||||
public class SequenceFindResponse extends BaseFindResponse<Sequence> {
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package xyz.wbsite.module.system.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
import xyz.wbsite.module.system.ent.Sequence;
|
||||
|
||||
/**
|
||||
* SequenceGetResponse - 序列
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-06-25
|
||||
*/
|
||||
public class SequenceGetResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 序列
|
||||
*/
|
||||
private Sequence sequence;
|
||||
|
||||
public Sequence getSequence() {
|
||||
return this.sequence;
|
||||
}
|
||||
|
||||
public void setSequence(Sequence sequence) {
|
||||
this.sequence = sequence;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package xyz.wbsite.module.system.rsp;
|
||||
|
||||
import xyz.wbsite.frame.base.BaseResponse;
|
||||
|
||||
/**
|
||||
* SequenceUpdateResponse - 序列
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2020-06-25
|
||||
*/
|
||||
public class SequenceUpdateResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 更新数目
|
||||
*/
|
||||
private Long result;
|
||||
|
||||
public Long getResult() {
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public void setResult(Long result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
-- ----------------------------
|
||||
-- Table structure for SEQUENCE - 序列
|
||||
-- Target : SQLite
|
||||
-- Author : wangbing
|
||||
-- Date: : 2020-06-25
|
||||
-- ----------------------------
|
||||
CREATE TABLE IF NOT EXISTS SYS_SEQUENCE (
|
||||
"ID" BIGINT PRIMARY KEY NOT NULL,
|
||||
"SEQ_NAME" VARCHAR(50) NOT NULL,
|
||||
"SEQ_NOTE" VARCHAR(50),
|
||||
"YEAR" VARCHAR(4),
|
||||
"MONTH" VARCHAR(2),
|
||||
"DATE" VARCHAR(2),
|
||||
"NEXT_VALUE" MEDIUMINT NOT NULL,
|
||||
"ROW_VERSION" BIGINT NOT NULL,
|
||||
"IS_DELETED" BOOLEAN NOT NULL,
|
||||
"CREATE_BY" BIGINT NOT NULL,
|
||||
"CREATE_TIME" DATETIME NOT NULL,
|
||||
"LAST_UPDATE_BY" BIGINT,
|
||||
"LAST_UPDATE_TIME" DATETIME
|
||||
);
|
@ -0,0 +1,279 @@
|
||||
<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="appName">
|
||||
<el-input v-model="vm.appName" clearable size="mini" placeholder="请输入应用名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="应用码" prop="appKey">
|
||||
<el-input v-model="vm.appKey" clearable size="mini" placeholder="请输入应用码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="安全码" prop="appSecret">
|
||||
<el-input v-model="vm.appSecret" clearable size="mini" placeholder="请输入安全码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否有效" prop="valid">
|
||||
<el-radio-group v-model="vm.valid" clearable size="mini">
|
||||
<el-radio :label="true">是</el-radio>
|
||||
<el-radio :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="开始日期" prop="startDate">
|
||||
<el-date-picker v-model="vm.startDate" clearable size="mini" placeholder="请输入开始日期" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="结束日期" prop="endDate">
|
||||
<el-date-picker v-model="vm.endDate" clearable size="mini" placeholder="请输入结束日期" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" size="mini" icon="el-icon-search" @click="onSearch">搜索</el-button>
|
||||
<el-button type="warning" size="mini" 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="mini" icon="el-icon-plus" @click="onCreate">新增</el-button>
|
||||
|
||||
<el-button type="warning" size="mini" 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="mini" icon="el-icon-date" @click="onTemplate"></el-button>
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip effect="dark" content="Excel导入" placement="bottom">
|
||||
<el-button size="mini" icon="el-icon-upload2" @click="onImport"></el-button>
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip effect="dark" content="批量删除" placement="bottom">
|
||||
<el-button size="mini" icon="el-icon-delete" @click="onBitchDelete"></el-button>
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip effect="dark" content="刷新" placement="bottom">
|
||||
<el-button size="mini" 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="无数据"
|
||||
:stripe="true"
|
||||
: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"
|
||||
width="180"
|
||||
prop="appName"
|
||||
label="应用名称">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
width="180"
|
||||
prop="appNote"
|
||||
label="应用简介">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
width="180"
|
||||
prop="appKey"
|
||||
label="应用码">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
width="150"
|
||||
prop="appSecret"
|
||||
label="安全码">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
width="80"
|
||||
prop="valid"
|
||||
label="是否有效">
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="mini" effect="dark" type="success" v-if="scope.row.valid">是</el-tag>
|
||||
<el-tag size="mini" effect="dark" type="danger" v-if="!scope.row.valid">否</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="createTime"
|
||||
label="创建时间">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
fixed="right"
|
||||
width="120"
|
||||
label="操作">
|
||||
<template slot-scope="scope">
|
||||
<wb-dropdown :arg="scope.row">
|
||||
<wb-dropdown-item value="编辑" icon="el-icon-edit" @click="onEdit"></wb-dropdown-item>
|
||||
<wb-dropdown-item value="删除" icon="el-icon-delete" @click="onDelete"></wb-dropdown-item>
|
||||
</wb-dropdown>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-pagination
|
||||
background
|
||||
v-if="vm.totalCount > vm.pageSize"
|
||||
style="margin-top: 10px"
|
||||
@current-change="onPageChange"
|
||||
@size-change="onPageSizeChange"
|
||||
: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.formTitle"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="form.formShow">
|
||||
<el-form class="form" :model="form" :inline="true" :rules="formRules" ref="form" label-position="right" label-width="90px">
|
||||
<el-form-item label="应用名称" prop="appName">
|
||||
<el-input v-model="form.appName" clearable size="mini" placeholder="请输入应用名称" maxlength="50"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="应用简介" prop="appNote">
|
||||
<el-input v-model="form.appNote"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="请输入应用简介"
|
||||
type="textarea"
|
||||
maxlength="255"
|
||||
show-word-limit></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="应用码" prop="appKey">
|
||||
<el-input v-model="form.appKey" clearable size="mini" placeholder="请输入应用码" maxlength="50"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="安全码" prop="appSecret">
|
||||
<el-input v-model="form.appSecret" clearable size="mini" placeholder="请输入安全码" maxlength="16"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否有效" prop="valid">
|
||||
<el-radio-group v-model="form.valid" clearable size="mini">
|
||||
<el-radio :label="true">是</el-radio>
|
||||
<el-radio :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button size="mini" @click="form.formShow = false">取 消</el-button>
|
||||
<el-button size="mini" type="primary" @click="onSave">保存</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
<script>
|
||||
var app = new Vue({
|
||||
mixins: [mixin],
|
||||
el: "#app",
|
||||
data: {
|
||||
module: 'system',
|
||||
target: 'visitor',
|
||||
vm: {//条件及分页参数
|
||||
appName: null,
|
||||
appKey: null,
|
||||
appSecret: null,
|
||||
valid: null,
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
totalCount: 0,
|
||||
sortKey:'CREATE_TIME',
|
||||
sortType:'DESC'
|
||||
},
|
||||
form: {//待提交表单
|
||||
formTitle: null,
|
||||
formShow: false,
|
||||
id: null,
|
||||
appName: null,
|
||||
appNote: null,
|
||||
appKey: null,
|
||||
appSecret: null,
|
||||
valid: null,
|
||||
rowVersion: null
|
||||
},
|
||||
formRules: {
|
||||
appName: [
|
||||
{required: true, message: '应用名称不能为空', trigger: 'blur'},
|
||||
{min: 1, max: 50, message: '应用名称长度在 1 到 50 个字符', trigger: 'blur'}
|
||||
],
|
||||
appNote: [
|
||||
{min: 1, max: 255, message: '应用简介长度在 1 到 255 个字符', trigger: 'blur'}
|
||||
],
|
||||
appKey: [
|
||||
{required: true, message: '应用码不能为空', trigger: 'blur'},
|
||||
{min: 1, max: 50, message: '应用码长度在 1 到 50 个字符', trigger: 'blur'}
|
||||
],
|
||||
appSecret: [
|
||||
{required: true, message: '安全码不能为空', trigger: 'blur'},
|
||||
{min: 1, max: 16, message: '安全码长度在 1 到 16 个字符', trigger: 'blur'}
|
||||
],
|
||||
valid: [
|
||||
{required: true, message: '是否有效不能为空', trigger: 'blur'},
|
||||
],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onCreate: function () {
|
||||
this.form.formTitle = "应用接入新增";
|
||||
this.form.formShow = true;
|
||||
this.form.id = "";
|
||||
this.form.appName = "";
|
||||
this.form.appNote = "";
|
||||
this.form.appKey = "";
|
||||
this.form.appSecret = "";
|
||||
this.form.valid = "";
|
||||
},
|
||||
onEdit: function (item) {
|
||||
this.form.formTitle = "应用接入编辑";
|
||||
this.form.formShow = true;
|
||||
this.form.id = item.id;
|
||||
this.form.appName = item.appName;
|
||||
this.form.appNote = item.appNote;
|
||||
this.form.appKey = item.appKey;
|
||||
this.form.appSecret = item.appSecret;
|
||||
this.form.valid = item.valid;
|
||||
this.form.rowVersion = item.rowVersion;
|
||||
},
|
||||
onDelete: function (item) {
|
||||
this.$confirm('将删除该项, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
new Ajax("system", "visitor").delete({id: item.id}, function (response) {
|
||||
if (response.errors.length > 0) {
|
||||
nav.e(response.errors[0].message);
|
||||
} else {
|
||||
nav.s("删除成功.");
|
||||
this.onFind();
|
||||
}
|
||||
}.bind(this))
|
||||
}.bind(this)).catch(function (action) {
|
||||
|
||||
});
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
this.onFind();
|
||||
},
|
||||
})
|
||||
</script>
|
Loading…
Reference in new issue