调整服务标签查询语句
This commit is contained in:
parent
f11bb84856
commit
0c45cf184e
|
@ -57,6 +57,7 @@ public class DirectivePackage implements Serializable {
|
|||
private java.lang.String delFlag;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
@Dict(dictTable = "sys_user",dicCode = "username",dicText = "realname")
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
|
|
@ -57,6 +57,7 @@ public class ServiceTag implements Serializable {
|
|||
private String delFlag;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
@Dict(dictTable = "sys_user",dicCode = "username",dicText = "realname")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
|
|
|
@ -4,57 +4,56 @@
|
|||
|
||||
<!-- 定义 resultMap -->
|
||||
<resultMap id="ServiceTagResultMap" type="com.nu.modules.servicetag.entity.ServiceTag">
|
||||
<id property="id" column="id" />
|
||||
<result property="tagName" column="tag_name" />
|
||||
<result property="description" column="description" />
|
||||
<result property="sort" column="sort" />
|
||||
<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" />
|
||||
<id property="id" column="id"/>
|
||||
<result property="tagName" column="tag_name"/>
|
||||
<result property="description" column="description"/>
|
||||
<result property="sort" column="sort"/>
|
||||
<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"/>
|
||||
<!-- 关联的指令列表 -->
|
||||
<collection property="directives" ofType="com.nu.modules.servicedirective.entity.ConfigServiceDirective">
|
||||
<id property="id" column="directive_id" />
|
||||
<result property="directiveName" column="directive_name" />
|
||||
<result property="categoryId" column="category_id" />
|
||||
<result property="typeId" column="type_id" />
|
||||
<result property="instructionTagId" column="instruction_tag_id" />
|
||||
<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="serviceContent" column="service_content" />
|
||||
<result property="serviceDuration" column="service_duration" />
|
||||
<result property="izEnabled" column="directive_iz_enabled" />
|
||||
<result property="delFlag" column="directive_del_flag" />
|
||||
<result property="createBy" column="directive_create_by" />
|
||||
<result property="createTime" column="directive_create_time" />
|
||||
<result property="updateBy" column="directive_update_by" />
|
||||
<result property="updateTime" column="directive_update_time" />
|
||||
<result property="sysOrgCode" column="directive_sys_org_code" />
|
||||
<result property="mp3File" column="mp3_file" />
|
||||
<result property="mp4File" column="mp4_file" />
|
||||
<result property="tagsName" column="tags_name" />
|
||||
<result property="categoryName" column="csc_category_name" />
|
||||
<result property="typeName" column="cst_type_name" />
|
||||
<id property="id" column="directive_id"/>
|
||||
<result property="directiveName" column="directive_name"/>
|
||||
<result property="categoryId" column="category_id"/>
|
||||
<result property="typeId" column="type_id"/>
|
||||
<result property="instructionTagId" column="instruction_tag_id"/>
|
||||
<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="serviceContent" column="service_content"/>
|
||||
<result property="serviceDuration" column="service_duration"/>
|
||||
<result property="izEnabled" column="directive_iz_enabled"/>
|
||||
<result property="delFlag" column="directive_del_flag"/>
|
||||
<result property="createBy" column="directive_create_by"/>
|
||||
<result property="createTime" column="directive_create_time"/>
|
||||
<result property="updateBy" column="directive_update_by"/>
|
||||
<result property="updateTime" column="directive_update_time"/>
|
||||
<result property="sysOrgCode" column="directive_sys_org_code"/>
|
||||
<result property="mp3File" column="mp3_file"/>
|
||||
<result property="mp4File" column="mp4_file"/>
|
||||
<result property="categoryName" column="csc_category_name"/>
|
||||
<result property="typeName" column="cst_type_name"/>
|
||||
<result property="previewFile" column="preview_file"/>
|
||||
<result property="immediateFile" column="immediate_file"/>
|
||||
<!-- 关联的标签列表 -->
|
||||
<collection property="tagList" ofType="com.nu.modules.directivetag.entity.DirectiveTag">
|
||||
<id property="id" column="tag_id" />
|
||||
<result property="tagName" column="tag_name" />
|
||||
<result property="sort" column="tag_sort" />
|
||||
<result property="izEnabled" column="tag_iz_enabled" />
|
||||
<result property="delFlag" column="tag_del_flag" />
|
||||
<result property="createBy" column="tag_create_by" />
|
||||
<result property="createTime" column="tag_create_time" />
|
||||
<result property="updateBy" column="tag_update_by" />
|
||||
<result property="updateTime" column="tag_update_time" />
|
||||
<result property="sysOrgCode" column="tag_sys_org_code" />
|
||||
<id property="id" column="tag_id"/>
|
||||
<result property="tagName" column="cdt_tag_name"/>
|
||||
<result property="sort" column="tag_sort"/>
|
||||
<result property="izEnabled" column="tag_iz_enabled"/>
|
||||
<result property="delFlag" column="tag_del_flag"/>
|
||||
<result property="createBy" column="tag_create_by"/>
|
||||
<result property="createTime" column="tag_create_time"/>
|
||||
<result property="updateBy" column="tag_update_by"/>
|
||||
<result property="updateTime" column="tag_update_time"/>
|
||||
<result property="sysOrgCode" column="tag_sys_org_code"/>
|
||||
</collection>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
@ -96,7 +95,16 @@
|
|||
csd.mp4_file,
|
||||
csd.preview_file,
|
||||
csd.immediate_file,
|
||||
cdt.tag_name as tags_name,
|
||||
cdt.id AS tag_id,
|
||||
cdt.tag_name as cdt_tag_name,
|
||||
cdt.sort AS tag_sort,
|
||||
cdt.iz_enabled AS tag_iz_enabled,
|
||||
cdt.del_flag AS tag_del_flag,
|
||||
cdt.create_by AS tag_create_by,
|
||||
cdt.create_time AS tag_create_time,
|
||||
cdt.update_by AS tag_update_by,
|
||||
cdt.update_time AS tag_update_time,
|
||||
cdt.sys_org_code AS tag_sys_org_code,
|
||||
csc.category_name AS csc_category_name,
|
||||
cst.type_name AS cst_type_name
|
||||
FROM
|
||||
|
@ -106,14 +114,12 @@
|
|||
<foreach collection="ids" item="item" open="(" separator="," close=")">
|
||||
#{item.id}
|
||||
</foreach>
|
||||
</where>) dp
|
||||
</where>
|
||||
) dp
|
||||
LEFT JOIN nu_servtag_directive sd ON dp.id = sd.tag_id
|
||||
LEFT JOIN nu_config_service_directive csd ON sd.directive_id = csd.id
|
||||
LEFT JOIN (
|
||||
select GROUP_CONCAT(c.tag_name) tag_name,b.directive_id from nu_directive_tag b
|
||||
LEFT JOIN nu_config_directive_tag c on b.tag_id = c.id
|
||||
GROUP BY b.directive_id
|
||||
) cdt on csd.id = cdt.directive_id
|
||||
LEFT JOIN nu_directive_tag dt ON csd.id = dt.directive_id
|
||||
LEFT JOIN nu_config_directive_tag cdt ON dt.tag_id = cdt.id
|
||||
LEFT JOIN nu_config_service_category csc ON csd.category_id = csc.id
|
||||
LEFT JOIN nu_config_service_type cst ON csd.type_id = cst.id
|
||||
order by dp.create_time desc
|
||||
|
@ -135,7 +141,9 @@
|
|||
</select>
|
||||
|
||||
<delete id="deleteDirectives">
|
||||
delete from nu_servtag_directive where tag_id = #{tag.id}
|
||||
delete
|
||||
from nu_servtag_directive
|
||||
where tag_id = #{tag.id}
|
||||
</delete>
|
||||
|
||||
<insert id="saveDirectives">
|
||||
|
@ -146,14 +154,20 @@
|
|||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
|
||||
<select id="getEmployeesList" resultType="com.nu.modules.servicetag.entity.ServiceTag">
|
||||
select * from (
|
||||
select nst.id ,nst.tag_name ,nst.description ,nst.sort,ifnull(est.id,'0') as employeesTagsId,nst.iz_enabled,nst.del_flag,nst.create_time,est.employees_id from nu_service_tag nst
|
||||
LEFT JOIN nu_biz_employees_servcie_tags est on nst.id = est.tags_id
|
||||
) a
|
||||
${ew.customSqlSegment}
|
||||
select *
|
||||
from (select nst.id,
|
||||
nst.tag_name,
|
||||
nst.description,
|
||||
nst.sort,
|
||||
ifnull(est.id, '0') as employeesTagsId,
|
||||
nst.iz_enabled,
|
||||
nst.del_flag,
|
||||
nst.create_time,
|
||||
est.employees_id
|
||||
from nu_service_tag nst
|
||||
LEFT JOIN nu_biz_employees_servcie_tags est on nst.id = est.tags_id) a
|
||||
${ew.customSqlSegment}
|
||||
|
||||
</select>
|
||||
|
||||
|
|
|
@ -5,12 +5,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.nu.modules.directivetag.entity.DirectiveTag;
|
||||
import com.nu.modules.servicedirective.entity.ConfigServiceDirective;
|
||||
import com.nu.modules.servicetag.entity.ServiceTag;
|
||||
import com.nu.modules.servicetag.mapper.ServiceTagMapper;
|
||||
import com.nu.modules.servicetag.service.IServiceTagService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 服务标签
|
||||
|
@ -30,6 +33,19 @@ public class ServiceTagServiceImpl extends ServiceImpl<ServiceTagMapper, Service
|
|||
@Override
|
||||
public void queryList(ServiceTag serviceTag, IPage<ServiceTag> pageList) {
|
||||
List<ServiceTag> record = baseMapper.queryList(serviceTag,pageList.getRecords());
|
||||
//将指令标签名使用逗号拼接成字符串设置到指令对象的tagsName变量中
|
||||
if(record != null && !record.isEmpty()){
|
||||
record.stream().forEach(l -> {
|
||||
if(l.getDirectives()!=null && !l.getDirectives().isEmpty()){
|
||||
List<ConfigServiceDirective> sd = l.getDirectives();
|
||||
for (int i = 0; i < sd.size(); i++) {
|
||||
List<DirectiveTag> tagList = sd.get(i).getTagList();
|
||||
List<String> tags = tagList.stream().map(t -> t.getTagName()).collect(Collectors.toList());
|
||||
sd.get(i).setTagsName(String.join(",",tags));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
pageList.setRecords(record);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue