项目库crud
This commit is contained in:
+46
@@ -0,0 +1,46 @@
|
||||
package com.jero.modules.projectLibrary.service;
|
||||
|
||||
import com.jero.modules.projectLibrary.entity.LawsProjectLibrary;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 项目库
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-09-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ILawsProjectLibraryService extends IService<LawsProjectLibrary> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
IPage<LawsProjectLibrary> queryPage(LawsProjectLibrary lawsProjectLibrary, Integer pageNo, Integer pageSize, HttpServletRequest req);
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
void add(LawsProjectLibrary lawsProjectLibrary);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
void editById(LawsProjectLibrary lawsProjectLibrary);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*/
|
||||
LawsProjectLibrary queryById(String id);
|
||||
}
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
package com.jero.modules.projectLibrary.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.jero.modules.projectLibrary.entity.LawsProjectLibrary;
|
||||
import com.jero.modules.projectLibrary.mapper.LawsProjectLibraryMapper;
|
||||
import com.jero.modules.projectLibrary.service.ILawsProjectLibraryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 项目库
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-09-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = JeroBootException.class)
|
||||
public class LawsProjectLibraryServiceImpl extends ServiceImpl<LawsProjectLibraryMapper, LawsProjectLibrary> implements ILawsProjectLibraryService {
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@Override
|
||||
public IPage<LawsProjectLibrary> queryPage(LawsProjectLibrary lawsProjectLibrary, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<LawsProjectLibrary> queryWrapper = QueryGenerator.initQueryWrapper(lawsProjectLibrary, req.getParameterMap());
|
||||
Page<LawsProjectLibrary> page = new Page<>(pageNo, pageSize);
|
||||
return page(page, queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@Override
|
||||
public void add(LawsProjectLibrary lawsProjectLibrary) {
|
||||
Date now = new Date();
|
||||
lawsProjectLibrary.setCreateTime(now);
|
||||
lawsProjectLibrary.setUpdateTime(now);
|
||||
save(lawsProjectLibrary);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
@Override
|
||||
public void editById(LawsProjectLibrary lawsProjectLibrary) {
|
||||
Date now = new Date();
|
||||
lawsProjectLibrary.setUpdateTime(now);
|
||||
saveOrUpdate(lawsProjectLibrary);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
LawsProjectLibrary projectLibrary = getById(id);
|
||||
projectLibrary.setDelFlag("1");
|
||||
updateById(projectLibrary);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
LambdaUpdateWrapper<LawsProjectLibrary> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.in(LawsProjectLibrary::getId, ids);
|
||||
wrapper.set(LawsProjectLibrary::getDelFlag, "1");
|
||||
update(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*/
|
||||
@Override
|
||||
public LawsProjectLibrary queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user