package com.ruoyi.service.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.utils.MapUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.domain.Physcial;
|
import com.ruoyi.domain.qrcode;
|
import com.ruoyi.mapper.PhyscialMapper;
|
import com.ruoyi.mapper.qrcodeMapper;
|
import com.ruoyi.service.PhyscialService;
|
import com.ruoyi.service.qrCodeService;
|
import org.springframework.stereotype.Service;
|
|
import java.text.ParseException;
|
import java.util.Arrays;
|
import java.util.HashMap;
|
import java.util.List;
|
@Service
|
public class qrCodeServiceImpl extends ServiceImpl<qrcodeMapper, qrcode> implements qrCodeService {
|
|
|
|
|
private LambdaQueryWrapper<qrcode> buildCondition(qrcode cos){
|
LambdaQueryWrapper<qrcode> lqw = new LambdaQueryWrapper<>();
|
|
lqw.like(!StringUtils.isEmpty(cos.getName()),qrcode::getName,cos.getName())
|
.between(cos.getHappenStartDeadTime()!=null&&cos.getHappenEndDeadTime()!=null,qrcode::getCreateTime,cos.getHappenStartDeadTime(),cos.getHappenEndDeadTime());
|
// lqw.like(!StringUtils.isEmpty(zfProperty.getType()), ZfProperty::getType, zfProperty.getType())
|
// .like(!StringUtils.isEmpty(zfProperty.getTitle()), ZfProperty::getTitle, zfProperty.getTitle())
|
// .like(!StringUtils.isEmpty(zfProperty.getLocation()), ZfProperty::getLocation, zfProperty.getLocation())
|
// .like(!StringUtils.isEmpty(zfProperty.getHolder()), ZfProperty::getHolder, zfProperty.getHolder())
|
// .like(!StringUtils.isEmpty(zfProperty.getAddress()), ZfProperty::getAddress, zfProperty.getAddress())
|
// .like(!StringUtils.isEmpty(zfProperty.getRemark()), ZfProperty::getRemark, zfProperty.getRemark())
|
// .eq(zfProperty.getFamilyId()!=null,ZfProperty::getFamilyId,zfProperty.getFamilyId())
|
// .in(ZfProperty::getFamilyId,familyIdList)
|
// .eq(zfProperty.getHappenTime()!=null,ZfProperty::getHappenTime,zfProperty.getHappenTime())
|
// .between(zfProperty.getHappenStartTime() != null && zfProperty.getHappenEndTime() != null, ZfProperty::getHappenTime, zfProperty.getHappenStartTime(), zfProperty.getHappenEndTime());
|
// if(cos.getUid()!=1)
|
// lqw.eq(cos.getUid()!=null, coscan::getUid,cos.getUid());
|
lqw.orderByDesc(qrcode::getCreateTime);
|
return lqw;
|
|
}
|
|
@Override
|
public List<qrcode> selectByCondition(qrcode cos) {
|
LambdaQueryWrapper<qrcode> lqw = buildCondition(cos);
|
List<qrcode> beanRecords = list(lqw);
|
return beanRecords;
|
}
|
|
@Override
|
public AjaxResult selectDataList(qrcode cos, Integer pageNum, Integer pageSize) {
|
LambdaQueryWrapper<qrcode> lqw = buildCondition(cos);
|
|
System.out.println(pageNum);
|
System.out.println(pageSize);
|
System.out.println("--------------------");
|
Page<qrcode> zfPropertyPage = new Page<>(pageNum, pageSize);
|
Page<qrcode> pageResult =
|
// page(zfPropertyPage);
|
page(zfPropertyPage, lqw);
|
long total = pageResult.getTotal();
|
List<qrcode> beanRecords = pageResult.getRecords();//得到查询出来的数据
|
System.out.println(beanRecords);
|
// List<ZfProperty> dtoResult = markOwnData(familyId, beanRecords);
|
|
HashMap<String, Object> data = MapUtils.getResult(pageResult);
|
return AjaxResult.success(data);
|
}
|
|
@Override
|
public AjaxResult addData(qrcode cos) throws ParseException {
|
if (save(cos)) {
|
return AjaxResult.success();
|
}
|
else{
|
return AjaxResult.error();
|
}
|
}
|
|
@Override
|
public AjaxResult updateData(qrcode cos) {
|
if(this.updateById(cos))
|
return AjaxResult.success("修改成功!");
|
else
|
return AjaxResult.error("修改失败!");
|
}
|
|
@Override
|
public AjaxResult deleteData(Long[] ids) {
|
|
if (this.removeByIds(Arrays.asList(ids))) {
|
|
|
return AjaxResult.success();
|
}else {
|
return AjaxResult.error();
|
}
|
}
|
}
|