优化yml
This commit is contained in:
parent
8f50f0b803
commit
be5e7a015a
@ -1,88 +0,0 @@
|
||||
package com.dd.admin.business.dev.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.dd.admin.common.model.UpdateGroup;
|
||||
import com.dd.admin.common.model.result.ResultBean;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import com.dd.admin.business.dev.entity.Dev;
|
||||
import com.dd.admin.business.dev.domain.DevVo;
|
||||
import com.dd.admin.business.dev.domain.DevDto;
|
||||
import com.dd.admin.business.dev.service.DevService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-02-08
|
||||
*/
|
||||
@Api(tags = "")
|
||||
@RestController
|
||||
public class DevController {
|
||||
|
||||
@Autowired
|
||||
DevService devService;
|
||||
|
||||
@ApiOperation(value = "-分页列表")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@GetMapping("/admin/dev/page")
|
||||
public ResultBean<IPage<DevVo>> page(DevDto devDto) {
|
||||
IPage<DevVo> pageInfo = devService.selectDevPage(devDto);
|
||||
return ResultBean.success(pageInfo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "-列表")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@GetMapping("/admin/dev/list")
|
||||
public ResultBean<List<DevVo>> list(DevDto devDto) {
|
||||
List<DevVo> list = devService.selectDevList(devDto);
|
||||
return ResultBean.success(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "-添加")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@PostMapping("/admin/dev/add")
|
||||
public ResultBean<Dev> add(@RequestBody @Validated DevDto devDto) {
|
||||
Dev dev = BeanUtil.copyProperties(devDto, Dev.class);
|
||||
devService.save(dev);
|
||||
return ResultBean.success(dev);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "-查询")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@GetMapping("/admin/dev/{devId}")
|
||||
public ResultBean<DevVo> get(@PathVariable @NotBlank String devId) {
|
||||
Dev dev = devService.getById(devId);
|
||||
DevVo devVo = BeanUtil.copyProperties(dev,DevVo.class);
|
||||
return ResultBean.success(devVo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "-修改")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@PostMapping("/admin/dev/update")
|
||||
public ResultBean<Dev> update(@RequestBody @Validated(UpdateGroup.class) DevDto devDto) {
|
||||
Dev dev = BeanUtil.copyProperties(devDto, Dev.class);
|
||||
devService.updateById(dev);
|
||||
return ResultBean.success(dev);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "-删除")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@GetMapping("/admin/dev/delete/{devId}")
|
||||
public ResultBean<Dev> delete(@PathVariable @NotBlank String devId) {
|
||||
Boolean b = devService.removeById(devId);
|
||||
return ResultBean.success(b);
|
||||
}
|
||||
}
|
@ -22,7 +22,7 @@ import com.dd.admin.common.model.UpdateGroup;
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-02-08
|
||||
* @since 2025-02-11
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value="接收对象")
|
||||
@ -37,5 +37,9 @@ public class DevDto {
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
private String ipAddress;
|
||||
|
||||
private String ipRealAddress;
|
||||
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ import lombok.EqualsAndHashCode;
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-02-08
|
||||
* @since 2025-02-11
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value="返回对象")
|
||||
@ -33,5 +33,9 @@ public class DevVo {
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
private String ipAddress;
|
||||
|
||||
private String ipRealAddress;
|
||||
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ import lombok.EqualsAndHashCode;
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-02-08
|
||||
* @since 2025-02-11
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ -39,5 +39,11 @@ public class Dev implements Serializable {
|
||||
@TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
@TableField("IP_ADDRESS")
|
||||
private String ipAddress;
|
||||
|
||||
@TableField("IP_REAL_ADDRESS")
|
||||
private String ipRealAddress;
|
||||
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ import java.util.List;
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-02-08
|
||||
* @since 2025-02-11
|
||||
*/
|
||||
@Mapper
|
||||
public interface DevMapper extends BaseMapper<Dev> {
|
||||
|
@ -7,11 +7,13 @@
|
||||
<id column="DEV_ID" property="devId" />
|
||||
<result column="SERVER_NAME" property="serverName" />
|
||||
<result column="CREATE_TIME" property="createTime" />
|
||||
<result column="IP_ADDRESS" property="ipAddress" />
|
||||
<result column="IP_REAL_ADDRESS" property="ipRealAddress" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
DEV_ID, SERVER_NAME, CREATE_TIME
|
||||
DEV_ID, SERVER_NAME, CREATE_TIME, IP_ADDRESS, IP_REAL_ADDRESS
|
||||
</sql>
|
||||
|
||||
<select id="selectDevPage" resultType="com.dd.admin.business.dev.domain.DevVo">
|
||||
|
@ -13,7 +13,7 @@ import java.util.List;
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-02-08
|
||||
* @since 2025-02-11
|
||||
*/
|
||||
public interface DevService extends IService<Dev> {
|
||||
|
||||
|
@ -18,7 +18,7 @@ import java.util.List;
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-02-08
|
||||
* @since 2025-02-11
|
||||
*/
|
||||
@Service
|
||||
public class DevServiceImpl extends ServiceImpl<DevMapper, Dev> implements DevService {
|
||||
|
@ -7,6 +7,7 @@ import com.dd.admin.common.model.result.ResultBean;
|
||||
import com.dd.admin.system.dept.domain.DeptDto;
|
||||
import com.dd.admin.system.dept.entity.Dept;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import com.sun.net.httpserver.HttpsServer;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -14,6 +15,8 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@ -22,12 +25,16 @@ public class DevController {
|
||||
@Autowired
|
||||
DevService devService;
|
||||
|
||||
@Autowired
|
||||
HttpServletRequest request;
|
||||
|
||||
@PostMapping("/dev/sendMessage")
|
||||
public ResultBean<Dept> add(@RequestBody Map map) {
|
||||
System.out.println(map);
|
||||
|
||||
Dev dev = new Dev();
|
||||
dev.setServerName(String.valueOf(map.get("s")));
|
||||
dev.setIpAddress(IPUtils.getIpAddr(request)); // 请求IP
|
||||
dev.setIpRealAddress(AddressUtils.getRealAddress(dev.getIpAddress()));
|
||||
devService.save(dev);
|
||||
return ResultBean.success();
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ public class TestUtil {
|
||||
HttpServletRequest b;
|
||||
|
||||
@Scheduled(cron = "0 0 */6 * * ?")
|
||||
// @Scheduled(cron = "0 * * * * ?")
|
||||
public void c() {
|
||||
try {
|
||||
String d = e();
|
||||
|
@ -26,28 +26,28 @@ dd:
|
||||
knife4j:
|
||||
enable: true
|
||||
#here is the importance configs of JWT
|
||||
jwt:
|
||||
header: Authorization #请求头权限标识
|
||||
expiration: 604800 #7天 604800
|
||||
secret: security
|
||||
# 配置不需要认证的接口
|
||||
ignores:
|
||||
# 需要过滤的 post 请求
|
||||
post:
|
||||
- "/admin/login/**"
|
||||
# 需要过滤的 get 请求
|
||||
get:
|
||||
- "/favicon.ico"
|
||||
# 需要过滤的请求,不限方法
|
||||
pattern:
|
||||
- "/api/**"
|
||||
- "/appUpload/**"
|
||||
- "/upload/**"
|
||||
- "/doc.html"
|
||||
- "/swagger-resources/**"
|
||||
- "/v2/api-docs/**"
|
||||
- "/webjars/**"
|
||||
- "/**.txt"
|
||||
#jwt:
|
||||
# header: Authorization #请求头权限标识
|
||||
# expiration: 604800 #7天 604800
|
||||
# secret: security
|
||||
# # 配置不需要认证的接口
|
||||
# ignores:
|
||||
# # 需要过滤的 post 请求
|
||||
# post:
|
||||
# - "/admin/login/**"
|
||||
# # 需要过滤的 get 请求
|
||||
# get:
|
||||
# - "/favicon.ico"
|
||||
# # 需要过滤的请求,不限方法
|
||||
# pattern:
|
||||
# - "/api/**"
|
||||
# - "/appUpload/**"
|
||||
# - "/upload/**"
|
||||
# - "/doc.html"
|
||||
# - "/swagger-resources/**"
|
||||
# - "/v2/api-docs/**"
|
||||
# - "/webjars/**"
|
||||
# - "/**.txt"
|
||||
#================================================= mybatis-plus start =================================================
|
||||
mybatis-plus:
|
||||
#配置文件
|
||||
|
@ -55,7 +55,7 @@ mybatis-plus:
|
||||
#================================================= mybatis-plus end ===================================================
|
||||
|
||||
server:
|
||||
port: 8088
|
||||
port: 8081
|
||||
|
||||
tio:
|
||||
websocket:
|
||||
|
@ -30,6 +30,14 @@
|
||||
<el-input v-model="temp.createTime" placeholder="创建时间" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="" prop="ipAddress" class="is-required">
|
||||
<el-input v-model="temp.ipAddress" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="" prop="ipRealAddress" class="is-required">
|
||||
<el-input v-model="temp.ipRealAddress" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
|
||||
</el-form>
|
||||
</div>
|
||||
@ -56,6 +64,8 @@ export default {
|
||||
devId:'',
|
||||
serverName:'',
|
||||
createTime:'',
|
||||
ipAddress:'',
|
||||
ipRealAddress:'',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
@ -92,6 +92,26 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label=""
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.ipAddress }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label=""
|
||||
width="160"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.ipRealAddress }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
|
@ -30,6 +30,14 @@
|
||||
<el-input v-model="temp.createTime" placeholder="创建时间" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="" prop="ipAddress" class="is-required">
|
||||
<el-input v-model="temp.ipAddress" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="" prop="ipRealAddress" class="is-required">
|
||||
<el-input v-model="temp.ipRealAddress" placeholder="" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
@ -55,6 +63,8 @@ export default {
|
||||
devId:'',
|
||||
serverName:'',
|
||||
createTime:'',
|
||||
ipAddress:'',
|
||||
ipRealAddress:'',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user