Compare commits
No commits in common. "d822d0098b37e867c10ea9762f8fbf07f39362c8" and "5718b856fc46f835bd93a80bbe79a0782a6a0672" have entirely different histories.
d822d0098b
...
5718b856fc
|
@ -17,7 +17,7 @@ import lombok.experimental.Accessors;
|
|||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DictModel implements Serializable {
|
||||
public class DictModel implements Serializable{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public DictModel() {
|
||||
|
@ -34,19 +34,6 @@ public class DictModel implements Serializable {
|
|||
this.color = color;
|
||||
}
|
||||
|
||||
public DictModel(String value, String text, Integer status) {
|
||||
this.value = value;
|
||||
this.text = text;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public DictModel(String value, String text, String color, Integer status) {
|
||||
this.value = value;
|
||||
this.text = text;
|
||||
this.color = color;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字典value
|
||||
*/
|
||||
|
@ -59,20 +46,14 @@ public class DictModel implements Serializable {
|
|||
* 字典颜色
|
||||
*/
|
||||
private String color;
|
||||
/**
|
||||
* 是否启用 1启用 0不启用
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 特殊用途: JgEditableTable
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getTitle() {
|
||||
return this.text;
|
||||
}
|
||||
|
||||
/**
|
||||
* 特殊用途: vue3 Select组件
|
||||
*/
|
||||
|
@ -80,6 +61,7 @@ public class DictModel implements Serializable {
|
|||
return this.text;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用于表单设计器 关联记录表数据存储
|
||||
* QQYUN-5595【表单设计器】他表字段 导入没有翻译
|
||||
|
|
|
@ -9,7 +9,6 @@ import com.nu.modules.serviceDirective.service.IConfigServiceDirectiveService;
|
|||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
|
@ -57,23 +56,8 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
|
|||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
|
||||
// 自定义多选的查询规则为:LIKE_WITH_OR
|
||||
customeRuleMap.put("categoryId", QueryRuleEnum.LIKE_WITH_OR);
|
||||
customeRuleMap.put("typeId", QueryRuleEnum.LIKE_WITH_OR);
|
||||
customeRuleMap.put("instructionTagId", QueryRuleEnum.LIKE_WITH_OR);
|
||||
customeRuleMap.put("izReimbursement", QueryRuleEnum.LIKE_WITH_OR);
|
||||
customeRuleMap.put("izPreferential", QueryRuleEnum.LIKE_WITH_OR);
|
||||
customeRuleMap.put("chargingFrequency", QueryRuleEnum.LIKE_WITH_OR);
|
||||
customeRuleMap.put("cycleType", QueryRuleEnum.LIKE_WITH_OR);
|
||||
customeRuleMap.put("izEnabled", QueryRuleEnum.LIKE_WITH_OR);
|
||||
QueryWrapper<ConfigServiceDirective> queryWrapper = QueryGenerator.initQueryWrapper(configServiceDirective, req.getParameterMap(), customeRuleMap);
|
||||
queryWrapper.select("id");
|
||||
Page<ConfigServiceDirective> page = new Page<ConfigServiceDirective>(pageNo, pageSize);
|
||||
IPage<ConfigServiceDirective> list = configServiceDirectiveService.page(page, queryWrapper);
|
||||
List<ConfigServiceDirective> pageList = service.pageList(configServiceDirective, list);
|
||||
list.setRecords(pageList);
|
||||
return Result.OK(list);
|
||||
IPage<ConfigServiceDirective> pageList = service.pageList(configServiceDirective, pageNo, pageSize);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,9 +72,6 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
|
|||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody ConfigServiceDirective configServiceDirective) {
|
||||
configServiceDirectiveService.save(configServiceDirective);
|
||||
if (StringUtils.isNotBlank(configServiceDirective.getTags())) {
|
||||
configServiceDirectiveService.saveTags(configServiceDirective);
|
||||
}
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
|
@ -106,9 +87,6 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
|
|||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody ConfigServiceDirective configServiceDirective) {
|
||||
configServiceDirectiveService.updateById(configServiceDirective);
|
||||
if (StringUtils.isNotBlank(configServiceDirective.getTags())) {
|
||||
configServiceDirectiveService.saveTags(configServiceDirective);
|
||||
}
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
|
|
|
@ -43,9 +43,9 @@ public class ConfigServiceDirective implements Serializable {
|
|||
@ApiModelProperty(value = "服务类型")
|
||||
@Dict(dicCode = "id" , dictTable = "config_service_type" , dicText = "type_name")
|
||||
private java.lang.String typeId;
|
||||
/**分类标签*/
|
||||
@Excel(name = "分类标签", width = 15)
|
||||
@ApiModelProperty(value = "分类标签")
|
||||
/**指令标签id*/
|
||||
@Excel(name = "指令标签", width = 15)
|
||||
@ApiModelProperty(value = "指令标签")
|
||||
@Dict(dicCode = "instruction_tag" )
|
||||
private java.lang.String instructionTagId;
|
||||
/**服务指令名称*/
|
||||
|
@ -137,8 +137,6 @@ public class ConfigServiceDirective implements Serializable {
|
|||
private Integer typeRowSpan;
|
||||
@TableField(exist = false)
|
||||
private Integer instructionRowSpan;
|
||||
@TableField(exist = false)
|
||||
private String tags;
|
||||
|
||||
//服务指令标签
|
||||
List<DirectiveTag> tagList;
|
||||
|
|
|
@ -22,16 +22,8 @@ public interface ConfigServiceDirectiveMapper extends BaseMapper<ConfigServiceDi
|
|||
* @param directive 主查询对象(包含搜索条件)
|
||||
* @return 分页结果
|
||||
*/
|
||||
List<ConfigServiceDirective> pageList(
|
||||
@Param("directive") ConfigServiceDirective directive,
|
||||
@Param("ids") List<ConfigServiceDirective> records
|
||||
IPage<ConfigServiceDirective> pageList(
|
||||
@Param("page") Page<ConfigServiceDirective> page,
|
||||
@Param("directive") ConfigServiceDirective directive
|
||||
);
|
||||
// IPage<ConfigServiceDirective> pageList(
|
||||
// @Param("page") Page<ConfigServiceDirective> page,
|
||||
// @Param("directive") ConfigServiceDirective directive
|
||||
// );
|
||||
|
||||
int deleteTags(@Param("directive") ConfigServiceDirective configServiceDirective);
|
||||
|
||||
int saveTags(@Param("directive") ConfigServiceDirective configServiceDirective);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
</collection>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<!-- 分页查询SQL -->
|
||||
<select id="pageList" resultMap="ConfigServiceDirectiveResultMap" parameterType="map">
|
||||
SELECT
|
||||
|
@ -68,87 +67,37 @@
|
|||
LEFT JOIN directive_tag d ON c.id = d.directive_id
|
||||
LEFT JOIN config_directive_tag tag ON d.tag_id = tag.id
|
||||
<where>
|
||||
c.id IN
|
||||
<foreach collection="ids" item="item" open="(" separator="," close=")">
|
||||
#{item.id}
|
||||
</foreach>
|
||||
<!-- 动态条件拼接 -->
|
||||
<if test="directive.categoryId != null and directive.categoryId != ''">
|
||||
AND c.category_id = #{directive.categoryId}
|
||||
</if>
|
||||
<if test="directive.typeId != null and directive.typeId != ''">
|
||||
AND c.type_id = #{directive.typeId}
|
||||
</if>
|
||||
<if test="directive.instructionTagId != null and directive.instructionTagId != ''">
|
||||
AND d.tag_id = #{directive.instructionTagId}
|
||||
</if>
|
||||
<if test="directive.directiveName != null and directive.directiveName != ''">
|
||||
AND c.directive_name LIKE CONCAT('%', #{directive.directiveName}, '%')
|
||||
</if>
|
||||
<if test="directive.izReimbursement != null and directive.izReimbursement != ''">
|
||||
AND c.iz_reimbursement = #{directive.izReimbursement}
|
||||
</if>
|
||||
<if test="directive.izPreferential != null and directive.izPreferential != ''">
|
||||
AND c.iz_preferential = #{directive.izPreferential}
|
||||
</if>
|
||||
<if test="directive.chargingFrequency != null and directive.chargingFrequency != ''">
|
||||
AND c.charging_frequency = #{directive.chargingFrequency}
|
||||
</if>
|
||||
<if test="directive.cycleType != null and directive.cycleType != ''">
|
||||
AND c.cycle_type = #{directive.cycleType}
|
||||
</if>
|
||||
<if test="directive.izEnabled != null and directive.izEnabled != ''">
|
||||
AND c.iz_enabled = #{directive.izEnabled}
|
||||
</if>
|
||||
AND c.del_flag = '0'
|
||||
</where>
|
||||
ORDER BY c.category_id ASC, c.type_id ASC, c.instruction_tag_id ASC,c.create_time desc
|
||||
</select>
|
||||
<!-- <select id="pageList" resultMap="ConfigServiceDirectiveResultMap" parameterType="map">-->
|
||||
<!-- SELECT-->
|
||||
<!-- c.id,-->
|
||||
<!-- c.category_id,-->
|
||||
<!-- c.type_id,-->
|
||||
<!-- c.instruction_tag_id,-->
|
||||
<!-- c.directive_name,-->
|
||||
<!-- c.toll_price,-->
|
||||
<!-- c.com_price,-->
|
||||
<!-- c.iz_reimbursement,-->
|
||||
<!-- c.iz_preferential,-->
|
||||
<!-- c.charging_frequency,-->
|
||||
<!-- c.cycle_type,-->
|
||||
<!-- c.sort,-->
|
||||
<!-- c.service_content,-->
|
||||
<!-- c.service_duration,-->
|
||||
<!-- c.iz_enabled,-->
|
||||
<!-- c.del_flag,-->
|
||||
<!-- c.create_by,-->
|
||||
<!-- c.create_time,-->
|
||||
<!-- c.update_by,-->
|
||||
<!-- c.update_time,-->
|
||||
<!-- c.sys_org_code,-->
|
||||
<!-- c.mp3_file,-->
|
||||
<!-- c.mp4_file,-->
|
||||
<!-- tag.id as tagId,-->
|
||||
<!-- tag.tag_name as tagName-->
|
||||
<!-- FROM config_service_directive c-->
|
||||
<!-- LEFT JOIN directive_tag d ON c.id = d.directive_id-->
|
||||
<!-- LEFT JOIN config_directive_tag tag ON d.tag_id = tag.id-->
|
||||
<!-- <where>-->
|
||||
<!-- <!– 动态条件拼接 –>-->
|
||||
<!-- <if test="directive.categoryId != null and directive.categoryId != ''">-->
|
||||
<!-- AND c.category_id = #{directive.categoryId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="directive.typeId != null and directive.typeId != ''">-->
|
||||
<!-- AND c.type_id = #{directive.typeId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="directive.instructionTagId != null and directive.instructionTagId != ''">-->
|
||||
<!-- AND d.tag_id = #{directive.instructionTagId}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="directive.directiveName != null and directive.directiveName != ''">-->
|
||||
<!-- AND c.directive_name LIKE CONCAT('%', #{directive.directiveName}, '%')-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="directive.izReimbursement != null and directive.izReimbursement != ''">-->
|
||||
<!-- AND c.iz_reimbursement = #{directive.izReimbursement}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="directive.izPreferential != null and directive.izPreferential != ''">-->
|
||||
<!-- AND c.iz_preferential = #{directive.izPreferential}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="directive.chargingFrequency != null and directive.chargingFrequency != ''">-->
|
||||
<!-- AND c.charging_frequency = #{directive.chargingFrequency}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="directive.cycleType != null and directive.cycleType != ''">-->
|
||||
<!-- AND c.cycle_type = #{directive.cycleType}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="directive.izEnabled != null and directive.izEnabled != ''">-->
|
||||
<!-- AND c.iz_enabled = #{directive.izEnabled}-->
|
||||
<!-- </if>-->
|
||||
<!-- AND c.del_flag = '0'-->
|
||||
<!-- </where>-->
|
||||
<!-- ORDER BY c.category_id ASC, c.type_id ASC, c.instruction_tag_id ASC,c.create_time desc-->
|
||||
<!-- </select>-->
|
||||
|
||||
<delete id="deleteTags">
|
||||
delete
|
||||
from directive_tag
|
||||
where directive_id = #{directive.id}
|
||||
</delete>
|
||||
|
||||
<insert id="saveTags">
|
||||
insert into directive_tag (directive_id,tag_id) values
|
||||
<foreach collection="directive.tags.split(',')" item="tagId" separator=",">
|
||||
(#{directive.id}, #{tagId})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
|
|
|
@ -19,11 +19,5 @@ public interface IConfigServiceDirectiveService extends IService<ConfigServiceDi
|
|||
|
||||
void merge(List<ConfigServiceDirective> records);
|
||||
|
||||
List<ConfigServiceDirective> pageList(ConfigServiceDirective configServiceDirective,IPage<ConfigServiceDirective> list);
|
||||
|
||||
/**
|
||||
* 存储指令标签数据
|
||||
* @param configServiceDirective
|
||||
*/
|
||||
void saveTags(ConfigServiceDirective configServiceDirective);
|
||||
IPage<ConfigServiceDirective> pageList(ConfigServiceDirective configServiceDirective, Integer pageNo, Integer pageSize);
|
||||
}
|
||||
|
|
|
@ -4,11 +4,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nu.modules.directiveTag.entity.DirectiveTag;
|
||||
import com.nu.modules.serviceDirective.entity.ConfigServiceDirective;
|
||||
import com.nu.modules.serviceDirective.mapper.ConfigServiceDirectiveMapper;
|
||||
import com.nu.modules.serviceDirective.service.IConfigServiceDirectiveService;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -17,7 +15,6 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 服务指令
|
||||
|
@ -30,22 +27,33 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
|
|||
|
||||
|
||||
@Override
|
||||
public List<ConfigServiceDirective> pageList(ConfigServiceDirective configServiceDirective,IPage<ConfigServiceDirective> list_) {
|
||||
if(list_.getRecords() == null || list_.getRecords().isEmpty()){
|
||||
return list_.getRecords();
|
||||
}
|
||||
List<ConfigServiceDirective> list = baseMapper.pageList(configServiceDirective, list_.getRecords());
|
||||
//处理服务标签字段
|
||||
if (list != null && !list.isEmpty()) {
|
||||
list.stream().forEach(record -> {
|
||||
List<DirectiveTag> tagList = record.getTagList();
|
||||
record.setTags(tagList.stream().map(DirectiveTag::getId).collect(Collectors.joining(",")));
|
||||
});
|
||||
}
|
||||
public IPage<ConfigServiceDirective> pageList(ConfigServiceDirective configServiceDirective, Integer pageNo, Integer pageSize) {
|
||||
Page<ConfigServiceDirective> page = new Page<>(pageNo, pageSize);
|
||||
IPage<ConfigServiceDirective> pageList = baseMapper.pageList(page, configServiceDirective);
|
||||
//处理单元格合并所需数据
|
||||
merge(list);
|
||||
return list;
|
||||
merge(pageList.getRecords());
|
||||
return pageList;
|
||||
}
|
||||
// @Override
|
||||
// public IPage<ConfigServiceDirective> pageList(ConfigServiceDirective configServiceDirective, Integer pageNo, Integer pageSize, HttpServletRequest req) {
|
||||
// // 自定义查询规则
|
||||
// Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
|
||||
// // 自定义多选的查询规则为:LIKE_WITH_OR
|
||||
// customeRuleMap.put("categoryId", QueryRuleEnum.LIKE_WITH_OR);
|
||||
// customeRuleMap.put("typeId", QueryRuleEnum.LIKE_WITH_OR);
|
||||
// customeRuleMap.put("instructionTagId", QueryRuleEnum.LIKE_WITH_OR);
|
||||
// customeRuleMap.put("izReimbursement", QueryRuleEnum.LIKE_WITH_OR);
|
||||
// customeRuleMap.put("izPreferential", QueryRuleEnum.LIKE_WITH_OR);
|
||||
// customeRuleMap.put("chargingFrequency", QueryRuleEnum.LIKE_WITH_OR);
|
||||
// customeRuleMap.put("cycleType", QueryRuleEnum.LIKE_WITH_OR);
|
||||
// customeRuleMap.put("izEnabled", QueryRuleEnum.LIKE_WITH_OR);
|
||||
// QueryWrapper<ConfigServiceDirective> queryWrapper = QueryGenerator.initQueryWrapper(configServiceDirective, req.getParameterMap(), customeRuleMap);
|
||||
// Page<ConfigServiceDirective> page = new Page<>(pageNo, pageSize);
|
||||
// IPage<ConfigServiceDirective> pageList = page(page, queryWrapper);
|
||||
// //处理单元格合并所需数据
|
||||
// merge(pageList.getRecords());
|
||||
// return pageList;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 主合并方法
|
||||
|
@ -159,15 +167,4 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 存储指令标签数据
|
||||
*
|
||||
* @param configServiceDirective
|
||||
*/
|
||||
@Override
|
||||
public void saveTags(ConfigServiceDirective configServiceDirective) {
|
||||
baseMapper.deleteTags(configServiceDirective);
|
||||
baseMapper.saveTags(configServiceDirective);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ public interface SysDictMapper extends BaseMapper<SysDict> {
|
|||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
IPage<DictModel> queryPageTableDictWithFilter(Page<DictModel> page, @Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("filterSql") String filterSql,@Param("ena") String ena);
|
||||
IPage<DictModel> queryPageTableDictWithFilter(Page<DictModel> page, @Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("filterSql") String filterSql);
|
||||
|
||||
/**
|
||||
* 查询 字典表数据 支持查询条件 查询所有
|
||||
|
@ -170,7 +170,7 @@ public interface SysDictMapper extends BaseMapper<SysDict> {
|
|||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
List<DictModel> queryTableDictWithFilter(@Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("filterSql") String filterSql,@Param("ena") String ena);
|
||||
List<DictModel> queryTableDictWithFilter(@Param("table") String table, @Param("text") String text, @Param("code") String code, @Param("filterSql") String filterSql);
|
||||
|
||||
/**
|
||||
* 查询字典表的数据
|
||||
|
|
|
@ -70,8 +70,7 @@
|
|||
dict.dict_code,
|
||||
item.item_text AS "text",
|
||||
item.item_value AS "value",
|
||||
item.item_color AS "color",
|
||||
item.status AS "status"
|
||||
item.item_color AS "color"
|
||||
FROM
|
||||
sys_dict_item item
|
||||
INNER JOIN sys_dict dict ON dict.id = item.dict_id
|
||||
|
@ -83,6 +82,7 @@
|
|||
</foreach>
|
||||
)
|
||||
</if>
|
||||
AND item.status =1
|
||||
order by dict.dict_code, item.sort_order
|
||||
</select>
|
||||
|
||||
|
@ -179,11 +179,7 @@
|
|||
|
||||
<!--查询表字典数据,支持关键字和自定义查询条件【已加入SQL注入check】 -->
|
||||
<sql id="queryTableDictWithFilterSqlFragment">
|
||||
select ${text} as "text", ${code} as "value"
|
||||
<if test="'1'.equals(ena) || ena == 1 || ena == '1'">
|
||||
,iz_enabled as status
|
||||
</if>
|
||||
from ${table}
|
||||
select ${text} as "text", ${code} as "value" from ${table}
|
||||
<if test="filterSql != null and filterSql != ''">
|
||||
where ${filterSql}
|
||||
</if>
|
||||
|
|
|
@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.jeecg.modules.system.security.DictQueryBlackListHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
@ -95,10 +94,10 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
dictQueryBlackListHandler.isPass(checkSql);
|
||||
|
||||
// 4.执行SQL 查询是否存在值
|
||||
try {
|
||||
try{
|
||||
//update-begin---author:chenrui ---date:20240715 for:[TV360X-49]postgres日期、年月日时分秒唯一校验报错------------
|
||||
if (DbTypeUtils.dbTypeIsPostgre(CommonUtils.getDatabaseTypeEnum())) {
|
||||
duplicateCheckVo.setFieldName("CAST(" + duplicateCheckVo.getFieldName() + " as text)");
|
||||
if(DbTypeUtils.dbTypeIsPostgre(CommonUtils.getDatabaseTypeEnum())){
|
||||
duplicateCheckVo.setFieldName("CAST("+duplicateCheckVo.getFieldName()+" as text)");
|
||||
}
|
||||
//update-end---author:chenrui ---date:20240715 for:[TV360X-49]postgres日期、年月日时分秒唯一校验报错------------
|
||||
if (StringUtils.isNotBlank(duplicateCheckVo.getDataId())) {
|
||||
|
@ -108,7 +107,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
// [2].添加页面校验
|
||||
count = sysDictMapper.duplicateCheckCountSqlNoDataId(duplicateCheckVo);
|
||||
}
|
||||
} catch (MyBatisSystemException e) {
|
||||
}catch(MyBatisSystemException e){
|
||||
log.error(e.getMessage(), e);
|
||||
String errorCause = "查询异常,请检查唯一校验的配置!";
|
||||
throw new JeecgBootException(errorCause);
|
||||
|
@ -128,19 +127,18 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
|
||||
/**
|
||||
* 通过查询指定code 获取字典
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Cacheable(value = CacheConstant.SYS_DICT_CACHE, key = "#code", unless = "#result == null ")
|
||||
@Cacheable(value = CacheConstant.SYS_DICT_CACHE,key = "#code", unless = "#result == null ")
|
||||
public List<DictModel> queryDictItemsByCode(String code) {
|
||||
log.debug("无缓存dictCache的时候调用这里!");
|
||||
return sysDictMapper.queryDictItemsByCode(code);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(value = CacheConstant.SYS_ENABLE_DICT_CACHE, key = "#code", unless = "#result == null ")
|
||||
@Cacheable(value = CacheConstant.SYS_ENABLE_DICT_CACHE,key = "#code", unless = "#result == null ")
|
||||
public List<DictModel> queryEnableDictItemsByCode(String code) {
|
||||
log.debug("无缓存dictCache的时候调用这里!");
|
||||
return sysDictMapper.queryEnableDictItemsByCode(code);
|
||||
|
@ -182,7 +180,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
// 使用groupingBy根据dictCode分组
|
||||
sysAllDictItems = sysDictItemList.stream()
|
||||
.collect(Collectors.groupingBy(DictModelMany::getDictCode,
|
||||
Collectors.mapping(d -> new DictModel(d.getValue(), d.getText(), d.getColor(), d.getStatus()), Collectors.toList())));
|
||||
Collectors.mapping(d -> new DictModel(d.getValue(), d.getText(), d.getColor()), Collectors.toList())));
|
||||
log.info(" >>> 1 获取系统字典项耗时(SQL):" + (System.currentTimeMillis() - start) + "毫秒");
|
||||
|
||||
Map<String, List<DictModel>> enumRes = ResourceUtil.getEnumDictData();
|
||||
|
@ -198,14 +196,13 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
|
||||
/**
|
||||
* 通过查询指定code 获取字典值text
|
||||
*
|
||||
* @param code
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
|
||||
@Override
|
||||
@Cacheable(value = CacheConstant.SYS_DICT_CACHE, key = "#code+':'+#key", unless = "#result == null ")
|
||||
@Cacheable(value = CacheConstant.SYS_DICT_CACHE,key = "#code+':'+#key", unless = "#result == null ")
|
||||
public String queryDictTextByKey(String code, String key) {
|
||||
log.debug("无缓存dictText的时候调用这里!");
|
||||
return sysDictMapper.queryDictTextByKey(code, key);
|
||||
|
@ -229,7 +226,6 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
/**
|
||||
* 通过查询指定table的 text code 获取字典
|
||||
* dictTableCache采用redis缓存有效期10分钟
|
||||
*
|
||||
* @param tableFilterSql
|
||||
* @param text
|
||||
* @param code
|
||||
|
@ -239,11 +235,11 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
@Deprecated
|
||||
public List<DictModel> queryTableDictItemsByCode(String tableFilterSql, String text, String code) {
|
||||
log.debug("无缓存dictTableList的时候调用这里!");
|
||||
String str = tableFilterSql + "," + text + "," + code;
|
||||
String str = tableFilterSql+","+text+","+code;
|
||||
// 【QQYUN-6533】表字典白名单check
|
||||
sysBaseAPI.dictTableWhiteListCheckByDict(tableFilterSql, text, code);
|
||||
// 1.表字典黑名单check
|
||||
if (!dictQueryBlackListHandler.isPass(str)) {
|
||||
if(!dictQueryBlackListHandler.isPass(str)){
|
||||
log.error(dictQueryBlackListHandler.getError());
|
||||
return null;
|
||||
}
|
||||
|
@ -251,11 +247,11 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
// 2.分割SQL获取表名和条件
|
||||
String table = null;
|
||||
String filterSql = null;
|
||||
if (tableFilterSql.toLowerCase().indexOf(DataBaseConstant.SQL_WHERE) > 0) {
|
||||
if(tableFilterSql.toLowerCase().indexOf(DataBaseConstant.SQL_WHERE)>0){
|
||||
String[] arr = tableFilterSql.split(" (?i)where ");
|
||||
table = arr[0];
|
||||
filterSql = oConvertUtils.getString(arr[1], null);
|
||||
} else {
|
||||
}else{
|
||||
table = tableFilterSql;
|
||||
}
|
||||
|
||||
|
@ -267,13 +263,9 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
table = SqlInjectionUtil.getSqlInjectTableName(table);
|
||||
text = SqlInjectionUtil.getSqlInjectField(text);
|
||||
code = SqlInjectionUtil.getSqlInjectField(code);
|
||||
List<DictModel> dictModels = Lists.newArrayList();
|
||||
try {
|
||||
dictModels = sysDictMapper.queryTableDictWithFilter(table, text, code, filterSql, "1");
|
||||
} catch (Exception e) {
|
||||
dictModels = sysDictMapper.queryTableDictWithFilter(table, text, code, filterSql, null);
|
||||
}
|
||||
return dictModels;
|
||||
|
||||
//return sysDictMapper.queryTableDictItemsByCode(tableFilterSql,text,code);
|
||||
return sysDictMapper.queryTableDictWithFilter(table,text,code,filterSql);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -285,11 +277,11 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
SqlInjectionUtil.filterContentMulti(text, code);
|
||||
SqlInjectionUtil.specialFilterContentForDictSql(filterSql);
|
||||
|
||||
String str = table + "," + text + "," + code;
|
||||
String str = table+","+text+","+code;
|
||||
// 【QQYUN-6533】表字典白名单check
|
||||
sysBaseAPI.dictTableWhiteListCheckByDict(table, text, code);
|
||||
// 2.表字典黑名单 Check
|
||||
if (!dictQueryBlackListHandler.isPass(str)) {
|
||||
if(!dictQueryBlackListHandler.isPass(str)){
|
||||
log.error(dictQueryBlackListHandler.getError());
|
||||
return null;
|
||||
}
|
||||
|
@ -298,19 +290,13 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
table = SqlInjectionUtil.getSqlInjectTableName(table);
|
||||
text = SqlInjectionUtil.getSqlInjectField(text);
|
||||
code = SqlInjectionUtil.getSqlInjectField(code);
|
||||
List<DictModel> dictModels = Lists.newArrayList();
|
||||
try {
|
||||
dictModels = sysDictMapper.queryTableDictWithFilter(table, text, code, filterSql, "1");
|
||||
} catch (Exception e) {
|
||||
dictModels = sysDictMapper.queryTableDictWithFilter(table, text, code, filterSql, null);
|
||||
}
|
||||
return dictModels;
|
||||
|
||||
return sysDictMapper.queryTableDictWithFilter(table,text,code,filterSql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过查询指定table的 text code 获取字典值text
|
||||
* dictTableCache采用redis缓存有效期10分钟
|
||||
*
|
||||
* @param table
|
||||
* @param text
|
||||
* @param code
|
||||
|
@ -319,14 +305,14 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
*/
|
||||
@Override
|
||||
@Cacheable(value = CacheConstant.SYS_DICT_TABLE_CACHE, unless = "#result == null ")
|
||||
public String queryTableDictTextByKey(String table, String text, String code, String key) {
|
||||
public String queryTableDictTextByKey(String table,String text,String code, String key) {
|
||||
log.debug("无缓存dictTable的时候调用这里!");
|
||||
|
||||
String str = table + "," + text + "," + code;
|
||||
String str = table+","+text+","+code;
|
||||
// 【QQYUN-6533】表字典白名单check
|
||||
sysBaseAPI.dictTableWhiteListCheckByDict(table, text, code);
|
||||
// 1.表字典黑名单check
|
||||
if (!dictQueryBlackListHandler.isPass(str)) {
|
||||
if(!dictQueryBlackListHandler.isPass(str)){
|
||||
log.error(dictQueryBlackListHandler.getError());
|
||||
return null;
|
||||
}
|
||||
|
@ -339,9 +325,9 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
code = SqlInjectionUtil.getSqlInjectField(code);
|
||||
|
||||
List<DictModel> dictModeList = sysDictMapper.queryTableDictByKeysAndFilterSql(table, text, code, null, Arrays.asList(key));
|
||||
if (CollectionUtils.isEmpty(dictModeList)) {
|
||||
if(CollectionUtils.isEmpty(dictModeList)){
|
||||
return null;
|
||||
} else {
|
||||
}else{
|
||||
return dictModeList.get(0).getText();
|
||||
}
|
||||
|
||||
|
@ -351,7 +337,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
|
||||
@Override
|
||||
public List<DictModel> queryTableDictTextByKeys(String table, String text, String code, List<String> codeValues, String dataSource) {
|
||||
String str = table + "," + text + "," + code;
|
||||
String str = table+","+text+","+code;
|
||||
//update-begin---author:chenrui ---date:20231221 for:[issues/#5643]解决分布式下表字典跨库无法查询问题------------
|
||||
// 是否自定义数据源
|
||||
boolean isCustomDataSource = oConvertUtils.isNotEmpty(dataSource);
|
||||
|
@ -369,7 +355,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
|
||||
// 2.分割SQL获取表名和条件
|
||||
String filterSql = null;
|
||||
if (table.toLowerCase().indexOf(DataBaseConstant.SQL_WHERE) > 0) {
|
||||
if(table.toLowerCase().indexOf(DataBaseConstant.SQL_WHERE)>0){
|
||||
String[] arr = table.split(" (?i)where ");
|
||||
table = arr[0];
|
||||
filterSql = arr[1];
|
||||
|
@ -401,11 +387,11 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
|
||||
@Override
|
||||
public List<String> queryTableDictByKeys(String table, String text, String code, String keys) {
|
||||
String str = table + "," + text + "," + code;
|
||||
String str = table+","+text+","+code;
|
||||
// 【QQYUN-6533】表字典白名单check
|
||||
sysBaseAPI.dictTableWhiteListCheckByDict(table, text, code);
|
||||
// 1.表字典黑名单check
|
||||
if (!dictQueryBlackListHandler.isPass(str)) {
|
||||
if(!dictQueryBlackListHandler.isPass(str)){
|
||||
log.error(dictQueryBlackListHandler.getError());
|
||||
return null;
|
||||
}
|
||||
|
@ -416,7 +402,6 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
/**
|
||||
* 通过查询指定table的 text code 获取字典,包含text和value
|
||||
* dictTableCache采用redis缓存有效期10分钟
|
||||
*
|
||||
* @param table
|
||||
* @param text
|
||||
* @param code
|
||||
|
@ -426,13 +411,13 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
*/
|
||||
@Override
|
||||
public List<String> queryTableDictByKeys(String table, String text, String code, String codeValuesStr, boolean delNotExist) {
|
||||
if (oConvertUtils.isEmpty(codeValuesStr)) {
|
||||
if(oConvertUtils.isEmpty(codeValuesStr)){
|
||||
return null;
|
||||
}
|
||||
|
||||
//1.分割sql获取表名 和 条件sql
|
||||
String filterSql = null;
|
||||
if (table.toLowerCase().indexOf("where") != -1) {
|
||||
if(table.toLowerCase().indexOf("where")!=-1){
|
||||
String[] arr = table.split(" (?i)where ");
|
||||
table = arr[0];
|
||||
filterSql = arr[1];
|
||||
|
@ -442,11 +427,11 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
SqlInjectionUtil.filterContentMulti(table, text, code);
|
||||
SqlInjectionUtil.specialFilterContentForDictSql(filterSql);
|
||||
|
||||
String str = table + "," + text + "," + code;
|
||||
String str = table+","+text+","+code;
|
||||
// 【QQYUN-6533】表字典白名单check
|
||||
sysBaseAPI.dictTableWhiteListCheckByDict(table, text, code);
|
||||
// 3.表字典黑名单check
|
||||
if (!dictQueryBlackListHandler.isPass(str)) {
|
||||
if(!dictQueryBlackListHandler.isPass(str)){
|
||||
log.error(dictQueryBlackListHandler.getError());
|
||||
return null;
|
||||
}
|
||||
|
@ -487,13 +472,13 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer saveMain(SysDict sysDict, List<SysDictItem> sysDictItemList) {
|
||||
int insert = 0;
|
||||
try {
|
||||
int insert=0;
|
||||
try{
|
||||
insert = sysDictMapper.insert(sysDict);
|
||||
if (sysDictItemList != null) {
|
||||
for (SysDictItem entity : sysDictItemList) {
|
||||
//update-begin---author:wangshuai ---date:20220211 for:[JTC-1168]如果字典项值为空,则字典项忽略导入------------
|
||||
if (oConvertUtils.isEmpty(entity.getItemValue())) {
|
||||
if(oConvertUtils.isEmpty(entity.getItemValue())){
|
||||
return -1;
|
||||
}
|
||||
//update-end---author:wangshuai ---date:20220211 for:[JTC-1168]如果字典项值为空,则字典项忽略导入------------
|
||||
|
@ -502,7 +487,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
sysDictItemMapper.insert(entity);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}catch(Exception e){
|
||||
return insert;
|
||||
}
|
||||
return insert;
|
||||
|
@ -539,12 +524,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
String filterSql = getFilterSql(tableSql, text, code, condition, keyword);
|
||||
|
||||
// 3. 返回表字典数据
|
||||
IPage<DictModel> pageList = new Page<>();
|
||||
try {
|
||||
pageList = baseMapper.queryPageTableDictWithFilter(page, table, text, code, filterSql, "1");
|
||||
} catch (Exception e) {
|
||||
pageList = baseMapper.queryPageTableDictWithFilter(page, table, text, code, filterSql, null);
|
||||
}
|
||||
IPage<DictModel> pageList = baseMapper.queryPageTableDictWithFilter(page, table, text, code, filterSql);
|
||||
return pageList.getRecords();
|
||||
}
|
||||
|
||||
|
@ -557,7 +537,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
* @param keyword
|
||||
* @return
|
||||
*/
|
||||
private String getFilterSql(String tableSql, String text, String code, String condition, String keyword) {
|
||||
private String getFilterSql(String tableSql, String text, String code, String condition, String keyword){
|
||||
String filterSql = "";
|
||||
String keywordSql = null;
|
||||
String sqlWhere = "where ";
|
||||
|
@ -590,7 +570,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
//update-end--author:scott--date:20220105--for:JTC-529【表单设计器】 编辑页面报错,in参数采用双引号导致----
|
||||
keywordSql = "(" + text + " in (" + inKeywords + ") or " + code + " in (" + inKeywords + "))";
|
||||
} else {
|
||||
keywordSql = "(" + text + " like '%" + keyword + "%' or " + code + " like '%" + keyword + "%')";
|
||||
keywordSql = "("+text + " like '%"+keyword+"%' or "+ code + " like '%"+keyword+"%')";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -636,12 +616,8 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
table = SqlInjectionUtil.getSqlInjectTableName(table);
|
||||
text = SqlInjectionUtil.getSqlInjectField(text);
|
||||
code = SqlInjectionUtil.getSqlInjectField(code);
|
||||
List<DictModel> ls = Lists.newArrayList();
|
||||
try {
|
||||
ls = baseMapper.queryTableDictWithFilter(table, text, code, filterSql, "1");
|
||||
} catch (Exception e) {
|
||||
ls = baseMapper.queryTableDictWithFilter(table, text, code, filterSql, null);
|
||||
}
|
||||
|
||||
List<DictModel> ls = baseMapper.queryTableDictWithFilter(table, text, code, filterSql);
|
||||
return ls;
|
||||
}
|
||||
|
||||
|
@ -655,7 +631,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
pidField = SqlInjectionUtil.getSqlInjectField(pidField);
|
||||
hasChildField = SqlInjectionUtil.getSqlInjectField(hasChildField);
|
||||
|
||||
if (oConvertUtils.isEmpty(text) || oConvertUtils.isEmpty(code)) {
|
||||
if(oConvertUtils.isEmpty(text) || oConvertUtils.isEmpty(code)){
|
||||
log.warn("text={},code={}", text, code);
|
||||
log.warn("加载树字典参数有误,text和code不允许为空!");
|
||||
return null;
|
||||
|
@ -668,7 +644,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
// 【QQYUN-6533】表字典白名单check
|
||||
sysBaseAPI.dictTableWhiteListCheckByDict(table, text, code);
|
||||
// 3.表字典SQL表名黑名单 Check
|
||||
if (!dictQueryBlackListHandler.isPass(dictCode)) {
|
||||
if(!dictQueryBlackListHandler.isPass(dictCode)){
|
||||
log.error("Sql异常:{}", dictQueryBlackListHandler.getError());
|
||||
return null;
|
||||
}
|
||||
|
@ -688,19 +664,19 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
@Override
|
||||
public void deleteOneDictPhysically(String id) {
|
||||
this.baseMapper.deleteOneById(id);
|
||||
this.sysDictItemMapper.delete(new LambdaQueryWrapper<SysDictItem>().eq(SysDictItem::getDictId, id));
|
||||
this.sysDictItemMapper.delete(new LambdaQueryWrapper<SysDictItem>().eq(SysDictItem::getDictId,id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDictDelFlag(int delFlag, String id) {
|
||||
baseMapper.updateDictDelFlag(delFlag, id);
|
||||
baseMapper.updateDictDelFlag(delFlag,id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysDict> queryDeleteList(String tenantId) {
|
||||
//update-begin---author:wangshuai---date:2024-02-27---for:【QQYUN-8340】回收站查找软删除记录时,没有判断是否启用多租户,造成可以查找并回收其他租户的数据 #5907---
|
||||
if (MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL) {
|
||||
if (oConvertUtils.isEmpty(tenantId)) {
|
||||
if(MybatisPlusSaasConfig.OPEN_SYSTEM_TENANT_CONTROL){
|
||||
if(oConvertUtils.isEmpty(tenantId)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return baseMapper.queryDeleteListBtTenantId(oConvertUtils.getInt(tenantId));
|
||||
|
@ -711,7 +687,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
|
||||
@Override
|
||||
public List<DictModel> queryDictTablePageList(DictQuery query, int pageSize, int pageNo) {
|
||||
Page page = new Page(pageNo, pageSize, false);
|
||||
Page page = new Page(pageNo,pageSize,false);
|
||||
|
||||
//为了防止sql(jeecg提供了防注入的方法,可以在拼接 SQL 语句时自动对参数进行转义,避免SQL注入攻击)
|
||||
// 1. 针对采用 ${}写法的表名和字段进行转义和check
|
||||
|
@ -722,11 +698,11 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
query.setTable(text);
|
||||
query.setText(code);
|
||||
|
||||
String dictCode = table + "," + text + "," + code;
|
||||
String dictCode = table+","+text+","+code;
|
||||
// 【QQYUN-6533】表字典白名单check
|
||||
sysBaseAPI.dictTableWhiteListCheckByDict(table, text, code);
|
||||
// 2.表字典黑名单check
|
||||
if (!dictQueryBlackListHandler.isPass(dictCode)) {
|
||||
if(!dictQueryBlackListHandler.isPass(dictCode)){
|
||||
log.error(dictQueryBlackListHandler.getError());
|
||||
return null;
|
||||
}
|
||||
|
@ -777,7 +753,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
// 【QQYUN-6533】表字典白名单check
|
||||
sysBaseAPI.dictTableWhiteListCheckByDict(dictCode);
|
||||
// 1.表字典黑名单check
|
||||
if (!dictQueryBlackListHandler.isPass(dictCode)) {
|
||||
if(!dictQueryBlackListHandler.isPass(dictCode)){
|
||||
log.error(dictQueryBlackListHandler.getError());
|
||||
return null;
|
||||
}
|
||||
|
@ -795,19 +771,19 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
} else if (params.length == 4) {
|
||||
condition = params[3];
|
||||
// update-begin-author:taoyan date:20220314 for: online表单下拉搜索框表字典配置#{sys_org_code}报错 #3500
|
||||
if (condition.indexOf(SymbolConstant.SYS_VAR_PREFIX) >= 0) {
|
||||
if(condition.indexOf(SymbolConstant.SYS_VAR_PREFIX)>=0){
|
||||
condition = QueryGenerator.getSqlRuleValue(condition);
|
||||
}
|
||||
// update-end-author:taoyan date:20220314 for: online表单下拉搜索框表字典配置#{sys_org_code}报错 #3500
|
||||
}
|
||||
|
||||
// 字典Code格式不正确 [表名为空]
|
||||
if (oConvertUtils.isEmpty(params[0])) {
|
||||
if(oConvertUtils.isEmpty(params[0])){
|
||||
return null;
|
||||
}
|
||||
List<DictModel> ls;
|
||||
if (pageSize != null) {
|
||||
ls = this.queryLittleTableDictItems(params[0], params[1], params[2], condition, keyword, pageNo, pageSize);
|
||||
ls = this.queryLittleTableDictItems(params[0], params[1], params[2], condition, keyword, pageNo,pageSize);
|
||||
} else {
|
||||
ls = this.queryAllTableDictItems(params[0], params[1], params[2], condition, keyword);
|
||||
}
|
||||
|
@ -822,12 +798,12 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
@Override
|
||||
public List<SysDictVo> getDictListByLowAppId(String lowAppId) {
|
||||
int tenantId = oConvertUtils.getInt(TenantContext.getTenant(), 0);
|
||||
List<SysDict> list = baseMapper.getDictListByLowAppId(lowAppId, tenantId);
|
||||
List<SysDict> list = baseMapper.getDictListByLowAppId(lowAppId,tenantId);
|
||||
//查询字典下面的字典项
|
||||
List<SysDictVo> dictVoList = new ArrayList<>();
|
||||
for (SysDict dict : list) {
|
||||
for (SysDict dict:list) {
|
||||
SysDictVo dictVo = new SysDictVo();
|
||||
BeanUtils.copyProperties(dict, dictVo);
|
||||
BeanUtils.copyProperties(dict,dictVo);
|
||||
List<SysDictItem> sysDictItems = sysDictItemMapper.selectItemsByMainId(dict.getId());
|
||||
dictVo.setDictItemsList(sysDictItems);
|
||||
dictVoList.add(dictVo);
|
||||
|
@ -837,10 +813,10 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
|
||||
@Override
|
||||
public String addDictByLowAppId(SysDictVo sysDictVo) {
|
||||
String[] dictResult = this.addDict(sysDictVo.getDictName(), sysDictVo.getLowAppId(), sysDictVo.getTenantId());
|
||||
String[] dictResult = this.addDict(sysDictVo.getDictName(),sysDictVo.getLowAppId(),sysDictVo.getTenantId());
|
||||
String id = dictResult[0];
|
||||
String code = dictResult[1];
|
||||
this.addDictItem(id, sysDictVo.getDictItemsList());
|
||||
this.addDictItem(id,sysDictVo.getDictItemsList());
|
||||
return code;
|
||||
}
|
||||
|
||||
|
@ -848,25 +824,24 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
public void editDictByLowAppId(SysDictVo sysDictVo) {
|
||||
String id = sysDictVo.getId();
|
||||
SysDict dict = baseMapper.selectById(id);
|
||||
if (null == dict) {
|
||||
if(null == dict){
|
||||
throw new JeecgBootException("字典数据不存在");
|
||||
}
|
||||
//判断应用id和数据库中的是否一致,不一致不让修改
|
||||
if (!dict.getLowAppId().equals(sysDictVo.getLowAppId())) {
|
||||
if(!dict.getLowAppId().equals(sysDictVo.getLowAppId())){
|
||||
throw new JeecgBootException("字典数据不存在");
|
||||
}
|
||||
SysDict sysDict = new SysDict();
|
||||
sysDict.setDictName(sysDictVo.getDictName());
|
||||
sysDict.setId(id);
|
||||
baseMapper.updateById(sysDict);
|
||||
this.updateDictItem(id, sysDictVo.getDictItemsList());
|
||||
this.updateDictItem(id,sysDictVo.getDictItemsList());
|
||||
// 删除字典缓存
|
||||
redisUtil.removeAll(CacheConstant.SYS_DICT_CACHE + "::" + dict.getDictCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* 还原逻辑删除
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
@Override
|
||||
|
@ -876,7 +851,6 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
|
||||
/**
|
||||
* 彻底删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
|
@ -892,10 +866,9 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
|
||||
/**
|
||||
* 添加字典
|
||||
*
|
||||
* @param dictName
|
||||
*/
|
||||
private String[] addDict(String dictName, String lowAppId, Integer tenantId) {
|
||||
private String[] addDict(String dictName,String lowAppId, Integer tenantId) {
|
||||
SysDict dict = new SysDict();
|
||||
dict.setDictName(dictName);
|
||||
dict.setDictCode(RandomUtil.randomString(10));
|
||||
|
@ -909,15 +882,14 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
|
||||
/**
|
||||
* 添加字典子项
|
||||
*
|
||||
* @param id
|
||||
* @param dictItemList
|
||||
*/
|
||||
private void addDictItem(String id, List<SysDictItem> dictItemList) {
|
||||
if (null != dictItemList && dictItemList.size() > 0) {
|
||||
for (SysDictItem dictItem : dictItemList) {
|
||||
private void addDictItem(String id,List<SysDictItem> dictItemList) {
|
||||
if(null!=dictItemList && dictItemList.size()>0){
|
||||
for (SysDictItem dictItem:dictItemList) {
|
||||
SysDictItem sysDictItem = new SysDictItem();
|
||||
BeanUtils.copyProperties(dictItem, sysDictItem);
|
||||
BeanUtils.copyProperties(dictItem,sysDictItem);
|
||||
sysDictItem.setDictId(id);
|
||||
sysDictItem.setId("");
|
||||
sysDictItem.setStatus(Integer.valueOf(CommonConstant.STATUS_1));
|
||||
|
@ -928,16 +900,15 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
|
||||
/**
|
||||
* 更新字典子项
|
||||
*
|
||||
* @param id
|
||||
* @param dictItemList
|
||||
*/
|
||||
private void updateDictItem(String id, List<SysDictItem> dictItemList) {
|
||||
private void updateDictItem(String id,List<SysDictItem> dictItemList){
|
||||
//先删除在新增 因为排序可能不一致
|
||||
LambdaQueryWrapper<SysDictItem> query = new LambdaQueryWrapper<>();
|
||||
query.eq(SysDictItem::getDictId, id);
|
||||
query.eq(SysDictItem::getDictId,id);
|
||||
sysDictItemMapper.delete(query);
|
||||
//新增子项
|
||||
this.addDictItem(id, dictItemList);
|
||||
this.addDictItem(id,dictItemList);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue