推广员导出

pull/2/head
perry 2023-05-28 11:36:55 +08:00
parent 5641f8d322
commit 4aadcef501
8 changed files with 53 additions and 19 deletions

View File

@ -98,10 +98,9 @@ public class PromoterController {
@OperateLog(type = EXPORT)
public void exportPromoterExcel(@Valid PromoterExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<PromoterDO> list = promoterService.getPromoterList(exportReqVO);
List<PromoterExcelVO> list = promoterService.getPromoterList(exportReqVO);
// 导出 Excel
List<PromoterExcelVO> datas = PromoterConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "推广员.xls", "数据", PromoterExcelVO.class, datas);
ExcelUtils.write(response, "推广员.xls", "数据", PromoterExcelVO.class, list);
}
@GetMapping("/get-import-template")
@Operation(summary = "获得导入推广员模板")

View File

@ -14,13 +14,14 @@ import com.alibaba.excel.annotation.ExcelProperty;
@Data
public class PromoterExcelVO {
@ExcelProperty("编号")
private Long id;
@ExcelProperty("组织id")
private String deptId;
@ExcelProperty("组织")
private String orgName;
@ExcelProperty("会员id")
private Long userId;
@ExcelProperty("推广员名称")
private String nickname;
@ExcelProperty("电话")
private String mobile;
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.member.controller.admin.promoter.vo;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
@ -12,7 +13,18 @@ public class PromoterExportReqVO {
@Schema(description = "组织id", example = "18443")
private String deptId;
@Schema(description = "会员id", example = "5841")
private Long userId;
@Schema(description = "推广员名称", example = "5841")
private String nickname;
@Schema(description = "推广员手机号", example = "15601691300")
private String mobile;
/**
*
* <p>
* {@link CommonStatusEnum}
*/
@Schema(description = "帐号状态")
private Integer status;
}

View File

@ -26,12 +26,14 @@ public interface PromoterMapper extends BaseMapperX<PromoterDO> {
}
IPage<PromoterRespVO> findListPage(IPage<PromoterRespVO> page, @Param("data") PromoterPageReqVO data);
List<PromoterExcelVO> findList(@Param("data") PromoterExportReqVO data);
PromoterRespVO getPromoterInfo(@Param("userId") Long userId);
default List<PromoterDO> selectList(PromoterExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<PromoterDO>()
.eqIfPresent(PromoterDO::getDeptId, reqVO.getDeptId())
.eqIfPresent(PromoterDO::getUserId, reqVO.getUserId())
.orderByDesc(PromoterDO::getId));
}

View File

@ -75,7 +75,7 @@ public interface PromoterService {
* @param exportReqVO
* @return 广
*/
List<PromoterDO> getPromoterList(PromoterExportReqVO exportReqVO);
List<PromoterExcelVO> getPromoterList(PromoterExportReqVO exportReqVO);
PromoterRespVO getPromoterInfo(Long userId);

View File

@ -158,8 +158,8 @@ public class PromoterServiceImpl implements PromoterService {
}
@Override
public List<PromoterDO> getPromoterList(PromoterExportReqVO exportReqVO) {
return promoterMapper.selectList(exportReqVO);
public List<PromoterExcelVO> getPromoterList(PromoterExportReqVO exportReqVO) {
return promoterMapper.findList(exportReqVO);
}
@Override

View File

@ -30,6 +30,26 @@
</select>
<select id="findList" resultType="cn.iocoder.yudao.module.member.controller.admin.promoter.vo.PromoterExcelVO">
select a.id,a.user_id,a.dept_id,b.nickname,b.status,b.mobile,c.parent_organization_name as 'orgName' from member_promoter a
left join member_user b on a.user_id = b.id
left join system_dept c on c.id=a.dept_id
<where>
<if test="data.deptId!=null and data.deptId!=''">
and c.parent_organization_ids like CONCAT(#{data.deptId},'%')
</if>
<if test="data.status!=null">
and b.status =#{data.status}
</if>
<if test="data.nickname!=null and data.nickname!=''">
and b.nickname like CONCAT('%',#{data.nickname},'%')
</if>
<if test="data.mobile!=null and data.mobile!=''">
and b.mobile like CONCAT('%',#{data.mobile},'%')
</if>
</where>
</select>
<select id="getPromoterInfo" resultType="cn.iocoder.yudao.module.member.controller.admin.promoter.vo.PromoterRespVO">
select a.id,a.user_id,a.dept_id,b.nickname,b.status,b.mobile,c.parent_organization_name as 'orgName',c.name as 'deptName' from member_promoter a
left join member_user b on a.user_id = b.id

View File

@ -38,10 +38,10 @@
v-hasPermi="['system:user:import']">导入
</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"-->
<!-- v-hasPermi="['member:promoter:export']">导出</el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['member:promoter:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>