新增license删除、重置接口
This commit is contained in:
+1
-1
@@ -72,7 +72,7 @@ public class SqlMapperInterceptor implements Interceptor {
|
||||
if (null == params) {
|
||||
res = jdbcTemplate.update(sql);
|
||||
} else if (params.getClass().isArray()){
|
||||
res = jdbcTemplate.update(sql, params);
|
||||
res = jdbcTemplate.update(sql, (Object[])params);
|
||||
} else if (params instanceof Map) {
|
||||
res = jdbcTemplate.updateByMap(sql, (Map)params);
|
||||
}
|
||||
|
||||
+13
-4
@@ -29,10 +29,7 @@ package fun.asgc.neutrino.proxy.server.controller;
|
||||
|
||||
import fun.asgc.neutrino.core.annotation.Autowired;
|
||||
import fun.asgc.neutrino.core.annotation.NonIntercept;
|
||||
import fun.asgc.neutrino.core.web.annotation.PostMapping;
|
||||
import fun.asgc.neutrino.core.web.annotation.RequestBody;
|
||||
import fun.asgc.neutrino.core.web.annotation.RequestMapping;
|
||||
import fun.asgc.neutrino.core.web.annotation.RestController;
|
||||
import fun.asgc.neutrino.core.web.annotation.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.LicenseCreateReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.LicenseUpdateEnableStatusReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.LicenseCreateRes;
|
||||
@@ -61,4 +58,16 @@ public class LicenseController {
|
||||
return licenseService.updateEnableStatus(req);
|
||||
}
|
||||
|
||||
@PostMapping("delete")
|
||||
public void delete(@RequestParam("id") Integer id) {
|
||||
// TODO 参数校验
|
||||
licenseService.delete(id);
|
||||
}
|
||||
|
||||
@PostMapping("reset")
|
||||
public void reset(@RequestParam("id") Integer id) {
|
||||
// TODO 参数校验
|
||||
licenseService.reset(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+9
@@ -23,10 +23,13 @@ package fun.asgc.neutrino.proxy.server.dal;
|
||||
|
||||
import fun.asgc.neutrino.core.annotation.Component;
|
||||
import fun.asgc.neutrino.core.annotation.Param;
|
||||
import fun.asgc.neutrino.core.db.annotation.Delete;
|
||||
import fun.asgc.neutrino.core.db.annotation.Update;
|
||||
import fun.asgc.neutrino.core.db.mapper.SqlMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.LicenseDO;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author: aoshiguchen
|
||||
@@ -43,4 +46,10 @@ public interface LicenseMapper extends SqlMapper {
|
||||
|
||||
@Update("update `license` set enable = :enable where id = :id")
|
||||
void updateEnableStatus(@Param("id") Integer id, @Param("enable") Integer enable);
|
||||
|
||||
@Update("update `license` set key = :key,update_time = :updateTime where id = :id")
|
||||
void reset(@Param("id") Integer id, @Param("key") String key, @Param("updateTime") Date updateTime);
|
||||
|
||||
@Delete("delete from `license` where id = ?")
|
||||
void delete(Integer id);
|
||||
}
|
||||
|
||||
+24
-1
@@ -23,7 +23,6 @@ package fun.asgc.neutrino.proxy.server.service;
|
||||
|
||||
import fun.asgc.neutrino.core.annotation.Autowired;
|
||||
import fun.asgc.neutrino.core.annotation.Component;
|
||||
import fun.asgc.neutrino.core.web.annotation.RequestBody;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.constant.EnableStatusEnum;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.constant.OnlineStatusEnum;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.LicenseCreateReq;
|
||||
@@ -68,10 +67,34 @@ public class LicenseService {
|
||||
return new LicenseCreateRes();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新license启用状态
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
public LicenseUpdateEnableStatusRes updateEnableStatus(LicenseUpdateEnableStatusReq req) {
|
||||
licenseMapper.updateEnableStatus(req.getId(), req.getEnable());
|
||||
|
||||
return new LicenseUpdateEnableStatusRes();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除license
|
||||
* @param id
|
||||
*/
|
||||
public void delete(Integer id) {
|
||||
licenseMapper.delete(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置license
|
||||
* @param id
|
||||
*/
|
||||
public void reset(Integer id) {
|
||||
String key = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
Date now = new Date();
|
||||
|
||||
licenseMapper.reset(id, key, now);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user