|
@@ -0,0 +1,92 @@
|
|
|
|
+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.CommonMenuMineDTO;
|
|
|
|
+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.CommonMenuMineVO;
|
|
|
|
+import com.platform.service.base.impl.BaseServiceImpl;
|
|
|
|
+import com.platform.service.upms.CommonMenuMineService;
|
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+import tk.mybatis.mapper.weekend.Weekend;
|
|
|
|
+import tk.mybatis.mapper.weekend.WeekendCriteria;
|
|
|
|
+
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ * @Description 我的常用菜单库 service 实现类
|
|
|
|
+ * @Author lsq
|
|
|
|
+ * @Date 2023-12-25 14:06:53
|
|
|
|
+ * @Version Copyright (c) 2020,北京乾元坤和科技有限公司 All rights reserved.
|
|
|
|
+ */
|
|
|
|
+@AllArgsConstructor
|
|
|
|
+@Service("commonMenuMineService")
|
|
|
|
+public class CommonMenuMineServiceImpl extends BaseServiceImpl<CommonMenuMineMapper, CommonMenuMine, CommonMenuMineDTO> implements CommonMenuMineService {
|
|
|
|
+ private CommonMenuMapper commonMenuMapper;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public CommonMenuMine getModelById(Object id) {
|
|
|
|
+ CommonMenuMine menuMine = super.getModelById(id);
|
|
|
|
+ CommonMenu menu = commonMenuMapper.selectByPrimaryKey(menuMine.getCommonMenuId());
|
|
|
|
+ menuMine.setMenuName(menu.getName());
|
|
|
|
+ menuMine.setMenuIconPath(menu.getIconPath());
|
|
|
|
+ menuMine.setMenuRemark(menu.getRemark());
|
|
|
|
+ menuMine.setMenuRouterUrl(menu.getRouterUrl());
|
|
|
|
+ return menuMine;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<CommonMenuMine> getModelListByDTO(CommonMenuMineDTO model) {
|
|
|
|
+ List<CommonMenuMine> commonMenuMines = super.getModelListByDTO(model);
|
|
|
|
+ if (commonMenuMines==null){
|
|
|
|
+ commonMenuMines = new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+ return commonMenuMines;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public CommonMenuMine saveModelByDTO(CommonMenuMineDTO model) {
|
|
|
|
+ UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
|
+ CommonMenuMine commonMenuMine = new CommonMenuMine();
|
|
|
|
+ commonMenuMine.setUserId(userInfo.getUserId());
|
|
|
|
+ commonMenuMine.setCommonMenuId(model.getCommonMenuId());
|
|
|
|
+ CommonMenuMine menuMine = mapper.selectOne(commonMenuMine);
|
|
|
|
+ if (menuMine!=null){
|
|
|
|
+ menuMine.setStatus(0);
|
|
|
|
+ mapper.updateByPrimaryKeySelective(menuMine);
|
|
|
|
+ return menuMine;
|
|
|
|
+ }else {
|
|
|
|
+ return super.saveModelByDTO(model);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int batchDelete(List<String> ids) {
|
|
|
|
+ Weekend<CommonMenuMine> weekend = new Weekend<>(CommonMenuMine.class);
|
|
|
|
+ WeekendCriteria<CommonMenuMine, Object> weekendCriteria = weekend.weekendCriteria();
|
|
|
|
+ weekendCriteria.andIn(CommonMenuMine::getId, ids);
|
|
|
|
+ mapper.deleteByExample(weekend);
|
|
|
|
+ return 1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public AbstractPageResultBean<CommonMenuMineVO> selectPageList(CommonMenuMineDTO record, int pageNum, int pageSize) {
|
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
|
+ return new MyPage(mapper.selectList(record));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public AbstractPageResultBean<CommonMenuMine> selectPageInfo(CommonMenuMineDTO record, int pageNum, int pageSize) {
|
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
|
+ return new MyPage(mapper.selectList(record));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|