ModuleServiceImpl.java 1.47 KB
Newer Older
刘弈臻's avatar
刘弈臻 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
package com.govmade.modules.system.service.impl;

import java.util.Map;
import java.util.Set;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.govmade.common.utils.PageUtils;
import com.govmade.common.utils.Query;
import com.govmade.modules.system.dao.ModuleDao;
import com.govmade.modules.system.entity.ModuleEntity;
import com.govmade.modules.system.service.ModuleService;

import cn.hutool.core.util.StrUtil;



/**
 * 系统管理 - 模块设置
 * 
 * @author 刘弈臻
 * @date 2018年8月9日
 */
@Service("ModuleService")
public class ModuleServiceImpl extends ServiceImpl<ModuleDao, ModuleEntity> implements ModuleService{

	@Override
	public PageUtils queryPage(Map<String, Object> params) {
		
		String name = (String) params.get("name");
		Page<ModuleEntity> page = this.selectPage(new Query<ModuleEntity>(params).getPage(),
				new EntityWrapper<ModuleEntity>()
				.like(StrUtil.isNotBlank(name), "name", name));
		return new PageUtils(page);
	}
	
	@Override
	public void save(ModuleEntity module) {
		super.insertOrUpdate(module);
	}
	
	@Override
	public void deleteBatch(Set<Long> ids) {
		this.baseMapper.deleteBatch(ids);
	}
	
	@Override
	public Integer checkModule(String name) {
		return super.selectCount(new EntityWrapper<ModuleEntity>().eq("name", name));
	}
}