Commit 706a8b5e authored by shiyu's avatar shiyu

签到记录查询,月份小于10,修改bug

parent 82d7654f
......@@ -5,4 +5,6 @@ import com.wwdz.ch.db.domain.SignInShareImage;
public interface SignInShareImageDao {
SignInShareImage findOne();
void insert(SignInShareImage signInShareImage);
}
......@@ -19,4 +19,10 @@ public class SignInShareImageDaoImpl implements SignInShareImageDao {
example.setOrderByClause(" rand()");
return signInShareImageMapper.selectOneByExample(example);
}
@Override
public void insert(SignInShareImage signInShareImage) {
signInShareImageMapper.insert(signInShareImage);
}
}
......@@ -224,11 +224,13 @@ public class UserSigninServiceImpl implements UserSigninService {
int year = today.getYear();
int month = today.getMonthValue();
if (StringUtils.isEmpty(dto.getYear()) || StringUtils.isEmpty(dto.getMonth())) {
dto.setYearMonth(year + "-" + month);
// 判断月份并进行格式化
String formattedMonth = (month < 10) ? "0" + month : String.valueOf(month);
dto.setYearMonth(year + "-" + formattedMonth);
} else {
year = Integer.parseInt(dto.getYear());
month = Integer.parseInt(dto.getMonth());
dto.setYearMonth(dto.getYear() + "-" + dto.getMonth());
dto.setYearMonth(dto.getYear() + "-" + (month < 10 ? "0" + month : String.valueOf(month)));
}
resultMap.put("year", year);
resultMap.put("month", month);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment