解决帮助中心bug
1、删除说明不提醒问题 2、删除类型没有删除掉子类型已经相关说明问题
This commit is contained in:
parent
bfddd11e3c
commit
e25d99b887
@ -134,4 +134,5 @@ public interface IHelpTypeDao {
|
||||
*/
|
||||
Integer countByParentId(String parentId) throws SearchException;
|
||||
|
||||
List<String> findChildrenByParentIds(Map<String, Object> params);
|
||||
}
|
@ -22,10 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @ClassName: HelpTypeServiceImpl
|
||||
@ -79,13 +76,36 @@ public class HelpTypeServiceImpl extends DefaultBaseService implements IHelpType
|
||||
@Override
|
||||
public void remove(String token, List<String> ids) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("helpTypeIds", ids);
|
||||
if (StringUtils.isBlank(token)) {
|
||||
setUpdateInfo(params);
|
||||
} else {
|
||||
setAppUpdateInfo(token, params);
|
||||
}
|
||||
// helpTypeDao.remove(params);
|
||||
|
||||
List<String> idList = new ArrayList<>(ids);
|
||||
|
||||
List<String> subIdList = findAllTypeData(ids, params);
|
||||
while(!CollectionUtils.isEmpty(subIdList)) {
|
||||
idList.addAll(subIdList);
|
||||
subIdList = findAllTypeData(subIdList, params);
|
||||
}
|
||||
|
||||
// 删除数据
|
||||
params.put("helpTypeIds", idList);
|
||||
helpTypeDao.remove(params);
|
||||
|
||||
// 删除说明数据
|
||||
helpDetailService.removeDetailByTypeId(idList, token);
|
||||
}
|
||||
|
||||
private List<String> findAllTypeData(List<String> ids, Map<String, Object> params) {
|
||||
params.put("ids", ids);
|
||||
List<String> children = helpTypeDao.findChildrenByParentIds(params);
|
||||
if(!CollectionUtils.isEmpty(children)) {
|
||||
return children;
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -346,4 +346,18 @@
|
||||
parent_id = #{_parameter}
|
||||
</select>
|
||||
|
||||
<select id="findChildrenByParentIds" parameterType="String" resultType="String">
|
||||
SELECT
|
||||
help_type_id
|
||||
FROM
|
||||
data_help_type
|
||||
WHERE
|
||||
is_delete = 0
|
||||
AND
|
||||
parent_id IN
|
||||
<foreach collection="ids" index="index" open="(" separator="," close=")">
|
||||
#{ids[${index}]}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -185,16 +185,25 @@
|
||||
}
|
||||
|
||||
function removeDetail(insertData) {
|
||||
console.log(insertData)
|
||||
var loadLayerIndex;
|
||||
var obj = {};
|
||||
top.restAjax.delete(top.restAjax.path('api/help-detail/removeDetailByTypeId/{helpTypeIds}', [insertData.helpTypeId]), obj, null, function(code, data) {
|
||||
}, function(code, data) {
|
||||
top.dialog.msg(data.msg);
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
top.dialog.msg(top.dataMessage.delete, {
|
||||
time: 0,
|
||||
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||
shade: 0.3,
|
||||
yes: function (index) {
|
||||
var loadLayerIndex;
|
||||
var obj = {};
|
||||
top.restAjax.delete(top.restAjax.path('api/help-detail/removeDetailByTypeId/{helpTypeIds}', [insertData.helpTypeId]), obj, null, function(code, data) {
|
||||
if(200 === code) {
|
||||
top.dialog.msg('清除成功');
|
||||
}
|
||||
}, function(code, data) {
|
||||
|
||||
}, function() {
|
||||
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||
}, function() {
|
||||
top.dialog.close(loadLayerIndex);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user