parent
d822d0098b
commit
b1cdb266b4
|
@ -101,6 +101,9 @@ public class ConfigServiceTypeController extends JeecgController<ConfigServiceTy
|
|||
@ApiOperation(value = "服务类型-通过id删除", notes = "服务类型-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
if(configServiceTypeService.isUsed(id)){
|
||||
return Result.error("已被使用,无法删除!");
|
||||
}
|
||||
configServiceTypeService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
@ -115,6 +118,9 @@ public class ConfigServiceTypeController extends JeecgController<ConfigServiceTy
|
|||
@ApiOperation(value = "服务类型-批量删除", notes = "服务类型-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
if(configServiceTypeService.isUsed(ids)){
|
||||
return Result.error("已被使用,无法删除!");
|
||||
}
|
||||
this.configServiceTypeService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
|
|
@ -11,4 +11,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
*/
|
||||
public interface IConfigServiceTypeService extends IService<ConfigServiceType> {
|
||||
|
||||
/**
|
||||
* 查询数据是否已被使用
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
boolean isUsed(String id);
|
||||
}
|
||||
|
|
|
@ -1,19 +1,47 @@
|
|||
package com.nu.modules.ServiceType.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.nu.modules.ServiceType.entity.ConfigServiceType;
|
||||
import com.nu.modules.ServiceType.mapper.ConfigServiceTypeMapper;
|
||||
import com.nu.modules.ServiceType.service.IConfigServiceTypeService;
|
||||
import com.nu.modules.serviceDirective.entity.ConfigServiceDirective;
|
||||
import com.nu.modules.serviceDirective.service.IConfigServiceDirectiveService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 服务类型
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ConfigServiceTypeServiceImpl extends ServiceImpl<ConfigServiceTypeMapper, ConfigServiceType> implements IConfigServiceTypeService {
|
||||
|
||||
@Autowired
|
||||
private IConfigServiceDirectiveService configServiceDirectiveService;
|
||||
|
||||
@Override
|
||||
public boolean isUsed(String ids) {
|
||||
if (StringUtils.isBlank(ids)) {
|
||||
return false;
|
||||
}
|
||||
boolean result = false;
|
||||
//是否已被服务指令使用
|
||||
LambdaQueryWrapper<ConfigServiceDirective> configServiceDirectiveLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
configServiceDirectiveLambdaQueryWrapper.in(ConfigServiceDirective::getTypeId, Arrays.asList(ids.split(",")));
|
||||
configServiceDirectiveLambdaQueryWrapper.eq(ConfigServiceDirective::getDelFlag, "0");
|
||||
List<ConfigServiceDirective> configServiceDirectives = configServiceDirectiveService.list(configServiceDirectiveLambdaQueryWrapper);
|
||||
if (!(configServiceDirectives == null || configServiceDirectives.isEmpty())) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,6 +101,9 @@ public class DirectiveTagController extends JeecgController<DirectiveTag, IDirec
|
|||
@ApiOperation(value="指令标签-通过id删除", notes="指令标签-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
if(directiveTagService.isUsed(id)){
|
||||
return Result.error("已被使用,无法删除!");
|
||||
}
|
||||
directiveTagService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
@ -115,6 +118,9 @@ public class DirectiveTagController extends JeecgController<DirectiveTag, IDirec
|
|||
@ApiOperation(value="指令标签-批量删除", notes="指令标签-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
if(directiveTagService.isUsed(ids)){
|
||||
return Result.error("已被使用,无法删除!");
|
||||
}
|
||||
this.directiveTagService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
|
|
@ -11,4 +11,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
*/
|
||||
public interface IDirectiveTagService extends IService<DirectiveTag> {
|
||||
|
||||
/**
|
||||
* 查询数据是否已被使用
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
boolean isUsed(String id);
|
||||
}
|
||||
|
|
|
@ -1,19 +1,43 @@
|
|||
package com.nu.modules.directiveTag.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.nu.modules.directiveTag.entity.DirectiveTag;
|
||||
import com.nu.modules.directiveTag.mapper.DirectiveTagMapper;
|
||||
import com.nu.modules.directiveTag.service.IDirectiveTagService;
|
||||
import com.nu.modules.serviceDirective.entity.ConfigServiceDirective;
|
||||
import com.nu.modules.serviceDirective.mapper.ConfigServiceDirectiveMapper;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 指令标签
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-17
|
||||
* @Date: 2025-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DirectiveTagServiceImpl extends ServiceImpl<DirectiveTagMapper, DirectiveTag> implements IDirectiveTagService {
|
||||
|
||||
@Autowired
|
||||
private ConfigServiceDirectiveMapper serviceDirectiveMapper;
|
||||
|
||||
@Override
|
||||
public boolean isUsed(String ids) {
|
||||
if (StringUtils.isBlank(ids)) {
|
||||
return false;
|
||||
}
|
||||
boolean result = false;
|
||||
//是否已被服务指令使用
|
||||
int i = serviceDirectiveMapper.queryCountByTagIds(Arrays.asList(ids.split(",")));
|
||||
if (i > 0) {
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,6 +101,9 @@ public class ConfigServiceCategoryController extends JeecgController<ConfigServi
|
|||
@ApiOperation(value="服务类别-通过id删除", notes="服务类别-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
if(configServiceCategoryService.isUsed(id)){
|
||||
return Result.error("已被使用,无法删除!");
|
||||
}
|
||||
configServiceCategoryService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
@ -115,6 +118,9 @@ public class ConfigServiceCategoryController extends JeecgController<ConfigServi
|
|||
@ApiOperation(value="服务类别-批量删除", notes="服务类别-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
if(configServiceCategoryService.isUsed(ids)){
|
||||
return Result.error("已被使用,无法删除!");
|
||||
}
|
||||
this.configServiceCategoryService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
|
|
@ -11,4 +11,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
*/
|
||||
public interface IConfigServiceCategoryService extends IService<ConfigServiceCategory> {
|
||||
|
||||
/**
|
||||
* 查询数据是否已被使用
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
boolean isUsed(String ids);
|
||||
}
|
||||
|
|
|
@ -1,19 +1,60 @@
|
|||
package com.nu.modules.serviceCategory.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.nu.modules.ServiceType.entity.ConfigServiceType;
|
||||
import com.nu.modules.ServiceType.service.IConfigServiceTypeService;
|
||||
import com.nu.modules.serviceCategory.entity.ConfigServiceCategory;
|
||||
import com.nu.modules.serviceCategory.mapper.ConfigServiceCategoryMapper;
|
||||
import com.nu.modules.serviceCategory.service.IConfigServiceCategoryService;
|
||||
import com.nu.modules.serviceDirective.entity.ConfigServiceDirective;
|
||||
import com.nu.modules.serviceDirective.service.IConfigServiceDirectiveService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 服务类别
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ConfigServiceCategoryServiceImpl extends ServiceImpl<ConfigServiceCategoryMapper, ConfigServiceCategory> implements IConfigServiceCategoryService {
|
||||
|
||||
@Autowired
|
||||
private IConfigServiceTypeService configServiceTypeService;
|
||||
@Autowired
|
||||
private IConfigServiceDirectiveService configServiceDirectiveService;
|
||||
|
||||
@Override
|
||||
public boolean isUsed(String ids) {
|
||||
if (StringUtils.isBlank(ids)) {
|
||||
return false;
|
||||
}
|
||||
boolean result = false;
|
||||
//是否已被服务类型使用
|
||||
LambdaQueryWrapper<ConfigServiceType> configServiceTypeLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
configServiceTypeLambdaQueryWrapper.in(ConfigServiceType::getCategoryId, Arrays.asList(ids.split(",")));
|
||||
configServiceTypeLambdaQueryWrapper.eq(ConfigServiceType::getDelFlag, "0");
|
||||
List<ConfigServiceType> configServiceTypes = configServiceTypeService.list(configServiceTypeLambdaQueryWrapper);
|
||||
if (configServiceTypes == null || configServiceTypes.isEmpty()) {
|
||||
//是否已被服务指令使用
|
||||
LambdaQueryWrapper<ConfigServiceDirective> configServiceDirectiveLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
configServiceDirectiveLambdaQueryWrapper.in(ConfigServiceDirective::getCategoryId, Arrays.asList(ids.split(",")));
|
||||
configServiceDirectiveLambdaQueryWrapper.eq(ConfigServiceDirective::getDelFlag, "0");
|
||||
List<ConfigServiceDirective> configServiceDirectives = configServiceDirectiveService.list(configServiceDirectiveLambdaQueryWrapper);
|
||||
if (!(configServiceDirectives == null || configServiceDirectives.isEmpty())) {
|
||||
result = true;
|
||||
}
|
||||
} else {
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,6 +90,8 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
|
|||
configServiceDirectiveService.save(configServiceDirective);
|
||||
if (StringUtils.isNotBlank(configServiceDirective.getTags())) {
|
||||
configServiceDirectiveService.saveTags(configServiceDirective);
|
||||
}else{
|
||||
configServiceDirectiveService.removeTags(configServiceDirective);
|
||||
}
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
@ -108,6 +110,8 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
|
|||
configServiceDirectiveService.updateById(configServiceDirective);
|
||||
if (StringUtils.isNotBlank(configServiceDirective.getTags())) {
|
||||
configServiceDirectiveService.saveTags(configServiceDirective);
|
||||
}else{
|
||||
configServiceDirectiveService.removeTags(configServiceDirective);
|
||||
}
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
|
|
@ -141,5 +141,6 @@ public class ConfigServiceDirective implements Serializable {
|
|||
private String tags;
|
||||
|
||||
//服务指令标签
|
||||
@TableField(exist = false)
|
||||
List<DirectiveTag> tagList;
|
||||
}
|
||||
|
|
|
@ -34,4 +34,10 @@ public interface ConfigServiceDirectiveMapper extends BaseMapper<ConfigServiceDi
|
|||
int deleteTags(@Param("directive") ConfigServiceDirective configServiceDirective);
|
||||
|
||||
int saveTags(@Param("directive") ConfigServiceDirective configServiceDirective);
|
||||
|
||||
/**
|
||||
* 查询指令标签是否被使用
|
||||
* @return
|
||||
*/
|
||||
int queryCountByTagIds(@Param("tagIds") List<String> tagIds);
|
||||
}
|
||||
|
|
|
@ -75,69 +75,13 @@
|
|||
</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>-->
|
||||
|
||||
<select id="queryCountByTagIds" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*) FROM directive_tag WHERE tag_id IN
|
||||
<foreach collection="tagIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<delete id="deleteTags">
|
||||
delete
|
||||
|
|
|
@ -26,4 +26,10 @@ public interface IConfigServiceDirectiveService extends IService<ConfigServiceDi
|
|||
* @param configServiceDirective
|
||||
*/
|
||||
void saveTags(ConfigServiceDirective configServiceDirective);
|
||||
|
||||
/**
|
||||
* 移除改服务指令下指令标签
|
||||
* @param configServiceDirective
|
||||
*/
|
||||
void removeTags(ConfigServiceDirective configServiceDirective);
|
||||
}
|
||||
|
|
|
@ -170,4 +170,13 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
|
|||
baseMapper.deleteTags(configServiceDirective);
|
||||
baseMapper.saveTags(configServiceDirective);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除改服务指令下指令标签
|
||||
* @param configServiceDirective
|
||||
*/
|
||||
@Override
|
||||
public void removeTags(ConfigServiceDirective configServiceDirective) {
|
||||
baseMapper.deleteTags(configServiceDirective);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue