Commit 0ecabf07 by 林永健

feat(staff): 新增员工列表分页查询功能

- 添加StaffInfoPageRequest请求类,支持多条件分页查询员工信息
- 新增DigitalManagementStaffRequestDTO和DigitalManagementStaffResponseDTO数据传输对象
- 在DigitalManagementStaffRecordMapper.xml中添加selectStaffInfo SQL语句,实现动态条件过滤
- 在DigitalManagementStaffRecordMapper接口中声明selectStaffInfo方法
- 实现DigitalManagementStaffRecordService的pageStaffInfo方法,整合分页查询逻辑
- 在DigitalManagementRecordRemote接口及实现中新增pageStaffInfo远程调用方法
- 在DigitalManagementRecordController新增queryStaffList接口,提供员工分页数据访问
- 添加相关测试用例验证分页查询功能的正确性
- 优化import语句和代码结构,提高代码整洁度和可维护性
1 parent a6b557d7
package cn.com.glsx.dj.mindworkplate.dto.digitalmanagement;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class DigitalManagementStaffRequestDTO implements Serializable {
@ApiModelProperty(notes = "员工姓名")
private String staffName;
@ApiModelProperty(notes = "员工手机号")
private String staffPhone;
@ApiModelProperty(notes = "商户名称")
private String merchantName;
@ApiModelProperty(notes = "员工编号列表")
private List<String> staffUuidList;
@ApiModelProperty(notes = "员工手机号列表")
private List<String> staffPhoneList;
@ApiModelProperty(notes = "商户号列表")
private List<Integer> merchantIds;
@ApiModelProperty(notes = "角色名称")
private List<String> roleNameList;
@ApiModelProperty(notes = "0-驻店,1-技师(与账户中心员工类型保持一致)")
private String staffType;
}
\ No newline at end of file
package cn.com.glsx.dj.mindworkplate.dto.digitalmanagement;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class DigitalManagementStaffResponseDTO implements Serializable {
@ApiModelProperty(notes = "员工编号")
private String staffUuid;
@ApiModelProperty(notes = "员工姓名")
private String staffName;
@ApiModelProperty(notes = "员工手机号")
private String staffPhone;
@ApiModelProperty(notes = "0-驻店,1-技师(与账户中心员工类型保持一致)")
private Integer staffType;
@ApiModelProperty(notes = "商户号")
private String merchantId;
@ApiModelProperty(notes = "商户名称")
private String merchantName;
@ApiModelProperty(notes = "角色名称")
private String roleName;
@ApiModelProperty(notes = "员工业务标签")
private String staffSceneLabel;
@ApiModelProperty(notes = "注册时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date registerTime;
}
\ No newline at end of file
......@@ -86,4 +86,8 @@ public interface DigitalManagementRecordRemote {
@ApiMethod("更新员工记录项")
RpcResponse<Boolean> updateStaffRecordItem(DigitalManagementStaffRecordItemDTO dto);
@ApiMethod("查询所有员工")
RpcResponse<RpcPagination<DigitalManagementStaffResponseDTO>> pageStaffInfo(RpcPagination<DigitalManagementStaffRequestDTO> req);
}
package cn.com.glsx.dj.mindworkplate.mapper.digitalmanagement;
import cn.com.glsx.dj.mindworkplate.dto.digitalmanagement.DigitalManagementStaffRecordDTO;
import cn.com.glsx.dj.mindworkplate.dto.digitalmanagement.DigitalManagementStaffRecordSummaryDTO;
import cn.com.glsx.dj.mindworkplate.dto.digitalmanagement.DigitalManagementTemplateDTO;
import cn.com.glsx.dj.mindworkplate.dto.digitalmanagement.*;
import cn.com.glsx.dj.mindworkplate.model.digitalmanagement.DigitalManagementStaffRecord;
import cn.com.glsx.dj.mindworkplate.model.digitalmanagement.PerformanceRanking;
import cn.com.glsx.dj.mindworkplate.model.digitalmanagement.QueryParam;
......@@ -64,4 +62,6 @@ public interface DigitalManagementStaffRecordMapper extends OreMapper<DigitalMan
List<PerformanceRanking> getDailyReportWeekly(QueryParam queryParam);
int getMonthlyIsTrainingOrganizedCount(String uuid);
List<DigitalManagementStaffResponseDTO> selectStaffInfo(DigitalManagementStaffRequestDTO condition);
}
\ No newline at end of file
......@@ -172,4 +172,17 @@ public class DigitalManagementRecordRemoteImpl implements DigitalManagementRecor
}
}
@Override
public RpcResponse<RpcPagination<DigitalManagementStaffResponseDTO>> pageStaffInfo(RpcPagination<DigitalManagementStaffRequestDTO> req) {
try {
return RpcResponse.success(RpcPagination.copyPage(staffRecordService.pageStaffInfo(req)));
} catch (RpcServiceException e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e.getError(), e.getMessage());
} catch (Exception e) {
log.error(e.getMessage(), e);
return RpcResponse.error(e);
}
}
}
......@@ -786,4 +786,13 @@ public class DigitalManagementStaffRecordService {
exist.setUpdatedDate(new Date());
return staffRecordItemMapper.updateByPrimaryKey(exist) > 0;
}
/**
* 查询 staff_info 表的所有员工数据
*/
public Page<DigitalManagementStaffResponseDTO> pageStaffInfo(RpcPagination<DigitalManagementStaffRequestDTO> req) {
Page<DigitalManagementStaffResponseDTO> res = PageHelper.startPage(req.getPageNum(), req.getPageSize());
staffRecordMapper.selectStaffInfo(req.getCondition());
return res;
}
}
......@@ -17,6 +17,17 @@
</resultMap>
<resultMap id="DTOResult" type="cn.com.glsx.dj.mindworkplate.dto.digitalmanagement.DigitalManagementStaffRecordDTO" extends="BaseResultMap">
</resultMap>
<resultMap id="StaffInfoResultMap" type="cn.com.glsx.dj.mindworkplate.dto.digitalmanagement.DigitalManagementStaffResponseDTO">
<result column="staff_uuid" property="staffUuid" jdbcType="VARCHAR" />
<result column="staff_name" property="staffName" jdbcType="VARCHAR" />
<result column="phone_number" property="staffPhone" jdbcType="VARCHAR" />
<result column="staff_type" property="staffType" jdbcType="INTEGER" />
<result column="staff_scene_label" property="staffSceneLabel" jdbcType="VARCHAR" />
<result column="role_name" property="roleName" jdbcType="VARCHAR" />
<result column="merchant_id" property="merchantId" jdbcType="INTEGER" />
<result column="merchant_name" property="merchantName" jdbcType="VARCHAR" />
<result column="register_time" property="registerTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
<!--
WARNING - @mbg.generated
......@@ -258,4 +269,51 @@
and t.created_date >= DATE_FORMAT(NOW(), '%Y-%m-01') AND t.created_date &lt;= LAST_DAY(NOW());
</select>
<select id="selectStaffInfo" resultMap="StaffInfoResultMap"
parameterType="cn.com.glsx.dj.mindworkplate.dto.digitalmanagement.DigitalManagementStaffRequestDTO">
select
si.staff_uuid, si.staff_name, si.phone_number, si.staff_type, si.staff_scene_label, si.role_name, si.merchant_id, si.merchant_name, si.register_time
from dj_car_life_staff_info si
<where>
si.deleted_flag = 'N'
<if test="staffName != null and staffName != ''">
and si.staff_name like concat('%',#{staffName},'%')
</if>
<if test="staffPhone != null and staffPhone != ''">
and si.phone_number like concat('%',#{staffPhone},'%')
</if>
<if test="merchantName != null and merchantName != ''">
and si.merchant_name like concat('%',#{merchantName},'%')
</if>
<if test="staffType != null">
and si.staff_type = #{staffType}
</if>
<if test="staffUuidList != null and staffUuidList.size() > 0">
and si.staff_uuid in
<foreach collection="staffUuidList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="staffPhoneList != null and staffPhoneList.size() > 0">
and si.phone_number in
<foreach collection="staffPhoneList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="merchantIds != null and merchantIds.size() > 0">
and si.merchant_id in
<foreach collection="merchantIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="roleNameList != null and roleNameList.size() > 0">
and
<foreach collection="roleNameList" item="item" open="(" separator=" or " close=")">
si.role_name like concat('%',#{item},'%')
</foreach>
</if>
</where>
order by si.register_time, si.created_date desc
</select>
</mapper>
\ No newline at end of file
package cn.com.glsx.dj.mindworkplate.service.digitalmenagement;
import cn.com.glsx.dj.mindworkplate.dto.digitalmanagement.DigitalManagementStaffRecordDTO;
import cn.com.glsx.dj.mindworkplate.dto.digitalmanagement.DigitalManagementStaffRecordSummaryDTO;
import cn.com.glsx.dj.mindworkplate.dto.digitalmanagement.DigitalManagementTemplateDTO;
import cn.com.glsx.dj.mindworkplate.dto.digitalmanagement.DigitalManagementTemplateSummaryDTO;
import cn.com.glsx.dj.mindworkplate.dto.digitalmanagement.*;
import cn.com.glsx.dj.mindworkplate.job.digitalmanagement.MonthlyTrainingStatisticsJob;
import cn.com.glsx.dj.mindworkplate.job.digitalmanagement.PerformanceRankingJob;
import cn.com.glsx.dj.mindworkplate.mapper.digitalmanagement.DigitalManagementStaffRecordMapper;
......@@ -352,4 +349,17 @@ public class DigitalManagementServiceTest extends BaseServiceTest {
}
}
@Test
public void pageStaffInfo(){
try {
RpcPagination<DigitalManagementStaffRequestDTO> req = new RpcPagination<>();
req.setPageNum(1);
req.setPageSize(100);
Object res = staffRecordService.pageStaffInfo(req);
System.out.println(res);
}catch (Exception e){
e.printStackTrace();
}
}
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!