57 lines
1.4 KiB
Plaintext
57 lines
1.4 KiB
Plaintext
|
|
package com.bonus.sys.service;
|
||
|
|
|
||
|
|
|
||
|
|
import java.util.ArrayList;
|
||
|
|
import java.util.HashMap;
|
||
|
|
import java.util.List;
|
||
|
|
import java.util.Map;
|
||
|
|
|
||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
|
import org.springframework.stereotype.Service;
|
||
|
|
import com.bonus.sys.BaseServiceImp;
|
||
|
|
import com.bonus.sys.beans.SysDictTypeBean;
|
||
|
|
import com.bonus.sys.dao.SysDataDictDao;
|
||
|
|
import com.bonus.sys.dao.SysDictTypeDao;
|
||
|
|
|
||
|
|
@Service("SysDictTypeService")
|
||
|
|
public class SysDictTypeServiceImp extends BaseServiceImp<SysDictTypeBean> implements SysDictTypeService {
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
SysDataDictDao dao;
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
SysDictTypeDao typeDao;
|
||
|
|
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public Map<String, List<Integer>> checkHasChild(String ids) {
|
||
|
|
Map<String, List<Integer>> arrs = new HashMap<String, List<Integer>>();
|
||
|
|
List<Integer> has = new ArrayList<Integer>();
|
||
|
|
List<Integer> noHas = new ArrayList<Integer>();
|
||
|
|
String[] idArr = ids.split(",");
|
||
|
|
Integer size = idArr.length;
|
||
|
|
Integer result = 0;
|
||
|
|
Integer id= 0;
|
||
|
|
for(int i = 0;i<size;i++) {
|
||
|
|
id = Integer.parseInt(idArr[i]);
|
||
|
|
result = dao.getCountByDictTypeId(id);
|
||
|
|
if(result>0) {
|
||
|
|
has.add(id);
|
||
|
|
}else {
|
||
|
|
noHas.add(id);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
arrs.put("has", has);
|
||
|
|
arrs.put("noHas", noHas);
|
||
|
|
return arrs;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public Integer batchDeleteByList(List<Integer> noHas) {
|
||
|
|
return typeDao.batchDeleteByList(noHas);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|