服务指令
This commit is contained in:
parent
8efe4f112f
commit
aae6048da2
|
@ -0,0 +1,168 @@
|
|||
package com.nu.modules.directivetag.body.controller;
|
||||
|
||||
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.nu.modules.directivetag.body.entity.DirectiveBodyTag;
|
||||
import com.nu.modules.directivetag.body.service.IDirectiveBodyTagService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 体型标签
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="体型标签")
|
||||
@RestController
|
||||
@RequestMapping("/services/directiveTag/bodyTag")
|
||||
@Slf4j
|
||||
public class DirectiveBodyTagController extends JeecgController<DirectiveBodyTag, IDirectiveBodyTagService> {
|
||||
@Autowired
|
||||
private IDirectiveBodyTagService directiveTagService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param directiveTag
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "体型标签-分页列表查询")
|
||||
@ApiOperation(value="体型标签-分页列表查询", notes="体型标签-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<DirectiveBodyTag>> queryPageList(DirectiveBodyTag directiveTag,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
// 自定义查询规则
|
||||
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
|
||||
// 自定义多选的查询规则为:LIKE_WITH_OR
|
||||
customeRuleMap.put("izEnabled", QueryRuleEnum.LIKE_WITH_OR);
|
||||
QueryWrapper<DirectiveBodyTag> queryWrapper = QueryGenerator.initQueryWrapper(directiveTag, req.getParameterMap(),customeRuleMap);
|
||||
Page<DirectiveBodyTag> page = new Page<DirectiveBodyTag>(pageNo, pageSize);
|
||||
IPage<DirectiveBodyTag> pageList = directiveTagService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param directiveTag
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "体型标签-添加")
|
||||
@ApiOperation(value="体型标签-添加", notes="体型标签-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody DirectiveBodyTag directiveTag) {
|
||||
directiveTagService.save(directiveTag);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param directiveTag
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "体型标签-编辑")
|
||||
@ApiOperation(value="体型标签-编辑", notes="体型标签-编辑")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody DirectiveBodyTag directiveTag) {
|
||||
directiveTagService.updateById(directiveTag);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "体型标签-通过id删除")
|
||||
@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("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "体型标签-批量删除")
|
||||
@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("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "体型标签-通过id查询")
|
||||
@ApiOperation(value="体型标签-通过id查询", notes="体型标签-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<DirectiveBodyTag> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
DirectiveBodyTag directiveTag = directiveTagService.getById(id);
|
||||
if(directiveTag==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(directiveTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param directiveTag
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, DirectiveBodyTag directiveTag) {
|
||||
return super.exportXls(request, directiveTag, DirectiveBodyTag.class, "体型标签");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, DirectiveBodyTag.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package com.nu.modules.directivetag.body.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 体型标签
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("nu_config_body_tag")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="nu_config_body_tag对象", description="体型标签")
|
||||
public class DirectiveBodyTag implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private String id;
|
||||
/**标签名称*/
|
||||
@Excel(name = "标签名称", width = 15)
|
||||
@ApiModelProperty(value = "标签名称")
|
||||
private String tagName;
|
||||
/**排序*/
|
||||
@Excel(name = "排序", width = 15)
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
/**是否启用 0启用 1未启用*/
|
||||
@Excel(name = "是否启用", width = 15, dicCode = "iz_enabled")
|
||||
@Dict(dicCode = "iz_enabled")
|
||||
@ApiModelProperty(value = "是否启用")
|
||||
private String izEnabled;
|
||||
/**是否删除 0未删除 1删除*/
|
||||
@Excel(name = "是否删除", width = 15)
|
||||
@ApiModelProperty(value = "是否删除")
|
||||
@TableLogic
|
||||
private String delFlag;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.nu.modules.directivetag.body.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 服务指令-体型标签中间表
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-4-23 09:26:04
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("nu_directive_body_tag")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="nu_directive_body_tag对象", description="服务指令-体型标签中间表")
|
||||
public class DirectiveBodyTagRelation implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String directiveId;
|
||||
private String tagId;
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.nu.modules.directivetag.body.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nu.modules.directivetag.body.entity.DirectiveBodyTag;
|
||||
import com.nu.modules.directivetag.body.entity.DirectiveBodyTagRelation;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 体型标签
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface DirectiveBodyTagMapper extends BaseMapper<DirectiveBodyTag> {
|
||||
|
||||
List<DirectiveBodyTag> selectAll(@Param("ids") List<String> ids,@Param("excludeIds") List<String> excludeIds);
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.nu.modules.directivetag.body.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nu.modules.directivetag.body.entity.DirectiveBodyTagRelation;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 体型标签
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface DirectiveBodyTagRelationMapper extends BaseMapper<DirectiveBodyTagRelation> {
|
||||
void removeAll();
|
||||
|
||||
void removeAllRelation();
|
||||
|
||||
List<DirectiveBodyTagRelation> selectAllRelation(@Param("ids") List<String> ids,@Param("excludeIds") List<String> excludeIds);
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nu.modules.directivetag.body.mapper.DirectiveBodyTagMapper">
|
||||
|
||||
<select id="selectAll" resultType="com.nu.modules.directivetag.body.entity.DirectiveBodyTag">
|
||||
select distinct b.* from nu_config_body_tag b left join nu_directive_body_tag d on b.id = d.tag_id
|
||||
<where>
|
||||
d.directive_id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
<if test="excludeIds != null and excludeIds.size() > 0">
|
||||
AND b.id not in
|
||||
<foreach collection="excludeIds" item="excludeId" open="(" separator="," close=")">
|
||||
#{excludeId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nu.modules.directivetag.body.mapper.DirectiveBodyTagRelationMapper">
|
||||
<delete id="removeAll">
|
||||
delete from nu_config_body_tag
|
||||
</delete>
|
||||
|
||||
<delete id="removeAllRelation">
|
||||
delete from nu_directive_body_tag
|
||||
</delete>
|
||||
|
||||
<select id="selectAllRelation" resultType="com.nu.modules.directivetag.body.entity.DirectiveBodyTagRelation">
|
||||
select * from nu_directive_body_tag
|
||||
<where>
|
||||
directive_id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
<if test="excludeIds != null and excludeIds.size() > 0">
|
||||
AND tag_id not in
|
||||
<foreach collection="excludeIds" item="excludeId" open="(" separator="," close=")">
|
||||
#{excludeId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,33 @@
|
|||
package com.nu.modules.directivetag.body.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nu.modules.directivetag.body.entity.DirectiveBodyTag;
|
||||
import com.nu.modules.directivetag.body.entity.DirectiveBodyTagRelation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 体型标签
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IDirectiveBodyTagService extends IService<DirectiveBodyTag> {
|
||||
|
||||
/**
|
||||
* 查询数据是否已被使用
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
boolean isUsed(String id);
|
||||
|
||||
public void removeAllRelation();
|
||||
|
||||
public List<DirectiveBodyTagRelation> selectAllRelation(String dataSourceCode, List<String> ids,List<String> excludeIds);
|
||||
|
||||
void insertAllRelation(List<DirectiveBodyTagRelation> relations);
|
||||
|
||||
List<DirectiveBodyTag> selectAll(String dataSourceCode, List<String> ids,List<String> excludeIds);
|
||||
|
||||
void insertAll(List<DirectiveBodyTag> bodyAll);
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package com.nu.modules.directivetag.body.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nu.modules.directivetag.body.entity.DirectiveBodyTag;
|
||||
import com.nu.modules.directivetag.body.entity.DirectiveBodyTagRelation;
|
||||
import com.nu.modules.directivetag.body.mapper.DirectiveBodyTagMapper;
|
||||
import com.nu.modules.directivetag.body.mapper.DirectiveBodyTagRelationMapper;
|
||||
import com.nu.modules.directivetag.body.service.IDirectiveBodyTagService;
|
||||
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 java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 体型标签
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DirectiveBodyTagServiceImpl extends ServiceImpl<DirectiveBodyTagMapper, DirectiveBodyTag> implements IDirectiveBodyTagService {
|
||||
|
||||
@Autowired
|
||||
private ConfigServiceDirectiveMapper serviceDirectiveMapper;
|
||||
@Autowired
|
||||
private DirectiveBodyTagRelationMapper tagRelationMapper;
|
||||
|
||||
@Override
|
||||
public boolean isUsed(String ids) {
|
||||
if (StringUtils.isBlank(ids)) {
|
||||
return false;
|
||||
}
|
||||
boolean result = false;
|
||||
//是否已被服务指令使用
|
||||
int i = serviceDirectiveMapper.queryCountByBodyTagIds(Arrays.asList(ids.split(",")));
|
||||
if (i > 0) {
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAllRelation() {
|
||||
tagRelationMapper.removeAll();
|
||||
tagRelationMapper.removeAllRelation();
|
||||
}
|
||||
|
||||
@Override
|
||||
@DS("#dataSourceCode")
|
||||
public List<DirectiveBodyTagRelation> selectAllRelation(String dataSourceCode, List<String> ids,List<String> excludeIds) {
|
||||
return tagRelationMapper.selectAllRelation(ids,excludeIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertAllRelation(List<DirectiveBodyTagRelation> idRelations) {
|
||||
idRelations.forEach(ir -> {
|
||||
tagRelationMapper.insert(ir);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@DS("#dataSourceCode")
|
||||
public List<DirectiveBodyTag> selectAll(String dataSourceCode, List<String> ids,List<String> excludeIds) {
|
||||
return baseMapper.selectAll(ids,excludeIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertAll(List<DirectiveBodyTag> bodyAll) {
|
||||
bodyAll.forEach(b -> {
|
||||
baseMapper.insert(b);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,168 @@
|
|||
package com.nu.modules.directivetag.emotion.controller;
|
||||
|
||||
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.nu.modules.directivetag.emotion.entity.DirectiveEmotionTag;
|
||||
import com.nu.modules.directivetag.emotion.service.IDirectiveEmotionTagService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 情绪标签
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="情绪标签")
|
||||
@RestController
|
||||
@RequestMapping("/services/directiveTag/emotionTag")
|
||||
@Slf4j
|
||||
public class DirectiveEmotionTagController extends JeecgController<DirectiveEmotionTag, IDirectiveEmotionTagService> {
|
||||
@Autowired
|
||||
private IDirectiveEmotionTagService directiveTagService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param directiveTag
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "情绪标签-分页列表查询")
|
||||
@ApiOperation(value="情绪标签-分页列表查询", notes="情绪标签-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<DirectiveEmotionTag>> queryPageList(DirectiveEmotionTag directiveTag,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
// 自定义查询规则
|
||||
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
|
||||
// 自定义多选的查询规则为:LIKE_WITH_OR
|
||||
customeRuleMap.put("izEnabled", QueryRuleEnum.LIKE_WITH_OR);
|
||||
QueryWrapper<DirectiveEmotionTag> queryWrapper = QueryGenerator.initQueryWrapper(directiveTag, req.getParameterMap(),customeRuleMap);
|
||||
Page<DirectiveEmotionTag> page = new Page<DirectiveEmotionTag>(pageNo, pageSize);
|
||||
IPage<DirectiveEmotionTag> pageList = directiveTagService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param directiveTag
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "情绪标签-添加")
|
||||
@ApiOperation(value="情绪标签-添加", notes="情绪标签-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody DirectiveEmotionTag directiveTag) {
|
||||
directiveTagService.save(directiveTag);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param directiveTag
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "情绪标签-编辑")
|
||||
@ApiOperation(value="情绪标签-编辑", notes="情绪标签-编辑")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody DirectiveEmotionTag directiveTag) {
|
||||
directiveTagService.updateById(directiveTag);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "情绪标签-通过id删除")
|
||||
@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("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "情绪标签-批量删除")
|
||||
@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("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "情绪标签-通过id查询")
|
||||
@ApiOperation(value="情绪标签-通过id查询", notes="情绪标签-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<DirectiveEmotionTag> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
DirectiveEmotionTag directiveTag = directiveTagService.getById(id);
|
||||
if(directiveTag==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(directiveTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param directiveTag
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, DirectiveEmotionTag directiveTag) {
|
||||
return super.exportXls(request, directiveTag, DirectiveEmotionTag.class, "情绪标签");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, DirectiveEmotionTag.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package com.nu.modules.directivetag.emotion.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 情绪标签
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("nu_config_emotion_tag")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="nu_config_emotion_tag对象", description="情绪标签")
|
||||
public class DirectiveEmotionTag implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private java.lang.String id;
|
||||
/**标签名称*/
|
||||
@Excel(name = "标签名称", width = 15)
|
||||
@ApiModelProperty(value = "标签名称")
|
||||
private java.lang.String tagName;
|
||||
/**排序*/
|
||||
@Excel(name = "排序", width = 15)
|
||||
@ApiModelProperty(value = "排序")
|
||||
private java.lang.Integer sort;
|
||||
/**是否启用 0启用 1未启用*/
|
||||
@Excel(name = "是否启用", width = 15, dicCode = "iz_enabled")
|
||||
@Dict(dicCode = "iz_enabled")
|
||||
@ApiModelProperty(value = "是否启用")
|
||||
private java.lang.String izEnabled;
|
||||
/**是否删除 0未删除 1删除*/
|
||||
@Excel(name = "是否删除", width = 15)
|
||||
@ApiModelProperty(value = "是否删除")
|
||||
@TableLogic
|
||||
private java.lang.String delFlag;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.nu.modules.directivetag.emotion.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 服务指令-情绪标签中间表
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-4-23 09:26:04
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("nu_directive_emotion_tag")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="nu_directive_emotion_tag对象", description="服务指令-情绪标签中间表")
|
||||
public class DirectiveEmotionTagRelation implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String directiveId;
|
||||
private String tagId;
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.nu.modules.directivetag.emotion.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTag;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 情绪标签
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface DirectiveEmotionTagMapper extends BaseMapper<DirectiveEmotionTag> {
|
||||
|
||||
List<DirectiveEmotionTag> selectAll(@Param("ids") List<String> ids, @Param("excludeIds") List<String> excludeIds);
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.nu.modules.directivetag.emotion.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTagRelation;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 情绪标签
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface DirectiveEmotionTagRelationMapper extends BaseMapper<DirectiveEmotionTagRelation> {
|
||||
|
||||
void removeAll();
|
||||
|
||||
void removeAllRelation();
|
||||
|
||||
List<DirectiveEmotionTagRelation> selectAllRelation(@Param("ids") List<String> ids, @Param("excludeIds") List<String> excludeIds);
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nu.modules.directivetag.emotion.mapper.DirectiveEmotionTagMapper">
|
||||
<select id="selectAll" resultType="com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTag">
|
||||
select distinct e.* from nu_config_emotion_tag e left join nu_directive_emotion_tag d on e.id = d.tag_id
|
||||
<where>
|
||||
directive_id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
<if test="excludeIds != null and excludeIds.size() > 0">
|
||||
AND e.id not in
|
||||
<foreach collection="excludeIds" item="excludeId" open="(" separator="," close=")">
|
||||
#{excludeId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nu.modules.directivetag.emotion.mapper.DirectiveEmotionTagRelationMapper">
|
||||
<delete id="removeAll">
|
||||
delete
|
||||
from nu_config_emotion_tag
|
||||
</delete>
|
||||
<delete id="removeAllRelation">
|
||||
delete
|
||||
from nu_directive_emotion_tag
|
||||
</delete>
|
||||
<select id="selectAllRelation" resultType="com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTagRelation">
|
||||
select * from nu_directive_emotion_tag
|
||||
<where>
|
||||
directive_id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
<if test="excludeIds != null and excludeIds.size() > 0">
|
||||
AND tag_id not in
|
||||
<foreach collection="excludeIds" item="excludeId" open="(" separator="," close=")">
|
||||
#{excludeId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,33 @@
|
|||
package com.nu.modules.directivetag.emotion.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTag;
|
||||
import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTagRelation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 情绪标签
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IDirectiveEmotionTagService extends IService<DirectiveEmotionTag> {
|
||||
|
||||
/**
|
||||
* 查询数据是否已被使用
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
boolean isUsed(String id);
|
||||
|
||||
public void removeAllRelation();
|
||||
|
||||
public List<DirectiveEmotionTagRelation> selectAllRelation(String dataSourceCode, List<String> ids,List<String> excludeIds);
|
||||
|
||||
void insertAllRelation(List<DirectiveEmotionTagRelation> relations);
|
||||
|
||||
List<DirectiveEmotionTag> selectAll(String dataSourceCode, List<String> ids,List<String> excludeIds);
|
||||
|
||||
void insertAll(List<DirectiveEmotionTag> emoRelations);
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package com.nu.modules.directivetag.emotion.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTag;
|
||||
import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTagRelation;
|
||||
import com.nu.modules.directivetag.emotion.mapper.DirectiveEmotionTagMapper;
|
||||
import com.nu.modules.directivetag.emotion.mapper.DirectiveEmotionTagRelationMapper;
|
||||
import com.nu.modules.directivetag.emotion.service.IDirectiveEmotionTagService;
|
||||
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 java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 情绪标签
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class DirectiveEmotionTagServiceImpl extends ServiceImpl<DirectiveEmotionTagMapper, DirectiveEmotionTag> implements IDirectiveEmotionTagService {
|
||||
|
||||
@Autowired
|
||||
private ConfigServiceDirectiveMapper serviceDirectiveMapper;
|
||||
@Autowired
|
||||
private DirectiveEmotionTagRelationMapper tagRelationMapper;
|
||||
|
||||
@Override
|
||||
public boolean isUsed(String ids) {
|
||||
if (StringUtils.isBlank(ids)) {
|
||||
return false;
|
||||
}
|
||||
boolean result = false;
|
||||
//是否已被服务指令使用
|
||||
int i = serviceDirectiveMapper.queryCountByEmotionTagIds(Arrays.asList(ids.split(",")));
|
||||
if (i > 0) {
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAllRelation() {
|
||||
tagRelationMapper.removeAll();
|
||||
tagRelationMapper.removeAllRelation();
|
||||
}
|
||||
|
||||
@Override
|
||||
@DS("#dataSourceCode")
|
||||
public List<DirectiveEmotionTagRelation> selectAllRelation(String dataSourceCode, List<String> ids, List<String> excludeIds) {
|
||||
return tagRelationMapper.selectAllRelation(ids, excludeIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertAllRelation(List<DirectiveEmotionTagRelation> idRelations) {
|
||||
idRelations.forEach(ir -> {
|
||||
tagRelationMapper.insert(ir);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@DS("#dataSourceCode")
|
||||
public List<DirectiveEmotionTag> selectAll(String dataSourceCode, List<String> ids, List<String> excludeIds) {
|
||||
return baseMapper.selectAll(ids, excludeIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertAll(List<DirectiveEmotionTag> emoRelations) {
|
||||
emoRelations.forEach(e -> {
|
||||
baseMapper.insert(e);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,168 @@
|
|||
package com.nu.modules.servicecategory.controller;
|
||||
|
||||
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.nu.modules.servicecategory.entity.ConfigServiceCategory;
|
||||
import com.nu.modules.servicecategory.service.IConfigServiceCategoryService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 服务类别
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="服务类别")
|
||||
@RestController
|
||||
@RequestMapping("/services/serviceCategory/configServiceCategory")
|
||||
@Slf4j
|
||||
public class ConfigServiceCategoryController extends JeecgController<ConfigServiceCategory, IConfigServiceCategoryService> {
|
||||
@Autowired
|
||||
private IConfigServiceCategoryService configServiceCategoryService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param configServiceCategory
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "服务类别-分页列表查询")
|
||||
@ApiOperation(value="服务类别-分页列表查询", notes="服务类别-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<ConfigServiceCategory>> queryPageList(ConfigServiceCategory configServiceCategory,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
// 自定义查询规则
|
||||
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
|
||||
// 自定义多选的查询规则为:LIKE_WITH_OR
|
||||
customeRuleMap.put("izEnabled", QueryRuleEnum.LIKE_WITH_OR);
|
||||
QueryWrapper<ConfigServiceCategory> queryWrapper = QueryGenerator.initQueryWrapper(configServiceCategory, req.getParameterMap(),customeRuleMap);
|
||||
Page<ConfigServiceCategory> page = new Page<ConfigServiceCategory>(pageNo, pageSize);
|
||||
IPage<ConfigServiceCategory> pageList = configServiceCategoryService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param configServiceCategory
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "服务类别-添加")
|
||||
@ApiOperation(value="服务类别-添加", notes="服务类别-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody ConfigServiceCategory configServiceCategory) {
|
||||
configServiceCategoryService.save(configServiceCategory);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param configServiceCategory
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "服务类别-编辑")
|
||||
@ApiOperation(value="服务类别-编辑", notes="服务类别-编辑")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody ConfigServiceCategory configServiceCategory) {
|
||||
configServiceCategoryService.updateById(configServiceCategory);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "服务类别-通过id删除")
|
||||
@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("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "服务类别-批量删除")
|
||||
@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("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "服务类别-通过id查询")
|
||||
@ApiOperation(value="服务类别-通过id查询", notes="服务类别-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<ConfigServiceCategory> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
ConfigServiceCategory configServiceCategory = configServiceCategoryService.getById(id);
|
||||
if(configServiceCategory==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(configServiceCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param configServiceCategory
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, ConfigServiceCategory configServiceCategory) {
|
||||
return super.exportXls(request, configServiceCategory, ConfigServiceCategory.class, "服务类别");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, ConfigServiceCategory.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package com.nu.modules.servicecategory.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 服务类别
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("nu_config_service_category")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="nu_config_service_category对象", description="服务类别")
|
||||
public class ConfigServiceCategory implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private java.lang.String id;
|
||||
/**分类标签id*/
|
||||
@Excel(name = "分类标签id", width = 15)
|
||||
@ApiModelProperty(value = "分类标签id")
|
||||
@Dict(dicCode = "id" , dictTable = "nu_config_service_instruction_tag" , dicText = "instruction_name")
|
||||
private java.lang.String instructionId;
|
||||
/**服务类别名称*/
|
||||
@Excel(name = "服务类别名称", width = 15)
|
||||
@ApiModelProperty(value = "服务类别名称")
|
||||
private java.lang.String categoryName;
|
||||
/**排序*/
|
||||
@Excel(name = "排序", width = 15)
|
||||
@ApiModelProperty(value = "排序")
|
||||
private java.lang.Integer sort;
|
||||
/**是否启用 0启用 1未启用*/
|
||||
@Excel(name = "是否启用", width = 15)
|
||||
@ApiModelProperty(value = "是否启用")
|
||||
@Dict(dicCode = "iz_enabled")
|
||||
private java.lang.String izEnabled;
|
||||
/**是否删除 0未删除 1删除*/
|
||||
@Excel(name = "是否删除", width = 15)
|
||||
@ApiModelProperty(value = "是否删除")
|
||||
@TableLogic
|
||||
private java.lang.String delFlag;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.nu.modules.servicecategory.mapper;
|
||||
|
||||
import com.nu.modules.servicecategory.entity.ConfigServiceCategory;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 服务类别
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ConfigServiceCategoryMapper extends BaseMapper<ConfigServiceCategory> {
|
||||
|
||||
void removeAll();
|
||||
|
||||
List<ConfigServiceCategory> selectAll(@Param("ids") List<String> ids, @Param("excludeIds") List<String> excludeIds);
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nu.modules.servicecategory.mapper.ConfigServiceCategoryMapper">
|
||||
|
||||
<delete id="removeAll">
|
||||
delete from nu_config_service_category
|
||||
</delete>
|
||||
<select id="selectAll" resultType="com.nu.modules.servicecategory.entity.ConfigServiceCategory">
|
||||
select distinct c.* from nu_config_service_category c left join nu_config_service_directive d on c.id = d.category_id
|
||||
<where>
|
||||
d.id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
<if test="excludeIds != null and excludeIds.size() > 0">
|
||||
AND c.id not in
|
||||
<foreach collection="excludeIds" item="excludeId" open="(" separator="," close=")">
|
||||
#{excludeId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,29 @@
|
|||
package com.nu.modules.servicecategory.service;
|
||||
|
||||
import com.nu.modules.servicecategory.entity.ConfigServiceCategory;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 服务类别
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IConfigServiceCategoryService extends IService<ConfigServiceCategory> {
|
||||
|
||||
/**
|
||||
* 查询数据是否已被使用
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
boolean isUsed(String ids);
|
||||
|
||||
void removeAll();
|
||||
|
||||
List<ConfigServiceCategory> selectAll(String dataSourceCode, List<String> ids, List<String> excludeSubIds);
|
||||
|
||||
void insertAll(List<ConfigServiceCategory> categoryList);
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package com.nu.modules.servicecategory.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
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
|
||||
* @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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAll() {
|
||||
baseMapper.removeAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
@DS("#dataSourceCode")
|
||||
public List<ConfigServiceCategory> selectAll(String dataSourceCode, List<String> ids, List<String> excludeSubIds) {
|
||||
return baseMapper.selectAll(ids, excludeSubIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertAll(List<ConfigServiceCategory> categoryList) {
|
||||
categoryList.forEach(c -> {
|
||||
baseMapper.insert(c);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,233 @@
|
|||
package com.nu.modules.servicedirective.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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.nu.modules.servicedirective.entity.ConfigServiceDirective;
|
||||
import com.nu.modules.servicedirective.service.IConfigServiceDirectiveService;
|
||||
import com.nu.modules.sysconfig.ISysConfigApi;
|
||||
import com.nu.utils.RabbitMQUtil;
|
||||
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;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 服务指令
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags = "服务指令")
|
||||
@RestController
|
||||
@RequestMapping("/services/serviceDirective")
|
||||
@Slf4j
|
||||
public class ConfigServiceDirectiveController extends JeecgController<ConfigServiceDirective, IConfigServiceDirectiveService> {
|
||||
@Autowired
|
||||
private IConfigServiceDirectiveService configServiceDirectiveService;
|
||||
@Autowired
|
||||
private RabbitMQUtil rabbitMQUtil;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param configServiceDirective
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "服务指令-分页列表查询")
|
||||
@ApiOperation(value = "服务指令-分页列表查询", notes = "服务指令-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<ConfigServiceDirective>> queryPageList(ConfigServiceDirective configServiceDirective,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
|
||||
// 自定义多选的查询规则为:LIKE_WITH_OR
|
||||
customeRuleMap.put("categoryId", QueryRuleEnum.LIKE_WITH_OR);
|
||||
customeRuleMap.put("typeId", QueryRuleEnum.LIKE_WITH_OR);
|
||||
customeRuleMap.put("instructionTagId", QueryRuleEnum.LIKE_WITH_OR);
|
||||
customeRuleMap.put("izReimbursement", QueryRuleEnum.LIKE_WITH_OR);
|
||||
customeRuleMap.put("izPreferential", QueryRuleEnum.LIKE_WITH_OR);
|
||||
customeRuleMap.put("chargingFrequency", QueryRuleEnum.LIKE_WITH_OR);
|
||||
customeRuleMap.put("cycleType", QueryRuleEnum.LIKE_WITH_OR);
|
||||
customeRuleMap.put("izEnabled", QueryRuleEnum.LIKE_WITH_OR);
|
||||
QueryWrapper<ConfigServiceDirective> queryWrapper = QueryGenerator.initQueryWrapper(configServiceDirective, req.getParameterMap(), customeRuleMap);
|
||||
queryWrapper.select("id");
|
||||
//如果有服务指令需要提前查询下对应的服务指令id
|
||||
List<ConfigServiceDirective> directiveIds = null;
|
||||
if (StringUtils.isNotBlank(configServiceDirective.getBodyTags())) {
|
||||
directiveIds = configServiceDirectiveService.queryDirectiveIdByBodyTagIds(configServiceDirective.getBodyTags());
|
||||
if (directiveIds != null && !directiveIds.isEmpty()) {
|
||||
queryWrapper.in("id", directiveIds.stream().map(ConfigServiceDirective::getId).collect(Collectors.toList()));
|
||||
} else {
|
||||
//体重标签下没有数据
|
||||
queryWrapper.eq("id", "null");
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(configServiceDirective.getEmotionTags())) {
|
||||
directiveIds = configServiceDirectiveService.queryDirectiveIdByEmotionTagIds(configServiceDirective.getEmotionTags());
|
||||
if (directiveIds != null && !directiveIds.isEmpty() && StringUtils.isNotBlank(configServiceDirective.getEmotionTags())) {
|
||||
queryWrapper.in("id", directiveIds.stream().map(ConfigServiceDirective::getId).collect(Collectors.toList()));
|
||||
} else {
|
||||
//情绪标签下没有数据
|
||||
queryWrapper.eq("id", "null");
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param configServiceDirective
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "服务指令-添加")
|
||||
@ApiOperation(value = "服务指令-添加", notes = "服务指令-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody ConfigServiceDirective configServiceDirective) {
|
||||
//业务平台添加时无媒体资源 处理媒体资源(放在保存方法之前)
|
||||
// configServiceDirectiveService.handleMediaFile(configServiceDirective);
|
||||
//业务平台创建的数据初始状态为“未授权” iz_enabled = 2
|
||||
configServiceDirective.setIzEnabled("2");
|
||||
configServiceDirectiveService.save(configServiceDirective);
|
||||
if (StringUtils.isNotBlank(configServiceDirective.getBodyTags())) {
|
||||
configServiceDirectiveService.saveBodyTags(configServiceDirective);
|
||||
} else {
|
||||
configServiceDirectiveService.removeBodyTags(configServiceDirective);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(configServiceDirective.getEmotionTags())) {
|
||||
configServiceDirectiveService.saveEmotionTags(configServiceDirective);
|
||||
} else {
|
||||
configServiceDirectiveService.removeEmotionTags(configServiceDirective);
|
||||
}
|
||||
|
||||
//同步给管理平台
|
||||
// rabbitMQUtil.sendToExchange("hldy.directive.add", "hldy.directive.add", null);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param configServiceDirective
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "服务指令-编辑")
|
||||
@ApiOperation(value = "服务指令-编辑", notes = "服务指令-编辑")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody ConfigServiceDirective configServiceDirective) {
|
||||
//业务平台添加时无媒体资源 处理媒体资源(放在保存方法之前)
|
||||
// configServiceDirectiveService.handleMediaFile(configServiceDirective);
|
||||
configServiceDirectiveService.updateById(configServiceDirective);
|
||||
if (StringUtils.isNotBlank(configServiceDirective.getBodyTags())) {
|
||||
configServiceDirectiveService.saveBodyTags(configServiceDirective);
|
||||
} else {
|
||||
configServiceDirectiveService.removeBodyTags(configServiceDirective);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(configServiceDirective.getEmotionTags())) {
|
||||
configServiceDirectiveService.saveEmotionTags(configServiceDirective);
|
||||
} else {
|
||||
configServiceDirectiveService.removeEmotionTags(configServiceDirective);
|
||||
}
|
||||
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "服务指令-通过id删除")
|
||||
@ApiOperation(value = "服务指令-通过id删除", notes = "服务指令-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
configServiceDirectiveService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "服务指令-批量删除")
|
||||
@ApiOperation(value = "服务指令-批量删除", notes = "服务指令-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.configServiceDirectiveService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "服务指令-通过id查询")
|
||||
@ApiOperation(value = "服务指令-通过id查询", notes = "服务指令-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<ConfigServiceDirective> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
ConfigServiceDirective configServiceDirective = configServiceDirectiveService.getById(id);
|
||||
if (configServiceDirective == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(configServiceDirective);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param configServiceDirective
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, ConfigServiceDirective configServiceDirective) {
|
||||
return super.exportXls(request, configServiceDirective, ConfigServiceDirective.class, "服务指令");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, ConfigServiceDirective.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,196 @@
|
|||
package com.nu.modules.servicedirective.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.nu.modules.directivetag.body.entity.DirectiveBodyTag;
|
||||
import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTag;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 服务指令
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("nu_config_service_directive")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="nu_config_service_directive对象", description="服务指令")
|
||||
public class ConfigServiceDirective implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private java.lang.String id;
|
||||
/**服务类别id*/
|
||||
@Excel(name = "服务类别", width = 15)
|
||||
@ApiModelProperty(value = "服务类别")
|
||||
@Dict(dicCode = "id" , dictTable = "nu_config_service_category" , dicText = "category_name")
|
||||
private java.lang.String categoryId;
|
||||
/**服务类型id*/
|
||||
@Excel(name = "服务类型", width = 15)
|
||||
@ApiModelProperty(value = "服务类型")
|
||||
@Dict(dicCode = "id" , dictTable = "nu_config_service_type" , dicText = "type_name")
|
||||
private java.lang.String typeId;
|
||||
/**分类标签*/
|
||||
@Excel(name = "分类标签", width = 15)
|
||||
@ApiModelProperty(value = "分类标签")
|
||||
@Dict(dicCode = "id" , dictTable = "nu_config_service_instruction_tag" , dicText = "instruction_name")
|
||||
private java.lang.String instructionTagId;
|
||||
/**服务指令名称*/
|
||||
@Excel(name = "服务指令名称", width = 15)
|
||||
@ApiModelProperty(value = "服务指令名称")
|
||||
private java.lang.String directiveName;
|
||||
/**收费价格*/
|
||||
@Excel(name = "收费价格", width = 15)
|
||||
@ApiModelProperty(value = "收费价格")
|
||||
private java.math.BigDecimal tollPrice;
|
||||
/**提成价格*/
|
||||
@Excel(name = "提成价格", width = 15)
|
||||
@ApiModelProperty(value = "提成价格")
|
||||
private java.math.BigDecimal comPrice;
|
||||
/**是否参与医保报销 0不报销 1报销*/
|
||||
@Excel(name = "医保报销", width = 15)
|
||||
@ApiModelProperty(value = "医保报销")
|
||||
@Dict(dicCode = "med_ins_reimb" )
|
||||
private java.lang.String izReimbursement;
|
||||
/**是否参与机构优惠 0不参与 1参与*/
|
||||
@Excel(name = "机构优惠", width = 15)
|
||||
@ApiModelProperty(value = "机构优惠")
|
||||
@Dict(dicCode = "institutional_discount" )
|
||||
private java.lang.String izPreferential;
|
||||
/**收费频次 1按次收费 2按天收费*/
|
||||
@Excel(name = "收费频次", width = 15)
|
||||
@ApiModelProperty(value = "收费频次")
|
||||
@Dict(dicCode = "billing_frequency" )
|
||||
private java.lang.String chargingFrequency;
|
||||
/**周期类型 1日常护理 2周期护理 3即时护理*/
|
||||
@Excel(name = "周期类型", width = 15)
|
||||
@ApiModelProperty(value = "周期类型")
|
||||
@Dict(dicCode = "period_type" )
|
||||
private java.lang.String cycleType;
|
||||
/**排序*/
|
||||
@Excel(name = "排序", width = 15)
|
||||
@ApiModelProperty(value = "排序")
|
||||
private java.lang.Integer sort;
|
||||
/**服务描述*/
|
||||
@Excel(name = "服务描述", width = 15)
|
||||
@ApiModelProperty(value = "服务描述")
|
||||
private java.lang.String serviceContent;
|
||||
/**服务时长(分钟)*/
|
||||
@Excel(name = "服务时长(分钟)", width = 15)
|
||||
@ApiModelProperty(value = "服务时长(分钟)")
|
||||
private java.lang.String serviceDuration;
|
||||
/**是否启用 0启用 1未启用*/
|
||||
@Excel(name = "是否启用", width = 15)
|
||||
@ApiModelProperty(value = "是否启用")
|
||||
@Dict(dicCode = "directive_status")
|
||||
private java.lang.String izEnabled;
|
||||
/**是否删除*/
|
||||
@Excel(name = "是否删除", width = 15)
|
||||
@ApiModelProperty(value = "是否删除")
|
||||
@TableLogic
|
||||
private java.lang.String delFlag;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
/**指令音频文件*/
|
||||
@ApiModelProperty(value = "指令音频文件")
|
||||
private java.lang.String mp3File;
|
||||
//语音文件是否变更
|
||||
@TableField(exist = false)
|
||||
private boolean mp3FileChanged;
|
||||
/**指令视频文件*/
|
||||
@ApiModelProperty(value = "指令视频文件")
|
||||
private java.lang.String mp4File;
|
||||
//视频文件是否变更
|
||||
@TableField(exist = false)
|
||||
private boolean mp4FileChanged;
|
||||
/**服务指令图片*/
|
||||
@ApiModelProperty(value = "服务指令图片")
|
||||
private java.lang.String previewFile;
|
||||
//服务指令图片是否变更
|
||||
@TableField(exist = false)
|
||||
private boolean previewFileChanged;
|
||||
/**即时指令图标*/
|
||||
@ApiModelProperty(value = "即时指令图标")
|
||||
private java.lang.String immediateFile;
|
||||
//即时指令图标是否变更
|
||||
@TableField(exist = false)
|
||||
private boolean immediateFileChanged;
|
||||
|
||||
//合并单元格用:类别合并的行数
|
||||
@TableField(exist = false)
|
||||
private Integer categoryRowSpan;
|
||||
//合并单元格用:类型合并的行数
|
||||
@TableField(exist = false)
|
||||
private Integer typeRowSpan;
|
||||
//合并单元格用:分类标签合并的行数
|
||||
@TableField(exist = false)
|
||||
private Integer instructionRowSpan;
|
||||
//体型标签id,id,id
|
||||
@TableField(exist = false)
|
||||
private String bodyTags;
|
||||
//情绪标签id,id,id
|
||||
@TableField(exist = false)
|
||||
private String emotionTags;
|
||||
|
||||
|
||||
//体型标签
|
||||
@TableField(exist = false)
|
||||
List<DirectiveBodyTag> bodyTagList;
|
||||
//体型标签字符串
|
||||
@TableField(exist = false)
|
||||
private String bodyTagsName;
|
||||
|
||||
//情绪标签
|
||||
@TableField(exist = false)
|
||||
List<DirectiveEmotionTag> emotionTagList;
|
||||
//情绪标签字符串
|
||||
@TableField(exist = false)
|
||||
private String emotionTagsName;
|
||||
|
||||
//分类标签中文名称
|
||||
@TableField(exist = false)
|
||||
private String instructionName;
|
||||
//服务类别中文名称
|
||||
@TableField(exist = false)
|
||||
private String categoryName;
|
||||
//服务类型中文名称
|
||||
@TableField(exist = false)
|
||||
private String typeName;
|
||||
//周期类型中文名称
|
||||
@TableField(exist = false)
|
||||
private String cycleTypeName;
|
||||
//媒体资源存储路径名
|
||||
@TableField(exist = false)
|
||||
private String mediaFileSavePath;
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package com.nu.modules.servicedirective.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.nu.modules.servicedirective.entity.ConfigServiceDirective;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import retrofit2.http.DELETE;
|
||||
|
||||
/**
|
||||
* @Description: 服务指令
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ConfigServiceDirectiveMapper extends BaseMapper<ConfigServiceDirective> {
|
||||
/**
|
||||
* 自定义分页查询方法
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param directive 主查询对象(包含搜索条件)
|
||||
* @return 分页结果
|
||||
*/
|
||||
List<ConfigServiceDirective> pageList(
|
||||
@Param("directive") ConfigServiceDirective directive,
|
||||
@Param("ids") List<ConfigServiceDirective> records
|
||||
);
|
||||
// IPage<ConfigServiceDirective> pageList(
|
||||
// @Param("page") Page<ConfigServiceDirective> page,
|
||||
// @Param("directive") ConfigServiceDirective directive
|
||||
// );
|
||||
|
||||
int deleteBodyTags(@Param("directive") ConfigServiceDirective configServiceDirective);
|
||||
|
||||
int saveBodyTags(@Param("directive") ConfigServiceDirective configServiceDirective);
|
||||
|
||||
int deleteEmotionTags(@Param("directive") ConfigServiceDirective configServiceDirective);
|
||||
|
||||
int saveEmotionTags(@Param("directive") ConfigServiceDirective configServiceDirective);
|
||||
|
||||
/**
|
||||
* 根据体型标签查询对应的服务指令id
|
||||
* @return
|
||||
*/
|
||||
List<ConfigServiceDirective> queryDirectiveIdByBodyTagIds(@Param("tagIds") String tagIds);
|
||||
|
||||
/**
|
||||
* 根据情绪标签查询对应的服务指令id
|
||||
* @return
|
||||
*/
|
||||
List<ConfigServiceDirective> queryDirectiveIdByEmotionTagIds(@Param("tagIds") String tagIds);
|
||||
|
||||
/**
|
||||
* 查询体型标签是否被使用
|
||||
* @return
|
||||
*/
|
||||
int queryCountByBodyTagIds(@Param("tagIds") List<String> tagIds);
|
||||
|
||||
/**
|
||||
* 查询情绪标签是否被使用
|
||||
* @return
|
||||
*/
|
||||
int queryCountByEmotionTagIds(@Param("tagIds") List<String> tagIds);
|
||||
|
||||
int removeAll();
|
||||
}
|
|
@ -0,0 +1,148 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nu.modules.servicedirective.mapper.ConfigServiceDirectiveMapper">
|
||||
|
||||
<!-- 自定义结果映射 -->
|
||||
<resultMap id="ConfigServiceDirectiveResultMap"
|
||||
type="com.nu.modules.servicedirective.entity.ConfigServiceDirective">
|
||||
<id property="id" column="id"/>
|
||||
<result property="categoryId" column="category_id"/>
|
||||
<result property="typeId" column="type_id"/>
|
||||
<result property="instructionTagId" column="instruction_tag_id"/>
|
||||
<result property="directiveName" column="directive_name"/>
|
||||
<result property="tollPrice" column="toll_price"/>
|
||||
<result property="comPrice" column="com_price"/>
|
||||
<result property="izReimbursement" column="iz_reimbursement"/>
|
||||
<result property="izPreferential" column="iz_preferential"/>
|
||||
<result property="chargingFrequency" column="charging_frequency"/>
|
||||
<result property="cycleType" column="cycle_type"/>
|
||||
<result property="sort" column="sort"/>
|
||||
<result property="serviceContent" column="service_content"/>
|
||||
<result property="serviceDuration" column="service_duration"/>
|
||||
<result property="izEnabled" column="iz_enabled"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="sysOrgCode" column="sys_org_code"/>
|
||||
<result property="mp3File" column="mp3_file"/>
|
||||
<result property="mp4File" column="mp4_file"/>
|
||||
<result property="previewFile" column="preview_file"/>
|
||||
<result property="immediateFile" column="immediate_file"/>
|
||||
|
||||
<collection property="bodyTagList" ofType="com.nu.modules.directivetag.body.entity.DirectiveBodyTag">
|
||||
<id property="id" column="bodyTagId"/>
|
||||
<result property="tagName" column="bodyTagName"/>
|
||||
</collection>
|
||||
|
||||
<collection property="emotionTagList" ofType="com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTag">
|
||||
<id property="id" column="emotionTagId"/>
|
||||
<result property="tagName" column="emotionTagName"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<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,
|
||||
c.preview_file,
|
||||
c.immediate_file,
|
||||
bodytag.id as bodyTagId,
|
||||
bodytag.tag_name as bodyTagName,
|
||||
emotag.id as emotionTagId,
|
||||
emotag.tag_name as emotionTagName
|
||||
FROM nu_config_service_directive c
|
||||
LEFT JOIN nu_directive_body_tag dbt ON c.id = dbt.directive_id
|
||||
LEFT JOIN nu_config_body_tag bodytag ON dbt.tag_id = bodytag.id
|
||||
LEFT JOIN nu_directive_emotion_tag det ON c.id = det.directive_id
|
||||
LEFT JOIN nu_config_emotion_tag emotag ON det.tag_id = emotag.id
|
||||
<where>
|
||||
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="queryDirectiveIdByBodyTagIds" resultType="com.nu.modules.servicedirective.entity.ConfigServiceDirective">
|
||||
SELECT distinct directive_id as id FROM nu_directive_body_tag WHERE tag_id IN
|
||||
<foreach collection="tagIds.split(',')" item="tagId" open="(" separator="," close=")">
|
||||
#{tagId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="queryDirectiveIdByEmotionTagIds" resultType="com.nu.modules.servicedirective.entity.ConfigServiceDirective">
|
||||
SELECT distinct directive_id as id FROM nu_directive_emotion_tag WHERE tag_id IN
|
||||
<foreach collection="tagIds.split(',')" item="tagId" open="(" separator="," close=")">
|
||||
#{tagId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="queryCountByBodyTagIds" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*) FROM nu_directive_body_tag WHERE tag_id IN
|
||||
<foreach collection="tagIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="queryCountByEmotionTagIds" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*) FROM nu_directive_emotion_tag WHERE tag_id IN
|
||||
<foreach collection="tagIds" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<delete id="deleteBodyTags">
|
||||
delete
|
||||
from nu_directive_body_tag
|
||||
where directive_id = #{directive.id}
|
||||
</delete>
|
||||
|
||||
<insert id="saveBodyTags">
|
||||
insert into nu_directive_body_tag (directive_id,tag_id) values
|
||||
<foreach collection="directive.bodyTags.split(',')" item="tagId" separator=",">
|
||||
(#{directive.id}, #{tagId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteEmotionTags">
|
||||
delete
|
||||
from nu_directive_emotion_tag
|
||||
where directive_id = #{directive.id}
|
||||
</delete>
|
||||
|
||||
<insert id="saveEmotionTags">
|
||||
insert into nu_directive_emotion_tag (directive_id,tag_id) values
|
||||
<foreach collection="directive.emotionTags.split(',')" item="tagId" separator=",">
|
||||
(#{directive.id}, #{tagId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="removeAll">
|
||||
delete from nu_config_service_directive
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,61 @@
|
|||
package com.nu.modules.servicedirective.service;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nu.modules.servicedirective.entity.ConfigServiceDirective;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 服务指令
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IConfigServiceDirectiveService extends IService<ConfigServiceDirective> {
|
||||
|
||||
void merge(List<ConfigServiceDirective> records);
|
||||
|
||||
List<ConfigServiceDirective> pageList(ConfigServiceDirective configServiceDirective, IPage<ConfigServiceDirective> list);
|
||||
|
||||
/**
|
||||
* 存储体型标签数据
|
||||
*
|
||||
* @param configServiceDirective
|
||||
*/
|
||||
void saveBodyTags(ConfigServiceDirective configServiceDirective);
|
||||
|
||||
/**
|
||||
* 存储情绪标签数据
|
||||
*
|
||||
* @param configServiceDirective
|
||||
*/
|
||||
void saveEmotionTags(ConfigServiceDirective configServiceDirective);
|
||||
|
||||
/**
|
||||
* 移除改服务指令下体型标签
|
||||
*
|
||||
* @param configServiceDirective
|
||||
*/
|
||||
void removeBodyTags(ConfigServiceDirective configServiceDirective);
|
||||
|
||||
/**
|
||||
* 移除改服务指令下情绪标签
|
||||
*
|
||||
* @param configServiceDirective
|
||||
*/
|
||||
void removeEmotionTags(ConfigServiceDirective configServiceDirective);
|
||||
|
||||
List<ConfigServiceDirective> queryDirectiveIdByBodyTagIds(String tags);
|
||||
|
||||
List<ConfigServiceDirective> queryDirectiveIdByEmotionTagIds(String tags);
|
||||
|
||||
void removeAll();
|
||||
|
||||
List<ConfigServiceDirective> selectAllByIds(String dataSourceCode, List<String> idList);
|
||||
|
||||
void insertAllDirectives(List<ConfigServiceDirective> directives);
|
||||
|
||||
void handleMediaFile(ConfigServiceDirective configServiceDirective);
|
||||
}
|
|
@ -0,0 +1,325 @@
|
|||
package com.nu.modules.servicedirective.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nu.modules.directivetag.body.entity.DirectiveBodyTag;
|
||||
import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTag;
|
||||
import com.nu.modules.servicedirective.entity.ConfigServiceDirective;
|
||||
import com.nu.modules.servicedirective.mapper.ConfigServiceDirectiveMapper;
|
||||
import com.nu.modules.servicedirective.service.IConfigServiceDirectiveService;
|
||||
import com.nu.modules.sysconfig.ISysConfigApi;
|
||||
import com.nu.utils.RabbitMQUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 服务指令
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigServiceDirectiveMapper, ConfigServiceDirective> implements IConfigServiceDirectiveService {
|
||||
|
||||
@Value(value = "${jeecg.path.upload}")
|
||||
private String uploadpath;
|
||||
|
||||
@Autowired
|
||||
private ISysConfigApi sysConfigApi;
|
||||
@Autowired
|
||||
private ISysBaseAPI sysBaseAPI;
|
||||
@Autowired
|
||||
private RabbitMQUtil rabbitMQUtil;
|
||||
|
||||
@Override
|
||||
public List<ConfigServiceDirective> pageList(ConfigServiceDirective configServiceDirective, IPage<ConfigServiceDirective> list_) {
|
||||
if (list_.getRecords() == null || list_.getRecords().isEmpty()) {
|
||||
return list_.getRecords();
|
||||
}
|
||||
List<ConfigServiceDirective> list = baseMapper.pageList(configServiceDirective, list_.getRecords());
|
||||
//处理服务标签字段
|
||||
if (list != null && !list.isEmpty()) {
|
||||
list.stream().forEach(record -> {
|
||||
List<DirectiveBodyTag> bodyTagList = record.getBodyTagList();
|
||||
record.setBodyTags(bodyTagList.stream().map(DirectiveBodyTag::getId).collect(Collectors.joining(",")));
|
||||
|
||||
List<DirectiveEmotionTag> emotionTagList = record.getEmotionTagList();
|
||||
record.setEmotionTags(emotionTagList.stream().map(DirectiveEmotionTag::getId).collect(Collectors.joining(",")));
|
||||
});
|
||||
}
|
||||
//处理单元格合并所需数据
|
||||
merge(list);
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主合并方法
|
||||
*
|
||||
* @param records 已排序的记录列表(需先按categoryId→typeId→instructionTagId排序)
|
||||
*/
|
||||
@Override
|
||||
public void merge(List<ConfigServiceDirective> records) {
|
||||
if (records == null || records.isEmpty()) return;
|
||||
|
||||
int outerStart = 0; // 新一级分组(原三级)起始索引
|
||||
String currentInstructionId = records.get(0).getInstructionTagId();
|
||||
|
||||
// 新一级循环:遍历所有记录处理instructionTagId分组
|
||||
for (int i = 1; i < records.size(); i++) {
|
||||
if (!records.get(i).getInstructionTagId().equals(currentInstructionId)) {
|
||||
processAllGroups(records, outerStart, i - 1); // 处理完整个新一级分组
|
||||
outerStart = i;
|
||||
currentInstructionId = records.get(i).getInstructionTagId();
|
||||
}
|
||||
}
|
||||
processAllGroups(records, outerStart, records.size() - 1); // 处理最后一组
|
||||
}
|
||||
|
||||
private void processAllGroups(List<ConfigServiceDirective> records, int start, int end) {
|
||||
processOuterGroup(records, start, end); // 处理新一级instructionRowSpan
|
||||
|
||||
int middleStart = start; // 新二级分组起始索引
|
||||
String currentCategoryId = records.get(middleStart).getCategoryId();
|
||||
|
||||
// 新二级循环:处理当前新一级分组内的categoryId分组
|
||||
for (int j = middleStart + 1; j <= end; j++) {
|
||||
if (!records.get(j).getCategoryId().equals(currentCategoryId)) {
|
||||
processMiddleGroup(records, middleStart, j - 1); // 处理完整个新二级分组
|
||||
middleStart = j;
|
||||
currentCategoryId = records.get(j).getCategoryId();
|
||||
}
|
||||
}
|
||||
processMiddleGroup(records, middleStart, end); // 处理最后一组新二级数据
|
||||
}
|
||||
|
||||
private void processMiddleGroup(List<ConfigServiceDirective> records, int start, int end) {
|
||||
processTypeRowSpan(records, start, end); // 设置新二级categoryRowSpan
|
||||
|
||||
int innerStart = start; // 新三级分组起始索引
|
||||
String currentTypeId = records.get(innerStart).getTypeId();
|
||||
|
||||
// 新三级循环:处理当前新二级分组内的typeId分组
|
||||
for (int k = innerStart + 1; k <= end; k++) {
|
||||
if (!records.get(k).getTypeId().equals(currentTypeId)) {
|
||||
processInnerGroup(records, innerStart, k - 1); // 处理完整个新三级分组
|
||||
innerStart = k;
|
||||
currentTypeId = records.get(k).getTypeId();
|
||||
}
|
||||
}
|
||||
processInnerGroup(records, innerStart, end); // 处理最后一组新三级数据
|
||||
}
|
||||
|
||||
private void processInnerGroup(List<ConfigServiceDirective> records, int start, int end) {
|
||||
int count = end - start + 1;
|
||||
if (count > 1) {
|
||||
records.get(start).setTypeRowSpan(count);
|
||||
for (int i = start + 1; i <= end; i++) {
|
||||
records.get(i).setTypeRowSpan(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 处理新一级instructionRowSpan
|
||||
private void processOuterGroup(List<ConfigServiceDirective> records, int start, int end) {
|
||||
int count = end - start + 1;
|
||||
if (count > 1) {
|
||||
records.get(start).setInstructionRowSpan(count);
|
||||
for (int i = start + 1; i <= end; i++) {
|
||||
records.get(i).setInstructionRowSpan(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 处理新二级categoryRowSpan
|
||||
private void processTypeRowSpan(List<ConfigServiceDirective> records, int start, int end) {
|
||||
int count = end - start + 1;
|
||||
if (count > 1) {
|
||||
records.get(start).setCategoryRowSpan(count);
|
||||
for (int i = start + 1; i <= end; i++) {
|
||||
records.get(i).setCategoryRowSpan(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 存储体型标签数据
|
||||
*
|
||||
* @param configServiceDirective
|
||||
*/
|
||||
@Override
|
||||
public void saveBodyTags(ConfigServiceDirective configServiceDirective) {
|
||||
baseMapper.deleteBodyTags(configServiceDirective);
|
||||
baseMapper.saveBodyTags(configServiceDirective);
|
||||
}
|
||||
|
||||
/**
|
||||
* 存储情绪标签数据
|
||||
*
|
||||
* @param configServiceDirective
|
||||
*/
|
||||
@Override
|
||||
public void saveEmotionTags(ConfigServiceDirective configServiceDirective) {
|
||||
baseMapper.deleteEmotionTags(configServiceDirective);
|
||||
baseMapper.saveEmotionTags(configServiceDirective);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除改服务指令下体型标签
|
||||
*
|
||||
* @param configServiceDirective
|
||||
*/
|
||||
@Override
|
||||
public void removeBodyTags(ConfigServiceDirective configServiceDirective) {
|
||||
baseMapper.deleteBodyTags(configServiceDirective);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除改服务指令下情绪标签
|
||||
*
|
||||
* @param configServiceDirective
|
||||
*/
|
||||
@Override
|
||||
public void removeEmotionTags(ConfigServiceDirective configServiceDirective) {
|
||||
baseMapper.deleteEmotionTags(configServiceDirective);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ConfigServiceDirective> queryDirectiveIdByBodyTagIds(String tags) {
|
||||
return baseMapper.queryDirectiveIdByBodyTagIds(tags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ConfigServiceDirective> queryDirectiveIdByEmotionTagIds(String tags) {
|
||||
return baseMapper.queryDirectiveIdByEmotionTagIds(tags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAll() {
|
||||
baseMapper.removeAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
@DS("#dataSourceCode")
|
||||
public List<ConfigServiceDirective> selectAllByIds(String dataSourceCode, List<String> idList) {
|
||||
QueryWrapper<ConfigServiceDirective> qw = new QueryWrapper<>();
|
||||
qw.in("id", idList);
|
||||
return baseMapper.selectList(qw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertAllDirectives(List<ConfigServiceDirective> directives) {
|
||||
directives.forEach(d -> {
|
||||
baseMapper.insert(d);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理资源文件
|
||||
* 1、检测各资源文件的存储路径是否跟路径字段的值一致
|
||||
* 2、如果不一致1)检测缺少的路径新建目录 2)然后把资源挪到新路径中 3)修改媒体资源对应字段的值的路径名
|
||||
*
|
||||
* @param configServiceDirective
|
||||
*/
|
||||
@Override
|
||||
public void handleMediaFile(ConfigServiceDirective configServiceDirective) {
|
||||
//上传根路径
|
||||
String path = uploadpath;
|
||||
//需要存储的路径
|
||||
String mediaFileSavePath = configServiceDirective.getMediaFileSavePath();
|
||||
//服务指令图片
|
||||
String previewFile = configServiceDirective.getPreviewFile();
|
||||
//即时指令图标
|
||||
String immediateFile = configServiceDirective.getImmediateFile();
|
||||
//指令音频文件
|
||||
String mp3File = configServiceDirective.getMp3File();
|
||||
//指令视频文件
|
||||
String mp4File = configServiceDirective.getMp4File();
|
||||
|
||||
// 处理每个文件并获取更新后的路径
|
||||
String newPreviewFile = processFile(path, mediaFileSavePath, previewFile);
|
||||
String newImmediateFile = processFile(path, mediaFileSavePath, immediateFile);
|
||||
String newMp3File = processFile(path, mediaFileSavePath, mp3File);
|
||||
String newMp4File = processFile(path, mediaFileSavePath, mp4File);
|
||||
|
||||
// 如果有变化,更新ConfigServiceDirective对象
|
||||
if (newPreviewFile != null) {
|
||||
configServiceDirective.setPreviewFile(newPreviewFile);
|
||||
}
|
||||
if (newImmediateFile != null) {
|
||||
configServiceDirective.setImmediateFile(newImmediateFile);
|
||||
}
|
||||
if (newMp3File != null) {
|
||||
configServiceDirective.setMp3File(newMp3File);
|
||||
}
|
||||
if (newMp4File != null) {
|
||||
configServiceDirective.setMp4File(newMp4File);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理单个文件,检查路径是否需要迁移
|
||||
* @param basePath 基础路径
|
||||
* @param targetDir 目标目录
|
||||
* @param filePath 文件路径
|
||||
* @return 如果路径有变化返回新路径,否则返回null
|
||||
*/
|
||||
private String processFile(String basePath, String targetDir, String filePath) {
|
||||
if (StringUtils.isBlank(filePath)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
// 检查文件路径是否以目标目录开头
|
||||
if (!filePath.startsWith(targetDir + "/")) {
|
||||
// 获取文件名(路径的最后一部分)
|
||||
String fileName = filePath.substring(filePath.lastIndexOf('/') + 1);
|
||||
|
||||
// 构建新的完整路径
|
||||
String newRelativePath = targetDir + "/" + fileName;
|
||||
String oldFullPath = basePath + "/" + filePath;
|
||||
String newFullPath = basePath + "/" + newRelativePath;
|
||||
|
||||
// 创建目标目录(如果不存在)
|
||||
File targetDirectory = new File(basePath + "/" + targetDir);
|
||||
if (!targetDirectory.exists()) {
|
||||
targetDirectory.mkdirs();
|
||||
}
|
||||
|
||||
// 移动文件
|
||||
File oldFile = new File(oldFullPath);
|
||||
if (oldFile.exists()) {
|
||||
File newFile = new File(newFullPath);
|
||||
|
||||
// 如果目标文件已存在,先删除
|
||||
if (newFile.exists()) {
|
||||
newFile.delete();
|
||||
}
|
||||
|
||||
// 移动文件
|
||||
Files.move(oldFile.toPath(), newFile.toPath());
|
||||
|
||||
// 返回新的相对路径
|
||||
return newRelativePath;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 处理异常,可以根据实际需求记录日志或抛出
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,168 @@
|
|||
package com.nu.modules.servicetype.controller;
|
||||
|
||||
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.nu.modules.servicetype.entity.ConfigServiceType;
|
||||
import com.nu.modules.servicetype.service.IConfigServiceTypeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.query.QueryRuleEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 服务类型
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags = "服务类型")
|
||||
@RestController
|
||||
@RequestMapping("/services/ServiceType/configServiceType")
|
||||
@Slf4j
|
||||
public class ConfigServiceTypeController extends JeecgController<ConfigServiceType, IConfigServiceTypeService> {
|
||||
@Autowired
|
||||
private IConfigServiceTypeService configServiceTypeService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param configServiceType
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "服务类型-分页列表查询")
|
||||
@ApiOperation(value = "服务类型-分页列表查询", notes = "服务类型-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<ConfigServiceType>> queryPageList(ConfigServiceType configServiceType,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
// 自定义查询规则
|
||||
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
|
||||
// 自定义多选的查询规则为:LIKE_WITH_OR
|
||||
customeRuleMap.put("categoryId", QueryRuleEnum.LIKE_WITH_OR);
|
||||
QueryWrapper<ConfigServiceType> queryWrapper = QueryGenerator.initQueryWrapper(configServiceType, req.getParameterMap(), customeRuleMap);
|
||||
Page<ConfigServiceType> page = new Page<ConfigServiceType>(pageNo, pageSize);
|
||||
IPage<ConfigServiceType> pageList = configServiceTypeService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param configServiceType
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "服务类型-添加")
|
||||
@ApiOperation(value = "服务类型-添加", notes = "服务类型-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody ConfigServiceType configServiceType) {
|
||||
configServiceTypeService.save(configServiceType);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param configServiceType
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "服务类型-编辑")
|
||||
@ApiOperation(value = "服务类型-编辑", notes = "服务类型-编辑")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody ConfigServiceType configServiceType) {
|
||||
configServiceTypeService.updateById(configServiceType);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "服务类型-通过id删除")
|
||||
@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("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "服务类型-批量删除")
|
||||
@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("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "服务类型-通过id查询")
|
||||
@ApiOperation(value = "服务类型-通过id查询", notes = "服务类型-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<ConfigServiceType> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
ConfigServiceType configServiceType = configServiceTypeService.getById(id);
|
||||
if (configServiceType == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(configServiceType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param configServiceType
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, ConfigServiceType configServiceType) {
|
||||
return super.exportXls(request, configServiceType, ConfigServiceType.class, "服务类型");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, ConfigServiceType.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
package com.nu.modules.servicetype.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Description: 服务类型
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("nu_config_service_type")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="nu_config_service_type对象", description="服务类型")
|
||||
public class ConfigServiceType implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private java.lang.String id;
|
||||
/**分类标签id*/
|
||||
@Excel(name = "分类标签id", width = 15)
|
||||
@ApiModelProperty(value = "分类标签id")
|
||||
@Dict(dicCode = "id" , dictTable = "nu_config_service_instruction_tag" , dicText = "instruction_name")
|
||||
private java.lang.String instructionId;
|
||||
/**服务类别id*/
|
||||
@Excel(name = "服务类别", width = 15)
|
||||
@ApiModelProperty(value = "服务类别")
|
||||
@Dict(dicCode = "id" , dictTable = "nu_config_service_category" , dicText = "category_name")
|
||||
private java.lang.String categoryId;
|
||||
/**服务类型名称*/
|
||||
@Excel(name = "服务类型名称", width = 15)
|
||||
@ApiModelProperty(value = "服务类型名称")
|
||||
private java.lang.String typeName;
|
||||
/**排序*/
|
||||
@Excel(name = "排序", width = 15)
|
||||
@ApiModelProperty(value = "排序")
|
||||
private java.lang.Integer sort;
|
||||
/**是否启用 0启用 1未启用*/
|
||||
@Excel(name = "是否启用", width = 15)
|
||||
@ApiModelProperty(value = "是否启用")
|
||||
@Dict(dicCode = "iz_enabled")
|
||||
private java.lang.String izEnabled;
|
||||
/**是否删除 0未删除 1删除*/
|
||||
@Excel(name = "是否删除", width = 15)
|
||||
@ApiModelProperty(value = "是否删除")
|
||||
@TableLogic
|
||||
private java.lang.String delFlag;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private java.lang.String sysOrgCode;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.nu.modules.servicetype.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nu.modules.servicetype.entity.ConfigServiceType;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 服务类型
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ConfigServiceTypeMapper extends BaseMapper<ConfigServiceType> {
|
||||
|
||||
void removeAll();
|
||||
|
||||
List<ConfigServiceType> selectAll(@Param("ids") List<String> ids, @Param("excludeIds") List<String> excludeIds);
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.nu.modules.servicetype.mapper.ConfigServiceTypeMapper">
|
||||
|
||||
<delete id="removeAll">
|
||||
delete from nu_config_service_type
|
||||
</delete>
|
||||
|
||||
<select id="selectAll" resultType="com.nu.modules.servicetype.entity.ConfigServiceType">
|
||||
select distinct t.* from nu_config_service_type t left join nu_config_service_directive d on t.id = d.type_id
|
||||
<where>
|
||||
d.id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
<if test="excludeIds != null and excludeIds.size() > 0">
|
||||
AND t.id not in
|
||||
<foreach collection="excludeIds" item="excludeId" open="(" separator="," close=")">
|
||||
#{excludeId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,29 @@
|
|||
package com.nu.modules.servicetype.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nu.modules.servicetype.entity.ConfigServiceType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 服务类型
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-03-13
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IConfigServiceTypeService extends IService<ConfigServiceType> {
|
||||
|
||||
/**
|
||||
* 查询数据是否已被使用
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
boolean isUsed(String id);
|
||||
|
||||
void removeAll();
|
||||
|
||||
List<ConfigServiceType> selectAll(String dataSourceCode, List<String> ids, List<String> excludeSubIds);
|
||||
|
||||
void insertAll(List<ConfigServiceType> categoryList);
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package com.nu.modules.servicetype.service.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nu.modules.servicedirective.entity.ConfigServiceDirective;
|
||||
import com.nu.modules.servicedirective.service.IConfigServiceDirectiveService;
|
||||
import com.nu.modules.servicetype.entity.ConfigServiceType;
|
||||
import com.nu.modules.servicetype.mapper.ConfigServiceTypeMapper;
|
||||
import com.nu.modules.servicetype.service.IConfigServiceTypeService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 服务类型
|
||||
* @Author: 张明远
|
||||
* @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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAll() {
|
||||
baseMapper.removeAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
@DS("#dataSourceCode")
|
||||
public List<ConfigServiceType> selectAll(String dataSourceCode, List<String> ids, List<String> excludeSubIds) {
|
||||
return baseMapper.selectAll(ids, excludeSubIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertAll(List<ConfigServiceType> categoryList) {
|
||||
categoryList.forEach(c -> {
|
||||
baseMapper.insert(c);
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue