update
This commit is contained in:
parent
7e6cebdaa2
commit
48d399d11c
@ -42,6 +42,19 @@ public class ProjectController extends BaseController {
|
|||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取项目列表
|
||||||
|
* @author zhuff
|
||||||
|
* @param monitorDataSourceVo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("pageList")
|
||||||
|
public TableDataInfo getPageList(@RequestBody MonitorDataSourceVo monitorDataSourceVo) {
|
||||||
|
List<Map<String , Object>> list = projectService.getPageList(monitorDataSourceVo);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建项目
|
* 创建项目
|
||||||
* @author zhuff
|
* @author zhuff
|
||||||
@ -69,6 +82,21 @@ public class ProjectController extends BaseController {
|
|||||||
return toAjax(projectService.addProject(monitorProject));
|
return toAjax(projectService.addProject(monitorProject));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建项目
|
||||||
|
* @author zhuff
|
||||||
|
* @param monitorProject
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("addProject")
|
||||||
|
public AjaxResult addProject(@RequestBody MonitorProject monitorProject) {
|
||||||
|
if (UserConstants.NOT_UNIQUE.equals(projectService.checkProjectNameUnique(monitorProject.getProjectName()))) {
|
||||||
|
return AjaxResult.error("新增项目模型'" + monitorProject.getProjectName() + "'失败,该项目模型已存在");
|
||||||
|
}
|
||||||
|
monitorProject.setSubjectId(111111);
|
||||||
|
return toAjax(projectService.addProjectNew(monitorProject));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改项目
|
* 修改项目
|
||||||
* @author zhuff
|
* @author zhuff
|
||||||
@ -100,6 +128,22 @@ public class ProjectController extends BaseController {
|
|||||||
return toAjax(projectService.updateProject(monitorProject));
|
return toAjax(projectService.updateProject(monitorProject));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改项目
|
||||||
|
* @author zhuff
|
||||||
|
* @param monitorProject
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("updateNewProject")
|
||||||
|
public AjaxResult updateNewProject(@RequestBody MonitorProject monitorProject) {
|
||||||
|
if (!projectService.getById(monitorProject.getId()).getProjectName().equals(monitorProject.getProjectName())) {
|
||||||
|
if (UserConstants.NOT_UNIQUE.equals(projectService.checkProjectNameUnique(monitorProject.getProjectName()))) {
|
||||||
|
return AjaxResult.error("修改项目模型'" + monitorProject.getProjectName() + "'失败,该项目模型已存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return toAjax(projectService.updateNewProject(monitorProject));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id获取项目
|
* 根据id获取项目
|
||||||
* @author zhuff
|
* @author zhuff
|
||||||
@ -111,6 +155,17 @@ public class ProjectController extends BaseController {
|
|||||||
return AjaxResult.success(projectService.getProjectById(id));
|
return AjaxResult.success(projectService.getProjectById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id获取项目
|
||||||
|
* @author zhuff
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("getNewProjectById")
|
||||||
|
public AjaxResult getNewProjectById(@RequestParam Integer id) {
|
||||||
|
return AjaxResult.success(projectService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除项目
|
* 删除项目
|
||||||
* @param id
|
* @param id
|
||||||
@ -121,6 +176,16 @@ public class ProjectController extends BaseController {
|
|||||||
return toAjax(projectService.deleteProject(id));
|
return toAjax(projectService.deleteProject(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除项目
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@DeleteMapping("deleteNewProject")
|
||||||
|
public AjaxResult deleteNewProject(Integer id){
|
||||||
|
return toAjax(projectService.deleteNewProject(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试连接
|
* 测试连接
|
||||||
|
@ -109,7 +109,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
|
|||||||
// 过滤请求
|
// 过滤请求
|
||||||
.authorizeRequests()
|
.authorizeRequests()
|
||||||
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
|
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
|
||||||
.antMatchers("/login", "/register", "/captchaImage", "/subject/project/*").anonymous()
|
.antMatchers("/login", "/register", "/captchaImage", "/subject/project/*","/subject/**").anonymous()
|
||||||
// 静态资源,可匿名访问
|
// 静态资源,可匿名访问
|
||||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
||||||
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
||||||
|
@ -26,4 +26,6 @@ public interface ProjectMapper {
|
|||||||
int updateProject(MonitorProject monitorProject);
|
int updateProject(MonitorProject monitorProject);
|
||||||
|
|
||||||
int deleteProject(Integer id);
|
int deleteProject(Integer id);
|
||||||
|
|
||||||
|
List<Map<String, Object>> getPageList(MonitorDataSourceVo monitorDataSourceVo);
|
||||||
}
|
}
|
||||||
|
@ -40,4 +40,12 @@ public interface ProjectService {
|
|||||||
Connection create(MonitorDataSource dataSource, List<Map<String, Object>> properties);
|
Connection create(MonitorDataSource dataSource, List<Map<String, Object>> properties);
|
||||||
|
|
||||||
void addDataSource(MonitorDataSource monitorDataSource);
|
void addDataSource(MonitorDataSource monitorDataSource);
|
||||||
|
|
||||||
|
List<Map<String, Object>> getPageList(MonitorDataSourceVo monitorDataSourceVo);
|
||||||
|
|
||||||
|
int addProjectNew(MonitorProject monitorProject);
|
||||||
|
|
||||||
|
int updateNewProject(MonitorProject monitorProject);
|
||||||
|
|
||||||
|
int deleteNewProject(Integer id);
|
||||||
}
|
}
|
||||||
|
@ -392,4 +392,29 @@ public class ProjectServiceImpl implements ProjectService {
|
|||||||
public void addDataSource(MonitorDataSource monitorDataSource){
|
public void addDataSource(MonitorDataSource monitorDataSource){
|
||||||
databaseMapper.addDatabaseSource(monitorDataSource);
|
databaseMapper.addDatabaseSource(monitorDataSource);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> getPageList(MonitorDataSourceVo monitorDataSourceVo) {
|
||||||
|
PageHelper.startPage(monitorDataSourceVo.getPageNum(),monitorDataSourceVo.getPageSize());
|
||||||
|
List<Map<String , Object>> list = projectMapper.getPageList(monitorDataSourceVo);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int addProjectNew(MonitorProject monitorProject) {
|
||||||
|
/*新增项目*/
|
||||||
|
int resultInt = projectMapper.addProject(monitorProject);
|
||||||
|
return resultInt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateNewProject(MonitorProject monitorProject) {
|
||||||
|
return projectMapper.updateProject(monitorProject);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteNewProject(Integer id) {
|
||||||
|
/*删除项目*/
|
||||||
|
return projectMapper.deleteProject(id);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,20 @@
|
|||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 15:39-->
|
||||||
|
<select id="getPageList" resultType="map">
|
||||||
|
SELECT p.id id,p.project_name projectName,p.project_description projectDescription,DATE_FORMAT(p.create_at, '%Y-%m-%d') createAt,p.subject_id subjectId
|
||||||
|
FROM monitor_project p
|
||||||
|
WHERE p.deleted = 0
|
||||||
|
<if test="projectName != null and projectName != ''">
|
||||||
|
AND p.project_name like concat('%', #{projectName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="subjectId != null and subjectId != ''">
|
||||||
|
AND p.subject_id like concat('%', #{subjectId}, '%')
|
||||||
|
</if>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="checkProjectNameUnique" resultType="int">
|
<select id="checkProjectNameUnique" resultType="int">
|
||||||
SELECT count(1) from monitor_project where project_name = #{projectName} and deleted = 0 limit 1
|
SELECT count(1) from monitor_project where project_name = #{projectName} and deleted = 0 limit 1
|
||||||
</select>
|
</select>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user