Browse Source

优化开发环境新建无校验bug

dev-active_learn
chenzhihang 9 months ago
parent
commit
0d0de5bd38
3 changed files with 12 additions and 0 deletions
  1. +2
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/DevEnvironmentDao.java
  2. +4
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/DevEnvironmentServiceImpl.java
  3. +6
    -0
      ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/DevEnvironmentDaoMapper.xml

+ 2
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/DevEnvironmentDao.java View File

@@ -62,6 +62,8 @@ public interface DevEnvironmentDao {
*/ */
int deleteById(Integer id); int deleteById(Integer id);


DevEnvironment getByName(@Param("name") String name);

List<DevEnvironment> getRunning(); List<DevEnvironment> getRunning();


List<DevEnvironment> queryByDatasetId(@Param("datasetId") String datasetId); List<DevEnvironment> queryByDatasetId(@Param("datasetId") String datasetId);


+ 4
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/DevEnvironmentServiceImpl.java View File

@@ -94,6 +94,10 @@ public class DevEnvironmentServiceImpl implements DevEnvironmentService {
*/ */
@Override @Override
public DevEnvironment insert(DevEnvironmentVo devEnvironmentVo) throws Exception { public DevEnvironment insert(DevEnvironmentVo devEnvironmentVo) throws Exception {
DevEnvironment devByName = devEnvironmentDao.getByName(devEnvironmentVo.getName());
if (devByName != null) {
throw new RuntimeException("开发环境名称已存在");
}
//插入预备,此时不需要判断版本重复 //插入预备,此时不需要判断版本重复
DevEnvironment devEnvironment = new DevEnvironment(); DevEnvironment devEnvironment = new DevEnvironment();
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();


+ 6
- 0
ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/DevEnvironmentDaoMapper.xml View File

@@ -208,6 +208,12 @@
where id = #{devEnvironment.id} where id = #{devEnvironment.id}
</update> </update>


<select id="getByName" resultType="com.ruoyi.platform.domain.DevEnvironment">
select *
from dev_environment
where name = #{name}
and state = 1
</select>


<!--通过主键删除--> <!--通过主键删除-->
<delete id="deleteById"> <delete id="deleteById">


Loading…
Cancel
Save