| | |
| | | |
| | | import com.yssh.entity.VocVals; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | * @param startVal 起始值(可为空) |
| | | * @return |
| | | */ |
| | | public List<VocVals> selectByTime(String time, Double startVal); |
| | | public List<VocVals> selectByTime(@Param("time") String time, @Param("startVal") Double startVal); |
| | | |
| | | /** |
| | | * 根据时间统计 |
| | |
| | | * @param time 时间(示例:2023060514) |
| | | * @return 行数 |
| | | */ |
| | | public int countByTime(String time); |
| | | public int countByTime(@Param("time") String time); |
| | | |
| | | /** |
| | | * 插入一条数据 |
| | |
| | | } |
| | | |
| | | private void loadVoc() { |
| | | vocValsService.deleteLastYear(); |
| | | Calendar calendar = getCalendar(96); |
| | | for (int i = 0; i < 192; i++) { |
| | | calendar.add(Calendar.HOUR, -1); |
| | |
| | | |
| | | private Date date; |
| | | |
| | | private List<VocVals> list = new ArrayList<>(BATCH_COUNT); |
| | | private List<VocVals> list = new ArrayList<>(); |
| | | |
| | | public VocParser(VocValsService vocValsService, Date date) { |
| | | this.vocValsService = vocValsService; |
| | |
| | | |
| | | if (list.size() >= BATCH_COUNT) { |
| | | inserts(); |
| | | list = new ArrayList<>(BATCH_COUNT); |
| | | list = new ArrayList<>(); |
| | | } |
| | | } |
| | | |
| | |
| | | <select id="countByTime" resultType="java.lang.Integer"> |
| | | select count(*) |
| | | from voc_vals |
| | | where date_format(create_time, '%Y%m%d%H') = ${time} |
| | | where date_format(create_time, '%Y%m%d%H') = ${time}; |
| | | </select> |
| | | |
| | | <insert id="insert" parameterType="com.yssh.entity.VocVals" useGeneratedKeys="true" keyProperty="id"> |
| | |
| | | |
| | | <delete id="deleteLastYear"> |
| | | delete from voc_vals |
| | | where create_time < date_sub(now(), interval 1 year); |
| | | where create_time < date_sub(now(), interval 1 year); |
| | | </delete> |
| | | </mapper> |