Commit 5f7b7eda authored by zengtianlai3's avatar zengtianlai3

Merge branch 'm33' into 'master'

修改格式

See merge request !2
parents 8124cc8b a0caf9d2
<component name="libraryTable">
<library name="Maven: com.alibaba:fastjson:1.2.28">
<CLASSES>
<root url="jar://C:/tools/Spring/mvn_repository/com/alibaba/fastjson/1.2.28/fastjson-1.2.28.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://C:/tools/Spring/mvn_repository/com/alibaba/fastjson/1.2.28/fastjson-1.2.28-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://C:/tools/Spring/mvn_repository/com/alibaba/fastjson/1.2.28/fastjson-1.2.28-sources.jar!/" />
</SOURCES>
</library>
</component>
\ No newline at end of file
......@@ -57,6 +57,12 @@
<artifactId>velocity-engine-core</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.28</version>
</dependency>
</dependencies>
......
package iot.sixiang.license.controller;
import com.alibaba.fastjson.JSONObject;
import iot.sixiang.license.entity.License;
import iot.sixiang.license.model.RespResult;
import iot.sixiang.license.service.LicenseService;
......@@ -18,7 +19,7 @@ import java.util.List;
* @since 2022-06-06
*/
@RestController
@RequestMapping("/iot_sixiang_license/license")
@RequestMapping("/iot_license/license")
public class LicenseController {
@Autowired
......@@ -26,12 +27,15 @@ public class LicenseController {
/**
* 添加license
* @param license
* @param jsonObject
* @return
*/
@PostMapping("add")
public RespResult addLicense(@RequestBody License license){
boolean save = licenseService.addLicense(license);
public RespResult addLicense(@RequestBody JSONObject jsonObject){
String appId = (String) jsonObject.get("app_id");
String appKey = (String) jsonObject.get("app_key");
String userId = (String) jsonObject.get("user_id");
boolean save = licenseService.addLicense(appId,appKey,userId);
if (save) {
return RespResult.success();
} else {
......@@ -45,7 +49,7 @@ public class LicenseController {
* @return
*/
@PostMapping("delete")
public RespResult deleteLicense(@RequestParam("appId") String appId) {
public RespResult deleteLicense(@RequestParam("app_id") String appId) {
boolean flag = licenseService.deleteLicense(appId);
if (flag) {
return RespResult.success();
......@@ -61,7 +65,7 @@ public class LicenseController {
* @return
*/
@GetMapping("get_license_list")
public RespResult getLicenseList(@RequestParam("pageNo") int pageNo, @RequestParam("pageSize") int pageSize) {
public RespResult getLicenseList(@RequestParam("page_no") int pageNo, @RequestParam("page_size") int pageSize) {
List<License> records = licenseService.getLicenseList(pageNo,pageSize);
return RespResult.success().record(records);
}
......
package iot.sixiang.license.controller;
import com.alibaba.fastjson.JSONObject;
import iot.sixiang.license.entity.Server;
import iot.sixiang.license.model.RespResult;
import iot.sixiang.license.service.ServerService;
......@@ -18,19 +19,21 @@ import java.util.List;
* @since 2022-06-06
*/
@RestController
@RequestMapping("/iot_sixiang_license/server")
@RequestMapping("/iot_license/server")
public class ServerController {
@Autowired
private ServerService serverService;
/**
* 添加server
* @param server
* @param jsonObject
* @return
*/
@PostMapping("add")
public RespResult addServer(@RequestBody Server server) {
boolean save = serverService.addServer(server);
public RespResult addServer(@RequestBody JSONObject jsonObject) {
String serverIp = (String) jsonObject.get("server_ip");
int port = (int)jsonObject.get("port");
boolean save = serverService.addServer(serverIp,port);
if (save) {
return RespResult.success();
} else {
......@@ -44,7 +47,7 @@ public class ServerController {
* @return
*/
@PostMapping("delete")
public RespResult deleteServer(@RequestParam("serverIp") String serverIp) {
public RespResult deleteServer(@RequestParam("server_ip") String serverIp) {
boolean flag = serverService.deleteServer(serverIp);
if (flag) {
return RespResult.success();
......@@ -60,7 +63,7 @@ public class ServerController {
* @return
*/
@GetMapping("get_server_list")
public RespResult getServerList(@RequestParam("pageNo") int pageNo, @RequestParam("pageSize") int pageSize) {
public RespResult getServerList(@RequestParam("page_no") int pageNo, @RequestParam("page_size") int pageSize) {
List<Server> records = serverService.getServerList(pageNo,pageSize);
return RespResult.success().record(records);
}
......
......@@ -2,6 +2,7 @@ package iot.sixiang.license.controller;
import com.alibaba.fastjson.JSONObject;
import iot.sixiang.license.entity.User;
import iot.sixiang.license.model.RespResult;
import iot.sixiang.license.service.UserService;
......@@ -19,7 +20,7 @@ import java.util.List;
* @since 2022-06-06
*/
@RestController
@RequestMapping("/iot_sixiang_license/user")
@RequestMapping("/iot_license/user")
public class UserController {
@Autowired
......@@ -27,12 +28,14 @@ public class UserController {
/**
* 添加user
* @param user
* @param jsonObject
* @return
*/
@PostMapping("add")
public RespResult addUser(@RequestBody User user) {
boolean save = userService.addUser(user);
public RespResult addUser(@RequestBody JSONObject jsonObject) {
String userId = (String) jsonObject.get("user_id");
String password = (String) jsonObject.get("password");
boolean save = userService.addUser(userId, password);
if (save) {
return RespResult.success();
} else {
......@@ -46,7 +49,7 @@ public class UserController {
* @return
*/
@PostMapping("delete")
public RespResult deleteUser(@RequestParam("userId") String userId) {
public RespResult deleteUser(@RequestParam("user_id") String userId) {
boolean flag = userService.deleteUser(userId);
if (flag) {
return RespResult.success();
......@@ -62,7 +65,7 @@ public class UserController {
* @return
*/
@GetMapping("get_user_list")
public RespResult getUserList(@RequestParam("pageNo") int pageNo, @RequestParam("pageSize") int pageSize) {
public RespResult getUserList(@RequestParam("page_no") int pageNo, @RequestParam("page_size") int pageSize) {
List<User> records = userService.getUserList(pageNo,pageSize);
return RespResult.success().record(records);
}
......
......@@ -13,7 +13,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface LicenseMapper extends BaseMapper<License> {
boolean addLicense(License license);
boolean deleteLicense(String appId);
boolean addLicense(String appId, String appKey, String userId);
}
......@@ -13,7 +13,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface ServerMapper extends BaseMapper<Server> {
boolean addServer(Server server);
boolean deleteServer(String serverIp);
boolean addServer(String serverIp, int port);
}
......@@ -13,7 +13,8 @@ import iot.sixiang.license.entity.User;
*/
public interface UserMapper extends BaseMapper<User> {
boolean addUser(User user);
boolean deleteUser(String user);
boolean addUser(String userId, String password);
}
......@@ -15,9 +15,9 @@ import java.util.List;
*/
public interface LicenseService extends IService<License> {
boolean addLicense(License license);
List<License> getLicenseList(int pageNo, int pageSize);
boolean deleteLicense(String appId);
boolean addLicense(String appId, String appKey, String userId);
}
......@@ -15,9 +15,9 @@ import java.util.List;
*/
public interface ServerService extends IService<Server> {
boolean addServer(Server server);
List<Server> getServerList(int pageNo, int pageSize);
boolean deleteServer(String serverIp);
boolean addServer(String serverIp, int port);
}
......@@ -15,9 +15,9 @@ import java.util.List;
*/
public interface UserService extends IService<User> {
boolean addUser(User user);
List<User> getUserList(int pageNo, int pageSize);
boolean deleteUser(String user);
boolean addUser(String userId, String password);
}
......@@ -23,10 +23,6 @@ public class LicenseServiceImpl extends ServiceImpl<LicenseMapper, License> impl
@Resource
LicenseMapper licenseMapper;
@Override
public boolean addLicense(License license) {
return licenseMapper.addLicense(license);
}
@Override
public List<License> getLicenseList(int pageNo, int pageSize) {
......@@ -41,4 +37,9 @@ public class LicenseServiceImpl extends ServiceImpl<LicenseMapper, License> impl
return licenseMapper.deleteLicense(appId);
}
@Override
public boolean addLicense(String appId, String appKey, String userId) {
return licenseMapper.addLicense(appId,appKey,userId);
}
}
......@@ -24,10 +24,6 @@ public class ServerServiceImpl extends ServiceImpl<ServerMapper, Server> impleme
@Resource
ServerMapper serverMapper;
@Override
public boolean addServer(Server server) {
return serverMapper.addServer(server);
}
@Override
public List<Server> getServerList(int pageNo, int pageSize) {
......@@ -41,4 +37,9 @@ public class ServerServiceImpl extends ServiceImpl<ServerMapper, Server> impleme
public boolean deleteServer(String serverIp) {
return serverMapper.deleteServer(serverIp);
}
@Override
public boolean addServer(String serverIp, int port) {
return baseMapper.addServer(serverIp,port);
}
}
......@@ -24,10 +24,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
@Resource
UserMapper userMapper;
@Override
public boolean addUser(User user) {
return userMapper.addUser(user);
}
@Override
public List<User> getUserList(int pageNo, int pageSize) {
......@@ -41,4 +37,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
public boolean deleteUser(String user) {
return userMapper.deleteUser(user);
}
@Override
public boolean addUser(String userId, String password) {
return userMapper.addUser(userId,password);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment