Former-commit-id: 69b92bf4f445e1a0d2b84f4b67b6ddcb56ff417f
master
wangbing 5 years ago
parent bf4fa31dce
commit d41f1c42b7

@ -0,0 +1,104 @@
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.WSheet;
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.Res;
import ${basePackage}.module.system.mgr.ResManager;
import ${basePackage}.module.system.req.ResCreateRequest;
import ${basePackage}.module.system.req.ResDeleteRequest;
import ${basePackage}.module.system.req.ResFindRequest;
import ${basePackage}.module.system.req.ResGetRequest;
import ${basePackage}.module.system.req.ResTreeRequest;
import ${basePackage}.module.system.req.ResUpdateRequest;
import ${basePackage}.module.system.rsp.ResCreateResponse;
import ${basePackage}.module.system.rsp.ResDeleteResponse;
import ${basePackage}.module.system.rsp.ResFindResponse;
import ${basePackage}.module.system.rsp.ResGetResponse;
import ${basePackage}.module.system.rsp.ResTreeResponse;
import ${basePackage}.module.system.rsp.ResUpdateResponse;
import java.io.IOException;
import java.util.List;
public class ResAjax {
@Autowired
private ResManager resManager;
public ResCreateResponse create(ResCreateRequest request) {
return resManager.create(request, LocalData.getToken());
}
public ResDeleteResponse delete(ResDeleteRequest request) {
return resManager.delete(request, LocalData.getToken());
}
public ResUpdateResponse update(ResUpdateRequest request) {
return resManager.update(request, LocalData.getToken());
}
public ResFindResponse find(ResFindRequest request) {
return resManager.find(request, LocalData.getToken());
}
public ResGetResponse get(ResGetRequest request) {
return resManager.get(request, LocalData.getToken());
}
public ResTreeResponse tree(ResTreeRequest request) {
return resManager.tree(request, LocalData.getToken());
}
public Object template() {
return ResponseUtil.apply(new WSheet<>(Res.class));
}
public Object exports(TreeNode jsonParam) {
ResFindRequest request = MapperUtil.toJava(jsonParam, ResFindRequest.class);
ResFindResponse response = resManager.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 WSheet<>(response.getResult()));
}
public Object imports(MultipartFile file) {
BaseResponse baseResponse = new BaseResponse();
try {
WSheet<Res> sheet = new WSheet<>(file.getBytes(), Res.class, new WSheet.Validator<Res>() {
@Override
public List<String> validate(Res o) {
ResCreateRequest request = MapperUtil.map(o, ResCreateRequest.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,48 @@
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.excel.WSheet;
import ${basePackage}.frame.utils.LogUtil;
import ${basePackage}.frame.auth.LocalData;
import ${basePackage}.frame.base.ErrorType;
import ${basePackage}.frame.utils.MapperUtil;
import ${basePackage}.frame.base.BaseResponse;
import ${basePackage}.frame.utils.ResponseUtil;
import ${basePackage}.frame.utils.ValidationUtil;
import ${basePackage}.frame.excel.exception.ReadErrorException;
import ${basePackage}.frame.excel.exception.TemplateNotMatchException;
import ${basePackage}.module.system.ent.RoleRes;
import ${basePackage}.module.system.mgr.RoleResManager;
import ${basePackage}.module.system.req.*;
import ${basePackage}.module.system.rsp.*;
import java.io.IOException;
import java.util.List;
public class RoleResAjax{
@Autowired
private RoleResManager roleResManager;
public RoleResCreateResponse create(RoleResCreateRequest request) {
return roleResManager.create(request, LocalData.getToken());
}
public RoleResDeleteResponse delete(RoleResDeleteRequest request) {
return roleResManager.delete(request, LocalData.getToken());
}
public RoleResUpdateResponse update(RoleResUpdateRequest request) {
return roleResManager.update(request, LocalData.getToken());
}
public RoleResFindResponse find(RoleResFindRequest request) {
return roleResManager.find(request, LocalData.getToken());
}
public RoleResGetResponse get(RoleResGetRequest request) {
return roleResManager.get(request, LocalData.getToken());
}
}

@ -25,8 +25,8 @@ import java.io.File;
import java.util.List;
import java.util.Locale;
import static xyz.wbsite.config.ActionConfig.CONTROL_PREFIX;
import static xyz.wbsite.config.ActionConfig.SCREEN_PREFIX;
import static ${basePackage}.config.ActionConfig.CONTROL_PREFIX;
import static ${basePackage}.config.ActionConfig.SCREEN_PREFIX;
@Configuration
public class FreeMarkerConfig {

@ -0,0 +1,116 @@
package ${basePackage}.module.system.ent;
import ${basePackage}.frame.excel.annotation.ColumnDescription;
import ${basePackage}.frame.excel.annotation.ColumnName;
import ${basePackage}.frame.excel.annotation.SheetName;
import ${basePackage}.frame.base.BaseEntity;
/**
* RES -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
@SheetName("资源")
public class Res extends BaseEntity {
/**
* RES_CODE -
*/
@ColumnName("资源代码")
@ColumnDescription("")
private String resCode;
/**
* RES_NAME -
*/
@ColumnName("资源名称")
@ColumnDescription("")
private String resName;
/**
* RES_TYPE -
*/
@ColumnName("资源类型")
@ColumnDescription("")
private String resType;
/**
* RES_VALUE -
*/
@ColumnName("资源内容")
@ColumnDescription("")
private String resValue;
/**
* SUP_CODE -
*/
@ColumnName("上级代码")
@ColumnDescription("")
private String supCode;
/**
* SUP_NAME -
*/
@ColumnName("上级名称")
@ColumnDescription("")
private String supName;
/**
* VALID -
*/
@ColumnName("是否有效")
@ColumnDescription("")
private Boolean valid;
public String getResCode() {
return this.resCode;
}
public void setResCode(String resCode) {
this.resCode = resCode;
}
public String getResName() {
return this.resName;
}
public void setResName(String resName) {
this.resName = resName;
}
public String getResType() {
return this.resType;
}
public void setResType(String resType) {
this.resType = resType;
}
public String getResValue() {
return this.resValue;
}
public void setResValue(String resValue) {
this.resValue = resValue;
}
public String getSupCode() {
return this.supCode;
}
public void setSupCode(String supCode) {
this.supCode = supCode;
}
public String getSupName() {
return this.supName;
}
public void setSupName(String supName) {
this.supName = supName;
}
public Boolean getValid() {
return this.valid;
}
public void setValid(Boolean valid) {
this.valid = valid;
}
}

@ -0,0 +1,49 @@
package ${basePackage}.module.system.ent;
import java.util.ArrayList;
import java.util.List;
/**
* ResTree -
*
* @author wangbing
* @version 0.0.1
* @since 2019-12-24
*/
public class ResTree extends Res {
private String label;
private String value;
private List<ResTree> children;
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public List<ResTree> getChildren() {
return children;
}
public void setChildren(List<ResTree> children) {
this.children = children;
}
public void addChild(ResTree deptTree) {
if (this.children == null) this.children = new ArrayList<>();
this.children.add(deptTree);
}
}

@ -0,0 +1,62 @@
package ${basePackage}.module.system.ent;
import ${basePackage}.frame.base.BaseEntity;
/**
* ROLE_RES -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public class RoleRes extends BaseEntity {
/**
* ROLE_ID -
*/
private Long roleId;
/**
* ROLE_CODE -
*/
private String roleCode;
/**
* RES_ID -
*/
private Long resId;
/**
* RES_CODE -
*/
private String resCode;
public Long getRoleId() {
return this.roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public String getRoleCode() {
return this.roleCode;
}
public void setRoleCode(String roleCode) {
this.roleCode = roleCode;
}
public Long getResId() {
return this.resId;
}
public void setResId(Long resId) {
this.resId = resId;
}
public String getResCode() {
return this.resCode;
}
public void setResCode(String resCode) {
this.resCode = resCode;
}
}

@ -0,0 +1,79 @@
package ${basePackage}.module.system.mgr;
import ${basePackage}.module.system.req.ResCreateRequest;
import ${basePackage}.module.system.req.ResDeleteRequest;
import ${basePackage}.module.system.req.ResFindRequest;
import ${basePackage}.module.system.req.ResGetRequest;
import ${basePackage}.module.system.req.ResTreeRequest;
import ${basePackage}.module.system.req.ResUpdateRequest;
import ${basePackage}.module.system.rsp.ResCreateResponse;
import ${basePackage}.module.system.rsp.ResDeleteResponse;
import ${basePackage}.module.system.rsp.ResFindResponse;
import ${basePackage}.module.system.rsp.ResGetResponse;
import ${basePackage}.module.system.rsp.ResTreeResponse;
import ${basePackage}.module.system.rsp.ResUpdateResponse;
import ${basePackage}.frame.base.Token;
/**
*
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public interface ResManager {
/**
*
*
* @param request
* @param token
* @return
*/
ResCreateResponse create(ResCreateRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
ResDeleteResponse delete(ResDeleteRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
ResUpdateResponse update(ResUpdateRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
ResFindResponse find(ResFindRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
ResGetResponse get(ResGetRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
ResTreeResponse tree(ResTreeRequest request, Token token);
}

@ -0,0 +1,249 @@
package ${basePackage}.module.system.mgr;
import ${basePackage}.frame.base.SortType;
import ${basePackage}.frame.utils.IDgenerator;
import ${basePackage}.frame.utils.Message;
import ${basePackage}.frame.base.ErrorType;
import ${basePackage}.frame.base.Token;
import ${basePackage}.frame.utils.MapperUtil;
import ${basePackage}.frame.utils.ValidationUtil;
import ${basePackage}.module.system.ent.Res;
import ${basePackage}.module.system.ent.ResTree;
import ${basePackage}.module.system.mpr.ResMapper;
import ${basePackage}.module.system.req.ResCreateRequest;
import ${basePackage}.module.system.req.ResDeleteRequest;
import ${basePackage}.module.system.req.ResFindRequest;
import ${basePackage}.module.system.req.ResGetRequest;
import ${basePackage}.module.system.req.ResTreeRequest;
import ${basePackage}.module.system.req.ResUpdateRequest;
import ${basePackage}.module.system.rsp.ResCreateResponse;
import ${basePackage}.module.system.rsp.ResDeleteResponse;
import ${basePackage}.module.system.rsp.ResFindResponse;
import ${basePackage}.module.system.rsp.ResGetResponse;
import ${basePackage}.module.system.rsp.ResTreeResponse;
import ${basePackage}.module.system.rsp.ResUpdateResponse;
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 java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* RES -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
@Transactional
@Service
public class ResManagerImpl implements ResManager {
@Autowired
private ResMapper resMapper;
/**
*
*
* @param request
* @param token
* @return
*/
public ResCreateResponse create(ResCreateRequest request, Token token) {
ResCreateResponse response = new ResCreateResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
long id = IDgenerator.nextId();
Res entity = MapperUtil.map(request, Res.class);
entity.setId(id);
long result = resMapper.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 ResDeleteResponse delete(ResDeleteRequest request, Token token) {
ResDeleteResponse response = new ResDeleteResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
long result = resMapper.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 ResUpdateResponse update(ResUpdateRequest request, Token token) {
ResUpdateResponse response = new ResUpdateResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
long result = resMapper.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 ResFindResponse find(ResFindRequest request, Token token) {
ResFindResponse response = new ResFindResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
PageHelper.startPage(request.getPageNumber(), request.getPageSize());
if (StringUtil.isNotEmpty(request.getSortKey())) {
PageHelper.orderBy(request.getSortKey() + " " + request.getSortType());
}
PageInfo<Res> pageInfo = new PageInfo<>(resMapper.find(request, token));
response.setResult(pageInfo.getList());
response.setTotalCount(pageInfo.getTotal());
return response;
}
/**
*
*
* @param request
* @param token
* @return
*/
@Transactional(readOnly = true)
public ResGetResponse get(ResGetRequest request, Token token) {
ResGetResponse response = new ResGetResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
Res po = resMapper.get(request, token);
if (po != null) {
response.setRes(po);
} else {
response.addError(ErrorType.BUSINESS_ERROR, Message.GET_FAILURE);
}
return response;
}
@Override
public ResTreeResponse tree(ResTreeRequest request, Token token) {
ResTreeResponse response = new ResTreeResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
ResFindRequest resourceFindRequest = new ResFindRequest();
resourceFindRequest.setPageSize(0);
resourceFindRequest.setValid(true);
resourceFindRequest.setSortType(SortType.ASC);
resourceFindRequest.setSortKey("CODE");
ResFindResponse resourceFindResponse = this.find(resourceFindRequest, token);
if (resourceFindResponse.hasError()) {
response.addErrors(resourceFindResponse.getErrors());
return response;
}
List<ResTree> data = new ArrayList<>();
Map<String, ResTree> allMap = new HashMap<>();
List<Res> result = resourceFindResponse.getResult();
// 获取最顶级资源
int level = 1;
while (result.size() > 0) {
Iterator<Res> iterator = result.iterator();
while (iterator.hasNext()) {
Res next = iterator.next();
ResTree tree = new ResTree();
tree.setId(next.getId());
tree.setResCode(next.getResCode());
tree.setResName(next.getResName());
tree.setResType(next.getResType());
tree.setResValue(next.getResValue());
tree.setValid(next.getValid());
tree.setRowVersion(next.getRowVersion());
if (next.getResCode() != null && next.getResCode().split("_").length == level) {
allMap.put(tree.getResCode(), tree);
iterator.remove();
//尝试获取上级资源
String code = next.getResCode();
ResTree Ptree = null;
while (code.contains("_")) {
code = code.substring(0, code.lastIndexOf("_"));
Ptree = allMap.get(code);
if (Ptree != null) break;
}
if (Ptree != null) {
Ptree.getChildren().add(tree);
} else {
data.add(tree);
}
}
}
level++;
}
response.setResult(data);
return response;
}
}

@ -0,0 +1,68 @@
package ${basePackage}.module.system.mgr;
import ${basePackage}.module.system.req.RoleResCreateRequest;
import ${basePackage}.module.system.req.RoleResDeleteRequest;
import ${basePackage}.module.system.req.RoleResFindRequest;
import ${basePackage}.module.system.req.RoleResGetRequest;
import ${basePackage}.module.system.req.RoleResUpdateRequest;
import ${basePackage}.module.system.rsp.RoleResCreateResponse;
import ${basePackage}.module.system.rsp.RoleResDeleteResponse;
import ${basePackage}.module.system.rsp.RoleResFindResponse;
import ${basePackage}.module.system.rsp.RoleResGetResponse;
import ${basePackage}.module.system.rsp.RoleResUpdateResponse;
import ${basePackage}.frame.base.Token;
/**
*
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public interface RoleResManager {
/**
*
*
* @param request
* @param token
* @return
*/
RoleResCreateResponse create(RoleResCreateRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
RoleResDeleteResponse delete(RoleResDeleteRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
RoleResUpdateResponse update(RoleResUpdateRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
RoleResFindResponse find(RoleResFindRequest request, Token token);
/**
*
*
* @param request
* @param token
* @return
*/
RoleResGetResponse get(RoleResGetRequest request, Token token);
}

@ -0,0 +1,175 @@
package ${basePackage}.module.system.mgr;
import ${basePackage}.frame.utils.IDgenerator;
import ${basePackage}.frame.utils.Message;
import ${basePackage}.frame.base.ErrorType;
import ${basePackage}.frame.base.Token;
import ${basePackage}.frame.utils.MapperUtil;
import ${basePackage}.frame.utils.ValidationUtil;
import ${basePackage}.module.system.ent.RoleRes;
import ${basePackage}.module.system.mpr.RoleResMapper;
import ${basePackage}.module.system.req.RoleResCreateRequest;
import ${basePackage}.module.system.req.RoleResDeleteRequest;
import ${basePackage}.module.system.req.RoleResFindRequest;
import ${basePackage}.module.system.req.RoleResGetRequest;
import ${basePackage}.module.system.req.RoleResUpdateRequest;
import ${basePackage}.module.system.rsp.RoleResCreateResponse;
import ${basePackage}.module.system.rsp.RoleResDeleteResponse;
import ${basePackage}.module.system.rsp.RoleResFindResponse;
import ${basePackage}.module.system.rsp.RoleResGetResponse;
import ${basePackage}.module.system.rsp.RoleResUpdateResponse;
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;
/**
* ROLE_RES -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
@Transactional
@Service
public class RoleResManagerImpl implements RoleResManager {
@Autowired
private RoleResMapper roleResMapper;
/**
*
*
* @param request
* @param token
* @return
*/
public RoleResCreateResponse create(RoleResCreateRequest request, Token token) {
RoleResCreateResponse response = new RoleResCreateResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
long id = IDgenerator.nextId();
RoleRes entity = MapperUtil.map(request, RoleRes.class);
entity.setId(id);
long result = roleResMapper.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 RoleResDeleteResponse delete(RoleResDeleteRequest request, Token token) {
RoleResDeleteResponse response = new RoleResDeleteResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
long result = roleResMapper.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 RoleResUpdateResponse update(RoleResUpdateRequest request, Token token) {
RoleResUpdateResponse response = new RoleResUpdateResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
long result = roleResMapper.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 RoleResFindResponse find(RoleResFindRequest request, Token token) {
RoleResFindResponse response = new RoleResFindResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
PageHelper.startPage(request.getPageNumber(), request.getPageSize());
if (StringUtil.isNotEmpty(request.getSortKey())) {
PageHelper.orderBy(request.getSortKey() + " " + request.getSortType());
}
PageInfo<RoleRes> pageInfo = new PageInfo<>(roleResMapper.find(request, token));
response.setResult(pageInfo.getList());
response.setTotalCount(pageInfo.getTotal());
return response;
}
/**
*
*
* @param request
* @param token
* @return
*/
@Transactional(readOnly = true)
public RoleResGetResponse get(RoleResGetRequest request, Token token) {
RoleResGetResponse response = new RoleResGetResponse();
ValidationUtil.validate(request, response);
if (response.hasError()) {
return response;
}
RoleRes po = roleResMapper.get(request, token);
if (po != null) {
response.setRoleRes(po);
} else {
response.addError(ErrorType.BUSINESS_ERROR, Message.GET_FAILURE);
}
return response;
}
}

@ -0,0 +1,161 @@
<?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.ResMapper">
<sql id="table">`SYS_RES`</sql>
<sql id="entityColumnList">
`ID`,`RES_CODE`,`RES_NAME`,`RES_TYPE`,`RES_VALUE`,`SUP_CODE`,`SUP_NAME`,`VALID`,`ROW_VERSION`,`IS_DELETED`,`CREATE_BY`,`CREATE_TIME`,`LAST_UPDATE_BY`,`LAST_UPDATE_TIME`
</sql>
<resultMap id="res" type="${basePackage}.module.system.ent.Res">
<result column="ID" jdbcType="BIGINT" property="id"/>
<result column="RES_CODE" jdbcType="VARCHAR" property="resCode"/>
<result column="RES_NAME" jdbcType="VARCHAR" property="resName"/>
<result column="RES_TYPE" jdbcType="VARCHAR" property="resType"/>
<result column="RES_VALUE" jdbcType="VARCHAR" property="resValue"/>
<result column="SUP_CODE" jdbcType="VARCHAR" property="supCode"/>
<result column="SUP_NAME" jdbcType="VARCHAR" property="supName"/>
<result column="VALID" jdbcType="BIT" property="valid"/>
<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="res">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
`IS_DELETED` = 0
<if test="request.resCode != null and request.resCode != ''">
AND `RES_CODE` = ${r'#'}{request.resCode}
</if>
<if test="request.resName != null and request.resName != ''">
AND `RES_NAME` = ${r'#'}{request.resName}
</if>
<if test="request.resType != null and request.resType != ''">
AND `RES_TYPE` = ${r'#'}{request.resType}
</if>
<if test="request.resValue != null and request.resValue != ''">
AND `RES_VALUE` = ${r'#'}{request.resValue}
</if>
<if test="request.supCode != null and request.supCode != ''">
AND `SUP_CODE` = ${r'#'}{request.supCode}
</if>
<if test="request.supName != null and request.supName != ''">
AND `SUP_NAME` = ${r'#'}{request.supName}
</if>
<if test="request.valid != null">
AND `VALID` = ${r'#'}{request.valid}
</if>
</select>
<select id="search" resultMap="res">
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.resCode,jdbcType=VARCHAR},
${r'#'}{request.resName,jdbcType=VARCHAR},
${r'#'}{request.resType,jdbcType=VARCHAR},
${r'#'}{request.resValue,jdbcType=VARCHAR},
${r'#'}{request.supCode,jdbcType=VARCHAR},
${r'#'}{request.supName,jdbcType=VARCHAR},
${r'#'}{request.valid,jdbcType=BIT},
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.resCode,jdbcType=VARCHAR},
${r'#'}{item.resName,jdbcType=VARCHAR},
${r'#'}{item.resType,jdbcType=VARCHAR},
${r'#'}{item.resValue,jdbcType=VARCHAR},
${r'#'}{item.supCode,jdbcType=VARCHAR},
${r'#'}{item.supName,jdbcType=VARCHAR},
${r'#'}{item.valid,jdbcType=BIT},
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
`RES_CODE` = ${r'#'}{request.resCode,jdbcType=VARCHAR},
`RES_NAME` = ${r'#'}{request.resName,jdbcType=VARCHAR},
`RES_TYPE` = ${r'#'}{request.resType,jdbcType=VARCHAR},
`RES_VALUE` = ${r'#'}{request.resValue,jdbcType=VARCHAR},
`SUP_CODE` = ${r'#'}{request.supCode,jdbcType=VARCHAR},
`SUP_NAME` = ${r'#'}{request.supName,jdbcType=VARCHAR},
`VALID` = ${r'#'}{request.valid,jdbcType=BIT},
`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="res">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
`IS_DELETED` = 0
AND `ID` = ${r'#'}{request.id}
</select>
</mapper>

@ -0,0 +1,140 @@
<?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.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="${basePackage}.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` = ${r'#'}{request.roleId}
</if>
<if test="request.roleCode != null and request.roleCode != ''">
AND `ROLE_CODE` = ${r'#'}{request.roleCode}
</if>
<if test="request.resId != null and request.resId != 0">
AND `RES_ID` = ${r'#'}{request.resId}
</if>
<if test="request.resCode != null and request.resCode != ''">
AND `RES_CODE` = ${r'#'}{request.resCode}
</if>
</select>
<select id="search" resultMap="roleRes">
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.roleId,jdbcType=BIGINT},
${r'#'}{request.roleCode,jdbcType=VARCHAR},
${r'#'}{request.resId,jdbcType=BIGINT},
${r'#'}{request.resCode,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.roleId,jdbcType=BIGINT},
${r'#'}{item.roleCode,jdbcType=VARCHAR},
${r'#'}{item.resId,jdbcType=BIGINT},
${r'#'}{item.resCode,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
`ROLE_ID` = ${r'#'}{request.roleId,jdbcType=BIGINT},
`ROLE_CODE` = ${r'#'}{request.roleCode,jdbcType=VARCHAR},
`RES_ID` = ${r'#'}{request.resId,jdbcType=BIGINT},
`RES_CODE` = ${r'#'}{request.resCode,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="roleRes">
SELECT
<include refid="entityColumnList"/>
FROM
<include refid="table"/>
WHERE
`IS_DELETED` = 0
AND `ID` = ${r'#'}{request.id}
</select>
</mapper>

@ -0,0 +1,78 @@
package ${basePackage}.module.system.mpr;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import ${basePackage}.module.system.ent.Res;
import ${basePackage}.module.system.req.ResCreateRequest;
import ${basePackage}.module.system.req.ResDeleteRequest;
import ${basePackage}.module.system.req.ResFindRequest;
import ${basePackage}.module.system.req.ResGetRequest;
import ${basePackage}.module.system.req.ResUpdateRequest;
import ${basePackage}.frame.base.Token;
/**
* RES -
*
* @author wangbing
* @date 2020-01-05
*/
@Mapper
public interface ResMapper {
/**
*
*
* @param request
* @param token
* @return
*/
long insert(@Param("request") Res request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
long insertBatch(@Param("list") List<Res> request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
long delete(@Param("request") ResDeleteRequest request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
long update(@Param("request") ResUpdateRequest request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
List<Res> find(@Param("request") ResFindRequest request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
Res get(@Param("request") ResGetRequest request, @Param("token") Token token);
}

@ -0,0 +1,78 @@
package ${basePackage}.module.system.mpr;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import ${basePackage}.module.system.ent.RoleRes;
import ${basePackage}.module.system.req.RoleResCreateRequest;
import ${basePackage}.module.system.req.RoleResDeleteRequest;
import ${basePackage}.module.system.req.RoleResFindRequest;
import ${basePackage}.module.system.req.RoleResGetRequest;
import ${basePackage}.module.system.req.RoleResUpdateRequest;
import ${basePackage}.frame.base.Token;
/**
* ROLE_RES -
*
* @author wangbing
* @date 2020-01-05
*/
@Mapper
public interface RoleResMapper {
/**
*
*
* @param request
* @param token
* @return
*/
long insert(@Param("request") RoleRes request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
long insertBatch(@Param("list") List<RoleRes> request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
long delete(@Param("request") RoleResDeleteRequest request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
long update(@Param("request") RoleResUpdateRequest request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
List<RoleRes> find(@Param("request") RoleResFindRequest request, @Param("token") Token token);
/**
*
*
* @param request
* @param token
* @return
*/
RoleRes get(@Param("request") RoleResGetRequest request, @Param("token") Token token);
}

@ -1,6 +1,6 @@
package xyz.wbsite.module.system.req;
package ${basePackage}.module.system.req;
import xyz.wbsite.frame.base.BaseRequest;
import ${basePackage}.frame.base.BaseRequest;
/**
* ResourceTreeRequest -

@ -0,0 +1,89 @@
package ${basePackage}.module.system.req;
import ${basePackage}.frame.base.BaseRequest;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.NotEmpty;
import org.hibernate.validator.constraints.Length;
import ${basePackage}.frame.validation.Dict;
/**
* ResCreateRequest -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public class ResCreateRequest extends BaseRequest {
/**
*
*/
@NotEmpty(message = "[resCode]资源代码不能为空")
@Length(min = 0, max = 50, message = "[resCode]资源代码长度不合法(0-50)")
private String resCode;
/**
*
*/
@Length(min = 0, max = 255, message = "[resName]资源名称长度不合法(0-255)")
private String resName;
/**
*
*/
@NotNull(message = "[resType]资源类型不能为NULL")
@Dict(name = "RES_TYPE")
private String resType;
/**
*
*/
@Length(min = 0, max = 100, message = "[resValue]资源内容长度不合法(0-100)")
private String resValue;
/**
*
*/
@NotNull(message = "[valid]是否有效不能为NULL")
private Boolean valid;
public String getResCode() {
return this.resCode;
}
public void setResCode(String resCode) {
this.resCode = resCode;
}
public String getResName() {
return this.resName;
}
public void setResName(String resName) {
this.resName = resName;
}
public String getResType() {
return this.resType;
}
public void setResType(String resType) {
this.resType = resType;
}
public String getResValue() {
return this.resValue;
}
public void setResValue(String resValue) {
this.resValue = resValue;
}
public Boolean getValid() {
return this.valid;
}
public void setValid(Boolean valid) {
this.valid = valid;
}
}

@ -0,0 +1,28 @@
package ${basePackage}.module.system.req;
import ${basePackage}.frame.base.BaseUpdateRequest;
import javax.validation.constraints.NotNull;
/**
* ResDeleteRequest -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public class ResDeleteRequest 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,106 @@
package ${basePackage}.module.system.req;
import ${basePackage}.frame.base.BaseFindRequest;
import ${basePackage}.frame.validation.Dict;
/**
* ResRequest -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public class ResFindRequest extends BaseFindRequest {
/**
*
*/
private String resCode;
/**
*
*/
private String resName;
/**
*
*/
@Dict(name = "RES_TYPE")
private String resType;
/**
*
*/
private String resValue;
/**
*
*/
private String supCode;
/**
*
*/
private String supName;
/**
*
*/
private Boolean valid;
public String getResCode() {
return this.resCode;
}
public void setResCode(String resCode) {
this.resCode = resCode;
}
public String getResName() {
return this.resName;
}
public void setResName(String resName) {
this.resName = resName;
}
public String getResType() {
return this.resType;
}
public void setResType(String resType) {
this.resType = resType;
}
public String getResValue() {
return this.resValue;
}
public void setResValue(String resValue) {
this.resValue = resValue;
}
public String getSupCode() {
return this.supCode;
}
public void setSupCode(String supCode) {
this.supCode = supCode;
}
public String getSupName() {
return this.supName;
}
public void setSupName(String supName) {
this.supName = supName;
}
public Boolean getValid() {
return this.valid;
}
public void setValid(Boolean valid) {
this.valid = valid;
}
}

@ -0,0 +1,28 @@
package ${basePackage}.module.system.req;
import ${basePackage}.frame.base.BaseRequest;
import javax.validation.constraints.NotNull;
/**
* ResGetRequest -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public class ResGetRequest 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,14 @@
package ${basePackage}.module.system.req;
import ${basePackage}.frame.base.BaseRequest;
/**
* ResTreeRequest -
*
* @author wangbing
* @version 0.0.1
* @since 2019-12-26
*/
public class ResTreeRequest extends BaseRequest {
}

@ -0,0 +1,132 @@
package ${basePackage}.module.system.req;
import ${basePackage}.frame.base.BaseUpdateRequest;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotEmpty;
import ${basePackage}.frame.validation.Dict;
/**
* ResUpdateRequest -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public class ResUpdateRequest extends BaseUpdateRequest {
/**
*
*/
@NotNull(message = "[id]主键不能为NULL")
private Long id;
/**
*
*/
@NotEmpty(message = "[resCode]资源代码不能为空")
@Length(min = 0, max = 50, message = "[resCode]资源代码长度不合法(0-50)")
private String resCode;
/**
*
*/
@Length(min = 0, max = 255, message = "[resName]资源名称长度不合法(0-255)")
private String resName;
/**
*
*/
@NotNull(message = "[resType]资源类型不能为NULL")
@Dict(name = "RES_TYPE")
private String resType;
/**
*
*/
@NotEmpty(message = "[resValue]资源内容不能为空")
@Length(min = 0, max = 100, message = "[resValue]资源内容长度不合法(0-100)")
private String resValue;
/**
*
*/
@Length(min = 0, max = 50, message = "[supCode]上级代码长度不合法(0-50)")
private String supCode;
/**
*
*/
@Length(min = 0, max = 50, message = "[supName]上级名称长度不合法(0-50)")
private String supName;
/**
*
*/
@NotNull(message = "[valid]是否有效不能为NULL")
private Boolean valid;
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public String getResCode() {
return this.resCode;
}
public void setResCode(String resCode) {
this.resCode = resCode;
}
public String getResName() {
return this.resName;
}
public void setResName(String resName) {
this.resName = resName;
}
public String getResType() {
return this.resType;
}
public void setResType(String resType) {
this.resType = resType;
}
public String getResValue() {
return this.resValue;
}
public void setResValue(String resValue) {
this.resValue = resValue;
}
public String getSupCode() {
return this.supCode;
}
public void setSupCode(String supCode) {
this.supCode = supCode;
}
public String getSupName() {
return this.supName;
}
public void setSupName(String supName) {
this.supName = supName;
}
public Boolean getValid() {
return this.valid;
}
public void setValid(Boolean valid) {
this.valid = valid;
}
}

@ -0,0 +1,74 @@
package ${basePackage}.module.system.req;
import ${basePackage}.frame.base.BaseRequest;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.NotEmpty;
import org.hibernate.validator.constraints.Length;
/**
* RoleResCreateRequest -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public class RoleResCreateRequest extends BaseRequest {
/**
*
*/
@NotNull(message = "[roleId]角色主键不能为NULL")
private Long roleId;
/**
*
*/
@NotEmpty(message = "[roleCode]角色代码不能为空")
@Length(min = 0, max = 50, message = "[roleCode]角色代码长度不合法(0-50)")
private String roleCode;
/**
*
*/
@NotNull(message = "[resId]资源主键不能为NULL")
private Long resId;
/**
*
*/
@NotEmpty(message = "[resCode]资源代码不能为空")
@Length(min = 0, max = 50, message = "[resCode]资源代码长度不合法(0-50)")
private String resCode;
public Long getRoleId() {
return this.roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public String getRoleCode() {
return this.roleCode;
}
public void setRoleCode(String roleCode) {
this.roleCode = roleCode;
}
public Long getResId() {
return this.resId;
}
public void setResId(Long resId) {
this.resId = resId;
}
public String getResCode() {
return this.resCode;
}
public void setResCode(String resCode) {
this.resCode = resCode;
}
}

@ -0,0 +1,28 @@
package ${basePackage}.module.system.req;
import ${basePackage}.frame.base.BaseUpdateRequest;
import javax.validation.constraints.NotNull;
/**
* RoleResDeleteRequest -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public class RoleResDeleteRequest 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,65 @@
package ${basePackage}.module.system.req;
import ${basePackage}.frame.base.BaseFindRequest;
/**
* RoleResRequest -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public class RoleResFindRequest extends BaseFindRequest {
/**
*
*/
private Long roleId;
/**
*
*/
private String roleCode;
/**
*
*/
private Long resId;
/**
*
*/
private String resCode;
public Long getRoleId() {
return this.roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public String getRoleCode() {
return this.roleCode;
}
public void setRoleCode(String roleCode) {
this.roleCode = roleCode;
}
public Long getResId() {
return this.resId;
}
public void setResId(Long resId) {
this.resId = resId;
}
public String getResCode() {
return this.resCode;
}
public void setResCode(String resCode) {
this.resCode = resCode;
}
}

@ -0,0 +1,28 @@
package ${basePackage}.module.system.req;
import ${basePackage}.frame.base.BaseRequest;
import javax.validation.constraints.NotNull;
/**
* RoleResGetRequest -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public class RoleResGetRequest 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,88 @@
package ${basePackage}.module.system.req;
import ${basePackage}.frame.base.BaseUpdateRequest;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotEmpty;
/**
* RoleResUpdateRequest -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public class RoleResUpdateRequest extends BaseUpdateRequest {
/**
*
*/
@NotNull(message = "[id]主键不能为NULL")
private Long id;
/**
*
*/
@NotNull(message = "[roleId]角色主键不能为NULL")
private Long roleId;
/**
*
*/
@NotEmpty(message = "[roleCode]角色代码不能为空")
@Length(min = 0, max = 50, message = "[roleCode]角色代码长度不合法(0-50)")
private String roleCode;
/**
*
*/
@NotNull(message = "[resId]资源主键不能为NULL")
private Long resId;
/**
*
*/
@NotEmpty(message = "[resCode]资源代码不能为空")
@Length(min = 0, max = 50, message = "[resCode]资源代码长度不合法(0-50)")
private String resCode;
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public Long getRoleId() {
return this.roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public String getRoleCode() {
return this.roleCode;
}
public void setRoleCode(String roleCode) {
this.roleCode = roleCode;
}
public Long getResId() {
return this.resId;
}
public void setResId(Long resId) {
this.resId = resId;
}
public String getResCode() {
return this.resCode;
}
public void setResCode(String resCode) {
this.resCode = resCode;
}
}

@ -1,7 +1,7 @@
package xyz.wbsite.module.system.rsp;
package ${basePackage}.module.system.rsp;
import xyz.wbsite.frame.base.BaseFindResponse;
import xyz.wbsite.module.system.ent.DeptTree;
import ${basePackage}.frame.base.BaseFindResponse;
import ${basePackage}.module.system.ent.DeptTree;
/**
* ResourceTreeResponse -

@ -0,0 +1,26 @@
package ${basePackage}.module.system.rsp;
import ${basePackage}.frame.base.BaseResponse;
/**
* ResCreateResponse -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public class ResCreateResponse 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;
/**
* ResDeleteResponse -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public class ResDeleteResponse extends BaseResponse {
/**
*
*/
private Long result;
public Long getResult() {
return this.result;
}
public void setResult(Long result) {
this.result = result;
}
}

@ -0,0 +1,14 @@
package ${basePackage}.module.system.rsp;
import ${basePackage}.frame.base.BaseFindResponse;
import ${basePackage}.module.system.ent.Res;
/**
* ResFindResponse -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public class ResFindResponse extends BaseFindResponse<Res> {
}

@ -0,0 +1,27 @@
package ${basePackage}.module.system.rsp;
import ${basePackage}.module.system.ent.Res;
import ${basePackage}.frame.base.BaseResponse;
/**
* ResGetResponse -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public class ResGetResponse extends BaseResponse {
/**
*
*/
private Res res;
public Res getRes() {
return this.res;
}
public void setRes(Res res) {
this.res = res;
}
}

@ -0,0 +1,15 @@
package ${basePackage}.module.system.rsp;
import ${basePackage}.frame.base.BaseFindResponse;
import ${basePackage}.module.system.ent.ResTree;
/**
* ResTreeResponse -
*
* @author author
* @version 0.0.1
* @since 2017-01-01
*/
public class ResTreeResponse extends BaseFindResponse<ResTree> {
}

@ -0,0 +1,26 @@
package ${basePackage}.module.system.rsp;
import ${basePackage}.frame.base.BaseResponse;
/**
* ResUpdateResponse -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public class ResUpdateResponse extends BaseResponse {
/**
*
*/
private Long result;
public Long getResult() {
return this.result;
}
public void setResult(Long result) {
this.result = result;
}
}

@ -0,0 +1,26 @@
package ${basePackage}.module.system.rsp;
import ${basePackage}.frame.base.BaseResponse;
/**
* RoleResCreateResponse -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public class RoleResCreateResponse 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;
/**
* RoleResDeleteResponse -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public class RoleResDeleteResponse extends BaseResponse {
/**
*
*/
private Long result;
public Long getResult() {
return this.result;
}
public void setResult(Long result) {
this.result = result;
}
}

@ -0,0 +1,14 @@
package ${basePackage}.module.system.rsp;
import ${basePackage}.frame.base.BaseFindResponse;
import ${basePackage}.module.system.ent.RoleRes;
/**
* RoleResFindResponse -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public class RoleResFindResponse extends BaseFindResponse<RoleRes> {
}

@ -0,0 +1,27 @@
package ${basePackage}.module.system.rsp;
import ${basePackage}.module.system.ent.RoleRes;
import ${basePackage}.frame.base.BaseResponse;
/**
* RoleResGetResponse -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public class RoleResGetResponse extends BaseResponse {
/**
*
*/
private RoleRes roleRes;
public RoleRes getRoleRes() {
return this.roleRes;
}
public void setRoleRes(RoleRes roleRes) {
this.roleRes = roleRes;
}
}

@ -0,0 +1,26 @@
package ${basePackage}.module.system.rsp;
import ${basePackage}.frame.base.BaseResponse;
/**
* RoleResUpdateResponse -
*
* @author wangbing
* @version 0.0.1
* @since 2020-01-05
*/
public class RoleResUpdateResponse extends BaseResponse {
/**
*
*/
private Long result;
public Long getResult() {
return this.result;
}
public void setResult(Long result) {
this.result = result;
}
}

@ -42,17 +42,19 @@ PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='字典项';
-- ----------------------------
-- Table structure for RESOURCE - 资源
-- Table structure for RES - 资源
-- Target : MySQL
-- Author : wangbing
-- Date: : 2019-12-27
-- Date: : 2020-01-05
-- ----------------------------
CREATE TABLE `SYS_RESOURCE` (
CREATE TABLE `SYS_RES` (
`ID` BIGINT(20) NOT NULL COMMENT '主键',
`CODE` VARCHAR(50) NOT NULL COMMENT '资源代码',
`VALUE` VARCHAR(100) NOT NULL COMMENT '资源内容',
`COMMENT` VARCHAR(250) COMMENT '资源描述',
`RESOURCE_TYPE` VARCHAR(20) NOT NULL COMMENT '资源类型',
`RES_CODE` VARCHAR(50) NOT NULL COMMENT '资源代码',
`RES_NAME` VARCHAR(250) COMMENT '资源名称',
`RES_TYPE` VARCHAR(20) NOT NULL COMMENT '资源类型',
`RES_VALUE` VARCHAR(100) NOT NULL COMMENT '资源内容',
`SUP_CODE` VARCHAR(50) COMMENT '上级代码',
`SUP_NAME` VARCHAR(50) COMMENT '上级名称',
`VALID` TINYINT(1) NOT NULL COMMENT '是否有效',
`ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本',
`IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除',
@ -63,6 +65,27 @@ CREATE TABLE `SYS_RESOURCE` (
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='资源';
-- ----------------------------
-- Table structure for ROLE_RES - 角色资源关系
-- Target : MySQL
-- Author : wangbing
-- Date: : 2020-01-05
-- ----------------------------
CREATE TABLE `SYS_ROLE_RES` (
`ID` BIGINT(20) NOT NULL COMMENT '主键',
`ROLE_ID` BIGINT(20) NOT NULL COMMENT '角色主键',
`ROLE_CODE` VARCHAR(50) NOT NULL COMMENT '角色代码',
`RES_ID` BIGINT(20) NOT NULL COMMENT '资源主键',
`RES_CODE` VARCHAR(50) NOT NULL COMMENT '资源代码',
`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='角色资源关系';
-- ----------------------------
-- Table structure for USER - 用户
-- Target : MySQL
@ -203,22 +226,3 @@ CREATE TABLE `SYS_USER_ROLE` (
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户角色授权';
-- ----------------------------
-- Table structure for ROLE_RESOURCE - 角色资源关系
-- Target : MySQL
-- Author : wangbing
-- Date: : 2019-12-27
-- ----------------------------
CREATE TABLE `SYS_ROLE_RESOURCE` (
`ID` BIGINT(20) NOT NULL COMMENT '主键',
`ROLE_ID` BIGINT(20) NOT NULL COMMENT '角色主键',
`RESOURCE_ID` BIGINT(20) NOT NULL COMMENT '资源主键',
`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,23 @@
-- ----------------------------
-- Table structure for RES - 资源
-- Target : MySQL
-- Author : wangbing
-- Date: : 2020-01-05
-- ----------------------------
CREATE TABLE `SYS_RES` (
`ID` BIGINT(20) NOT NULL COMMENT '主键',
`RES_CODE` VARCHAR(50) NOT NULL COMMENT '资源代码',
`RES_NAME` VARCHAR(250) COMMENT '资源名称',
`RES_TYPE` VARCHAR(20) NOT NULL COMMENT '资源类型',
`RES_VALUE` VARCHAR(100) NOT NULL COMMENT '资源内容',
`SUP_CODE` VARCHAR(50) COMMENT '上级代码',
`SUP_NAME` VARCHAR(50) COMMENT '上级名称',
`VALID` TINYINT(1) NOT NULL COMMENT '是否有效',
`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,20 @@
-- ----------------------------
-- Table structure for ROLE_RES - 角色资源关系
-- Target : MySQL
-- Author : wangbing
-- Date: : 2020-01-05
-- ----------------------------
CREATE TABLE `SYS_ROLE_RES` (
`ID` BIGINT(20) NOT NULL COMMENT '主键',
`ROLE_ID` BIGINT(20) NOT NULL COMMENT '角色主键',
`ROLE_CODE` VARCHAR(50) NOT NULL COMMENT '角色代码',
`RES_ID` BIGINT(20) NOT NULL COMMENT '资源主键',
`RES_CODE` VARCHAR(50) NOT NULL COMMENT '资源代码',
`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='角色资源关系';

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project>
<projectName>wadmin</projectName>
<projectBasePackage>${basePackage}</projectBasePackage>
<projectBasePackage>xyz.wbsite</projectBasePackage>
<projectAuthor>wangbing</projectAuthor>
<multiDB>false</multiDB>
<sysMD>false</sysMD>
@ -43,13 +43,15 @@
<field IsSystem="true" defaultValue="" fieldComment="最后更新时间" fieldLength="0" fieldName="LAST_UPDATE_TIME" fieldType="Date" isMust="false" isPrimaryKey="false" isQuery="false" isSearch="false"/>
</fields>
</table>
<table create="true" delete="true" find="true" get="true" html="true" search="false" sys="true" tableComment="资源" tableName="RESOURCE" update="true">
<table create="true" delete="true" find="true" get="true" html="true" search="false" sys="true" tableComment="资源" tableName="RES" update="true">
<fields>
<field IsSystem="true" defaultValue="" fieldComment="主键" fieldLength="0" fieldName="ID" fieldType="Long" isMust="true" isPrimaryKey="true" isQuery="false" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="资源代码" fieldLength="50" fieldName="CODE" fieldType="String_var50" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="资源内容" fieldLength="100" fieldName="VALUE" fieldType="String_var100" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="资源描述" fieldLength="255" fieldName="COMMENT" fieldType="String_var255" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="资源类型" fieldLength="20" fieldName="RESOURCE_TYPE" fieldType="Dict" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="资源代码" fieldLength="50" fieldName="RES_CODE" fieldType="String_var50" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="资源名称" fieldLength="255" fieldName="RES_NAME" fieldType="String_var255" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="资源类型" fieldLength="20" fieldName="RES_TYPE" fieldType="Dict" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="资源内容" fieldLength="100" fieldName="RES_VALUE" fieldType="String_var100" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="上级代码" fieldLength="50" fieldName="SUP_CODE" fieldType="String_var50" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="上级名称" fieldLength="50" fieldName="SUP_NAME" fieldType="String_var50" isMust="false" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="是否有效" fieldLength="0" fieldName="VALID" fieldType="Boolean" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="true" defaultValue="" fieldComment="行版本" fieldLength="0" fieldName="ROW_VERSION" fieldType="Long" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/>
<field IsSystem="true" defaultValue="0" fieldComment="是否已删除" fieldLength="0" fieldName="IS_DELETED" fieldType="Boolean" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/>
@ -163,11 +165,13 @@
<field IsSystem="true" defaultValue="" fieldComment="最后更新时间" fieldLength="0" fieldName="LAST_UPDATE_TIME" fieldType="Date" isMust="false" isPrimaryKey="false" isQuery="false" isSearch="false"/>
</fields>
</table>
<table create="true" delete="true" find="true" get="true" html="false" search="false" sys="true" tableComment="角色资源关系" tableName="ROLE_RESOURCE" update="true">
<table create="true" delete="true" find="true" get="true" html="false" search="false" sys="true" tableComment="角色资源关系" tableName="ROLE_RES" update="true">
<fields>
<field IsSystem="true" defaultValue="" fieldComment="主键" fieldLength="0" fieldName="ID" fieldType="Long" isMust="true" isPrimaryKey="true" isQuery="false" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="角色主键" fieldLength="0" fieldName="ROLE_ID" fieldType="Long" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="资源主键" fieldLength="0" fieldName="RESOURCE_ID" fieldType="Long" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="角色代码" fieldLength="50" fieldName="ROLE_CODE" fieldType="String_var50" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="资源主键" fieldLength="0" fieldName="RES_ID" fieldType="Long" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="false" defaultValue="NULL" fieldComment="资源代码" fieldLength="50" fieldName="RES_CODE" fieldType="String_var50" isMust="true" isPrimaryKey="false" isQuery="true" isSearch="false"/>
<field IsSystem="true" defaultValue="" fieldComment="行版本" fieldLength="0" fieldName="ROW_VERSION" fieldType="Long" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/>
<field IsSystem="true" defaultValue="0" fieldComment="是否已删除" fieldLength="0" fieldName="IS_DELETED" fieldType="Boolean" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/>
<field IsSystem="true" defaultValue="" fieldComment="创建用户" fieldLength="0" fieldName="CREATE_BY" fieldType="Long" isMust="true" isPrimaryKey="false" isQuery="false" isSearch="false"/>

@ -19,7 +19,7 @@
</template>
<el-menu-item index="${tool.uuid()}" @click="addTab({title: '字典管理', name: 'dict', url: '${r'${context}'}/system/dict.htm'})">字典管理</el-menu-item>
<el-menu-item index="${tool.uuid()}" @click="addTab({title: '文件管理', name: 'file', url: '${r'${context}'}/system/file.htm'})">文件管理</el-menu-item>
<el-menu-item index="${tool.uuid()}" @click="addTab({title: '资源管理', name: 'resource', url: '${r'${context}'}/system/resource.htm'})">资源管理</el-menu-item>
<el-menu-item index="${tool.uuid()}" @click="addTab({title: '资源管理', name: 'res', url: '${r'${context}'}/system/res.htm'})">资源管理</el-menu-item>
<el-menu-item index="${tool.uuid()}" @click="addTab({title: '用户管理', name: 'user', url: '${r'${context}'}/system/user.htm'})">用户管理</el-menu-item>
<el-menu-item index="${tool.uuid()}" @click="addTab({title: '部门管理', name: 'dept', url: '${r'${context}'}/system/dept.htm'})">部门管理</el-menu-item>
<el-menu-item index="${tool.uuid()}" @click="addTab({title: '角色管理', name: 'role', url: '${r'${context}'}/system/role.htm'})">角色管理</el-menu-item>

@ -165,7 +165,7 @@
</el-pagination>
</el-card>
<el-dialog :title="form.title" :visible.sync="form.dialog">
<el-dialog class="form-dialog" :title="form.title" :visible.sync="form.dialog">
<el-form class="form" :model="form" :inline="true" :rules="formRules" ref="form" label-position="right" label-width="90px">
<#list fields as item>
<#if !item.isSystem>

@ -5,18 +5,17 @@
<span slot="label"><i class="el-icon-s-operation"></i>列表展示</span>
<el-form class="search" :inline="true" :model="vm" ref="vm" label-position="right" label-width="90px">
<el-form-item label="资源代码" prop="code">
<el-input v-model="vm.code" clearable size="small" placeholder="请输入资源代码"></el-input>
<el-form-item label="资源代码" prop="resCode">
<el-input v-model="vm.resCode" clearable size="small" placeholder="请输入资源代码"></el-input>
</el-form-item>
<el-form-item label="资源内容" prop="value">
<el-input v-model="vm.value" clearable size="small" placeholder="请输入资源内容"></el-input>
<el-form-item label="资源名称" prop="resName">
<el-input v-model="vm.resName" clearable size="small" placeholder="请输入资源名称"></el-input>
</el-form-item>
<el-form-item label="资源描述" prop="comment">
<el-input v-model="vm.comment" clearable size="small" placeholder="请输入资源描述"></el-input>
<el-form-item label="资源类型" prop="resType">
<el-input-dict v-model="vm.resType" clearable size="small" placeholder="请输入资源类型" dict-name="RES_TYPE"></el-input-dict>
</el-form-item>
<el-form-item label="资源类型" prop="resourceType">
<el-input-dict v-model="vm.resourceType" clearable size="small" placeholder="请输入资源类型"
dict-name="RESOURCE_TYPE"></el-input-dict>
<el-form-item label="资源内容" prop="resValue">
<el-input v-model="vm.resValue" clearable size="small" placeholder="请输入资源内容"></el-input>
</el-form-item>
<el-form-item label="是否有效" prop="valid">
<el-radio-group v-model="vm.valid" clearable size="small">
@ -104,7 +103,7 @@
</el-table-column>
<el-table-column
align="center"
prop="resourceType"
prop="resType"
label="资源类型">
</el-table-column>
<el-table-column
@ -200,22 +199,22 @@
<el-dialog class="form-dialog" :title="form.title" :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="code">
<el-input v-model="form.code" clearable size="small"
<el-form-item label="资源代码" prop="resCode">
<el-input v-model="form.resCode" clearable size="small"
placeholder="请输入资源代码"></el-input>
</el-form-item>
<el-form-item label="资源内容" prop="value">
<el-input v-model="form.value" clearable size="small"
placeholder="请输入资源内容"></el-input>
<el-form-item label="资源名称" prop="resName">
<el-input v-model="form.resName" clearable size="small"
placeholder="请输入资源名称"></el-input>
</el-form-item>
<el-form-item label="资源描述" prop="comment">
<el-input v-model="form.comment" clearable size="small"
placeholder="请输入资源描述"></el-input>
</el-form-item>
<el-form-item label="资源类型" prop="resourceType">
<el-input-dict v-model="form.resourceType" clearable size="small"
<el-form-item label="资源类型" prop="resType">
<el-input-dict v-model="form.resType" clearable size="small"
placeholder="请输入资源类型"
dict-name="RESOURCE_TYPE"></el-input-dict>
dict-name="RES_TYPE"></el-input-dict>
</el-form-item>
<el-form-item label="资源内容" prop="resValue">
<el-input v-model="form.resValue" clearable size="small"
placeholder="请输入资源描述"></el-input>
</el-form-item>
<el-form-item label="是否有效" prop="valid">
<el-radio-group v-model="form.valid" clearable size="small">
@ -246,12 +245,12 @@
el: "#app",
data: {
module: 'system',
target: 'resource',
target: 'res',
vm: {//条件及分页参数
code: "",
value: "",
comment: "",
resourceType: "",
resCode: "",
resName: "",
resType: "",
resValue: "",
valid: "",
pageNumber: 1,
pageSize: 10,
@ -263,28 +262,28 @@
title: "",
dialog: false,
id: '',
code: "",
value: "",
comment: "",
resourceType: "",
resCode: "",
resName: "",
resType: "",
resValue: "",
valid: "",
rowVersion: ""
},
formRules: {
code: [
resCode: [
{required: true, message: '资源代码不能为空', trigger: 'blur'},
{min: 1, max: 50, message: '资源代码长度在 1 到 50 个字符', trigger: 'blur'}
],
value: [
{required: true, message: '资源内容不能为空', trigger: 'blur'},
{min: 1, max: 100, message: '资源内容长度在 1 到 100 个字符', trigger: 'blur'}
resName: [
{required: true, message: '资源名称不能为空', trigger: 'blur'},
{min: 1, max: 100, message: '资源名称长度在 1 到 100 个字符', trigger: 'blur'}
],
comment: [
{min: 1, max: 255, message: '资源描述长度在 1 到 255 个字符', trigger: 'blur'}
],
resourceType: [
resType: [
{required: true, message: '资源类型不能为空', trigger: 'blur'},
],
resValue: [
{min: 1, max: 255, message: '资源内容长度在 1 到 255 个字符', trigger: 'blur'}
],
valid: [
{required: true, message: '是否有效不能为空', trigger: 'blur'},
],
@ -296,31 +295,30 @@
onCreate: function () {
this.form.title = "资源新增";
this.form.dialog = true;
this.form.id = "";
this.form.code = "";
this.form.value = "";
this.form.comment = "";
this.form.resourceType = "";
this.form.valid = "";
this.form.resCode = "";
this.form.resName = "";
this.form.resType = "";
this.form.resValue = "";
this.form.valid = true;
},
onTreeCreate: function (pItem) {
this.form.title = "资源新增";
this.form.dialog = true;
this.form.id = "";
this.form.code = pItem.code + "_";
this.form.value = "";
this.form.comment = "";
this.form.resourceType = "";
this.form.valid = "";
this.form.resCode = pItem.code + "_";
this.form.resName = "";
this.form.resType = "";
this.form.resValue = "";
this.form.valid = true;
},
onTreeEdit: function (pItem) {
this.form.title = "资源编辑";
this.form.dialog = true;
this.form.id = pItem.id;
this.form.code = pItem.code;
this.form.value = pItem.value;
this.form.comment = pItem.comment;
this.form.resourceType = pItem.resourceType;
this.form.resCode = pItem.resCode;
this.form.resName = pItem.resName;
this.form.resType = pItem.resType;
this.form.resValue = pItem.resValue;
this.form.valid = pItem.valid;
this.form.rowVersion = pItem.rowVersion;
},
@ -339,10 +337,10 @@
this.form.title = "资源编辑";
this.form.dialog = true;
this.form.id = item.id;
this.form.code = item.code;
this.form.value = item.value;
this.form.comment = item.comment;
this.form.resourceType = item.resourceType;
this.form.resCode = item.resCode;
this.form.resName = item.resName;
this.form.resType = item.resType;
this.form.resValue = item.resValue;
this.form.valid = item.valid;
this.form.rowVersion = item.rowVersion;
break;
@ -357,7 +355,7 @@
onLoadTree: function () {
new Ajax()
.module("system")
.target("resource")
.target("res")
.method("tree")
.data({})
.post(function (response) {

@ -1,4 +1,4 @@
package xyz.wbsite.system;
package ${basePackage}.system;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -7,10 +7,10 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
import xyz.wbsite.frame.base.Token;
import xyz.wbsite.module.system.mgr.DeptManager;
import xyz.wbsite.module.system.req.*;
import xyz.wbsite.module.system.rsp.*;
import ${basePackage}.frame.base.Token;
import ${basePackage}.module.system.mgr.DeptManager;
import ${basePackage}.module.system.req.*;
import ${basePackage}.module.system.rsp.*;
import static org.junit.Assert.assertTrue;

@ -1,139 +0,0 @@
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.req.*;
import ${basePackage}.module.system.rsp.*;
import static org.junit.Assert.assertTrue;
/**
* ResourceTest - -
*
* @author author
* @version 0.0.1
* @since 2017-01-01
*/
@RunWith(SpringRunner.class)
@SpringBootTest
@Transactional
public class ResourceTest {
@Autowired
private Token token;
@Autowired
private ${basePackage}.module.system.mgr.ResourceManager resourceManager;
@Test
public void testCreate() {
ResourceCreateRequest request = new ResourceCreateRequest();
request.setValue("资源内容");
request.setComment("资源描述");
request.setResourceType("code");
request.setValid(true);
ResourceCreateResponse response = resourceManager.create(request,token);
assertTrue(!response.hasError());
}
@Test
public void testDelete() {
//创建数据
ResourceCreateRequest createRequest = new ResourceCreateRequest();
createRequest.setValue("资源内容");
createRequest.setComment("资源描述");
createRequest.setResourceType("code");
createRequest.setValid(true);
ResourceCreateResponse createResponse = resourceManager.create(createRequest,token);
assertTrue(!createResponse.hasError() && createResponse.getId() > 0);
//删除数据
ResourceDeleteRequest request = new ResourceDeleteRequest();
request.setId(createResponse.getId());
ResourceDeleteResponse response = resourceManager.delete(request,token);
assertTrue(!response.hasError() && response.getResult() == 1L);
}
@Test
public void testUpdate() {
//创建数据
ResourceCreateRequest createRequest = new ResourceCreateRequest();
createRequest.setValue("资源内容");
createRequest.setComment("资源描述");
createRequest.setResourceType("code");
createRequest.setValid(true);
ResourceCreateResponse createResponse = resourceManager.create(createRequest, token);
assertTrue(!createResponse.hasError());
//更新数据
ResourceUpdateRequest request = new ResourceUpdateRequest();
request.setId(createResponse.getId());
request.setValue("资源内容");
request.setComment("资源描述");
request.setResourceType("code");
request.setValid(true);
ResourceUpdateResponse response = resourceManager.update(request,token);
assertTrue(!response.hasError() && response.getResult() == 1L);
}
@Test
public void testFind() {
ResourceFindRequest request = new ResourceFindRequest();
request.setValue("资源内容");
request.setComment("资源描述");
request.setResourceType("code");
request.setValid(true);
ResourceFindResponse response = resourceManager.find(request,token);
assertTrue(!response.hasError());
}
@Test
public void testGet() {
//创建数据
ResourceCreateRequest createRequest = new ResourceCreateRequest();
createRequest.setValue("资源内容");
createRequest.setComment("资源描述");
createRequest.setResourceType("code");
createRequest.setValid(true);
ResourceCreateResponse createResponse = resourceManager.create(createRequest, token);
assertTrue(!createResponse.hasError());
//获得数据
ResourceGetRequest request = new ResourceGetRequest();
request.setId(createResponse.getId());
ResourceGetResponse response = resourceManager.get(request,token);
assertTrue(!response.hasError() && response.getResource() != null);
}
@Test
public void testTree() {
//创建数据
ResourceTreeRequest request = new ResourceTreeRequest();
ResourceTreeResponse response = resourceManager.tree(request, token);
assertTrue(!response.hasError());
}
}

@ -1,118 +0,0 @@
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.RoleResourceManager;
import ${basePackage}.module.system.req.*;
import ${basePackage}.module.system.rsp.*;
import static org.junit.Assert.assertTrue;
/**
* RoleResourceTest - -
*
* @author wangbing
* @version 0.0.1
* @since 2019-12-27
*/
@RunWith(SpringRunner.class)
@SpringBootTest
@Transactional
public class RoleResourceTest {
@Autowired
private Token token;
@Autowired
private RoleResourceManager roleResourceManager;
@Test
public void testCreate() {
RoleResourceCreateRequest request = new RoleResourceCreateRequest();
request.setRoleId(1L);
request.setResourceId(1L);
RoleResourceCreateResponse response = roleResourceManager.create(request,token);
assertTrue(!response.hasError());
}
@Test
public void testDelete() {
//创建数据
RoleResourceCreateRequest createRequest = new RoleResourceCreateRequest();
createRequest.setRoleId(1L);
createRequest.setResourceId(1L);
RoleResourceCreateResponse createResponse = roleResourceManager.create(createRequest,token);
assertTrue(!createResponse.hasError() && createResponse.getId() > 0);
//删除数据
RoleResourceDeleteRequest request = new RoleResourceDeleteRequest();
request.setId(createResponse.getId());
RoleResourceDeleteResponse response = roleResourceManager.delete(request,token);
assertTrue(!response.hasError() && response.getResult() == 1L);
}
@Test
public void testUpdate() {
//创建数据
RoleResourceCreateRequest createRequest = new RoleResourceCreateRequest();
createRequest.setRoleId(1L);
createRequest.setResourceId(1L);
RoleResourceCreateResponse createResponse = roleResourceManager.create(createRequest, token);
assertTrue(!createResponse.hasError());
//更新数据
RoleResourceUpdateRequest request = new RoleResourceUpdateRequest();
request.setId(createResponse.getId());
request.setRoleId(1L);
request.setResourceId(1L);
RoleResourceUpdateResponse response = roleResourceManager.update(request,token);
assertTrue(!response.hasError() && response.getResult() == 1L);
}
@Test
public void testFind() {
RoleResourceFindRequest request = new RoleResourceFindRequest();
request.setRoleId(1L);
request.setResourceId(1L);
RoleResourceFindResponse response = roleResourceManager.find(request,token);
assertTrue(!response.hasError());
}
@Test
public void testGet() {
//创建数据
RoleResourceCreateRequest createRequest = new RoleResourceCreateRequest();
createRequest.setRoleId(1L);
createRequest.setResourceId(1L);
RoleResourceCreateResponse createResponse = roleResourceManager.create(createRequest, token);
assertTrue(!createResponse.hasError());
//获得数据
RoleResourceGetRequest request = new RoleResourceGetRequest();
request.setId(createResponse.getId());
RoleResourceGetResponse response = roleResourceManager.get(request,token);
assertTrue(!response.hasError() && response.getRoleResource() != null);
}
}

@ -6,18 +6,18 @@ 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 xyz.wbsite.frame.base.Token;
import xyz.wbsite.module.system.mgr.UserManager;
import xyz.wbsite.module.system.req.UserCreateRequest;
import xyz.wbsite.module.system.req.UserDeleteRequest;
import xyz.wbsite.module.system.req.UserFindRequest;
import xyz.wbsite.module.system.req.UserGetRequest;
import xyz.wbsite.module.system.req.UserUpdateRequest;
import xyz.wbsite.module.system.rsp.UserCreateResponse;
import xyz.wbsite.module.system.rsp.UserDeleteResponse;
import xyz.wbsite.module.system.rsp.UserFindResponse;
import xyz.wbsite.module.system.rsp.UserGetResponse;
import xyz.wbsite.module.system.rsp.UserUpdateResponse;
import ${basePackage}.frame.base.Token;
import ${basePackage}.module.system.mgr.UserManager;
import ${basePackage}.module.system.req.UserCreateRequest;
import ${basePackage}.module.system.req.UserDeleteRequest;
import ${basePackage}.module.system.req.UserFindRequest;
import ${basePackage}.module.system.req.UserGetRequest;
import ${basePackage}.module.system.req.UserUpdateRequest;
import ${basePackage}.module.system.rsp.UserCreateResponse;
import ${basePackage}.module.system.rsp.UserDeleteResponse;
import ${basePackage}.module.system.rsp.UserFindResponse;
import ${basePackage}.module.system.rsp.UserGetResponse;
import ${basePackage}.module.system.rsp.UserUpdateResponse;
import static org.junit.Assert.assertTrue;

Loading…
Cancel
Save

Powered by TurnKey Linux.