临时提交

pull/1719/head
648540858 2024-11-21 20:50:22 +08:00
parent 0cacdb5928
commit 4b694954d4
2 changed files with 35 additions and 9 deletions

View File

@ -40,7 +40,15 @@ public class RecordPlanServiceImpl implements IRecordPlanService {
@Override
public RecordPlan get(Integer planId) {
return recordPlanMapper.get(planId);
RecordPlan recordPlan = recordPlanMapper.get(planId);
if (recordPlan == null) {
return null;
}
List<RecordPlanItem> recordPlanItemList = recordPlanMapper.getItemList(planId);
if (!recordPlanItemList.isEmpty()) {
recordPlan.setPlanItemList(recordPlanItemList);
}
return recordPlan;
}
@Override

View File

@ -2,9 +2,7 @@ package com.genersoft.iot.vmp.storager.dao;
import com.genersoft.iot.vmp.service.bean.RecordPlan;
import com.genersoft.iot.vmp.service.bean.RecordPlanItem;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.*;
import java.util.List;
@ -26,15 +24,35 @@ public interface RecordPlanMapper {
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
void add(RecordPlan plan);
RecordPlan get(Integer planId);
@Insert(" <script>" +
"INSERT INTO wvp_device_channel (" +
"start_time," +
"stop_time, " +
"week_day," +
"create_time," +
"update_time) " +
"VALUES" +
"<foreach collection='commonGBChannels' index='index' item='item' separator=','> " +
"(#{item.startTime}, #{item.stopTime}, #{item.weekDay},#{item.planId},#{item.createTime},#{item.updateTime})" +
"</foreach> " +
" </script>")
void batchAddItem(@Param("planId") int planId, List<RecordPlanItem> planItemList);
List<RecordPlan> query(String query);
@Select("select * from wvp_record_plan where id = #{planId}")
RecordPlan get(@Param("planId") Integer planId);
@Select(" <script>" +
"select * from wvp_record_plan where 1=1" +
" <if test='query != null'> AND (name LIKE concat('%',#{query},'%') escape '/' )</if> " +
" </script>")
List<RecordPlan> query(@Param("query") String query);
@Update("UPDATE wvp_record_plan SET update_time=#{updateTime}, name=#{name}, snap=#{snap} WHERE id=#{id}")
void update(RecordPlan plan);
void delete(Integer planId);
@Delete("DELETE FROM wvp_record_plan WHERE id=#{id}")
void delete(@Param("planId") Integer planId);
void batchAddItem(int planId, List<RecordPlanItem> planItemList);
List<RecordPlanItem> getItemList(Integer planId);
}