|
@@ -0,0 +1,139 @@
|
|
|
|
|
+package com.zd.laboratory.service.impl;
|
|
|
|
|
+
|
|
|
|
|
+import com.zd.common.core.annotation.DataScope;
|
|
|
|
|
+import com.zd.common.core.exception.NoRollException;
|
|
|
|
|
+import com.zd.common.core.exception.ServiceException;
|
|
|
|
|
+import com.zd.common.core.security.TokenService;
|
|
|
|
|
+import com.zd.laboratory.domain.LabWhiteJoinSublist;
|
|
|
|
|
+import com.zd.laboratory.domain.LabWhitelist;
|
|
|
|
|
+import com.zd.laboratory.domain.XxpClassify;
|
|
|
|
|
+import com.zd.laboratory.domain.XxpClassifyDetail;
|
|
|
|
|
+import com.zd.laboratory.domain.vo.LabWhitelistVO;
|
|
|
|
|
+import com.zd.laboratory.mapper.LabWhiteJoinSublistMapper;
|
|
|
|
|
+import com.zd.laboratory.mapper.LabWhitelistMapper;
|
|
|
|
|
+import com.zd.laboratory.mapper.XxpClassifyDetailedMapper;
|
|
|
|
|
+import com.zd.laboratory.mapper.XxpClassifyMapper;
|
|
|
|
|
+import com.zd.laboratory.service.ILabWhitelistService;
|
|
|
|
|
+import com.zd.laboratory.service.IXxpClassifyService;
|
|
|
|
|
+import com.zd.model.domain.per.PerPrefix;
|
|
|
|
|
+import com.zd.model.entity.SysUser;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.Collections;
|
|
|
|
|
+import java.util.Date;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import java.util.Optional;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * 信息牌类目Service业务层处理
|
|
|
|
|
+ *
|
|
|
|
|
+ * @author zd
|
|
|
|
|
+ * @date 2022-01-26
|
|
|
|
|
+ */
|
|
|
|
|
+@Service
|
|
|
|
|
+public class XxpClassifyServiceImpl implements IXxpClassifyService
|
|
|
|
|
+{
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private XxpClassifyMapper xxpClassifyMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private XxpClassifyDetailedMapper detailedMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private TokenService tokenService;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询信息牌类目
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param id 信息牌类目主键
|
|
|
|
|
+ * @return 信息牌类目
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public XxpClassify selectXxpClassifyById(Long id) {
|
|
|
|
|
+ return xxpClassifyMapper.selectXxpClassifyById(id);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询信息牌类目列表
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param xxpClassify 信息牌类目
|
|
|
|
|
+ * @return 信息牌类目集合
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<XxpClassify> selectXxpClassifyList(XxpClassify xxpClassify) {
|
|
|
|
|
+ return xxpClassifyMapper.selectXxpClassifyList(xxpClassify);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 新增信息牌类目
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param xxpClassify 信息牌类目
|
|
|
|
|
+ * @return 结果
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public int insertXxpClassify(XxpClassify xxpClassify) {
|
|
|
|
|
+ SysUser sysUser = tokenService.getLoginUser().getSysUser();
|
|
|
|
|
+ xxpClassify.setCreateBy(sysUser.getNickName());
|
|
|
|
|
+ xxpClassify.setUserId(sysUser.getUserId());
|
|
|
|
|
+ xxpClassify.setCreateTime(new Date());
|
|
|
|
|
+ return xxpClassifyMapper.insertXxpClassify(xxpClassify);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 修改信息牌类目
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param xxpClassify 信息牌类目
|
|
|
|
|
+ * @return 结果
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public int updateXxpClassify(XxpClassify xxpClassify) {
|
|
|
|
|
+ SysUser sysUser = tokenService.getLoginUser().getSysUser();
|
|
|
|
|
+ xxpClassify.setUpdateBy(sysUser.getNickName());
|
|
|
|
|
+ xxpClassify.setUpdateTime(new Date());
|
|
|
|
|
+ return xxpClassifyMapper.updateXxpClassify(xxpClassify);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 批量删除信息牌类目
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param ids 需要删除的信息牌类目主键集合
|
|
|
|
|
+ * @return 结果
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public int deleteXxpClassifyByIds(Long[] ids) {
|
|
|
|
|
+ for (int i=0;i<ids.length;i++){
|
|
|
|
|
+ if(delCheck(ids[i]).size()>0){
|
|
|
|
|
+ XxpClassify classify =xxpClassifyMapper.selectXxpClassifyById(ids[i]);
|
|
|
|
|
+ throw new ServiceException(classify.getClassifyName()+",类目下存在子项!");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return xxpClassifyMapper.deleteXxpClassifyByIds(ids);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 删除信息牌类目信息
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param id 信息牌类目主键
|
|
|
|
|
+ * @return 结果
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public int deleteXxpClassifyById(Long id) {
|
|
|
|
|
+ if(delCheck(id).size()>0){
|
|
|
|
|
+ throw new ServiceException("该类目下存在子项!");
|
|
|
|
|
+ }
|
|
|
|
|
+ return xxpClassifyMapper.deleteXxpClassifyById(id);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /***
|
|
|
|
|
+ * 查看该类目下是否有子类
|
|
|
|
|
+ * @param classifyId
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public List<XxpClassifyDetail> delCheck(Long classifyId){
|
|
|
|
|
+ XxpClassifyDetail detail = new XxpClassifyDetail();
|
|
|
|
|
+ detail.setInfoClassifyId(classifyId);
|
|
|
|
|
+ List<XxpClassifyDetail> list = detailedMapper.selectXxpClassifyDetailedList(detail);
|
|
|
|
|
+ return list;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|