版本信息操作

This commit is contained in:
GYJ
2025-02-12 16:24:44 +08:00
parent 8a4d083bc8
commit 6725f7bf32
8 changed files with 272 additions and 45 deletions

View File

@@ -1,4 +1,4 @@
package com.czg.controller;
package com.czg.admin;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.resp.CzgResult;

View File

@@ -0,0 +1,79 @@
package com.czg.admin;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.resp.CzgResult;
import com.czg.system.dto.VersionDTO;
import com.czg.system.service.VersionService;
import com.czg.validator.group.InsertGroup;
import com.czg.validator.group.UpdateGroup;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author GYJoker
*/
@RestController
@RequestMapping("/admin/version")
public class VersionController {
@Resource
private VersionService versionService;
/**
* 新增版本
* @param versionDTO 版本信息
* @return Long id
*/
@PostMapping
@SaAdminCheckPermission("version:add")
public CzgResult<Long> insertVersion(@RequestBody @Validated({InsertGroup.class}) VersionDTO versionDTO) {
return versionService.insertVersion(versionDTO);
}
/**
* 更新版本
* @param versionDTO 版本信息
* @return Long id
*/
@PutMapping
@SaAdminCheckPermission("version:update")
public CzgResult<Long> updateVersion(@RequestBody @Validated({UpdateGroup.class}) VersionDTO versionDTO) {
return versionService.updateVersion(versionDTO);
}
/**
* 删除版本
* @param id 版本id
* @return Long id
*/
@DeleteMapping("/{id}")
@SaAdminCheckPermission("version:delete")
public CzgResult<Long> deleteVersion(@PathVariable Long id) {
return versionService.deleteVersion(id);
}
/**
* 获取版本信息
* @param source 渠道
* @param type 类型
* @return VersionDTO
*/
@GetMapping("/{source}/{type}")
@SaAdminCheckPermission("version:get")
public CzgResult<VersionDTO> getVersionInfo(@PathVariable("source") String source, @PathVariable("type") String type) {
return versionService.getVersionInfo(source, type);
}
/**
* 获取版本列表
* @return List<VersionDTO>
*/
@GetMapping("/list")
@SaAdminCheckPermission("version:getList")
public CzgResult<List<VersionDTO>> getVersionList() {
return versionService.getVersionList();
}
}

View File

@@ -1,34 +0,0 @@
package com.czg.controller;
import com.czg.SysParamsDTO2;
import com.czg.resp.CzgResult;
import com.czg.system.dto.SysParamsDTO;
import com.czg.system.service.SysParamsService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author GYJoker
*/
@RestController
@RequestMapping("/admin/feign")
public class FeignController {
@Resource
private SysParamsService sysParamsService;
@RequestMapping("/testCall/{name}")
public CzgResult<SysParamsDTO2> testCall(@PathVariable String name) {
return CzgResult.success(new SysParamsDTO2().setParamCode("system-server:" + name));
}
@GetMapping("/sysParam/code/{code}")
public SysParamsDTO getParamsByCode(@PathVariable String code) {
CzgResult<SysParamsDTO> paramsByCode = sysParamsService.getParamsByCode(code);
return paramsByCode.getData();
}
}

View File

@@ -0,0 +1,31 @@
package com.czg.user;
import com.czg.resp.CzgResult;
import com.czg.system.dto.VersionDTO;
import com.czg.system.service.VersionService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author GYJoker
*/
@RestController
@RequestMapping("/user/version")
public class UserVersionController {
@Resource
private VersionService versionService;
/**
* 获取版本信息
* @param source 渠道
* @param type 类型
* @return VersionDTO
*/
@GetMapping("/info/{source}/{type}")
public CzgResult<VersionDTO> getVersionInfo(@PathVariable("source") String source, @PathVariable("type") String type) {
return versionService.getVersionInfo(source, type);
}
}