Commit 9d788f72 authored by lenovo's avatar lenovo

删除校验功能修改

parent 68decbc3
......@@ -115,12 +115,10 @@ public class ActSuppliesController extends BaseController
public AjaxResult remove(@PathVariable Long[] ids)
{
List<Integer> find = Stream.concat(actSuppliesService.findall().stream(),actSuppliesService.findAllId().stream()).collect(Collectors.toList());
if (actSuppliesService.findall(ids).size()>0 || actSuppliesService.findAllId(ids).size()>0){
return AjaxResult.error("该物料下存在关联物料,请先删除关联物料!!!","操作失败");
for (long num : ids){
if (find.contains((int)num)){
return AjaxResult.success("删除失败","操作失败");
}
}
return toAjax(actSuppliesService.deleteActSuppliesByIds(ids));
......@@ -145,17 +143,7 @@ public class ActSuppliesController extends BaseController
public AjaxResult setDisable(@PathVariable("id") Long id)
{
BigDecimal numBigDecimal = new BigDecimal(id);
Integer numberInt = numBigDecimal.intValue();
List<Integer> find = Stream.concat(actSuppliesService.findall().stream(),actSuppliesService.findAllId().stream()).collect(Collectors.toList());
if (find.contains(numberInt)){
return AjaxResult.success("删除失败","操作失败");
}
System.out.println("开始处理【禁用物料总分类管理】的请求,参数:{}"+ id);
actSuppliesService.setDisable(id);
return AjaxResult.success("200","修改成功");
......
......@@ -116,15 +116,9 @@ public class ActSuppliesDetailsController extends BaseController
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
List<Integer> find = actSuppliesDetailsService.findall();
for (long num : ids){
if (find.contains((int)num)){
return AjaxResult.success("删除失败","操作失败");
}
}
return toAjax(actSuppliesDetailsService.deleteActSuppliesDetailsByIds(ids));
}
/**
......
......@@ -114,14 +114,12 @@ public class ActSuppliesRoleController extends BaseController
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Integer[] ids)
{
List<Integer> find = actSuppliesRoleService.findall();
for (long num : ids){
if (find.contains((int)num)){
return AjaxResult.success("删除失败","操作失败");
}
if (actSuppliesRoleService.findall(ids).size()>0){
return AjaxResult.error("该规则下存在关联规则,请先删除关联规则!!!","操作失败");
}
return toAjax(actSuppliesRoleService.deleteActSuppliesRoleByIds(ids));
}
......
......@@ -105,12 +105,10 @@ public class ActSuppliesTemplateController extends BaseController {
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
List<Integer> find = actSuppliesTemplateService.findall();
for (long num : ids){
if (find.contains((int)num)){
return AjaxResult.success("删除失败","操作失败");
}
if (actSuppliesTemplateService.findall(ids).size()>0){
return AjaxResult.error("该模板下存在关联规则,请先删除关联规则!!!","操作失败");
}
return toAjax(actSuppliesTemplateService.deleteSuppliesTemplateByIds(ids));
......@@ -121,12 +119,12 @@ public class ActSuppliesTemplateController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('SuppliesTemplate:SuppliesTemplate:ifName')")
@GetMapping("/ifName/{name}")
public AjaxResult setEnable(@PathVariable("name") String name)
public AjaxResult ifName(@PathVariable("name") String name)
{
List<String> find = actSuppliesTemplateService.findName();
if (find.contains(name)){
return AjaxResult.success("验证失败","存在重复");
return AjaxResult.success("上传文件名重复,请修改后上传!","存在重复");
}
return AjaxResult.success("验证通过","验证通过");
......
......@@ -62,7 +62,5 @@ public interface ActSuppliesDetailsMapper
*/
public int deleteActSuppliesDetailsByIds(Long[] ids);
List<Integer> findall();
List<ActSupplies> saveSid();
}
......@@ -62,9 +62,9 @@ public interface ActSuppliesMapper
List<ActSupplies> options();
List<Integer> findall();
List<Integer> findall(Long[] ids);
List<Integer> findAllId();
List<Integer> findAllId(Long[] ids);
/**
......
......@@ -64,7 +64,7 @@ public interface ActSuppliesRoleMapper
List<ActSuppliesTemplate> saveSid();
List<Integer> findall();
List<Integer> findall(Integer[] ids);
public int countByRoleName(String roleName);
......
......@@ -27,7 +27,7 @@ public interface ActSuppliesTemplateMapper
List<ActSuppliesTemplate> saveTemplate(Long id);
List<Integer> findall();
List<Integer> findall(Long[] ids);
List<String> findName();
......
......@@ -25,7 +25,7 @@ public interface ActSuppliesTemplateService
List<ActSuppliesTemplate> saveTemplate(Long id);
List<Integer> findall();
List<Integer> findall(Long[] ids);
/**
* 启用物料细分类管理
*
......
......@@ -62,8 +62,6 @@ public interface IActSuppliesDetailsService
*/
public int deleteActSuppliesDetailsById(Long id);
List<Integer> findall();
List<ActSupplies> saveSid();
/**
* 启用物料总分类管理
......
......@@ -78,5 +78,5 @@ public interface IActSuppliesRoleService
*/
void setDisable(Long id);
List<Integer> findall();
List<Integer> findall(Integer[] ids);
}
......@@ -64,7 +64,6 @@ public interface IActSuppliesService
List<ActSupplies> options();
List<Integer> findall();
/**
* 启用物料细分类管理
......@@ -81,7 +80,9 @@ public interface IActSuppliesService
*/
void setDisable(Long id);
List<Integer> findAllId();
List<Integer> findall(Long[] ids);
List<Integer> findAllId(Long[] ids);
}
......@@ -97,11 +97,6 @@ public class ActSuppliesDetailsServiceImpl implements IActSuppliesDetailsService
return actSuppliesDetailsMapper.deleteActSuppliesDetailsById(id);
}
@Override
public List<Integer> findall() {
return actSuppliesDetailsMapper.findall();
}
@Override
public List<ActSupplies> saveSid() {
return actSuppliesDetailsMapper.saveSid();
......
......@@ -135,8 +135,8 @@ public class ActSuppliesRoleServiceImpl implements IActSuppliesRoleService
}
@Override
public List<Integer> findall() {
return actSuppliesRoleMapper.findall();
public List<Integer> findall(Integer[] ids) {
return actSuppliesRoleMapper.findall(ids);
}
......
......@@ -127,8 +127,8 @@ public class ActSuppliesServiceImpl implements IActSuppliesService
}
@Override
public List<Integer> findall() {
return actSuppliesMapper.findall();
public List<Integer> findall(Long[] ids) {
return actSuppliesMapper.findall(ids);
}
@Override
......@@ -142,8 +142,8 @@ public class ActSuppliesServiceImpl implements IActSuppliesService
}
@Override
public List<Integer> findAllId() {
return actSuppliesMapper.findAllId();
public List<Integer> findAllId(Long[] ids) {
return actSuppliesMapper.findAllId(ids);
}
......
......@@ -67,8 +67,8 @@ public class ActSuppliesTemplateServiceImpl implements ActSuppliesTemplateServic
}
@Override
public List<Integer> findall() {
return actSuppliesTemplateMapper.findall();
public List<Integer> findall(Long[] ids) {
return actSuppliesTemplateMapper.findall(ids);
}
@Override
public void setEnable(Long id) {
......
......@@ -49,10 +49,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id,pid,supplies_name from act_supplies where status = 0;
</select>
<select id="findall" resultType="Integer">
select det_id from act_supplies_template GROUP BY det_id
</select>
<select id="selectActSuppliesDetailsList" parameterType="ActSuppliesDetails" resultMap="OneActSuppliesDetailsResult">
select a.id, a.sid,b.supplies_name,a.details_name,a.sysclassify,a.status from act_supplies_details a left join act_supplies b on a.sid = b.id
<where>
......
......@@ -85,12 +85,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<select id="findall" resultType="Integer">
select sid from act_supplies_details GROUP BY sid
<select id="findall" parameterType="String" resultType="Integer">
-- select sid from act_supplies_details GROUP BY sid
select sid from act_supplies_details where sid in
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<select id="findAllId" resultType="Integer">
select pid from act_supplies
<select id="findAllId" parameterType="String" resultType="Integer">
-- select pid from act_supplies
select pid from act_supplies where pid in
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
......
......@@ -30,9 +30,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<select id="findall" resultType="Integer">
select role_id from act_supplies_role_detail GROUP BY role_id
<select id="findall" parameterType="String" resultType="Integer">
select role_id from act_supplies_role_detail where role_id in
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<select id="countByRoleName" resultType="int">
select count(*) from act_supplies_role where role_name=#{roleName}
</select>
......
......@@ -21,8 +21,11 @@
select id, det_id, template_name, template_content, status, create_by, create_time, update_by, update_time from act_supplies_template
</sql>
<select id="findall" resultType="Integer">
select temp_id from act_supplies_role GROUP BY temp_id
<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=")">
#{id}
</foreach>
</select>
<select id="findName" resultType="String">
......
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