管理员系统 优化 按用户名或用户邮箱 查询用户design频率

This commit is contained in:
2024-08-21 15:07:14 +08:00
parent c5da68dc47
commit 8a774aa328
3 changed files with 12 additions and 6 deletions

View File

@@ -52,7 +52,7 @@ public class ConvenientInquiryController {
@ApiOperation("获取指定时间区间内所有用户design的使用情况") @ApiOperation("获取指定时间区间内所有用户design的使用情况")
@GetMapping("/getDesignStatistic") @GetMapping("/getDesignStatistic")
public Response<List<UserDesignStatisticDTO>> getDesignStatistic(@RequestParam String startTime, @RequestParam String endTime, public Response<List<UserDesignStatisticDTO>> getDesignStatistic(@RequestParam String startTime, @RequestParam String endTime,
@RequestParam(required = false) String userName, @RequestParam(required = false) String email) { @RequestParam(required = false) List<Long> ids, @RequestParam(required = false) String email) {
Long accountId = UserContext.getUserHolder().getId(); Long accountId = UserContext.getUserHolder().getId();
if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L) || accountId.equals(6L) || accountId.equals(4L) || accountId.equals(73L)) { if (accountId.equals(31L) || accountId.equals(87L) || accountId.equals(83L) || accountId.equals(6L) || accountId.equals(4L) || accountId.equals(73L)) {
if (StringUtil.isNullOrEmpty(startTime)) startTime = "2024-02-01 00:00:00"; if (StringUtil.isNullOrEmpty(startTime)) startTime = "2024-02-01 00:00:00";
@@ -61,7 +61,10 @@ public class ConvenientInquiryController {
Date date = new Date(); Date date = new Date();
endTime = simpleDateFormat.format(date); endTime = simpleDateFormat.format(date);
} }
List<UserDesignStatisticDTO> designStatistic = designMapper.getDesignStatistic(startTime, endTime, userName, email); if (!StringUtil.isNullOrEmpty(email)){
email = email.trim();
}
List<UserDesignStatisticDTO> designStatistic = designMapper.getDesignStatistic(startTime, endTime, ids, email);
return Response.success(designStatistic); return Response.success(designStatistic);
} else { } else {
return Response.fail("Sorry, you don't have permission"); return Response.fail("Sorry, you don't have permission");

View File

@@ -18,5 +18,5 @@ public interface DesignMapper extends CommonMapper<Design> {
//返回插入数据后生成的主键 //返回插入数据后生成的主键
Long insertDesign(Design design); Long insertDesign(Design design);
List<UserDesignStatisticDTO> getDesignStatistic(String startTime, String endTime, String userName, String email); List<UserDesignStatisticDTO> getDesignStatistic(String startTime, String endTime, List<Long> ids, String email);
} }

View File

@@ -39,11 +39,14 @@
</where> </where>
and b.create_date not like '%:01' and b.create_date not like '%:01'
and b.create_date not like '%:02' and b.create_date not like '%:02'
<if test="userName != null and userName != '' "> <if test="ids != null and ids.size() > 0">
and a.user_name = #{userName} and a.id in
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</if> </if>
<if test="email != null and email != '' "> <if test="email != null and email != '' ">
and a.user_email = #{email} and a.user_email like CONCAT('%', #{email}, '%')
</if> </if>
GROUP BY b.account_id GROUP BY b.account_id
ORDER BY b.account_id asc) d ORDER BY b.account_id asc) d