Commit cb1a43a5 authored by 蒋凌峰's avatar 蒋凌峰 😉

提交

parent 4d3fbe35
......@@ -138,6 +138,10 @@ public class FncSubjectTypeController extends BaseController {
@Log(title = "科目类别", businessType = BusinessType.DELETE)
@GetMapping("/remove/{subjectTypeIds}")
public AjaxResult remove(@PathVariable Long[] subjectTypeIds) {
if (fncSubjectTypeService.hasChildByIds(subjectTypeIds))
{
return warn("存在子科目类别,不允许删除");
}
return toAjax(fncSubjectTypeService.removeByIds(Arrays.asList(subjectTypeIds)) ? 1 : 0);
}
}
......@@ -6,7 +6,7 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://192.168.182.130:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: root
# 从库数据源
......
......@@ -38,4 +38,12 @@ public interface IFncSubjectTypeService extends IService<FncSubjectType> {
* @return
*/
FncSubjectTypeVo queryById(Long subjectTypeId);
/**
* 根据ID集合查询是存在子科目类别
*
* @param subjectTypeIds
* @return
*/
boolean hasChildByIds(Long[] subjectTypeIds);
}
package com.ruoyi.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.PageUtils;
......@@ -9,6 +11,7 @@ import com.ruoyi.system.mapper.FncSubjectTypeMapper;
import com.ruoyi.system.service.IFncSubjectTypeService;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
/**
......@@ -34,4 +37,10 @@ public class FncSubjectTypeServiceImpl extends ServiceImpl<FncSubjectTypeMapper,
public FncSubjectTypeVo queryById(Long subjectTypeId) {
return this.baseMapper.queryById(subjectTypeId);
}
//根据ID集合查询是存在子科目类别
@Override
public boolean hasChildByIds(Long[] subjectTypeIds) {
return this.baseMapper.selectCount(new LambdaQueryWrapper<FncSubjectType>().in(FncSubjectType::getParentId, Arrays.asList(subjectTypeIds))) > 0;
}
}
......@@ -65,6 +65,6 @@
</sql>
<sql id="search">
-- where A.delete_status = 1
</sql>
</mapper>
......@@ -145,6 +145,6 @@
</sql>
<sql id="search">
-- where A.delete_status = 1
</sql>
</mapper>
File added
......@@ -36,6 +36,7 @@ module.exports = {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
target: `http://localhost:8080`,
// target: `http://120.79.23.199:8080/`,
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment