mirror of https://gitee.com/stylefeng/guns
parent
f7a1c55e72
commit
7c22e6cd82
|
@ -3,11 +3,16 @@ package cn.stylefeng.guns.core.beetl.tag;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import cn.stylefeng.guns.core.beetl.consts.DictTagConstants;
|
import cn.stylefeng.guns.core.beetl.consts.DictTagConstants;
|
||||||
|
import cn.stylefeng.roses.kernel.dict.modular.entity.SysDict;
|
||||||
|
import cn.stylefeng.roses.kernel.dict.modular.entity.SysDictType;
|
||||||
import cn.stylefeng.roses.kernel.dict.modular.service.DictService;
|
import cn.stylefeng.roses.kernel.dict.modular.service.DictService;
|
||||||
import cn.stylefeng.roses.kernel.dict.modular.service.DictTypeService;
|
import cn.stylefeng.roses.kernel.dict.modular.service.DictTypeService;
|
||||||
|
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.beetl.core.tag.GeneralVarTagBinding;
|
import org.beetl.core.tag.GeneralVarTagBinding;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,6 +78,12 @@ public class SysDictBaseTag extends GeneralVarTagBinding {
|
||||||
*/
|
*/
|
||||||
public String itemName;
|
public String itemName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化绑定属性
|
||||||
|
*
|
||||||
|
* @author liuhanqing
|
||||||
|
* @date 2021/1/16 23:49
|
||||||
|
*/
|
||||||
public void initAttr() {
|
public void initAttr() {
|
||||||
Map<String, Object> attrs = this.getAttributes();
|
Map<String, Object> attrs = this.getAttributes();
|
||||||
if (attrs.size() > 0) {
|
if (attrs.size() > 0) {
|
||||||
|
@ -122,4 +133,33 @@ public class SysDictBaseTag extends GeneralVarTagBinding {
|
||||||
public void render() {
|
public void render() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字典类型
|
||||||
|
* @return 字典类型
|
||||||
|
* @author liuhanqing
|
||||||
|
* @date 2021/1/16 23:46
|
||||||
|
*/
|
||||||
|
public SysDictType getDictType(){
|
||||||
|
// 根据字典类型编码去查询字典类型
|
||||||
|
LambdaQueryWrapper<SysDictType> dictTypeQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
dictTypeQueryWrapper.eq(SysDictType::getDictTypeCode, this.getDictTypeCode());
|
||||||
|
dictTypeQueryWrapper.ne(SysDictType::getDelFlag, YesOrNotEnum.Y.getCode());
|
||||||
|
return dictTypeService.getOne(dictTypeQueryWrapper);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return 根据字典类型返回字典集合
|
||||||
|
* @author liuhanqing
|
||||||
|
* @date 2021/1/16 23:46
|
||||||
|
*/
|
||||||
|
public List<SysDict> getDictList(){
|
||||||
|
// 查询字典列表
|
||||||
|
LambdaQueryWrapper<SysDict> dictQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
dictQueryWrapper.eq(SysDict::getDictTypeCode, this.getDictTypeCode());
|
||||||
|
dictQueryWrapper.ne(SysDict::getDelFlag, YesOrNotEnum.Y.getCode());
|
||||||
|
dictQueryWrapper.orderByAsc(SysDict::getDictSort);
|
||||||
|
return dictService.list(dictQueryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,18 +27,10 @@ public class SysDictCheckBoxTag extends SysDictBaseTag {
|
||||||
// 当字典类型编码不为空
|
// 当字典类型编码不为空
|
||||||
if (StrUtil.isNotBlank(this.getDictTypeCode())) {
|
if (StrUtil.isNotBlank(this.getDictTypeCode())) {
|
||||||
// 根据字典类型编码去查询字典类型
|
// 根据字典类型编码去查询字典类型
|
||||||
LambdaQueryWrapper<SysDictType> dictTypeQueryWrapper = new LambdaQueryWrapper<>();
|
SysDictType dictType = getDictType();
|
||||||
dictTypeQueryWrapper.eq(SysDictType::getDictTypeCode, this.getDictTypeCode());
|
|
||||||
dictTypeQueryWrapper.ne(SysDictType::getDelFlag, YesOrNotEnum.Y.getCode());
|
|
||||||
SysDictType dictType = dictTypeService.getOne(dictTypeQueryWrapper);
|
|
||||||
// 判断字典类型不为空
|
// 判断字典类型不为空
|
||||||
if (dictType != null) {
|
if (dictType != null) {
|
||||||
// 查询字典列表
|
List<SysDict> lst = getDictList();
|
||||||
LambdaQueryWrapper<SysDict> dictQueryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
dictQueryWrapper.eq(SysDict::getDictTypeCode, dictType.getDictTypeCode());
|
|
||||||
dictQueryWrapper.ne(SysDict::getDelFlag, YesOrNotEnum.Y.getCode());
|
|
||||||
dictQueryWrapper.orderByAsc(SysDict::getDictSort);
|
|
||||||
List<SysDict> lst = dictService.list(dictQueryWrapper);
|
|
||||||
// 默认选中值
|
// 默认选中值
|
||||||
String defaultValue = this.getDefaultValue();
|
String defaultValue = this.getDefaultValue();
|
||||||
// 循环字典列表
|
// 循环字典列表
|
||||||
|
|
|
@ -26,18 +26,10 @@ public class SysDictRadioTag extends SysDictBaseTag {
|
||||||
// 当字典类型编码不为空
|
// 当字典类型编码不为空
|
||||||
if (StrUtil.isNotBlank(this.getDictTypeCode())) {
|
if (StrUtil.isNotBlank(this.getDictTypeCode())) {
|
||||||
// 根据字典类型编码去查询字典类型
|
// 根据字典类型编码去查询字典类型
|
||||||
LambdaQueryWrapper<SysDictType> dictTypeQueryWrapper = new LambdaQueryWrapper<>();
|
SysDictType dictType = getDictType();
|
||||||
dictTypeQueryWrapper.eq(SysDictType::getDictTypeCode, this.getDictTypeCode());
|
|
||||||
dictTypeQueryWrapper.ne(SysDictType::getDelFlag, YesOrNotEnum.Y.getCode());
|
|
||||||
SysDictType dictType = dictTypeService.getOne(dictTypeQueryWrapper);
|
|
||||||
// 判断字典类型不为空
|
// 判断字典类型不为空
|
||||||
if (dictType != null) {
|
if (dictType != null) {
|
||||||
// 查询字典列表
|
List<SysDict> lst = getDictList();
|
||||||
LambdaQueryWrapper<SysDict> dictQueryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
dictQueryWrapper.eq(SysDict::getDictTypeCode, dictType.getDictTypeCode());
|
|
||||||
dictQueryWrapper.ne(SysDict::getDelFlag, YesOrNotEnum.Y.getCode());
|
|
||||||
dictQueryWrapper.orderByAsc(SysDict::getDictSort);
|
|
||||||
List<SysDict> lst = dictService.list(dictQueryWrapper);
|
|
||||||
// 默认选中值
|
// 默认选中值
|
||||||
String defaultValue = this.getDefaultValue();
|
String defaultValue = this.getDefaultValue();
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
|
@ -64,17 +64,10 @@ public class SysDictSelectTag extends SysDictBaseTag {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 根据字典类型编码去查询字典类型
|
// 根据字典类型编码去查询字典类型
|
||||||
LambdaQueryWrapper<SysDictType> dictTypeQueryWrapper = new LambdaQueryWrapper<>();
|
SysDictType dictType = getDictType();
|
||||||
dictTypeQueryWrapper.eq(SysDictType::getDictTypeCode, this.getDictTypeCode());
|
// 判断字典类型不为空
|
||||||
dictTypeQueryWrapper.ne(SysDictType::getDelFlag, YesOrNotEnum.Y.getCode());
|
|
||||||
SysDictType dictType = dictTypeService.getOne(dictTypeQueryWrapper);
|
|
||||||
if (dictType != null) {
|
if (dictType != null) {
|
||||||
// 查询字典列表
|
List<SysDict> lst = getDictList();
|
||||||
LambdaQueryWrapper<SysDict> dictQueryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
dictQueryWrapper.eq(SysDict::getDictTypeCode, dictType.getDictTypeCode());
|
|
||||||
dictQueryWrapper.ne(SysDict::getDelFlag, YesOrNotEnum.Y.getCode());
|
|
||||||
dictQueryWrapper.orderByAsc(SysDict::getDictSort);
|
|
||||||
List<SysDict> lst = dictService.list(dictQueryWrapper);
|
|
||||||
// 默认选中值
|
// 默认选中值
|
||||||
String defaultValue = this.getDefaultValue();
|
String defaultValue = this.getDefaultValue();
|
||||||
// 循环字典列表,添加下拉选项
|
// 循环字典列表,添加下拉选项
|
||||||
|
|
Loading…
Reference in New Issue