zhj 2 éve
szülő
commit
6302dc2353

+ 4 - 0
src/main/java/com/welampiot/common/InterfaceResultEnum.java

@@ -156,6 +156,10 @@ public enum InterfaceResultEnum {
     PRO_REVIEWER_STATUS_ERROR("0346","已审核,无法重复操作","Reviewed, cannot be repeated","Повторная операция невозможна"),
     LACK_START_DATE_ERROR("0347","缺少开始日期","The lack of start date","Отсутствие даты начала"),
     LACK_TIME_LIST_ERROR("0348","缺少时间列表","Lack of time list","Не хватает времени для списка"),
+    LACK_START_TIME_ERROR("0349","开始时间不能为空","Lack of start time","Не хватает времени для начала"),
+    LACK_VOL_ERROR("0350","设备音量不能为空","The device volume cannot be empty","Громкость оборудования не может быть пустой"),
+    LACK_PLAY_TYPE_ERROR("0351","播放类型不能为空","The play type cannot be empty","Тип игры не может быть пустым"),
+    LACK_PROGRAM_TIME_ERROR("0352","节目播放时间不能为空","The program time cannot be empty","Время шоу не должно быть пустым"),
     ;
     private String code;
     private String msgCn;

+ 197 - 3
src/main/java/com/welampiot/controller/BroadcastController.java

@@ -1,14 +1,18 @@
 package com.welampiot.controller;
 
 import com.welampiot.common.BaseResult;
-import com.welampiot.dto.BroadcastDTO;
-import com.welampiot.dto.BroadcastItemDTO;
-import com.welampiot.dto.BroadcastProListDTO;
+import com.welampiot.common.InterfaceResultEnum;
+import com.welampiot.dto.*;
+import com.welampiot.service.BroadcastItemService;
+import com.welampiot.service.BroadcastPolicyInfoService;
 import com.welampiot.service.BroadcastService;
+import com.welampiot.service.UserService;
 import com.welampiot.utils.ToolUtils;
+import com.welampiot.vo.BroadcastDetailsVO;
 import com.welampiot.vo.BroadcastItemVO;
 import com.welampiot.vo.BroadcastProListVO;
 import com.welampiot.vo.BroadcastVO;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.CrossOrigin;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -16,6 +20,10 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * ClassName: BroadcastController
@@ -36,6 +44,15 @@ public class BroadcastController {
     @Autowired
     private ToolUtils toolUtils;
 
+    @Autowired
+    private UserService userService;
+
+    @Autowired
+    private BroadcastItemService broadcastItemService;
+
+    @Autowired
+    private BroadcastPolicyInfoService broadcastPolicyInfoService;
+
     /**
      * 获取音柱列表
      * @param request
@@ -76,4 +93,181 @@ public class BroadcastController {
         BroadcastItemVO vo = broadcastService.getItemListByDTO(username, devId);
         return BaseResult.success(vo);
     }
+
+    /**
+     * 添加编辑节目
+     * @param vo 节目表属性
+     * @return 添加编辑节目
+     */
+    @RequestMapping(value = "/itemSave", method = RequestMethod.POST)
+    public BaseResult<?> itemSave(BroadcastDetailsVO vo) {
+        BroadcastDetailsVO detailsVO = BroadcastDetailsVO.getBroadcastDetailsVO(vo);
+        Integer version = detailsVO.getVersion();
+        String username = detailsVO.getUsername();
+        Integer proType = detailsVO.getProType();
+        String name = detailsVO.getName();
+        Integer playType = detailsVO.getPlayType();
+        String broadcastId = detailsVO.getBroadcastId();
+        if (username.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        UserDTO userDTO = userService.queryUserIdByUsername(username);
+        if (userDTO == null) return toolUtils.response(InterfaceResultEnum.PARAM_FAIL,version);
+        detailsVO.setUserId(userDTO.getId());
+        if (proType == null || name.length() == 0 || broadcastId.length() == 0 || playType == null)
+            return toolUtils.response(InterfaceResultEnum.LACK_NEED_PARAM,version);
+        BroadcastItemDTO broadcastItemDTO = new BroadcastItemDTO();
+        BeanUtils.copyProperties(detailsVO,broadcastItemDTO);
+        Integer id = detailsVO.getId();
+        if (proType == 0) { // 普通节目
+            if (id == 0) {
+                long l = System.currentTimeMillis();
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                String format = simpleDateFormat.format(l);
+                broadcastItemDTO.setCreateTime(format);
+                broadcastItemService.addCommonProgramData(broadcastItemDTO);
+            } else {
+                broadcastItemService.updateCommonProgramData(broadcastItemDTO);
+            }
+        } else { // 策略节目
+            Integer policyType = broadcastItemDTO.getPolicyType();
+            List<BroadcastContentDTO> proList = detailsVO.getProList();
+            if (policyType == null || proList.size() == 0)
+                return toolUtils.response(InterfaceResultEnum.LACK_NEED_PARAM,version);
+            List<BroadcastPolicyInfoDTO> contentList = new ArrayList<>();
+            for (BroadcastContentDTO b : proList) {
+                BroadcastPolicyInfoDTO policyInfoDTO = new BroadcastPolicyInfoDTO();
+                String startDate = b.getBeginDate();
+                policyInfoDTO.setBeginDate(startDate);
+                List<BroadcastPolicyInfoDTO> proTimeList = b.getProTimeList();
+                if (proTimeList == null || proTimeList.size() == 0)
+                    return toolUtils.response(InterfaceResultEnum.LACK_NEED_PARAM,version);
+                for (BroadcastPolicyInfoDTO dto : proTimeList) {
+                    String beginTime = dto.getBeginTime();
+                    Integer time = dto.getTime();
+                    Integer vol = dto.getVol();
+                    Integer type = dto.getPlayType();
+                    if (beginTime == null || beginTime.length() == 0)
+                        return toolUtils.response(InterfaceResultEnum.LACK_START_TIME_ERROR,version);
+                    if (time == null || time == 0)
+                        return toolUtils.response(InterfaceResultEnum.LACK_PROGRAM_TIME_ERROR,version);
+                    if (vol == null || vol == 0)
+                        return toolUtils.response(InterfaceResultEnum.LACK_VOL_ERROR,version);
+                    if (type == null)
+                        return toolUtils.response(InterfaceResultEnum.LACK_PLAY_TYPE_ERROR,version);
+                    BeanUtils.copyProperties(dto,policyInfoDTO);
+                    contentList.add(policyInfoDTO);
+                }
+            }
+            if (id == 0) {
+                long l = System.currentTimeMillis();
+                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                String format = simpleDateFormat.format(l);
+                broadcastItemDTO.setCreateTime(format);
+                broadcastItemService.addCommonProgramData(broadcastItemDTO);
+                Integer broadcastItemId = broadcastItemDTO.getId();
+                contentList.forEach(dto -> dto.setBroadcastPolicyId(broadcastItemId));
+                for (BroadcastPolicyInfoDTO b : contentList) {
+                    broadcastPolicyInfoService.addBroadcastPolicyInfoData(b);
+                }
+            } else {
+                broadcastItemService.updateCommonProgramData(broadcastItemDTO);
+                contentList.forEach(dto -> dto.setBroadcastPolicyId(id));
+                broadcastPolicyInfoService.deleteBroadcastPolicyInfoData(id);
+                for (BroadcastPolicyInfoDTO b : contentList) {
+                    broadcastPolicyInfoService.addBroadcastPolicyInfoData(b);
+                }
+            }
+        }
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
+    }
+
+    /**
+     * 删除节目
+     * @param vo id
+     * @return 删除节目
+     */
+    @RequestMapping(value = "/itemDel", method = RequestMethod.POST)
+    public BaseResult<?> itemDel(BroadcastDetailsVO vo) {
+        BroadcastDetailsVO detailsVO = BroadcastDetailsVO.getBroadcastDetailsVO(vo);
+        Integer version = detailsVO.getVersion();
+        Integer id = detailsVO.getId();
+        if (id == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        broadcastItemService.deleteBroadcastItemDataById(id);
+        BroadcastItemDTO dto = broadcastItemService.getBroadcastItemDTOById(id);
+        if (dto.getProType() == 1) {
+            broadcastPolicyInfoService.deleteBroadcastPolicyInfoData(id);
+        }
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version);
+    }
+
+    /**
+     * 获取节目详情
+     * @param vo id
+     * @return 获取节目详情
+     */
+    @RequestMapping(value = "/itemInfo", method = RequestMethod.POST)
+    public BaseResult<?> itemInfo(BroadcastDetailsVO vo) {
+        BroadcastDetailsVO detailsVO = BroadcastDetailsVO.getBroadcastDetailsVO(vo);
+        Integer version = detailsVO.getVersion();
+        Integer id = detailsVO.getId();
+        if (id == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        BroadcastItemDTO dto = broadcastItemService.getBroadcastItemDTOById(id);
+        Integer proType = dto.getProType();
+        BroadcastDetailsVO broadcastDetailsVO = new BroadcastDetailsVO();
+        if (proType == 0) { // 普通节目
+            BeanUtils.copyProperties(dto,broadcastDetailsVO);
+        } else { // 策略节目
+            List<BroadcastPolicyInfoDTO> list = broadcastPolicyInfoService.getBroadcastPolicyInfoListByBroadcastId(id);
+            broadcastDetailsVO.setName(dto.getName());
+            broadcastDetailsVO.setProType(dto.getProType());
+            broadcastDetailsVO.setBroadcastId(dto.getBroadcastId());
+            broadcastDetailsVO.setPolicyType(dto.getPolicyType());
+            List<BroadcastContentDTO> proList = new ArrayList<>();
+            List<String> strings = new ArrayList<>();
+            list.forEach(dto1 -> strings.add(dto1.getBeginDate()));
+            List<String> stringList = strings.stream().distinct().collect(Collectors.toList());
+            for (String s : stringList) {
+                List<BroadcastPolicyInfoDTO> proTimeList = new ArrayList<>();
+                for (BroadcastPolicyInfoDTO b : list) {
+                    if (s.equals(b.getBeginDate())) {
+                        proTimeList.add(b);
+                    }
+                }
+                BroadcastContentDTO contentDTO = new BroadcastContentDTO();
+                contentDTO.setBeginDate(s);
+                contentDTO.setProTimeList(proTimeList);
+                proList.add(contentDTO);
+            }
+            broadcastDetailsVO.setProList(proList);
+        }
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,broadcastDetailsVO);
+    }
+
+    /**
+     * 策略信息列表
+     * @param vo id
+     * @return 策略信息列表
+     */
+    @RequestMapping(value = "/policyList", method = RequestMethod.POST)
+    public BaseResult<?> policyList(BroadcastItemVO vo) {
+        BroadcastItemVO itemVO = BroadcastItemVO.getBroadcastItemVO(vo);
+        Integer version = itemVO.getVersion();
+        String username = itemVO.getUsername();
+        if (username.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_PARAM_ERROR,version);
+        UserDTO userDTO = userService.queryUserIdByUsername(username);
+        if (userDTO == null) return toolUtils.response(InterfaceResultEnum.PARAM_FAIL,version);
+        Integer page = itemVO.getPage();
+        Integer count = itemVO.getCount();
+        String keyword = itemVO.getKeyword();
+        BroadcastItemVO broadcastItemVO = new BroadcastItemVO();
+        broadcastItemVO.setPage(count * (page - 1));
+        broadcastItemVO.setCount(count);
+        broadcastItemVO.setKeyword(keyword);
+        broadcastItemVO.setUserId(userDTO.getId());
+        List<BroadcastItemDTO> list = broadcastItemService.getBroadcastItemListByItemVO(broadcastItemVO);
+        Integer total = broadcastItemService.getBroadcastItemTotalByItemVO(broadcastItemVO);
+        BroadcastItemVO broadcastItemVO1 = new BroadcastItemVO();
+        broadcastItemVO1.setList(list);
+        broadcastItemVO1.setTotal(total);
+        return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,broadcastItemVO1);
+    }
 }

+ 30 - 0
src/main/java/com/welampiot/dao/BroadcastItemDao.java

@@ -0,0 +1,30 @@
+package com.welampiot.dao;
+
+import com.welampiot.dto.BroadcastItemDTO;
+import com.welampiot.vo.BroadcastItemVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * ClassName: BroadcastItemDao
+ * Package: com.welampiot.dao
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/8/11 - 11:36
+ * @Version: v1.0
+ */
+public interface BroadcastItemDao {
+    void addCommonProgramData(BroadcastItemDTO dto);
+
+    void updateCommonProgramData(BroadcastItemDTO dto);
+
+    BroadcastItemDTO getBroadcastItemDTOById(@Param("id") Integer id);
+
+    void deleteBroadcastItemDataById(@Param("id") Integer id);
+
+    List<BroadcastItemDTO> getBroadcastItemListByItemVO(BroadcastItemVO vo);
+
+    Integer getBroadcastItemTotalByItemVO(BroadcastItemVO vo);
+}

+ 23 - 0
src/main/java/com/welampiot/dao/BroadcastPolicyInfoDao.java

@@ -0,0 +1,23 @@
+package com.welampiot.dao;
+
+import com.welampiot.dto.BroadcastPolicyInfoDTO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * ClassName: BroadcastPolicyInfoDao
+ * Package: com.welampiot.dao
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/8/11 - 14:18
+ * @Version: v1.0
+ */
+public interface BroadcastPolicyInfoDao {
+    void addBroadcastPolicyInfoData(BroadcastPolicyInfoDTO dto);
+
+    void deleteBroadcastPolicyInfoData(@Param("broadcastId") Integer broadcastId);
+
+    List<BroadcastPolicyInfoDTO> getBroadcastPolicyInfoListByBroadcastId(@Param("broadcastId") Integer broadcastId);
+}

+ 22 - 0
src/main/java/com/welampiot/dto/BroadcastContentDTO.java

@@ -0,0 +1,22 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ClassName: BroadcastContentDTO
+ * Package: com.welampiot.dto
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/8/14 - 10:19
+ * @Version: v1.0
+ */
+@Data
+public class BroadcastContentDTO implements Serializable {
+    private String beginDate;
+
+    private List<BroadcastPolicyInfoDTO> proTimeList;
+}

+ 1 - 1
src/main/java/com/welampiot/dto/BroadcastItemDTO.java

@@ -19,7 +19,7 @@ public class BroadcastItemDTO implements Serializable {
     private Integer id;
 
     /** 音柱id,多个用逗号隔开 **/
-    private String broadCastId;
+    private String broadcastId;
 
     /** 音乐id **/
     private Integer proId;

+ 42 - 0
src/main/java/com/welampiot/dto/BroadcastPolicyInfoDTO.java

@@ -0,0 +1,42 @@
+package com.welampiot.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * ClassName: BroadcastPolicyInfoDTO
+ * Package: com.welampiot.dto
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/8/11 - 11:48
+ * @Version: v1.0
+ */
+@Data
+public class BroadcastPolicyInfoDTO implements Serializable {
+    private Integer id;
+
+    private Integer broadcastPolicyId; // 广播策略id
+
+    private String beginDate; // 策略开始日期
+
+    private String beginTime; // 策略开始时间
+
+    private Integer time; // 策略播放时长(min)
+
+    private Integer playType; // 播放类型(0 顺序播放,1 循环播放,2 随机播放)
+
+    private Integer proId1; // 音乐1
+    private Integer proId2;
+    private Integer proId3;
+    private Integer proId4;
+    private Integer proId5;
+    private Integer proId6;
+    private Integer proId7;
+    private Integer proId8;
+    private Integer proId9;
+    private Integer proId10;
+
+    private Integer vol; // 播放音量
+}

+ 30 - 0
src/main/java/com/welampiot/service/BroadcastItemService.java

@@ -0,0 +1,30 @@
+package com.welampiot.service;
+
+import com.welampiot.dto.BroadcastItemDTO;
+import com.welampiot.vo.BroadcastItemVO;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * ClassName: BroadcastItemService
+ * Package: com.welampiot.service
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/8/11 - 11:37
+ * @Version: v1.0
+ */
+public interface BroadcastItemService {
+    void addCommonProgramData(BroadcastItemDTO dto);
+
+    void updateCommonProgramData(BroadcastItemDTO dto);
+
+    BroadcastItemDTO getBroadcastItemDTOById(@Param("id") Integer id);
+
+    void deleteBroadcastItemDataById(@Param("id") Integer id);
+
+    List<BroadcastItemDTO> getBroadcastItemListByItemVO(BroadcastItemVO vo);
+
+    Integer getBroadcastItemTotalByItemVO(BroadcastItemVO vo);
+}

+ 22 - 0
src/main/java/com/welampiot/service/BroadcastPolicyInfoService.java

@@ -0,0 +1,22 @@
+package com.welampiot.service;
+
+import com.welampiot.dto.BroadcastPolicyInfoDTO;
+
+import java.util.List;
+
+/**
+ * ClassName: BroadcastPolicyInfoService
+ * Package: com.welampiot.service
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/8/11 - 14:19
+ * @Version: v1.0
+ */
+public interface BroadcastPolicyInfoService {
+    void addBroadcastPolicyInfoData(BroadcastPolicyInfoDTO dto);
+
+    void deleteBroadcastPolicyInfoData(Integer broadcastId);
+
+    List<BroadcastPolicyInfoDTO> getBroadcastPolicyInfoListByBroadcastId(Integer broadcastId);
+}

+ 55 - 0
src/main/java/com/welampiot/service/impl/BroadcastItemServiceImpl.java

@@ -0,0 +1,55 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.BroadcastItemDao;
+import com.welampiot.dto.BroadcastItemDTO;
+import com.welampiot.service.BroadcastItemService;
+import com.welampiot.vo.BroadcastItemVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * ClassName: BroadcastItemServiceImpl
+ * Package: com.welampiot.service.impl
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/8/11 - 11:37
+ * @Version: v1.0
+ */
+@Service
+public class BroadcastItemServiceImpl implements BroadcastItemService {
+    @Autowired
+    private BroadcastItemDao broadcastItemDao;
+
+    @Override
+    public void addCommonProgramData(BroadcastItemDTO dto) {
+        broadcastItemDao.addCommonProgramData(dto);
+    }
+
+    @Override
+    public void updateCommonProgramData(BroadcastItemDTO dto) {
+        broadcastItemDao.updateCommonProgramData(dto);
+    }
+
+    @Override
+    public BroadcastItemDTO getBroadcastItemDTOById(Integer id) {
+        return broadcastItemDao.getBroadcastItemDTOById(id);
+    }
+
+    @Override
+    public void deleteBroadcastItemDataById(Integer id) {
+        broadcastItemDao.deleteBroadcastItemDataById(id);
+    }
+
+    @Override
+    public List<BroadcastItemDTO> getBroadcastItemListByItemVO(BroadcastItemVO vo) {
+        return broadcastItemDao.getBroadcastItemListByItemVO(vo);
+    }
+
+    @Override
+    public Integer getBroadcastItemTotalByItemVO(BroadcastItemVO vo) {
+        return broadcastItemDao.getBroadcastItemTotalByItemVO(vo);
+    }
+}

+ 39 - 0
src/main/java/com/welampiot/service/impl/BroadcastPolicyInfoServiceImpl.java

@@ -0,0 +1,39 @@
+package com.welampiot.service.impl;
+
+import com.welampiot.dao.BroadcastPolicyInfoDao;
+import com.welampiot.dto.BroadcastPolicyInfoDTO;
+import com.welampiot.service.BroadcastPolicyInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * ClassName: BroadcastPolicyInfoServiceImpl
+ * Package: com.welampiot.service.impl
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/8/11 - 14:20
+ * @Version: v1.0
+ */
+@Service
+public class BroadcastPolicyInfoServiceImpl implements BroadcastPolicyInfoService {
+    @Autowired
+    private BroadcastPolicyInfoDao broadcastPolicyInfoDao;
+
+    @Override
+    public void addBroadcastPolicyInfoData(BroadcastPolicyInfoDTO dto) {
+        broadcastPolicyInfoDao.addBroadcastPolicyInfoData(dto);
+    }
+
+    @Override
+    public void deleteBroadcastPolicyInfoData(Integer broadcastId) {
+        broadcastPolicyInfoDao.deleteBroadcastPolicyInfoData(broadcastId);
+    }
+
+    @Override
+    public List<BroadcastPolicyInfoDTO> getBroadcastPolicyInfoListByBroadcastId(Integer broadcastId) {
+        return broadcastPolicyInfoDao.getBroadcastPolicyInfoListByBroadcastId(broadcastId);
+    }
+}

+ 73 - 0
src/main/java/com/welampiot/vo/BroadcastDetailsVO.java

@@ -0,0 +1,73 @@
+package com.welampiot.vo;
+
+import com.welampiot.dto.BroadcastContentDTO;
+import lombok.Data;
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * ClassName: BroadcastDetailsVO
+ * Package: com.welampiot.vo
+ * Description:
+ *
+ * @Author: zhj_Start
+ * @Create: 2023/8/11 - 14:31
+ * @Version: v1.0
+ */
+@Data
+public class BroadcastDetailsVO implements Serializable {
+    private Integer id;
+
+    private Integer proType;
+
+    private String name;
+
+    private Integer version;
+
+    private String username;
+
+    private Integer userId;
+
+    private Integer proId1; // 音乐1
+    private Integer proId2;
+    private Integer proId3;
+    private Integer proId4;
+    private Integer proId5;
+    private Integer proId6;
+    private Integer proId7;
+    private Integer proId8;
+    private Integer proId9;
+    private Integer proId10;
+
+    private String broadcastId;
+
+    private Integer playType;
+
+    private Integer policyType;
+
+    private List<BroadcastContentDTO> proList;
+
+    @NotNull
+    @Contract("_ -> param1")
+    public static BroadcastDetailsVO getBroadcastDetailsVO(@NotNull BroadcastDetailsVO vo) {
+        if (vo.getId() == null) {
+            vo.setId(0);
+        }
+        if (vo.getName() == null) {
+            vo.setName("");
+        }
+        if (vo.getBroadcastId() == null) {
+            vo.setBroadcastId("");
+        }
+        if (vo.getVersion() == null) {
+            vo.setVersion(0);
+        }
+        if (vo.getUsername() == null) {
+            vo.setUsername("");
+        }
+        return vo;
+    }
+}

+ 37 - 0
src/main/java/com/welampiot/vo/BroadcastItemVO.java

@@ -2,6 +2,8 @@ package com.welampiot.vo;
 
 import com.welampiot.dto.BroadcastItemDTO;
 import lombok.Data;
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
 
 import java.io.Serializable;
 import java.util.List;
@@ -17,7 +19,42 @@ import java.util.List;
  */
 @Data
 public class BroadcastItemVO implements Serializable {
+    private Integer page;
+
+    private Integer count;
+
+    private String keyword;
+
+    private Integer version;
+
+    private String username;
+
+    private Integer userId;
+
+    private Integer total;
+
     private List<BroadcastItemDTO> list;
 
     private static final long serialVersionUID = 1L;
+
+    @NotNull
+    @Contract("_ -> param1")
+    public static BroadcastItemVO getBroadcastItemVO(@NotNull BroadcastItemVO vo) {
+        if (vo.getVersion() == null) {
+            vo.setVersion(0);
+        }
+        if (vo.getUsername() == null) {
+            vo.setUsername("");
+        }
+        if (vo.getPage() == null) {
+            vo.setPage(1);
+        }
+        if (vo.getCount() == null) {
+            vo.setCount(16);
+        }
+        if (vo.getKeyword() == null) {
+            vo.setKeyword("");
+        }
+        return vo;
+    }
 }

+ 170 - 0
src/main/resources/mapper/BroadcastItemMapper.xml

@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.welampiot.dao.BroadcastItemDao">
+
+    <insert id="addCommonProgramData" keyProperty="id" useGeneratedKeys="true" parameterType="BroadcastItemDTO">
+        INSERT INTO broadcast_item(broadcastId,
+        `name`,
+        userId,
+        <if test="proId1 != null and proId1 != 0">
+            proId1,
+        </if>
+        <if test="proId2 != null and proId2 != 0">
+            proId2,
+        </if>
+        <if test="proId3 != null and proId3 != 0">
+            proId3,
+        </if>
+        <if test="proId4 != null and proId4 != 0">
+            proId4,
+        </if>
+        <if test="proId5 != null and proId5 != 0">
+            proId5,
+        </if>
+        <if test="proId6 != null and proId6 != 0">
+            proId6,
+        </if>
+        <if test="proId7 != null and proId7 != 0">
+            proId7,
+        </if>
+        <if test="proId8 != null and proId8 != 0">
+            proId8,
+        </if>
+        <if test="proId9 != null and proId9 != 0">
+            proId9,
+        </if>
+        <if test="proId10 != null and proId10 != 0">
+            proId10,
+        </if>
+        <if test="policyType != null and policyType != 0">
+            policyType,
+        </if>
+        playType,
+        proType,
+        createTime)
+        VALUES (#{broadcastId},
+        #{name},
+        #{userId},
+        <if test="proId1 != null and proId1 != 0">
+            #{proId1},
+        </if>
+        <if test="proId2 != null and proId2 != 0">
+            #{proId2},
+        </if>
+        <if test="proId3 != null and proId3 != 0">
+            #{proId3},
+        </if>
+        <if test="proId4 != null and proId4 != 0">
+            #{proId4},
+        </if>
+        <if test="proId5 != null and proId5 != 0">
+            #{proId5},
+        </if>
+        <if test="proId6 != null and proId6 != 0">
+            #{proId6},
+        </if>
+        <if test="proId7 != null and proId7 != 0">
+            #{proId7},
+        </if>
+        <if test="proId8 != null and proId8 != 0">
+            #{proId8},
+        </if>
+        <if test="proId9 != null and proId9 != 0">
+            #{proId9},
+        </if>
+        <if test="proId10 != null and proId10 != 0">
+            #{proId10},
+        </if>
+        <if test="policyType != null and policyType != 0">
+            #{policyType},
+        </if>
+        #{playType},
+        #{proType},
+        #{createTime})
+    </insert>
+
+    <update id="updateCommonProgramData" parameterType="BroadcastItemDTO">
+        update
+            broadcast_item b
+        set
+            b.broadcastId = #{broadcastId},
+            b.name = #{name},
+        <if test="proId1 != null and proId1 != 0">
+            b.proId1 = #{proId1},
+        </if>
+        <if test="proId2 != null and proId2 != 0">
+            b.proId2 = #{proId2},
+        </if>
+        <if test="proId3 != null and proId3 != 0">
+            b.proId3 = #{proId3},
+        </if>
+        <if test="proId4 != null and proId4 != 0">
+            b.proId4 = #{proId4},
+        </if>
+        <if test="proId5 != null and proId5 != 0">
+            b.proId5 = #{proId5},
+        </if>
+        <if test="proId6 != null and proId6 != 0">
+            b.proId6 = #{proId6},
+        </if>
+        <if test="proId7 != null and proId7 != 0">
+            b.proId7 = #{proId7},
+        </if>
+        <if test="proId8 != null and proId8 != 0">
+            b.proId8 = #{proId8},
+        </if>
+        <if test="proId9 != null and proId9 != 0">
+            b.proId9 = #{proId9},
+        </if>
+        <if test="proId10 != null and proId10 != 0">
+            b.proId10 = #{proId10},
+        </if>
+        <if test="policyType != null and policyType != 0">
+            b.policyType = #{policyType},
+        </if>
+            b.playType = #{playType},
+            b.proType = #{proType}
+        where
+            b.id = #{id}
+    </update>
+
+    <select id="getBroadcastItemDTOById" resultType="BroadcastItemDTO">
+        select b.id, b.broadcastId,b.`name`, b.userId,
+               b.proId1, b.proId2, b.proId3, b.proId4, b.proId5,
+               b.proId6, b.proId7, b.proId8, b.proId9, b.proId10,
+               b.playType,b.proType,b.policyType,b.createTime
+        from broadcast_item b
+        where b.id = #{id}
+    </select>
+
+    <delete id="deleteBroadcastItemDataById">
+        delete
+        from broadcast_item
+        where id = #{id};
+    </delete>
+    
+    <select id="getBroadcastItemListByItemVO" resultType="BroadcastItemDTO">
+        select
+            b.id,
+            b.name,
+            b.policyType,
+            b.status,
+            b.createTime
+        from broadcast_item b 
+        where b.userId = #{userId}
+        <if test="keyword != null and keyword != ''">
+            and b.name like '%${keyword}%'
+        </if>
+        <if test="page >= 0 and count > 0">
+            limit #{page},#{count}
+        </if>
+    </select>
+
+    <select id="getBroadcastItemTotalByItemVO" resultType="Integer">
+        select
+            count(*)
+        from broadcast_item b
+        where b.userId = #{userId}
+    </select>
+
+</mapper>

+ 101 - 0
src/main/resources/mapper/BroadcastPolicyInfoMapper.xml

@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.welampiot.dao.BroadcastPolicyInfoDao">
+
+    <insert id="addBroadcastPolicyInfoData" parameterType="BroadcastPolicyInfoDTO" keyProperty="id" useGeneratedKeys="true">
+        INSERT INTO broadcast_policy_info(
+        broadcast_policy_id,
+        beginDate,
+        beginTime,
+        `time`,
+        playType,
+        <if test="proId1 != null and proId1 != 0">
+            proId1,
+        </if>
+        <if test="proId2 != null and proId2 != 0">
+            proId2,
+        </if>
+        <if test="proId3 != null and proId3 != 0">
+            proId3,
+        </if>
+        <if test="proId4 != null and proId4 != 0">
+            proId4,
+        </if>
+        <if test="proId5 != null and proId5 != 0">
+            proId5,
+        </if>
+        <if test="proId6 != null and proId6 != 0">
+            proId6,
+        </if>
+        <if test="proId7 != null and proId7 != 0">
+            proId7,
+        </if>
+        <if test="proId8 != null and proId8 != 0">
+            proId8,
+        </if>
+        <if test="proId9 != null and proId9 != 0">
+            proId9,
+        </if>
+        <if test="proId10 != null and proId10 != 0">
+            proId10,
+        </if>
+        vol)
+        VALUES (#{broadcastPolicyId},
+                #{beginDate},
+                #{beginTime},
+                #{time},
+                #{playType},
+                <if test="proId1 != null and proId1 != 0">
+                    #{proId1},
+                </if>
+                <if test="proId2 != null and proId2 != 0">
+                    #{proId2},
+                </if>
+                <if test="proId3 != null and proId3 != 0">
+                    #{proId3},
+                </if>
+                <if test="proId4 != null and proId4 != 0">
+                    #{proId4},
+                </if>
+                <if test="proId5 != null and proId5 != 0">
+                    #{proId5},
+                </if>
+                <if test="proId6 != null and proId6 != 0">
+                    #{proId6},
+                </if>
+                <if test="proId7 != null and proId7 != 0">
+                    #{proId7},
+                </if>
+                <if test="proId8 != null and proId8 != 0">
+                    #{proId8},
+                </if>
+                <if test="proId9 != null and proId9 != 0">
+                    #{proId9},
+                </if>
+                <if test="proId10 != null and proId10 != 0">
+                    #{proId10},
+                </if>
+                #{vol})
+    </insert>
+
+    <delete id="deleteBroadcastPolicyInfoData">
+        delete
+        from broadcast_policy_info
+        where broadcast_policy_id = #{broadcastId};
+    </delete>
+
+    <select id="getBroadcastPolicyInfoListByBroadcastId" resultType="BroadcastPolicyInfoDTO">
+        select b.id, b.broadcast_policy_id as broadcastPolicyId, b.beginDate, b.beginTime,
+               b.time, b.playType, b.proId1, b.proId2, b.proId3, b.proId4, b.proId5, b.proId6,
+               b.proId7, b.proId8, b.proId9, b.proId10, b.vol
+        from broadcast_policy_info b
+        where b.broadcast_policy_id = #{broadcastId}
+    </select>
+
+    <delete id="deleteBroadcastPolicyIfoDataById">
+        delete
+        from broadcast_policy_info
+        where id ;
+    </delete>
+
+</mapper>