master
周文涛 2 years ago
parent df786e393b
commit 5248000100

@ -8,6 +8,7 @@ import ${bussiPackage}.vo.Add${entityName}PVO;
import ${bussiPackage}.vo.Edit${entityName}PVO; import ${bussiPackage}.vo.Edit${entityName}PVO;
import ${bussiPackage}.${entityPackage}.${entityName}; import ${bussiPackage}.${entityPackage}.${entityName};
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/** /**
* @Description: ${tableVo.ftlDescription} * @Description: ${tableVo.ftlDescription}
@ -21,6 +22,16 @@ public interface I${entityName}Service extends IService<${entityName}> {
*/ */
TableDataInfo pageList(Query${entityName}VO query${entityName}VO); TableDataInfo pageList(Query${entityName}VO query${entityName}VO);
/**
* 全部
*/
AjaxResult listAll();
/**
* 获取详情信息
*/
AjaxResult get${entityName}Detail(String id);
/** /**
* 新增 * 新增
*/ */
@ -30,4 +41,14 @@ public interface I${entityName}Service extends IService<${entityName}> {
* 编辑 * 编辑
*/ */
AjaxResult modify${entityName}PVO(Edit${entityName}PVO edit${entityName}PVO); AjaxResult modify${entityName}PVO(Edit${entityName}PVO edit${entityName}PVO);
/**
* 删除
*/
AjaxResult delete${entityName}(String id);
/**
* 批量删除
*/
AjaxResult delete${entityName}(List<String> ids);
} }

@ -9,6 +9,7 @@ import com.enjoy.common.core.constant.HttpStatus;
import com.enjoy.common.core.web.page.TableDataInfo; import com.enjoy.common.core.web.page.TableDataInfo;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -37,6 +38,7 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
private InternationalizationService internationalizationService; private InternationalizationService internationalizationService;
/** /**
* 分页 * 分页
* return
*/ */
@Override @Override
public TableDataInfo pageList(Query${entityName}VO query${entityName}VO){ public TableDataInfo pageList(Query${entityName}VO query${entityName}VO){
@ -71,8 +73,38 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
rspData.setTotal(0); rspData.setTotal(0);
return rspData; return rspData;
} }
/**
* 全部
* return
*/
public AjaxResult listAll(){
List<${entityName}DTO> list=new ArrayList();
QueryWrapper<${entityName}> queryWrapper=new QueryWrapper();
List<${entityName}> dbEntityList = this.list(queryWrapper);
if (CollectionUtil.isNotEmpty(dbEntityList)) {
dbEntityList.stream().forEach(entity->{
${entityName}DTO ${uncap_first}DTO=new ${entityName}DTO();
BeanHkUtils.copyProperties(entity,${uncap_first}DTO);
list.add(${uncap_first}DTO);
});
}
return AjaxResult.success(list);
}
/**
* 获取详情信息
* return
*/
public AjaxResult get${entityName}Detail(String id){
${entityName}DTO ${uncap_first}DTO=new ${entityName}DTO();
${uncap_first}DTO =(${entityName}DTO) BeanHkUtils.copyProperties(this.getById(id),${uncap_first}DTO);
return AjaxResult.success(${uncap_first}DTO);
}
/** /**
* 新增 * 新增
* @param add${entityName}PVO
*/ */
@Override @Override
public AjaxResult save${entityName}PVO(Add${entityName}PVO add${entityName}PVO){ public AjaxResult save${entityName}PVO(Add${entityName}PVO add${entityName}PVO){
@ -83,6 +115,7 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
} }
/** /**
* 编辑 * 编辑
* @param edit${entityName}PVO
*/ */
@Override @Override
public AjaxResult modify${entityName}PVO(Edit${entityName}PVO edit${entityName}PVO){ public AjaxResult modify${entityName}PVO(Edit${entityName}PVO edit${entityName}PVO){
@ -91,4 +124,32 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
this.updateById(${uncap_first}); this.updateById(${uncap_first});
return AjaxResult.success("编辑成功!"); return AjaxResult.success("编辑成功!");
} }
/**
* 删除
*/
@Override
public AjaxResult delete${entityName}(String id){
UpdateWrapper<${entityName}> updateWrapper=new UpdateWrapper();
updateWrapper.set("del_flag","1");
updateWrapper.eq("id",id);
this.update(updateWrapper);
return AjaxResult.success("删除成功!");
}
/**
* 批量删除
* @param ids
* @return
*/
@Override
public AjaxResult delete${entityName}(List<String> ids){
if(!CollectionUtil.isNotEmpty(ids)){
return AjaxResult.error("id不可为空");
}
UpdateWrapper<${entityName}> updateWrapper=new UpdateWrapper();
updateWrapper.set("del_flag","1");
updateWrapper.in("id",ids);
this.update(updateWrapper);
return AjaxResult.success("删除成功!");
}
} }

Loading…
Cancel
Save