package com.ruoyi.satisfaction.mapper;
|
|
import com.ruoyi.satisfaction.domain.row.SatisfactionCategoryRow;
|
import com.ruoyi.satisfaction.domain.row.SatisfactionIvrScriptRow;
|
import com.ruoyi.satisfaction.domain.row.SatisfactionOptionScoreRow;
|
import com.ruoyi.satisfaction.domain.row.SatisfactionScriptQuery;
|
import com.ruoyi.satisfaction.domain.row.SatisfactionSvyScriptRow;
|
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Param;
|
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* 满意度统计取「满意度分类 / 模板问题 / 选项分值」的只读 Mapper。
|
* <p>
|
* <b>为什么不复用 smartor 的模板/分类 Mapper:</b>
|
* <ul>
|
* <li>{@code com.ruoyi.template.domain.IvrLibaScriptAssort} / {@code IvrLibaTemplateScript} /
|
* {@code SvyLibScriptCategory} / {@code SvyLibTemplateScript} 这 4 个实体属于
|
* smartor 的**模板与分类管理**业务(分别被 11/9/12/13 个文件使用,含增删改查),
|
* 不能搬进本模块;</li>
|
* <li>本模块要求「不依赖 smartor,其它模块要用只能调本模块 api」,所以不能 import 它们;</li>
|
* <li>原文这些查询依赖 `resultMap` + 共享 `<sql>` 片段,而片段被同文件里其它
|
* <b>非满意度</b>查询共用。直接复制片段会造成「同一份 SQL 两处维护」的隐患,
|
* 因此这里<b>改写为显式列清单</b>,只取满意度真正用到的字段。</li>
|
* </ul>
|
* <p>
|
* ⚠️ 本 Mapper 全部是<b>只读查询</b>,不会对 {@code ivr_liba_*} / {@code svy_lib_*} 做任何写操作。
|
* <p>
|
* 对应 XML:{@code mapper/satisfaction/SatisfactionScriptMapper.xml}
|
*/
|
@Mapper
|
public interface SatisfactionScriptMapper {
|
|
// ================================================================ 满意度分类
|
|
/**
|
* 查询指定机构下的满意度分类(语音侧)。
|
* <p>
|
* 原实现:{@code IvrLibaScriptAssortMapper.selectIvrLibaScriptAssortList}
|
* <pre>
|
* select id, index_assort_name, type from ivr_liba_script_assort
|
* where del_flag = 0 and orgid = ? and type like '%myd%' order by seqno asc
|
* </pre>
|
* 调用方再按 {@code type.contains("myd")} 过滤出满意度分类 id。
|
*
|
* @param query orgid 与 type(type 传 "myd")
|
* @return 每行含 id、index_assort_name、type
|
*/
|
List<SatisfactionCategoryRow> selectIvrCategoryList(@Param("q") SatisfactionScriptQuery query);
|
|
/**
|
* 查询指定机构下的满意度分类(问卷侧)。
|
* <p>
|
* 原实现:{@code SvyLibScriptCategoryMapper.selectSvyLibScriptCategoryList}
|
* (注意:该 statement 定义在 {@code SvyLibTopicCategoryMapper.xml} 里,namespace 与文件名不一致)
|
* <pre>
|
* select id, name, type from svy_lib_script_category
|
* where del_flag = 0 and orgid = ? and type like '%myd%' order by seqno asc
|
* </pre>
|
*
|
* @param query orgid 与 type(type 传 "myd")
|
* @return 每行含 id、name、type
|
*/
|
List<SatisfactionCategoryRow> selectSvyCategoryList(@Param("q") SatisfactionScriptQuery query);
|
|
// ================================================================ 模板问题(按分类)
|
|
/**
|
* 按语音分类 id 取问题。
|
* <p>
|
* 原实现:{@code IvrLibaTemplateScriptMapper.queryLibTemplateIds}
|
* <pre>
|
* select templateid, scriptid, script_content, script_assortname, dimension
|
* from ivr_liba_template_script
|
* where del_flag = 0 [and script_assortid in (...)]
|
* </pre>
|
* <b>口径注意</b>:{@code scriptAssortids} 为空时不再拼该条件(原实现是
|
* {@code if test="scriptAssortids != null and scriptAssortids.size > 0"})。
|
*/
|
List<SatisfactionIvrScriptRow> queryIvrScriptByAssort(@Param("q") SatisfactionScriptQuery query);
|
|
/**
|
* 按问卷分类 id 取问题。
|
* <p>
|
* 原实现:{@code SvyLibTemplateScriptMapper.querySvyLibTemplateIds}
|
* <pre>
|
* select id, svyid, script_content, categoryName, dimension
|
* from svy_lib_template_script
|
* where del_flag = 0 [and categoryid in (...)]
|
* </pre>
|
* <b>口径注意</b>:原实现取选项分值时用的是 {@code id}(主键),
|
* 而聚合统计的模板 id 用的是 {@code svyid}——两者都保留在结果行里。
|
*/
|
List<SatisfactionSvyScriptRow> querySvyScriptByCategory(@Param("q") SatisfactionScriptQuery query);
|
|
// ================================================================ 模板问题(按维度)
|
|
/**
|
* 按维度取问题(语音侧)。
|
* <p>
|
* 原实现:{@code IvrLibaTemplateScriptMapper.selectILTSBydimension}
|
* <pre>
|
* ... where del_flag = 0
|
* [and dimension in (...)]
|
* [dimension IS NOT NULL] ← dimensionList 为空时拼这个
|
* </pre>
|
* <b>口径注意</b>:{@code dimensionList} 为空时,语音侧会拼
|
* {@code dimension IS NOT NULL}(问卷侧不会)——这是原实现的行为,必须保留。
|
* 同时原实现还支持 duty/report 相关过滤,满意度调用时不传,故不再暴露。
|
*/
|
List<SatisfactionIvrScriptRow> selectIvrScriptByDimension(@Param("q") SatisfactionScriptQuery query);
|
|
/**
|
* 按维度取问题(问卷侧)。
|
* <p>
|
* 原实现:{@code SvyLibTemplateScriptMapper.selectSLTScriptListBydimension}
|
* <pre>
|
* ... where del_flag = 0 [and dimension in (...)]
|
* </pre>
|
* <b>口径注意</b>:与语音侧不同,{@code dimensionList} 为空时<b>不拼</b>
|
* {@code dimension IS NOT NULL}(等于取该表全部 del_flag=0 的问题)。
|
* 另外此处聚合统计用的模板 id 与取选项分值用的关联 id <b>都是 {@code svyid}</b>。
|
*/
|
List<SatisfactionSvyScriptRow> selectSvyScriptByDimension(@Param("q") SatisfactionScriptQuery query);
|
|
// ================================================================ 选项分值
|
|
/**
|
* 按问题 id 批量取语音选项分值(只取 scriptid、score 两列)。
|
* <p>
|
* 原实现:{@code IvrLibaTemplateTargetoptionMapper.selectIvrLibaTargetoptionScores}
|
* <p>
|
* <b>口径注意</b>:{@code scriptIds} 为 null 时原实现不拼 scriptid 条件
|
* (等于取该表全部分值),调用方用 null 作 key 存这一份。
|
*/
|
List<SatisfactionOptionScoreRow> selectIvrTargetOptionScores(@Param("scriptIds") List<Long> scriptIds);
|
|
/**
|
* 按问题 id 批量取问卷选项分值(只取 scriptid、score 两列)。
|
* <p>
|
* 原实现:{@code SvyLibTemplateTargetoptionMapper.selectSvyLibTargetoptionScores}
|
*/
|
List<SatisfactionOptionScoreRow> selectSvyTargetOptionScores(@Param("scriptIds") List<Long> scriptIds);
|
}
|