2022-11-08 15:51:08 +08:00
|
|
|
package ${package}.${moduleName}.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import lombok.AllArgsConstructor;
|
2023-01-20 15:33:50 +08:00
|
|
|
import ${package}.framework.common.utils.PageResult;
|
|
|
|
|
import ${package}.framework.mybatis.service.impl.BaseServiceImpl;
|
2022-11-08 15:51:08 +08:00
|
|
|
import ${package}.${moduleName}.convert.${ClassName}Convert;
|
|
|
|
|
import ${package}.${moduleName}.entity.${ClassName}Entity;
|
|
|
|
|
import ${package}.${moduleName}.query.${ClassName}Query;
|
|
|
|
|
import ${package}.${moduleName}.vo.${ClassName}VO;
|
|
|
|
|
import ${package}.${moduleName}.dao.${ClassName}Dao;
|
|
|
|
|
import ${package}.${moduleName}.service.${ClassName}Service;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ${tableComment}
|
|
|
|
|
*
|
|
|
|
|
* @author ${author} ${email}
|
|
|
|
|
* @since ${version} ${date}
|
|
|
|
|
*/
|
|
|
|
|
@Service
|
|
|
|
|
@AllArgsConstructor
|
|
|
|
|
public class ${ClassName}ServiceImpl extends BaseServiceImpl<${ClassName}Dao, ${ClassName}Entity> implements ${ClassName}Service {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public PageResult<${ClassName}VO> page(${ClassName}Query query) {
|
|
|
|
|
IPage<${ClassName}Entity> page = baseMapper.selectPage(getPage(query), getWrapper(query));
|
|
|
|
|
|
|
|
|
|
return new PageResult<>(${ClassName}Convert.INSTANCE.convertList(page.getRecords()), page.getTotal());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private LambdaQueryWrapper<${ClassName}Entity> getWrapper(${ClassName}Query query){
|
|
|
|
|
LambdaQueryWrapper<${ClassName}Entity> wrapper = Wrappers.lambdaQuery();
|
|
|
|
|
|
|
|
|
|
return wrapper;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void save(${ClassName}VO vo) {
|
|
|
|
|
${ClassName}Entity entity = ${ClassName}Convert.INSTANCE.convert(vo);
|
|
|
|
|
|
|
|
|
|
baseMapper.insert(entity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void update(${ClassName}VO vo) {
|
|
|
|
|
${ClassName}Entity entity = ${ClassName}Convert.INSTANCE.convert(vo);
|
|
|
|
|
|
|
|
|
|
updateById(entity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public void delete(List<Long> idList) {
|
|
|
|
|
removeByIds(idList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|