You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
3.0 KiB
105 lines
3.0 KiB
5 years ago
|
package com.epmet.controller;
|
||
|
|
||
|
import com.epmet.commons.tools.annotation.LoginUser;
|
||
|
import com.epmet.commons.tools.security.dto.TokenDto;
|
||
|
import com.epmet.commons.tools.utils.Result;
|
||
|
import com.epmet.commons.tools.validator.ValidatorUtils;
|
||
|
import com.epmet.dto.form.AddBadgeFormDTO;
|
||
|
import com.epmet.dto.form.BadgeFormDTO;
|
||
|
import com.epmet.dto.form.EditBadgeFormDTO;
|
||
|
import com.epmet.dto.result.BadgeDetailResultDTO;
|
||
|
import com.epmet.dto.result.BadgeListResultDTO;
|
||
|
import com.epmet.service.BadgeService;
|
||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||
|
import org.springframework.web.bind.annotation.RestController;
|
||
|
|
||
|
import java.util.List;
|
||
|
|
||
|
/**
|
||
|
* @author zhaoqifeng
|
||
|
* @dscription
|
||
|
* @date 2020/11/3 16:09
|
||
|
*/
|
||
|
@RestController
|
||
|
@RequestMapping("badge")
|
||
|
public class BadgeController {
|
||
|
@Autowired
|
||
|
private BadgeService badgeService;
|
||
|
|
||
|
/**
|
||
|
* 徽章列表
|
||
|
* @author zhaoqifeng
|
||
|
* @date 2020/11/4 14:27
|
||
|
* @param tokenDto
|
||
|
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.BadgeListResultDTO>>
|
||
|
*/
|
||
|
@PostMapping("list")
|
||
|
public Result<List<BadgeListResultDTO>> list(@LoginUser TokenDto tokenDto) {
|
||
|
List<BadgeListResultDTO> result = badgeService.getList(tokenDto.getCustomerId());
|
||
|
return new Result<List<BadgeListResultDTO>>().ok(result);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 添加徽章
|
||
|
* @author zhaoqifeng
|
||
|
* @date 2020/11/4 14:27
|
||
|
* @param tokenDto
|
||
|
* @param formDTO
|
||
|
* @return com.epmet.commons.tools.utils.Result
|
||
|
*/
|
||
|
@PostMapping("add")
|
||
|
public Result add(@LoginUser TokenDto tokenDto, @RequestBody AddBadgeFormDTO formDTO) {
|
||
|
ValidatorUtils.validateEntity(formDTO);
|
||
|
badgeService.add(tokenDto, formDTO);
|
||
|
return new Result();
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 徽章详情
|
||
|
* @author zhaoqifeng
|
||
|
* @date 2020/11/4 14:27
|
||
|
* @param tokenDto
|
||
|
* @param formDTO
|
||
|
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.result.BadgeDetailResultDTO>
|
||
|
*/
|
||
|
@PostMapping("detail")
|
||
|
public Result<BadgeDetailResultDTO> detail(@LoginUser TokenDto tokenDto, @RequestBody BadgeFormDTO formDTO) {
|
||
|
BadgeDetailResultDTO result = badgeService.detail(tokenDto, formDTO);
|
||
|
return new Result<BadgeDetailResultDTO>().ok(result);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 修改
|
||
|
* @author zhaoqifeng
|
||
|
* @date 2020/11/4 15:32
|
||
|
* @param tokenDto
|
||
|
* @param formDTO
|
||
|
* @return com.epmet.commons.tools.utils.Result
|
||
|
*/
|
||
|
@PostMapping("edit")
|
||
|
public Result edit(@LoginUser TokenDto tokenDto, @RequestBody EditBadgeFormDTO formDTO) {
|
||
|
ValidatorUtils.validateEntity(formDTO);
|
||
|
badgeService.edit(tokenDto, formDTO);
|
||
|
return new Result();
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 删除徽章
|
||
|
* @author zhaoqifeng
|
||
|
* @date 2020/11/4 15:34
|
||
|
* @param tokenDto
|
||
|
* @param formDTO
|
||
|
* @return com.epmet.commons.tools.utils.Result
|
||
|
*/
|
||
|
@PostMapping("delete")
|
||
|
public Result delete(@LoginUser TokenDto tokenDto, @RequestBody BadgeFormDTO formDTO) {
|
||
|
badgeService.deleteBadge(tokenDto, formDTO);
|
||
|
return new Result();
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|