Commit 410b7ef5 authored by liudonghua123's avatar liudonghua123 Committed by 闲.大赋
Browse files

!22 Fix: 修复上次提交忘记同步修改ajax更新方法,以及使用约定的query/edit/add/delete

Merge pull request !22 from liudonghua123/master
parents 581e2d39 7d1e0e48
......@@ -168,7 +168,7 @@ public class RoleConsoleController {
* @return
*/
@PostMapping(MODEL + "/update.json")
@Function("role.update")
@Function("role.edit")
@ResponseBody
public JsonResult<String> update(@Validated(ValidateConfig.UPDATE.class) CoreRole role) {
......@@ -265,7 +265,7 @@ public class RoleConsoleController {
// }
@PostMapping(MODEL + "/function/ids.json")
@Function("role.function.list")
@Function("role.function.query")
@ResponseBody
public JsonResult<List<Long>> getFunctionIdByRole(Long roleId) {
List<Long> list = functionConsoleService.getFunctionByRole(roleId);
......@@ -273,7 +273,7 @@ public class RoleConsoleController {
}
@GetMapping(MODEL + "/function/queryFunction.json")
@Function("role.function.list")
@Function("role.function.query")
@ResponseBody
public JsonResult<List<RoleDataAccessFunction>> getQueryFunctionByRole(Long roleId) {
List<RoleDataAccessFunction> list = functionConsoleService.getQueryFunctionByRole(roleId);
......@@ -281,7 +281,7 @@ public class RoleConsoleController {
}
@PostMapping(MODEL + "/function/update.json")
@Function("role.function.update")
@Function("role.function.edit")
@ResponseBody
public JsonResult updateFunction(Long roleId, String ids) {
List<Long> all = ConvertUtil.str2longs(ids);
......
......@@ -13,6 +13,9 @@ public class Attribute {
//数据字典
private String dictType;
private String comment;
// 是否范围
private boolean isDateRange;
private boolean isDateTimeRange;
//校验对象
private List<Verify> verifyList = new ArrayList<>();
......@@ -77,5 +80,30 @@ public class Attribute {
public void setVerifyList(List<Verify> verifyList) {
this.verifyList = verifyList;
}
public boolean isDateRange() {
for(Verify verify: verifyList) {
if(verify.getName().equals("dateRange")) {
return true;
}
}
return false;
}
public void setDateRange(boolean dateRange) {
isDateRange = dateRange;
}
public boolean isDateTimeRange() {
for(Verify verify: verifyList) {
if(verify.getName().equals("datetimeRange")) {
return true;
}
}
return false;
}
public void setDateTimeRange(boolean dateTimeRange) {
isDateTimeRange = dateTimeRange;
}
}
package ${package};
import org.apache.commons.lang3.StringUtils;
import com.ibeetl.admin.core.annotation.Query;
import com.ibeetl.admin.core.util.Tool;
import com.ibeetl.admin.core.util.enums.CoreDictType;
import com.ibeetl.admin.core.web.query.PageParam;
import java.util.Date;
......@@ -11,18 +13,81 @@ public class ${entity.name}Query extends PageParam {
@for(attr in attrs) {
@if(isNotEmpty(attr.dictType)) {
\@Query(name = "${attr.displayName}", display = true,type=Query.TYPE_DICT,dict="${attr.dictType}")
@}else {
\@Query(name = "${attr.displayName}", display = true)
@}
private ${attr.javaType} ${attr.name};
@} else if(attr.isDateRange) {
\@Query(name = "${attr.displayName}", display = true,type=Query.TYPE_DATE_BETWEEN)
private String ${attr.name};
private Date ${strutil.replace (attr.name,"Range","")}Start;
private Date ${strutil.replace (attr.name,"Range","")}End;
@} else if(attr.isDateTimeRange) {
\@Query(name = "${attr.displayName}", display = true,type=Query.TYPE_DATETIME_BETWEEN)
private String ${attr.name};
private Date ${strutil.replace (attr.name,"Range","")}Start;
private Date ${strutil.replace (attr.name,"Range","")}End;
@} else {
\@Query(name = "${attr.displayName}", display = true)
private ${attr.javaType} ${attr.name};
@}
@}
@for(attr in attrs) {
@if(attr.isDateRange) {
public String get${upperFirst(attr.name)}(){
return ${attr.name};
}
public void set${upperFirst(attr.name)}(String ${attr.name} ){
this.${attr.name} = ${attr.name};
if(StringUtils.isEmpty(${attr.name})) {
return ;
}
Date[] ds = Tool.parseDataRange(${attr.name});
this.${strutil.replace (attr.name,"Range","")}Start=ds[0];
this.${strutil.replace (attr.name,"Range","")}End =ds[1];
}
public Date get${upperFirst(strutil.replace (attr.name,"Range",""))}Start(){
return ${strutil.replace (attr.name,"Range","")}Start;
}
public void set${upperFirst(strutil.replace(attr.name,"Range",""))}Start(Date ${strutil.replace (attr.name,"Range","")}Start){
this.${strutil.replace (attr.name,"Range","")}Start = ${strutil.replace (attr.name,"Range","")}Start;
}
public ${attr.javaType} get${upperFirst(strutil.replace (attr.name,"Range",""))}End(){
return ${strutil.replace (attr.name,"Range","")}End;
}
public void set${upperFirst(strutil.replace (attr.name,"Range",""))}End(${attr.javaType} ${strutil.replace (attr.name,"Range","")}End){
this.${strutil.replace (attr.name,"Range","")}End = ${strutil.replace (attr.name,"Range","")}End;
}
@} else if(attr.isDateTimeRange) {
public String get${upperFirst(attr.name)}(){
return ${attr.name};
}
public void set${upperFirst(attr.name)}(String ${attr.name} ){
this.${attr.name} = ${attr.name};
if(StringUtils.isEmpty(${attr.name})) {
return ;
}
Date[] ds = Tool.parseDataTimeRange(${attr.name});
this.${strutil.replace (attr.name,"Range","")}Start=ds[0];
this.${strutil.replace (attr.name,"Range","")}End =ds[1];
}
public Date get${upperFirst(strutil.replace (attr.name,"Range",""))}Start(){
return ${strutil.replace (attr.name,"Range","")}Start;
}
public void set${upperFirst(strutil.replace(attr.name,"Range",""))}Start(Date ${strutil.replace (attr.name,"Range","")}Start){
this.${strutil.replace (attr.name,"Range","")}Start = ${strutil.replace (attr.name,"Range","")}Start;
}
public ${attr.javaType} get${upperFirst(strutil.replace (attr.name,"Range",""))}End(){
return ${strutil.replace (attr.name,"Range","")}End;
}
public void set${upperFirst(strutil.replace (attr.name,"Range",""))}End(${attr.javaType} ${strutil.replace (attr.name,"Range","")}End){
this.${strutil.replace (attr.name,"Range","")}End = ${strutil.replace (attr.name,"Range","")}End;
}
@} else {
public ${attr.javaType} get${upperFirst(attr.name)}(){
return ${attr.name};
}
public void set${upperFirst(attr.name)}(${attr.javaType} ${attr.name} ){
this.${attr.name} = ${attr.name};
}
@}
@}
@}
}
......@@ -2,7 +2,7 @@
layui.define([], function(exports) {
var api={
update${upperFirst(entity.code)}:function(form,callback){
Lib.submitForm("/${target.urlBase}/${entity.code}/update.json",form,{},callback)
Lib.submitForm("/${target.urlBase}/${entity.code}/edit.json",form,{},callback)
},
add${upperFirst(entity.code)}:function(form,callback){
Lib.submitForm("/${target.urlBase}/${entity.code}/add.json",form,{},callback)
......
......@@ -12,9 +12,18 @@ queryByCondition
and #function("${entity.code}.query")#
@for(attr in entity.list){
@if(attr.showInQuery){
@if(attr.isDateRange || attr.isDateTimeRange){
\@if(!isEmpty(${strutil.replace (attr.name,"Range","")}Start)){
and t.${attr.colName} > #${strutil.replace (attr.name,"Range","")}Start#
\@}
\@if(!isEmpty(${strutil.replace (attr.name,"Range","")}End)){
and t.${attr.colName} < #${strutil.replace (attr.name,"Range","")}End#
\@}
@} else {
\@if(!isEmpty(${attr.name})){
and t.${attr.colName} =#${attr.name}#
\@}
@}
@}
@}
......
......@@ -62,6 +62,9 @@ layui.define([ 'form', 'laydate', 'table','codeApi'], function(exports) {
'<div class="layui-form-item">'+
'<input type="checkbox" class="verify" title="数字"value="number" />'+
'<input type="checkbox" class="verify" title="日期" value="date"/>'+
'<input type="checkbox" class="verify" title="日期范围" value="dateRange"/>'+
'<input type="checkbox" class="verify" title="日期时间" value="datetime"/>'+
'<input type="checkbox" class="verify" title="日期时间范围" value="datetimeRange"/>'+
'<input type="checkbox" class="verify" title="网址" value="url"/>'+
'</div>'+
'<div class="layui-form-item">'+
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment