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