Compare commits

...

2 Commits

Author SHA1 Message Date
1378012178@qq.com d822d0098b Merge branch 'master' of http://47.115.223.229:8888/yangjun/hldy_java_monomer 2025-03-19 09:48:03 +08:00
1378012178@qq.com b0832f29e4 一、调整系统字典表
1、启用停用的值
2、停用后依旧显示(原不显示)但是将下拉选调整为禁用状态
2025-03-19 09:47:56 +08:00
10 changed files with 979 additions and 836 deletions

View File

@ -17,55 +17,73 @@ import lombok.experimental.Accessors;
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@JsonIgnoreProperties(ignoreUnknown = true)
public class DictModel implements Serializable{
private static final long serialVersionUID = 1L;
public class DictModel implements Serializable {
private static final long serialVersionUID = 1L;
public DictModel() {
}
public DictModel(String value, String text) {
this.value = value;
this.text = text;
}
public DictModel() {
}
public DictModel(String value, String text, String color) {
this.value = value;
this.text = text;
this.color = color;
}
public DictModel(String value, String text) {
this.value = value;
this.text = text;
}
/**
* 字典value
*/
private String value;
/**
* 字典文本
*/
private String text;
/**
* 字典颜色
*/
private String color;
public DictModel(String value, String text, String color) {
this.value = value;
this.text = text;
this.color = color;
}
/**
* 特殊用途 JgEditableTable
* @return
*/
public String getTitle() {
return this.text;
}
/**
* 特殊用途 vue3 Select组件
*/
public String getLabel() {
return this.text;
}
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;
}
/**
* 用于表单设计器 关联记录表数据存储
* QQYUN-5595表单设计器他表字段 导入没有翻译
*/
private JSONObject jsonObject;
/**
* 字典value
*/
private String value;
/**
* 字典文本
*/
private String text;
/**
* 字典颜色
*/
private String color;
/**
* 是否启用 1启用 0不启用
*/
private Integer status;
/**
* 特殊用途 JgEditableTable
*
* @return
*/
public String getTitle() {
return this.text;
}
/**
* 特殊用途 vue3 Select组件
*/
public String getLabel() {
return this.text;
}
/**
* 用于表单设计器 关联记录表数据存储
* QQYUN-5595表单设计器他表字段 导入没有翻译
*/
private JSONObject jsonObject;
}

View File

@ -9,6 +9,7 @@ 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;
@ -56,8 +57,23 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
IPage<ConfigServiceDirective> pageList = service.pageList(configServiceDirective, pageNo, pageSize);
return Result.OK(pageList);
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);
}
/**
@ -72,6 +88,9 @@ 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("添加成功!");
}
@ -87,6 +106,9 @@ 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("编辑成功!");
}

View File

@ -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;
/**指令标签id*/
@Excel(name = "指令标签", width = 15)
@ApiModelProperty(value = "指令标签")
/**分类标签*/
@Excel(name = "分类标签", width = 15)
@ApiModelProperty(value = "分类标签")
@Dict(dicCode = "instruction_tag" )
private java.lang.String instructionTagId;
/**服务指令名称*/
@ -137,6 +137,8 @@ public class ConfigServiceDirective implements Serializable {
private Integer typeRowSpan;
@TableField(exist = false)
private Integer instructionRowSpan;
@TableField(exist = false)
private String tags;
//服务指令标签
List<DirectiveTag> tagList;

View File

@ -22,8 +22,16 @@ public interface ConfigServiceDirectiveMapper extends BaseMapper<ConfigServiceDi
* @param directive 主查询对象包含搜索条件
* @return 分页结果
*/
IPage<ConfigServiceDirective> pageList(
@Param("page") Page<ConfigServiceDirective> page,
@Param("directive") ConfigServiceDirective directive
List<ConfigServiceDirective> pageList(
@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);
}

View File

@ -35,6 +35,7 @@
</collection>
</resultMap>
<!-- 分页查询SQL -->
<select id="pageList" resultMap="ConfigServiceDirectiveResultMap" parameterType="map">
SELECT
@ -67,37 +68,87 @@
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'
c.id IN
<foreach collection="ids" item="item" open="(" separator="," close=")">
#{item.id}
</foreach>
</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>-->
<!-- &lt;!&ndash; 动态条件拼接 &ndash;&gt;-->
<!-- <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>

View File

@ -19,5 +19,11 @@ public interface IConfigServiceDirectiveService extends IService<ConfigServiceDi
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);
}

View File

@ -4,9 +4,11 @@ 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;
@ -15,6 +17,7 @@ import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Description: 服务指令
@ -27,33 +30,22 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
@Override
public IPage<ConfigServiceDirective> pageList(ConfigServiceDirective configServiceDirective, Integer pageNo, Integer pageSize) {
Page<ConfigServiceDirective> page = new Page<>(pageNo, pageSize);
IPage<ConfigServiceDirective> pageList = baseMapper.pageList(page, configServiceDirective);
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(",")));
});
}
//处理单元格合并所需数据
merge(pageList.getRecords());
return pageList;
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);
}
}

View File

@ -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);
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
*/
@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);
/**
* 查询字典表的数据

View File

@ -70,7 +70,8 @@
dict.dict_code,
item.item_text AS "text",
item.item_value AS "value",
item.item_color AS "color"
item.item_color AS "color",
item.status AS "status"
FROM
sys_dict_item item
INNER JOIN sys_dict dict ON dict.id = item.dict_id
@ -82,7 +83,6 @@
</foreach>
)
</if>
AND item.status =1
order by dict.dict_code, item.sort_order
</select>
@ -179,7 +179,11 @@
<!--查询表字典数据支持关键字和自定义查询条件【已加入SQL注入check】 -->
<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 != ''">
where ${filterSql}
</if>