修复已知问题
This commit is contained in:
@@ -0,0 +1,125 @@
|
|||||||
|
package com.gxwebsoft.common.system.controller;
|
||||||
|
|
||||||
|
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||||
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.common.system.entity.CompanyGit;
|
||||||
|
import com.gxwebsoft.common.system.param.CompanyGitParam;
|
||||||
|
import com.gxwebsoft.common.system.service.CompanyGitService;
|
||||||
|
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-10-19 18:08:51
|
||||||
|
*/
|
||||||
|
@Api(tags = "代码仓库管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/system/company-git")
|
||||||
|
public class CompanyGitController extends BaseController {
|
||||||
|
@Resource
|
||||||
|
private CompanyGitService companyGitService;
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('sys:company:list')")
|
||||||
|
@OperationLog
|
||||||
|
@ApiOperation("分页查询代码仓库")
|
||||||
|
@GetMapping("/page")
|
||||||
|
public ApiResult<PageResult<CompanyGit>> page(CompanyGitParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(companyGitService.pageRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('sys:company:list')")
|
||||||
|
@OperationLog
|
||||||
|
@ApiOperation("查询全部代码仓库")
|
||||||
|
@GetMapping()
|
||||||
|
public ApiResult<List<CompanyGit>> list(CompanyGitParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(companyGitService.listRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('sys:company:list')")
|
||||||
|
@OperationLog
|
||||||
|
@ApiOperation("根据id查询代码仓库")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ApiResult<CompanyGit> get(@PathVariable("id") Integer id) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(companyGitService.getByIdRel(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('sys:company:save')")
|
||||||
|
@OperationLog
|
||||||
|
@ApiOperation("添加代码仓库")
|
||||||
|
@PostMapping()
|
||||||
|
public ApiResult<?> save(@RequestBody CompanyGit companyGit) {
|
||||||
|
if (companyGitService.save(companyGit)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('sys:company:update')")
|
||||||
|
@OperationLog
|
||||||
|
@ApiOperation("修改代码仓库")
|
||||||
|
@PutMapping()
|
||||||
|
public ApiResult<?> update(@RequestBody CompanyGit companyGit) {
|
||||||
|
if (companyGitService.updateById(companyGit)) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('sys:company:remove')")
|
||||||
|
@OperationLog
|
||||||
|
@ApiOperation("删除代码仓库")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||||
|
if (companyGitService.removeById(id)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('sys:company:save')")
|
||||||
|
@OperationLog
|
||||||
|
@ApiOperation("批量添加代码仓库")
|
||||||
|
@PostMapping("/batch")
|
||||||
|
public ApiResult<?> saveBatch(@RequestBody List<CompanyGit> list) {
|
||||||
|
if (companyGitService.saveBatch(list)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('sys:company:update')")
|
||||||
|
@OperationLog
|
||||||
|
@ApiOperation("批量修改代码仓库")
|
||||||
|
@PutMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<CompanyGit> batchParam) {
|
||||||
|
if (batchParam.update(companyGitService, "id")) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('sys:company:remove')")
|
||||||
|
@OperationLog
|
||||||
|
@ApiOperation("批量删除代码仓库")
|
||||||
|
@DeleteMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||||
|
if (companyGitService.removeByIds(ids)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package com.gxwebsoft.common.system.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代码仓库
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-10-19 18:08:51
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@ApiModel(value = "CompanyGit对象", description = "代码仓库")
|
||||||
|
@TableName("sys_company_git")
|
||||||
|
public class CompanyGit implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "自增ID")
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "仓库名称")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "厂商")
|
||||||
|
private String brand;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "企业ID")
|
||||||
|
private Integer companyId;
|
||||||
|
|
||||||
|
@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.common.system.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.gxwebsoft.common.system.entity.CompanyGit;
|
||||||
|
import com.gxwebsoft.common.system.param.CompanyGitParam;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代码仓库Mapper
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-10-19 18:08:51
|
||||||
|
*/
|
||||||
|
public interface CompanyGitMapper extends BaseMapper<CompanyGit> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param page 分页对象
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<CompanyGit>
|
||||||
|
*/
|
||||||
|
List<CompanyGit> selectPageRel(@Param("page") IPage<CompanyGit> page,
|
||||||
|
@Param("param") CompanyGitParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<User>
|
||||||
|
*/
|
||||||
|
List<CompanyGit> selectListRel(@Param("param") CompanyGitParam param);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<?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.common.system.mapper.CompanyGitMapper">
|
||||||
|
|
||||||
|
<!-- 关联查询sql -->
|
||||||
|
<sql id="selectSql">
|
||||||
|
SELECT a.*
|
||||||
|
FROM sys_company_git a
|
||||||
|
<where>
|
||||||
|
<if test="param.id != null">
|
||||||
|
AND a.id = #{param.id}
|
||||||
|
</if>
|
||||||
|
<if test="param.title != null">
|
||||||
|
AND a.title LIKE CONCAT('%', #{param.title}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.brand != null">
|
||||||
|
AND a.brand = #{param.brand}
|
||||||
|
</if>
|
||||||
|
<if test="param.companyId != null">
|
||||||
|
AND a.company_id = #{param.companyId}
|
||||||
|
</if>
|
||||||
|
<if test="param.domain != null">
|
||||||
|
AND a.domain LIKE CONCAT('%', #{param.domain}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.account != null">
|
||||||
|
AND a.account LIKE CONCAT('%', #{param.account}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.password != null">
|
||||||
|
AND a.password LIKE CONCAT('%', #{param.password}, '%')
|
||||||
|
</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 >= #{param.createTimeStart}
|
||||||
|
</if>
|
||||||
|
<if test="param.createTimeEnd != null">
|
||||||
|
AND a.create_time <= #{param.createTimeEnd}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!-- 分页查询 -->
|
||||||
|
<select id="selectPageRel" resultType="com.gxwebsoft.common.system.entity.CompanyGit">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 查询全部 -->
|
||||||
|
<select id="selectListRel" resultType="com.gxwebsoft.common.system.entity.CompanyGit">
|
||||||
|
<include refid="selectSql"></include>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.gxwebsoft.common.system.param;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.gxwebsoft.common.core.annotation.QueryField;
|
||||||
|
import com.gxwebsoft.common.core.annotation.QueryType;
|
||||||
|
import com.gxwebsoft.common.core.web.BaseParam;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代码仓库查询参数
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-10-19 18:08:51
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@ApiModel(value = "CompanyGitParam对象", description = "代码仓库查询参数")
|
||||||
|
public class CompanyGitParam extends BaseParam {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "自增ID")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "仓库名称")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "厂商")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private String brand;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "企业ID")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer companyId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "仓库地址")
|
||||||
|
private String domain;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "账号")
|
||||||
|
private String account;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "密码")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@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.common.system.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.common.system.entity.CompanyGit;
|
||||||
|
import com.gxwebsoft.common.system.param.CompanyGitParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代码仓库Service
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-10-19 18:08:51
|
||||||
|
*/
|
||||||
|
public interface CompanyGitService extends IService<CompanyGit> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页关联查询
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return PageResult<CompanyGit>
|
||||||
|
*/
|
||||||
|
PageResult<CompanyGit> pageRel(CompanyGitParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联查询全部
|
||||||
|
*
|
||||||
|
* @param param 查询参数
|
||||||
|
* @return List<CompanyGit>
|
||||||
|
*/
|
||||||
|
List<CompanyGit> listRel(CompanyGitParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询
|
||||||
|
*
|
||||||
|
* @param id 自增ID
|
||||||
|
* @return CompanyGit
|
||||||
|
*/
|
||||||
|
CompanyGit getByIdRel(Integer id);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.gxwebsoft.common.system.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.common.system.entity.CompanyGit;
|
||||||
|
import com.gxwebsoft.common.system.mapper.CompanyGitMapper;
|
||||||
|
import com.gxwebsoft.common.system.param.CompanyGitParam;
|
||||||
|
import com.gxwebsoft.common.system.service.CompanyGitService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代码仓库Service实现
|
||||||
|
*
|
||||||
|
* @author 科技小王子
|
||||||
|
* @since 2024-10-19 18:08:51
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CompanyGitServiceImpl extends ServiceImpl<CompanyGitMapper, CompanyGit> implements CompanyGitService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<CompanyGit> pageRel(CompanyGitParam param) {
|
||||||
|
PageParam<CompanyGit, CompanyGitParam> page = new PageParam<>(param);
|
||||||
|
page.setDefaultOrder("create_time desc");
|
||||||
|
List<CompanyGit> list = baseMapper.selectPageRel(page, param);
|
||||||
|
return new PageResult<>(list, page.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CompanyGit> listRel(CompanyGitParam param) {
|
||||||
|
List<CompanyGit> list = baseMapper.selectListRel(param);
|
||||||
|
// 排序
|
||||||
|
PageParam<CompanyGit, CompanyGitParam> page = new PageParam<>();
|
||||||
|
page.setDefaultOrder("create_time desc");
|
||||||
|
return page.sortRecords(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompanyGit getByIdRel(Integer id) {
|
||||||
|
CompanyGitParam param = new CompanyGitParam();
|
||||||
|
param.setId(id);
|
||||||
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user