新增:项目管理的域名列表

This commit is contained in:
gxwebsoft
2024-04-16 01:27:22 +08:00
parent 54b9436f2c
commit a3f62b0c77
11 changed files with 417 additions and 0 deletions
@@ -11,9 +11,11 @@ import com.gxwebsoft.common.core.web.BatchParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.User;
import com.gxwebsoft.oa.entity.App;
import com.gxwebsoft.oa.entity.AppUrl;
import com.gxwebsoft.oa.entity.AppUser;
import com.gxwebsoft.oa.param.AppParam;
import com.gxwebsoft.oa.service.AppService;
import com.gxwebsoft.oa.service.AppUrlService;
import com.gxwebsoft.oa.service.AppUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -44,6 +46,8 @@ public class AppController extends BaseController {
@Resource
private AppUserService appUserService;
@Resource
private AppUrlService appUrlService;
@Resource
private RedisUtil redisUtil;
@ApiOperation("统计信息")
@@ -121,6 +125,8 @@ public class AppController extends BaseController {
final PageResult<App> appPageResult = appService.pageRel(param);
appPageResult.getList().forEach(d -> {
d.setContent(null);
// 读取链接列表
d.setAppUrlList(appUrlService.list(new LambdaQueryWrapper<AppUrl>().eq(AppUrl::getAppId,d.getAppId())));
});
return appPageResult;
}
@@ -0,0 +1,109 @@
package com.gxwebsoft.oa.controller;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.oa.service.AppUrlService;
import com.gxwebsoft.oa.entity.AppUrl;
import com.gxwebsoft.oa.param.AppUrlParam;
import com.gxwebsoft.common.core.web.ApiResult;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.BatchParam;
import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.system.entity.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 项目域名控制器
*
* @author 科技小王子
* @since 2024-04-15 13:01:34
*/
@Api(tags = "项目域名管理")
@RestController
@RequestMapping("/api/oa/app-url")
public class AppUrlController extends BaseController {
@Resource
private AppUrlService appUrlService;
@ApiOperation("分页查询项目域名")
@GetMapping("/page")
public ApiResult<PageResult<AppUrl>> page(AppUrlParam param) {
// 使用关联查询
return success(appUrlService.pageRel(param));
}
@ApiOperation("查询全部项目域名")
@GetMapping()
public ApiResult<List<AppUrl>> list(AppUrlParam param) {
// 使用关联查询
return success(appUrlService.listRel(param));
}
@ApiOperation("根据id查询项目域名")
@GetMapping("/{id}")
public ApiResult<AppUrl> get(@PathVariable("id") Integer id) {
// 使用关联查询
return success(appUrlService.getByIdRel(id));
}
@ApiOperation("添加项目域名")
@PostMapping()
public ApiResult<?> save(@RequestBody AppUrl appUrl) {
if (appUrlService.save(appUrl)) {
return success("添加成功");
}
return fail("添加失败");
}
@ApiOperation("修改项目域名")
@PutMapping()
public ApiResult<?> update(@RequestBody AppUrl appUrl) {
if (appUrlService.updateById(appUrl)) {
return success("修改成功");
}
return fail("修改失败");
}
@ApiOperation("删除项目域名")
@DeleteMapping("/{id}")
public ApiResult<?> remove(@PathVariable("id") Integer id) {
if (appUrlService.removeById(id)) {
return success("删除成功");
}
return fail("删除失败");
}
@ApiOperation("批量添加项目域名")
@PostMapping("/batch")
public ApiResult<?> saveBatch(@RequestBody List<AppUrl> list) {
if (appUrlService.saveBatch(list)) {
return success("添加成功");
}
return fail("添加失败");
}
@ApiOperation("批量修改项目域名")
@PutMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody BatchParam<AppUrl> batchParam) {
if (batchParam.update(appUrlService, "app_url_id")) {
return success("修改成功");
}
return fail("修改失败");
}
@ApiOperation("批量删除项目域名")
@DeleteMapping("/batch")
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
if (appUrlService.removeByIds(ids)) {
return success("删除成功");
}
return fail("删除失败");
}
}
@@ -239,6 +239,10 @@ public class App implements Serializable {
@TableField(exist = false)
private List<AppUser> users;
@ApiModelProperty(value = "链接列表")
@TableField(exist = false)
private List<AppUrl> appUrlList;
@ApiModelProperty(value = "主体名称")
@TableField(exist = false)
private String tenantName;
@@ -0,0 +1,62 @@
package com.gxwebsoft.oa.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 项目域名
*
* @author 科技小王子
* @since 2024-04-15 13:01:34
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "AppUrl对象", description = "项目域名")
@TableName("oa_app_url")
public class AppUrl implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "自增ID")
@TableId(value = "app_url_id", type = IdType.AUTO)
private Integer appUrlId;
@ApiModelProperty(value = "应用ID")
private Integer appId;
@ApiModelProperty(value = "域名类型")
private String name;
@ApiModelProperty(value = "域名")
private String domain;
@ApiModelProperty(value = "账号")
private String account;
@ApiModelProperty(value = "密码")
private String password;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "排序(数字越小越靠前)")
private Integer sortNumber;
@ApiModelProperty(value = "状态, 0正常, 1待确认")
private Integer status;
@ApiModelProperty(value = "注册时间")
private Date createTime;
@ApiModelProperty(value = "租户id")
private Integer tenantId;
}
@@ -0,0 +1,37 @@
package com.gxwebsoft.oa.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gxwebsoft.oa.entity.AppUrl;
import com.gxwebsoft.oa.param.AppUrlParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 项目域名Mapper
*
* @author 科技小王子
* @since 2024-04-15 13:01:34
*/
public interface AppUrlMapper extends BaseMapper<AppUrl> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<AppUrl>
*/
List<AppUrl> selectPageRel(@Param("page") IPage<AppUrl> page,
@Param("param") AppUrlParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<AppUrl> selectListRel(@Param("param") AppUrlParam param);
}
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gxwebsoft.oa.mapper.AppUrlMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM oa_app_url a
<where>
<if test="param.appUrlId != null">
AND a.app_url_id = #{param.appUrlId}
</if>
<if test="param.appId != null">
AND a.app_id = #{param.appId}
</if>
<if test="param.name != null">
AND a.name LIKE CONCAT('%', #{param.name}, '%')
</if>
<if test="param.domain != null">
AND a.domain LIKE CONCAT('%', #{param.domain}, '%')
</if>
<if test="param.comments != null">
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
</if>
<if test="param.status != null">
AND a.status = #{param.status}
</if>
<if test="param.createTimeStart != null">
AND a.create_time &gt;= #{param.createTimeStart}
</if>
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
<if test="param.keywords != null">
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
)
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.oa.entity.AppUrl">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.oa.entity.AppUrl">
<include refid="selectSql"></include>
</select>
</mapper>
@@ -233,4 +233,8 @@ public class AppParam extends BaseParam {
@TableField(exist = false)
private Boolean showIndex;
@ApiModelProperty(value = "是否读取链接列表")
@TableField(exist = false)
private Boolean showAppUrl;
}
@@ -0,0 +1,51 @@
package com.gxwebsoft.oa.param;
import java.math.BigDecimal;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 项目域名查询参数
*
* @author 科技小王子
* @since 2024-04-15 13:01:34
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "AppUrlParam对象", description = "项目域名查询参数")
public class AppUrlParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "自增ID")
@QueryField(type = QueryType.EQ)
private Integer appUrlId;
@ApiModelProperty(value = "应用ID")
@QueryField(type = QueryType.EQ)
private Integer appId;
@ApiModelProperty(value = "域名类型")
private String name;
@ApiModelProperty(value = "域名")
private String domain;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "排序(数字越小越靠前)")
@QueryField(type = QueryType.EQ)
private Integer sortNumber;
@ApiModelProperty(value = "状态, 0正常, 1待确认")
@QueryField(type = QueryType.EQ)
private Integer status;
}
@@ -0,0 +1,42 @@
package com.gxwebsoft.oa.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.oa.entity.AppUrl;
import com.gxwebsoft.oa.param.AppUrlParam;
import java.util.List;
/**
* 项目域名Service
*
* @author 科技小王子
* @since 2024-04-15 13:01:34
*/
public interface AppUrlService extends IService<AppUrl> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<AppUrl>
*/
PageResult<AppUrl> pageRel(AppUrlParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<AppUrl>
*/
List<AppUrl> listRel(AppUrlParam param);
/**
* 根据id查询
*
* @param appUrlId 自增ID
* @return AppUrl
*/
AppUrl getByIdRel(Integer appUrlId);
}
@@ -0,0 +1,47 @@
package com.gxwebsoft.oa.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.oa.mapper.AppUrlMapper;
import com.gxwebsoft.oa.service.AppUrlService;
import com.gxwebsoft.oa.entity.AppUrl;
import com.gxwebsoft.oa.param.AppUrlParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 项目域名Service实现
*
* @author 科技小王子
* @since 2024-04-15 13:01:34
*/
@Service
public class AppUrlServiceImpl extends ServiceImpl<AppUrlMapper, AppUrl> implements AppUrlService {
@Override
public PageResult<AppUrl> pageRel(AppUrlParam param) {
PageParam<AppUrl, AppUrlParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc, create_time desc");
List<AppUrl> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<AppUrl> listRel(AppUrlParam param) {
List<AppUrl> list = baseMapper.selectListRel(param);
// 排序
PageParam<AppUrl, AppUrlParam> page = new PageParam<>();
page.setDefaultOrder("sort_number asc, create_time desc");
return page.sortRecords(list);
}
@Override
public AppUrl getByIdRel(Integer appUrlId) {
AppUrlParam param = new AppUrlParam();
param.setAppUrlId(appUrlId);
return param.getOne(baseMapper.selectListRel(param));
}
}