|
@@ -3,7 +3,7 @@ package cn.com.ty.lift.business.evaluation.service;
|
|
|
import cn.com.ty.lift.business.evaluation.dao.entity.Evaluation;
|
|
|
import cn.com.ty.lift.business.evaluation.dao.mapper.EvaluationMapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -18,18 +18,27 @@ import org.springframework.stereotype.Service;
|
|
|
@Service
|
|
|
public class EvaluationService extends ServiceImpl<EvaluationMapper, Evaluation> {
|
|
|
|
|
|
- public Evaluation findByRecord(Long recordId){
|
|
|
- QueryWrapper<Evaluation> queryWrapper = new QueryWrapper<>();
|
|
|
- LambdaQueryWrapper<Evaluation> lambdaQueryWrapper = queryWrapper.lambda();
|
|
|
- lambdaQueryWrapper.eq(Evaluation::getRecordId,recordId);
|
|
|
+ /**
|
|
|
+ * 根据记录id和来源分类查询评价记录
|
|
|
+ * @param recordId 急修or维保id
|
|
|
+ * @param source 急修or维保
|
|
|
+ */
|
|
|
+ public Evaluation findByRecord(Long recordId, int source){
|
|
|
+ LambdaQueryWrapper<Evaluation> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
|
|
+ lambdaQueryWrapper.eq(Evaluation::getRecordId, recordId);
|
|
|
+ lambdaQueryWrapper.eq(Evaluation::getSource, source);
|
|
|
lambdaQueryWrapper.last("LIMIT 1");
|
|
|
return getOne(lambdaQueryWrapper);
|
|
|
}
|
|
|
-
|
|
|
- public int countByRecord(Long recordId){
|
|
|
- QueryWrapper<Evaluation> queryWrapper = new QueryWrapper<>();
|
|
|
- LambdaQueryWrapper<Evaluation> lambdaQueryWrapper = queryWrapper.lambda();
|
|
|
- lambdaQueryWrapper.eq(Evaluation::getRecordId,recordId);
|
|
|
+ /**
|
|
|
+ * 根据记录id和来源分类查询评价记录条数
|
|
|
+ * @param recordId 急修or维保id
|
|
|
+ * @param source 急修or维保
|
|
|
+ */
|
|
|
+ public int countByRecord(Long recordId, int source) {
|
|
|
+ LambdaQueryWrapper<Evaluation> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
|
|
+ lambdaQueryWrapper.eq(Evaluation::getRecordId, recordId);
|
|
|
+ lambdaQueryWrapper.eq(Evaluation::getSource, source);
|
|
|
return count(lambdaQueryWrapper);
|
|
|
}
|
|
|
}
|