|
@@ -0,0 +1,93 @@
|
|
|
+package com.platform.service.upms.impl;
|
|
|
+
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
+import com.platform.common.bean.AbstractPageResultBean;
|
|
|
+import com.platform.common.model.UserInfo;
|
|
|
+import com.platform.common.util.SecurityUtils;
|
|
|
+import com.platform.dao.bean.MyPage;
|
|
|
+import com.platform.dao.dto.upms.CommonMenuDTO;
|
|
|
+import com.platform.dao.entity.upms.CommonMenu;
|
|
|
+import com.platform.dao.entity.upms.CommonMenuMine;
|
|
|
+import com.platform.dao.mapper.upms.CommonMenuMapper;
|
|
|
+import com.platform.dao.mapper.upms.CommonMenuMineMapper;
|
|
|
+import com.platform.dao.vo.query.upms.CommonMenuVO;
|
|
|
+import com.platform.service.base.impl.BaseServiceImpl;
|
|
|
+import com.platform.service.upms.CommonMenuService;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import tk.mybatis.mapper.weekend.Weekend;
|
|
|
+import tk.mybatis.mapper.weekend.WeekendCriteria;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description 常用菜单库 service 实现类
|
|
|
+ * @Author lsq
|
|
|
+ * @Date 2023-12-25 14:06:26
|
|
|
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
|
|
|
+ */
|
|
|
+@AllArgsConstructor
|
|
|
+@Service("commonMenuService")
|
|
|
+
|
|
|
+public class CommonMenuServiceImpl extends BaseServiceImpl<CommonMenuMapper, CommonMenu, CommonMenuDTO> implements CommonMenuService {
|
|
|
+ private CommonMenuMineMapper commonMenuMineMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int batchDelete(List<String> ids) {
|
|
|
+ Weekend<CommonMenu> weekend = new Weekend<>(CommonMenu.class);
|
|
|
+ WeekendCriteria<CommonMenu, Object> weekendCriteria = weekend.weekendCriteria();
|
|
|
+ weekendCriteria.andIn(CommonMenu::getId, ids);
|
|
|
+ mapper.deleteByExample(weekend);
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<CommonMenu> getModelListByDTO(CommonMenuDTO model) {
|
|
|
+ return super.getModelListByDTO(model);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AbstractPageResultBean<CommonMenuVO> selectPageList(CommonMenuDTO record, int pageNum, int pageSize) {
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
+ return new MyPage(mapper.selectList(record));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AbstractPageResultBean<CommonMenuVO> selectPageList2(CommonMenuDTO record, int pageNum, int pageSize) {
|
|
|
+ UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
+ List<CommonMenuVO> commonMenuVOS = mapper.selectList(record);
|
|
|
+ CommonMenuMine commonMenuMine = new CommonMenuMine();
|
|
|
+// commonMenuMine.setCreatedUserId("1");
|
|
|
+ commonMenuMine.setCreatedUserId(userInfo.getUserId());
|
|
|
+ List<CommonMenuMine> commonMenuMines = commonMenuMineMapper.select(commonMenuMine);
|
|
|
+ if (commonMenuVOS != null) {
|
|
|
+ for (CommonMenuVO commonMenuVO : commonMenuVOS) {
|
|
|
+ Boolean flag = false;
|
|
|
+ if (commonMenuMines != null)
|
|
|
+ for (CommonMenuMine mine : commonMenuMines) {
|
|
|
+ if (mine.getCommonMenuId().equals(commonMenuVO.getId())) {
|
|
|
+ flag = true;
|
|
|
+ commonMenuVO.setMineId(mine.getId());
|
|
|
+ if (mine.getStatus() == 0) {
|
|
|
+ commonMenuVO.setMineStatus(0);
|
|
|
+ } else {
|
|
|
+ commonMenuVO.setMineStatus(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!flag) {
|
|
|
+ commonMenuVO.setMineStatus(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return new MyPage<>(commonMenuVOS);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AbstractPageResultBean<CommonMenu> selectPageInfo(CommonMenuDTO record, int pageNum, int pageSize) {
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
+ return new MyPage(mapper.selectList(record));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|