渠道账号管理 CRUD

pull/13/head
3y 2 years ago
parent 6bd3393987
commit 741878b8c2

@ -5,6 +5,7 @@ import com.java3y.austin.support.domain.ChannelAccount;
import com.java3y.austin.support.domain.MessageTemplate;
import com.java3y.austin.support.domain.SmsRecord;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.CrudRepository;
import java.util.List;
@ -14,7 +15,7 @@ import java.util.List;
*
* @author 3y
*/
public interface ChannelAccountDao extends CrudRepository<ChannelAccount, Long> {
public interface ChannelAccountDao extends JpaRepository<ChannelAccount, Long> {
/**

@ -1,11 +1,9 @@
package com.java3y.austin.web.controller;
import com.java3y.austin.common.constant.AustinConstant;
import cn.hutool.core.util.StrUtil;
import com.java3y.austin.common.vo.BasicResultVO;
import com.java3y.austin.support.dao.ChannelAccountDao;
import com.java3y.austin.support.domain.ChannelAccount;
import com.java3y.austin.support.domain.MessageTemplate;
import com.java3y.austin.web.service.ChannelAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -13,6 +11,10 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
*
*
@ -21,7 +23,7 @@ import org.springframework.web.bind.annotation.*;
@Slf4j
@RestController
@RequestMapping("/account")
@Api("素材管理接口")
@Api("渠道账号管理接口")
@CrossOrigin(origins = "http://localhost:3000", allowCredentials = "true", allowedHeaders = "*")
public class ChannelAccountController {
@ -42,10 +44,34 @@ public class ChannelAccountController {
/**
*
*/
@GetMapping("/query")
@ApiOperation("/保存数据")
@GetMapping("/queryByChannelType")
@ApiOperation("/根据渠道标识查询相关的记录")
public BasicResultVO query(Integer channelType) {
return BasicResultVO.success(channelAccountService.queryByChannelType(channelType));
}
/**
*
*/
@GetMapping("/list")
@ApiOperation("/渠道账号列表信息")
public BasicResultVO list() {
return BasicResultVO.success(channelAccountService.list());
}
/**
* Id
* id
*/
@DeleteMapping("delete/{id}")
@ApiOperation("/根据Ids删除")
public BasicResultVO deleteByIds(@PathVariable("id") String id) {
if (StrUtil.isNotBlank(id)) {
List<Long> idList = Arrays.stream(id.split(StrUtil.COMMA)).map(s -> Long.valueOf(s)).collect(Collectors.toList());
channelAccountService.deleteByIds(idList);
return BasicResultVO.success();
}
return BasicResultVO.fail();
}
}

@ -1,9 +1,7 @@
package com.java3y.austin.web.service;
import com.java3y.austin.common.vo.BasicResultVO;
import com.java3y.austin.support.domain.ChannelAccount;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@ -31,4 +29,19 @@ public interface ChannelAccountService {
*/
List<ChannelAccount> queryByChannelType(Integer channelType);
/**
*
*
* @return
*/
List<ChannelAccount> list();
/**
* (deleted=1)
*
* @param ids
*/
void deleteByIds(List<Long> ids);
}

@ -32,4 +32,14 @@ public class ChannelAccountServiceImpl implements ChannelAccountService {
public List<ChannelAccount> queryByChannelType(Integer channelType) {
return channelAccountDao.findAllByIsDeletedEqualsAndSendChannelEquals(AustinConstant.FALSE, channelType);
}
@Override
public List<ChannelAccount> list() {
return channelAccountDao.findAll();
}
@Override
public void deleteByIds(List<Long> ids) {
channelAccountDao.deleteAllById(ids);
}
}

Loading…
Cancel
Save