|
|
|
@ -4,7 +4,6 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import com.enjoy.common.core.utils.iqc.IQCExcelUtils;
|
|
|
|
|
import com.enjoy.common.core.web.domain.AjaxResult;
|
|
|
|
|
import com.enjoy.common.security.utils.ExcelUtil;
|
|
|
|
|
import com.enjoy.common.core.web.domain.AjaxResult;
|
|
|
|
|
import com.enjoy.oqc.utils.BeanHkUtils;
|
|
|
|
|
import com.enjoy.oqc.utils.CollectionUtil;
|
|
|
|
|
import com.enjoy.common.core.i18n.InternationalizationService;
|
|
|
|
@ -12,7 +11,7 @@ import com.enjoy.common.core.constant.Constants;
|
|
|
|
|
import com.enjoy.common.core.constant.HttpStatus;
|
|
|
|
|
import com.enjoy.common.core.web.page.TableDataInfo;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
@ -52,17 +51,17 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
|
|
|
|
|
public TableDataInfo pageList(Query${entityName}VO query${entityName}VO){
|
|
|
|
|
TableDataInfo rspData=new TableDataInfo();
|
|
|
|
|
try{
|
|
|
|
|
List<${entityName}DTO> list=new ArrayList();
|
|
|
|
|
QueryWrapper<${entityName}> queryWrapper=new QueryWrapper();
|
|
|
|
|
List<${entityName}DTO> list=new ArrayList<>();
|
|
|
|
|
LambdaQueryWrapper<${entityName}> queryWrapper=new LambdaQueryWrapper<>();
|
|
|
|
|
<#list originalColumns as po>
|
|
|
|
|
<#if po.fieldColumn == 'create_time'>
|
|
|
|
|
queryWrapper.orderByDesc("update_time","create_time");
|
|
|
|
|
queryWrapper.orderByDesc(${entityName}::getCreateTime);
|
|
|
|
|
<#else>
|
|
|
|
|
</#if>
|
|
|
|
|
</#list>
|
|
|
|
|
List<${entityName}> dbEntityList = this.list(queryWrapper);
|
|
|
|
|
if (CollectionUtil.isNotEmpty(dbEntityList)) {
|
|
|
|
|
dbEntityList.stream().forEach(entity->{
|
|
|
|
|
dbEntityList.forEach(entity->{
|
|
|
|
|
${entityName}DTO ${uncap_first}DTO=new ${entityName}DTO();
|
|
|
|
|
${uncap_first}DTO = (${entityName}DTO) BeanHkUtils.copyProperties(entity,${uncap_first}DTO);
|
|
|
|
|
list.add(${uncap_first}DTO);
|
|
|
|
@ -70,7 +69,7 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
|
|
|
|
|
}
|
|
|
|
|
rspData.setCode(HttpStatus.SUCCESS);
|
|
|
|
|
rspData.setRows(list);
|
|
|
|
|
rspData.setTotal(new PageInfo(dbEntityList).getTotal());
|
|
|
|
|
rspData.setTotal(new PageInfo<>(dbEntityList).getTotal());
|
|
|
|
|
rspData.setMsg(internationalizationService.getMessage(Constants.QUERY_SUCCESS));
|
|
|
|
|
return rspData;
|
|
|
|
|
}catch(Exception e){
|
|
|
|
@ -87,11 +86,10 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public AjaxResult listAll(Query${entityName}VO query${entityName}VO){
|
|
|
|
|
List<${entityName}DTO> list=new ArrayList();
|
|
|
|
|
QueryWrapper<${entityName}> queryWrapper=new QueryWrapper();
|
|
|
|
|
List<${entityName}> dbEntityList = this.list(queryWrapper);
|
|
|
|
|
List<${entityName}DTO> list=new ArrayList<>();
|
|
|
|
|
List<${entityName}> dbEntityList = this.list(new LambdaQueryWrapper<>());
|
|
|
|
|
if (CollectionUtil.isNotEmpty(dbEntityList)) {
|
|
|
|
|
dbEntityList.stream().forEach(entity->{
|
|
|
|
|
dbEntityList.forEach(entity->{
|
|
|
|
|
${entityName}DTO ${uncap_first}DTO=new ${entityName}DTO();
|
|
|
|
|
${uncap_first}DTO = (${entityName}DTO) BeanHkUtils.copyProperties(entity,${uncap_first}DTO);
|
|
|
|
|
list.add(${uncap_first}DTO);
|
|
|
|
@ -135,7 +133,7 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public AjaxResult delete${entityName}(String id){
|
|
|
|
|
UpdateWrapper<${entityName}> updateWrapper=new UpdateWrapper();
|
|
|
|
|
UpdateWrapper<${entityName}> updateWrapper=new UpdateWrapper<>();
|
|
|
|
|
updateWrapper.set("del_flag","1");
|
|
|
|
|
updateWrapper.eq("id",id);
|
|
|
|
|
this.update(updateWrapper);
|
|
|
|
@ -150,7 +148,7 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
|
|
|
|
|
if(!CollectionUtil.isNotEmpty(ids)){
|
|
|
|
|
return AjaxResult.error("id不可为空");
|
|
|
|
|
}
|
|
|
|
|
UpdateWrapper<${entityName}> updateWrapper=new UpdateWrapper();
|
|
|
|
|
UpdateWrapper<${entityName}> updateWrapper=new UpdateWrapper<>();
|
|
|
|
|
updateWrapper.set("del_flag","1");
|
|
|
|
|
updateWrapper.in("id",ids);
|
|
|
|
|
this.update(updateWrapper);
|
|
|
|
@ -161,21 +159,21 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void export(HttpServletResponse response, Query${entityName}VO query${entityName}VO){
|
|
|
|
|
List<${entityName}Excel> list=new ArrayList();
|
|
|
|
|
QueryWrapper<${entityName}> queryWrapper=new QueryWrapper();
|
|
|
|
|
List<${entityName}Excel> list=new ArrayList<>();
|
|
|
|
|
LambdaQueryWrapper<${entityName}> queryWrapper=new LambdaQueryWrapper<>();
|
|
|
|
|
//根据选中项导出
|
|
|
|
|
if(StringUtils.isNotBlank(query${entityName}VO.getIds())){
|
|
|
|
|
queryWrapper.in("id", Arrays.asList(query${entityName}VO.getIds().split(",")));
|
|
|
|
|
queryWrapper.in(${entityName}::getId, Arrays.asList(query${entityName}VO.getIds().split(",")));
|
|
|
|
|
}
|
|
|
|
|
List<${entityName}> dbEntityList = this.list(queryWrapper);
|
|
|
|
|
if (CollectionUtil.isNotEmpty(dbEntityList)) {
|
|
|
|
|
dbEntityList.stream().forEach(entity->{
|
|
|
|
|
dbEntityList.forEach(entity->{
|
|
|
|
|
${entityName}Excel ${uncap_first}Excel=new ${entityName}Excel();
|
|
|
|
|
${uncap_first}Excel = (${entityName}Excel) BeanHkUtils.copyProperties(entity,${uncap_first}Excel);
|
|
|
|
|
list.add(${uncap_first}Excel);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
ExcelUtil<${entityName}Excel> util = new ExcelUtil<${entityName}Excel>(${entityName}Excel.class);
|
|
|
|
|
ExcelUtil<${entityName}Excel> util = new ExcelUtil<>(${entityName}Excel.class);
|
|
|
|
|
util.exportExcel(response, list, "${tableVo.ftlDescription}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -200,7 +198,7 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void importTemplateExcel(HttpServletResponse response){
|
|
|
|
|
ExcelUtil<${entityName}Excel> util = new ExcelUtil<${entityName}Excel>(${entityName}Excel.class);
|
|
|
|
|
ExcelUtil<${entityName}Excel> util = new ExcelUtil<>(${entityName}Excel.class);
|
|
|
|
|
util.importTemplateExcel(response, "${tableVo.ftlDescription}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|