Commit 053094dc authored by 张兴海's avatar 张兴海

状态关联下级,名称重复优化

parent 77399351
......@@ -90,7 +90,12 @@ public class ActSuppliesController extends BaseController
{
SysUser user = SecurityUtils.getLoginUser().getUser();
actSupplies.setCreateBy(user.getUserName());
return toAjax(actSuppliesService.insertActSupplies(actSupplies));
/*return toAjax(actSuppliesService.insertActSupplies(actSupplies));*/
int i = actSuppliesService.insertActSupplies(actSupplies);
if(i==0){
return AjaxResult.error("添加名称失败,名称已被占用");
}
return AjaxResult.success("添加成功");
}
/**
......@@ -103,7 +108,12 @@ public class ActSuppliesController extends BaseController
{
SysUser user = SecurityUtils.getLoginUser().getUser();
actSupplies.setUpdateBy(user.getUserName());
return toAjax(actSuppliesService.updateActSupplies(actSupplies));
// return toAjax(actSuppliesService.updateActSupplies(actSupplies));
int i = actSuppliesService.updateActSupplies(actSupplies);
if(i==0){
return AjaxResult.error("修改名称失败.名称已被占用");
}
return AjaxResult.success("修改成功");
}
/**
......@@ -143,7 +153,13 @@ public class ActSuppliesController extends BaseController
public AjaxResult setDisable(@PathVariable("id") Long id)
{
if (actSuppliesService.find(id).size()>0 || actSuppliesService.findId(id).size()>0){
return AjaxResult.success("该物料下存在关联物料,请先删除关联物料!!!","操作失败");
}
System.out.println("开始处理【禁用物料总分类管理】的请求,参数:{}"+ id);
actSuppliesService.setDisable(id);
return AjaxResult.success("200","修改成功");
......
......@@ -89,7 +89,12 @@ public class ActSuppliesRoleController extends BaseController
{
SysUser user = SecurityUtils.getLoginUser().getUser();
actSuppliesRole.setCreateBy(user.getUserName());
return toAjax(actSuppliesRoleService.insertActSuppliesRole(actSuppliesRole));
/*return toAjax(actSuppliesService.insertActSupplies(actSupplies));*/
int i = actSuppliesRoleService.insertActSuppliesRole(actSuppliesRole);
if(i==0){
return AjaxResult.error("添加名称失败,名称已被占用");
}
return AjaxResult.success("添加成功");
}
/**
......@@ -103,7 +108,12 @@ public class ActSuppliesRoleController extends BaseController
SysUser user = SecurityUtils.getLoginUser().getUser();
actSuppliesRole.setUpdateBy(user.getUserName());
return toAjax(actSuppliesRoleService.updateActSuppliesRole(actSuppliesRole));
/*return toAjax(actSuppliesRoleService.updateActSuppliesRole(actSuppliesRole));*/
int i = actSuppliesRoleService.insertActSuppliesRole(actSuppliesRole);
if(i==0){
return AjaxResult.error("修改名称失败,名称已被占用");
}
return AjaxResult.success("修改成功");
}
/**
......@@ -142,6 +152,10 @@ public class ActSuppliesRoleController extends BaseController
@GetMapping("/disable/{id}")
public AjaxResult setDisable(@PathVariable("id") Long id)
{
if (actSuppliesRoleService.find(Math.toIntExact(id)).size()>0){
return AjaxResult.success("该规则下存在关联规则,请先删除关联规则!!!","操作失败");
}
System.out.println("开始处理【禁用物料总分类管理】的请求,参数:{}"+ id);
actSuppliesRoleService.setDisable(id);
return AjaxResult.success();
......
......@@ -149,6 +149,9 @@ public class ActSuppliesTemplateController extends BaseController {
@GetMapping("/disable/{id}")
public AjaxResult setDisable(@PathVariable("id") Long id)
{
if(actSuppliesTemplateService.find(id).size()>0){
return AjaxResult.success("该物料下存在关联物料,请先删除关联物料!!!","操作失败");
}
System.out.println("开始处理【禁用物料总分类管理】的请求,参数:{}"+ id);
actSuppliesTemplateService.setDisable(id);
return AjaxResult.success();
......
......@@ -66,6 +66,10 @@ public interface ActSuppliesMapper
List<Integer> findAllId(Long[] ids);
List<Integer> find(Long id);
List<Integer> findId(Long id);
/**
* 根据物料总分类名称统计数量
......
......@@ -65,6 +65,7 @@ public interface ActSuppliesRoleMapper
List<ActSuppliesTemplate> saveSid();
List<Integer> findall(Integer[] ids);
List<Integer> find(Integer id);
public int countByRoleName(String roleName);
......
......@@ -29,6 +29,8 @@ public interface ActSuppliesTemplateMapper
List<Integer> findall(Long[] ids);
List<Integer> find(Long id);
List<String> findName();
}
......@@ -26,6 +26,8 @@ public interface ActSuppliesTemplateService
List<ActSuppliesTemplate> saveTemplate(Long id);
List<Integer> findall(Long[] ids);
List<Integer> find(Long id);
/**
* 启用物料细分类管理
*
......@@ -43,4 +45,6 @@ public interface ActSuppliesTemplateService
List<String> findName();
}
......@@ -79,4 +79,5 @@ public interface IActSuppliesRoleService
void setDisable(Long id);
List<Integer> findall(Integer[] ids);
List<Integer> find(Integer id);
}
......@@ -84,5 +84,10 @@ public interface IActSuppliesService
List<Integer> findAllId(Long[] ids);
List<Integer> find(Long id);
List<Integer> findId(Long id);
}
......@@ -64,13 +64,14 @@ public class ActSuppliesRoleServiceImpl implements IActSuppliesRoleService
if(countByRoleName > 0){
String message = "添加规则失败,规则名称已被占用";
System.out.println(message);
throw new ServiceException(ServiceCode.ERR_CONFLICT,message);
/*throw new ServiceException(ServiceCode.ERR_CONFLICT,message);*/
}
ActSuppliesRole actSuppliesRole1 = new ActSuppliesRole();
BeanUtils.copyProperties(actSuppliesRole,actSuppliesRole1);
actSuppliesRole.setCreateTime(DateUtils.getNowDate());
return actSuppliesRoleMapper.insertActSuppliesRole(actSuppliesRole);
return 0;
/* actSuppliesRoleMapper.insertActSuppliesRole(actSuppliesRole)*/
}
/**
......@@ -87,12 +88,13 @@ public class ActSuppliesRoleServiceImpl implements IActSuppliesRoleService
if(countByRoleName > 0){
String message = "修改规则失败,新的规则名称已被占用";
System.out.println(message);
throw new ServiceException(ServiceCode.ERR_CONFLICT,message);
/* throw new ServiceException(ServiceCode.ERR_CONFLICT,message);*/
}
ActSuppliesRole actSuppliesRole2 = new ActSuppliesRole();
BeanUtils.copyProperties(actSuppliesRole,actSuppliesRole2);
actSuppliesRole.setUpdateTime(DateUtils.getNowDate());
return actSuppliesRoleMapper.updateActSuppliesRole(actSuppliesRole);
return 0;
/* actSuppliesRoleMapper.insertActSuppliesRole(actSuppliesRole)*/
}
/**
......@@ -139,6 +141,11 @@ public class ActSuppliesRoleServiceImpl implements IActSuppliesRoleService
return actSuppliesRoleMapper.findall(ids);
}
@Override
public List<Integer> find(Integer id) {
return actSuppliesRoleMapper.find(id);
}
private void updateStatusById(Long id, Integer status){
String[] statusText={"禁用","启用"};
......
......@@ -66,13 +66,15 @@ public class ActSuppliesServiceImpl implements IActSuppliesService
if(countBySuppliesName > 0){
String message = "添加物料总分类管理失败,名称已被占用!";
System.out.println(message);
throw new ServiceException(ServiceCode.ERR_CONFLICT,message);
/*throw new ServiceException(ServiceCode.ERR_CONFLICT,message);*/
}
ActSupplies actSupplies1 = new ActSupplies();
BeanUtils.copyProperties(actSupplies,actSupplies1);
actSupplies.setCreateTime(DateUtils.getNowDate());
return actSuppliesMapper.insertActSupplies(actSupplies);
return 0;
/*actSuppliesMapper.insertActSupplies(actSupplies)*/
}
/**
......@@ -89,12 +91,13 @@ public class ActSuppliesServiceImpl implements IActSuppliesService
if(countBySuppliesName > 0) {
String message = "修改物料总分类管理失败,新的名称已被占用!";
System.out.println(message);
throw new ServiceException(ServiceCode.ERR_CONFLICT, message);
/* throw new ServiceException(ServiceCode.ERR_CONFLICT, message);*/
}
ActSupplies actSupplies1 = new ActSupplies();
BeanUtils.copyProperties(actSupplies,actSupplies1);
actSupplies.setUpdateTime(DateUtils.getNowDate());
return actSuppliesMapper.updateActSupplies(actSupplies);
return 0;
/*actSuppliesMapper.updateActSupplies(actSupplies);*/
}
/**
......@@ -146,6 +149,16 @@ public class ActSuppliesServiceImpl implements IActSuppliesService
return actSuppliesMapper.findAllId(ids);
}
@Override
public List<Integer> find(Long id) {
return actSuppliesMapper.find(id);
}
@Override
public List<Integer> findId(Long id) {
return actSuppliesMapper.findId(id);
}
private void updateStatusById(Long id, Integer status){
String[] statusText={"禁用","启用"};
......@@ -164,6 +177,8 @@ public class ActSuppliesServiceImpl implements IActSuppliesService
System.out.println(message);
throw new RuntimeException(message);
}
ActSupplies actSupplies = new ActSupplies();
actSupplies.setId(id);
actSupplies.setStatus(status);
......
......@@ -70,6 +70,12 @@ public class ActSuppliesTemplateServiceImpl implements ActSuppliesTemplateServic
public List<Integer> findall(Long[] ids) {
return actSuppliesTemplateMapper.findall(ids);
}
@Override
public List<Integer> find(Long id) {
return actSuppliesTemplateMapper.find(id);
}
@Override
public void setEnable(Long id) {
updateStatusById(id,0);
......
......@@ -101,6 +101,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</select>
<select id="find" resultType="Integer">
-- select sid from act_supplies_details GROUP BY sid
select sid from act_supplies_details where sid = #{id}
</select>
<select id="findId" resultType="Integer">
-- select pid from act_supplies
select pid from act_supplies where pid = #{id}
</select>
<!-- <delete id="deleteActSuppliesById" parameterType="Long">-->
<!-- delete from act_supplies where id = #{id}-->
......
......@@ -37,6 +37,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</select>
<select id="find" resultType="Integer">
select role_id from act_supplies_role_detail where role_id=#{id}
</select>
<select id="countByRoleName" resultType="int">
select count(*) from act_supplies_role where role_name=#{roleName}
</select>
......
......@@ -21,6 +21,10 @@
select id, det_id, template_name, template_content, status, create_by, create_time, update_by, update_time from act_supplies_template
</sql>
<select id="find" resultType="Integer">
select temp_id from act_supplies_role where temp_id=#{id}
</select>
<select id="findall" parameterType="String" resultType="Integer">
select temp_id from act_supplies_role where temp_id in
<foreach collection="array" item="id" open="(" separator="," close=")">
......@@ -28,6 +32,7 @@
</foreach>
</select>
<select id="findName" resultType="String">
select template_name from act_supplies_template
</select>
......
......@@ -3,12 +3,14 @@ module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module'
sourceType: 'module',
},
env: {
browser: true,
node: true,
es6: true,
jquery: true
},
extends: ['plugin:vue/recommended', 'eslint:recommended'],
......
......@@ -17,7 +17,7 @@
<script src="/expendPlugins/chart/chartmix.umd.min.js"></script>
<!-- <link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/plugins/css/pluginsCss.css' />
<!--<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/plugins/css/pluginsCss.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/plugins/plugins.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/css/luckysheet.css' />
<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/luckysheet@latest/dist/assets/iconfont/iconfont.css' />
......
......@@ -23,10 +23,7 @@ import RightToolbar from "@/components/RightToolbar"
import axios from "axios";
import qs from 'qs';
import * as echarts from "echarts";
// import $ from "jquery";
//
// window.jQuery = $;
// window.$ = $;
// 全局方法挂载
Vue.prototype.echarts=echarts;
......
......@@ -262,12 +262,10 @@ export default {
toggleEnable(actSuppliesDetails){
console.log('你点击了【' + actSuppliesDetails.detailsName+'】的开关控件,当前开关值:' + actSuppliesDetails.status);
let enableText=['启用','禁用'];
if(actSuppliesDetails.status == 0) {
if(actSuppliesDetails.status === 0) {
toggleEnable(actSuppliesDetails.id).then((response) =>{
if(response.code == 200){
if(response.code === 200){
let message = '操作成功,已经将【' + actSuppliesDetails.detailsName +'】的状态改为【'+ enableText[actSuppliesDetails.status] +'】 !';
this.$message({
......@@ -280,7 +278,7 @@ export default {
});
}else {
toggleDisable(actSuppliesDetails.id).then((response) =>{
if(response.code == 200){
if(response.code === 200){
let message = '操作成功,已经将【' + actSuppliesDetails.detailsName +'】的状态改为【'+ enableText[actSuppliesDetails.status] +'】 !';
this.$message({
message: message,
......@@ -323,7 +321,7 @@ export default {
sid: null,
detailsName: null,
sysclassify: null,
status: 0,
status: null,
createBy: null,
createTime: null,
updateBy: null,
......
......@@ -253,33 +253,41 @@ export default {
// const pageNumber = this.queryParams.pageNum || 1;
return index + 1;
},
/**启用 */
toggleEnable(actSupplies){
console.log('你点击了【' + actSupplies.suppliesName+'】的开关控件,当前开关值:' + actSupplies.status);
let enableText=['启用','禁用'];
if(actSupplies.status == 0) {
if(actSupplies.status === 0) {
toggleEnable(actSupplies.id).then((response) =>{
response.code == 200;
if(response.code === 200){
let message = '操作成功,已经将【' + actSupplies.suppliesName +'】的状态改为【'+ enableText[actSupplies.status] +'】 !';
this.$message({
message: message,
type:'success'
});
}else {
this.$message.error(response.message);
}
});
}else {
toggleDisable(actSupplies.id).then((response) =>{
response.code == 200;
if(response.msg === "200"){
let message = '操作成功,已经将【' + actSupplies.suppliesName +'】的状态改为【'+ enableText[actSupplies.status] +'】 !';
this.$message({
message: message,
type:'error'
});
}else {
this.getList();
this.$message.error(response.msg);
}
});
}
},
/** 查询上级关联关系*/
fetchOptions() {
getPid().then(response => {
......
......@@ -274,14 +274,15 @@ export default {
});
} else {
toggleDisable(SuppliesTemplate.id).then((response) => {
if (response.code === 200) {
if (response.msg === "200") {
let message = '操作成功,已经将【' + SuppliesTemplate.templateName + '】的状态改为【' + enableText[SuppliesTemplate.status] + '】 !';
this.$message({
message: message,
type: 'error'
});
} else {
this.$message.error(response.message);
this.getList();
this.$message.error(response.msg);
}
});
......
......@@ -223,13 +223,13 @@ export default {
methods: {
/**启用 */
toggleEnable(suppliesrole){
console.log('你点击了【' + suppliesrole.s+'】的开关控件,当前开关值:' + suppliesrole.status);
toggleEnable(suppliesRole){
console.log('你点击了【' + suppliesRole.s+'】的开关控件,当前开关值:' + suppliesRole.status);
let enableText=['启用','禁用'];
if(suppliesrole.status == 0) {
toggleEnable(suppliesrole.id).then((response) =>{
if(response.code == 200){
let message = '操作成功,已经将【' + suppliesrole.roleName +'】的状态改为【'+ enableText[suppliesrole.status] +'】 !';
if(suppliesRole.status === 0) {
toggleEnable(suppliesRole.id).then((response) =>{
if(response.code === 200){
let message = '操作成功,已经将【' + suppliesRole.roleName +'】的状态改为【'+ enableText[suppliesRole.status] +'】 !';
this.$message({
message: message,
type:'success'
......@@ -239,15 +239,16 @@ export default {
}
});
}else {
toggleDisable(suppliesrole.id).then((response) =>{
if(response.code == 200){
let message = '操作成功,已经将【' + suppliesrole.roleName +'】的状态改为【'+ enableText[suppliesrole.status] +'】 !';
toggleDisable(suppliesRole.id).then((response) =>{
if(response.msg === "200"){
let message = '操作成功,已经将【' + suppliesRole.roleName +'】的状态改为【'+ enableText[suppliesRole.status] +'】 !';
this.$message({
message: message,
type:'error'
});
}else {
this.$message.error(response.message);
this.getList();
this.$message.error(response.msg);
}
});
......
......@@ -420,23 +420,23 @@ export default {
},
toggleEnable(suppliesroledetail){
console.log('你点击了【' + suppliesroledetail.s+'】的开关控件,当前开关值:' + suppliesroledetail.status);
toggleEnable(suppliesRoleDetail){
console.log('你点击了【' + suppliesRoleDetail.s+'】的开关控件,当前开关值:' + suppliesRoleDetail.status);
let enableText=['启用','禁用'];
if(suppliesroledetail.status === 0) {
toggleEnable(suppliesroledetail.id).then((response) =>{
if(suppliesRoleDetail.status === 0) {
toggleEnable(suppliesRoleDetail.id).then((response) =>{
if(response.code === 200){
let message = '操作成功,已经将【' + suppliesroledetail.roleName +'】的状态改为【'+ enableText[suppliesroledetail.status] +'】 !';
let message = '操作成功,已经将【' + suppliesRoleDetail.roleName +'】的状态改为【'+ enableText[suppliesRoleDetail.status] +'】 !';
this.$message({message: message,type:'success'});
}else {
this.$message.error(response.message);
}
});
}else {
toggleDisable(suppliesroledetail.id).then((response) =>{
toggleDisable(suppliesRoleDetail.id).then((response) =>{
if(response.code === 200){
let message = '操作成功,已经将【' + suppliesroledetail.roleName +'】的状态改为【'+ enableText[suppliesroledetail.status] +'】 !';
let message = '操作成功,已经将【' + suppliesRoleDetail.roleName +'】的状态改为【'+ enableText[suppliesRoleDetail.status] +'】 !';
this.$message({message: message, type:'success'});
}else {
this.$message.error(response.message);
......
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