use of com.itrus.portal.db.TempPicExample in project portal by ixinportal.
the class TempPicService method removeRandomUserCert.
/**
* 将旧的临时图片删除,并设置为无效状态
*
* @param temPic
* @throws Exception
*/
public void removeRandomUserCert(TempPic temPic) throws Exception {
TempPicExample tempPicExample = new TempPicExample();
TempPicExample.Criteria tempPicCriteria = tempPicExample.or();
tempPicCriteria.andCreateTimeLessThan(new Date(temPic.getCreateTime().getTime() - DAY));
// 2:上传时间为空
// TempPicExample.Criteria tempPicCriteria2 = tempPicExample.or();
// tempPicCriteria2.andUploadTimeIsNull();
List<TempPic> tempPicList = sqlSession.selectList("com.itrus.portal.db.TempPicMapper.selectByExample", tempPicExample);
if (tempPicList.size() > 0) {
for (TempPic tempPic : tempPicList) {
File imgDir = getDir(tempPic.getRandom());
// }
if (StringUtils.isNotBlank(tempPic.getImgFileA())) {
FileUtils.deleteQuietly(imgDir);
}
if (StringUtils.isNotBlank(tempPic.getImgFileB())) {
FileUtils.deleteQuietly(imgDir);
}
// 删除无效的临时记录
sqlSession.delete("com.itrus.portal.db.TempPicMapper.deleteByPrimaryKey", tempPic);
}
}
}
use of com.itrus.portal.db.TempPicExample in project portal by ixinportal.
the class TempPicService method getTempPicByRandomAndTime.
/**
* 根据随机数,图片上传时间,找到对应的临时文件
*
* @param random
* @param uploadTime
* @return
*/
public TempPic getTempPicByRandomAndTime(String random, Date uploadTime) {
TempPic tempPic = null;
TempPicExample tempPicExample = new TempPicExample();
TempPicExample.Criteria tempPicCriteria = tempPicExample.or();
tempPicCriteria.andImgFileAIsNotNull();
tempPicCriteria.andRandomEqualTo(random);
tempPicCriteria.andUploadTimeEqualTo(uploadTime);
tempPic = sqlSession.selectOne("com.itrus.portal.db.TempPicMapper.selectByExample", tempPicExample);
return tempPic;
}
use of com.itrus.portal.db.TempPicExample in project portal by ixinportal.
the class TempPicService method hasImg.
/**
* 根据random查看是否有上传图片
*
* @param random
* @return
*/
public boolean hasImg(String random) {
List<TempPic> tempPicList = new ArrayList<TempPic>();
TempPicExample tempPicExample = new TempPicExample();
TempPicExample.Criteria tempPicCriteria = tempPicExample.or();
tempPicCriteria.andRandomEqualTo(random);
tempPicCriteria.andUploadTimeIsNotNull();
tempPicExample.setOrderByClause("upload_time desc");
tempPicList = sqlSession.selectList("com.itrus.portal.db.TempPicMapper.selectByExample", tempPicExample);
if (tempPicList.size() > 0) {
return true;
}
return false;
}
use of com.itrus.portal.db.TempPicExample in project portal by ixinportal.
the class TempPicService method findTempPicByRandom.
/**
* 根据随机数 查询有效的(有图片或无图片)的随机数实例
*
* @param random
* @return
*/
public TempPic findTempPicByRandom(String random) {
List<TempPic> tempPicList = new ArrayList<TempPic>();
TempPic tempPic = null;
TempPicExample tempPicExample = new TempPicExample();
TempPicExample.Criteria tempPicCriteria = tempPicExample.or();
tempPicCriteria.andRandomEqualTo(random);
tempPicExample.setOrderByClause("upload_time desc");
tempPicList = sqlSession.selectList("com.itrus.portal.db.TempPicMapper.selectByExample", tempPicExample);
if (tempPicList.size() > 0) {
tempPic = tempPicList.get(0);
}
return tempPic;
}
Aggregations