Commit df7baf31 by wangqi

管理区手册模板

parent 87aad036
...@@ -130,9 +130,9 @@ public class SysMenuController extends BaseController ...@@ -130,9 +130,9 @@ public class SysMenuController extends BaseController
public AjaxResult remove(@PathVariable("menuId") Long menuId) public AjaxResult remove(@PathVariable("menuId") Long menuId)
{ {
if (menuService.hasChildByMenuId(menuId)) if (menuService.hasChildByMenuId(menuId))
{ {
return warn("存在子菜单,不允许删除"); return warn("存在子菜单,不允许删除");
} }
if (menuService.checkMenuExistRole(menuId)) if (menuService.checkMenuExistRole(menuId))
{ {
return warn("菜单已分配,不允许删除"); return warn("菜单已分配,不允许删除");
......
...@@ -274,11 +274,11 @@ public class SysMenuServiceImpl implements ISysMenuService ...@@ -274,11 +274,11 @@ public class SysMenuServiceImpl implements ISysMenuService
* @return 结果 * @return 结果
*/ */
@Override @Override
public boolean hasChildByMenuId(Long menuId) public boolean hasChildByMenuId(Long menuId)
{ {
int result = menuMapper.hasChildByMenuId(menuId); int result = menuMapper.hasChildByMenuId(menuId);
return result > 0; return result > 0;
} }
/** /**
* 查询菜单使用数量 * 查询菜单使用数量
......
...@@ -96,9 +96,13 @@ public class BzscCyglqglscMbcbController extends BaseController ...@@ -96,9 +96,13 @@ public class BzscCyglqglscMbcbController extends BaseController
* 删除标准手册-采油管理区管理手册-模板从 * 删除标准手册-采油管理区管理手册-模板从
*/ */
@Log(title = "标准手册-采油管理区管理手册-模板从", businessType = BusinessType.DELETE) @Log(title = "标准手册-采油管理区管理手册-模板从", businessType = BusinessType.DELETE)
@DeleteMapping("/{IDs}") @DeleteMapping("/{ID}")
public AjaxResult remove(@PathVariable Long[] IDs) public AjaxResult remove(@PathVariable Long ID)
{ {
return toAjax(bzscCyglqglscMbcbService.deleteBzscCyglqglscMbcbByIDs(IDs)); if (bzscCyglqglscMbcbService.hasChildByID(ID))
{
return warn("存在子内容,不允许删除");
}
return toAjax(bzscCyglqglscMbcbService.deleteBzscCyglqglscMbcbByID(ID));
} }
} }
...@@ -2,6 +2,9 @@ package com.qianhe.bzsc.controller; ...@@ -2,6 +2,9 @@ package com.qianhe.bzsc.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.qianhe.bzsc.domain.BzscCyglqglscMbcb;
import com.qianhe.bzsc.service.IBzscCyglqglscMbcbService;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -86,13 +89,20 @@ public class BzscCyglqglscMbzbController extends BaseController ...@@ -86,13 +89,20 @@ public class BzscCyglqglscMbzbController extends BaseController
return toAjax(bzscCyglqglscMbzbService.updateBzscCyglqglscMbzb(bzscCyglqglscMbzb)); return toAjax(bzscCyglqglscMbzbService.updateBzscCyglqglscMbzb(bzscCyglqglscMbzb));
} }
@Autowired
private IBzscCyglqglscMbcbService bzscCyglqglscMbcbService;
/** /**
* 删除标准手册-采油管理区管理手册-模板主 * 删除标准手册-采油管理区管理手册-模板主
*/ */
@Log(title = "标准手册-采油管理区管理手册-模板主", businessType = BusinessType.DELETE) @Log(title = "标准手册-采油管理区管理手册-模板主", businessType = BusinessType.DELETE)
@DeleteMapping("/{IDs}") @DeleteMapping("/{ID}")
public AjaxResult remove(@PathVariable Long[] IDs) public AjaxResult remove(@PathVariable Long ID)
{ {
return toAjax(bzscCyglqglscMbzbService.deleteBzscCyglqglscMbzbByIDs(IDs)); List<BzscCyglqglscMbcb> list = bzscCyglqglscMbcbService.selectBzscCyglqglscMbcbList_ByZbid(ID);
if (list.size()>0)
{
return warn("存在明细内容,不允许删除");
}
return toAjax(bzscCyglqglscMbzbService.deleteBzscCyglqglscMbzbByID(ID));
} }
} }
...@@ -24,14 +24,6 @@ public class BzscCyglqglscMbcb extends BaseEntity ...@@ -24,14 +24,6 @@ public class BzscCyglqglscMbcb extends BaseEntity
@Excel(name = "主表id") @Excel(name = "主表id")
private Long zbId; private Long zbId;
/** 单位id */
@Excel(name = "单位id")
private Long deptId;
/** 年度 */
@Excel(name = "年度")
private String nd;
/** 上级id */ /** 上级id */
@Excel(name = "上级id") @Excel(name = "上级id")
private Long parentId; private Long parentId;
...@@ -90,24 +82,8 @@ public class BzscCyglqglscMbcb extends BaseEntity ...@@ -90,24 +82,8 @@ public class BzscCyglqglscMbcb extends BaseEntity
{ {
return zbId; return zbId;
} }
public void setDeptId(Long deptId)
{
this.deptId = deptId;
}
public Long getDeptId()
{
return deptId;
}
public void setNd(String nd)
{
this.nd = nd;
}
public String getNd()
{
return nd;
}
public void setParentId(Long parentId) public void setParentId(Long parentId)
{ {
this.parentId = parentId; this.parentId = parentId;
...@@ -204,8 +180,7 @@ public class BzscCyglqglscMbcb extends BaseEntity ...@@ -204,8 +180,7 @@ public class BzscCyglqglscMbcb extends BaseEntity
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("ID", getID()) .append("ID", getID())
.append("zbId", getZbId()) .append("zbId", getZbId())
.append("deptId", getDeptId())
.append("nd", getNd())
.append("parentId", getParentId()) .append("parentId", getParentId())
.append("mc", getMc()) .append("mc", getMc())
.append("ms", getMs()) .append("ms", getMs())
......
...@@ -60,4 +60,6 @@ public interface BzscCyglqglscMbcbMapper ...@@ -60,4 +60,6 @@ public interface BzscCyglqglscMbcbMapper
public int deleteBzscCyglqglscMbcbByIDs(Long[] IDs); public int deleteBzscCyglqglscMbcbByIDs(Long[] IDs);
public List<BzscCyglqglscMbcb> selectBzscCyglqglscMbcbList_ByZbid(Long zbId); public List<BzscCyglqglscMbcb> selectBzscCyglqglscMbcbList_ByZbid(Long zbId);
public int hasChildByID(Long ID);
} }
...@@ -60,4 +60,6 @@ public interface IBzscCyglqglscMbcbService ...@@ -60,4 +60,6 @@ public interface IBzscCyglqglscMbcbService
public int deleteBzscCyglqglscMbcbByID(Long ID); public int deleteBzscCyglqglscMbcbByID(Long ID);
public List<BzscCyglqglscMbcb> selectBzscCyglqglscMbcbList_ByZbid(Long zbId); public List<BzscCyglqglscMbcb> selectBzscCyglqglscMbcbList_ByZbid(Long zbId);
public boolean hasChildByID(Long menuId);
} }
...@@ -169,4 +169,11 @@ public class BzscCyglqglscMbcbServiceImpl implements IBzscCyglqglscMbcbService ...@@ -169,4 +169,11 @@ public class BzscCyglqglscMbcbServiceImpl implements IBzscCyglqglscMbcbService
{ {
return getChildList(list, t).size() > 0; return getChildList(list, t).size() > 0;
} }
@Override
public boolean hasChildByID(Long ID)
{
int result = bzscCyglqglscMbcbMapper.hasChildByID(ID);
return result > 0;
}
} }
...@@ -7,8 +7,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -7,8 +7,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="BzscCyglqglscMbcb" id="BzscCyglqglscMbcbResult"> <resultMap type="BzscCyglqglscMbcb" id="BzscCyglqglscMbcbResult">
<result property="ID" column="ID" /> <result property="ID" column="ID" />
<result property="zbId" column="zb_id" /> <result property="zbId" column="zb_id" />
<result property="deptId" column="dept_id" />
<result property="nd" column="nd" />
<result property="parentId" column="parent_id" /> <result property="parentId" column="parent_id" />
<result property="mc" column="mc" /> <result property="mc" column="mc" />
<result property="ms" column="ms" /> <result property="ms" column="ms" />
...@@ -27,15 +25,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -27,15 +25,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectBzscCyglqglscMbcbVo"> <sql id="selectBzscCyglqglscMbcbVo">
select ID, zb_id, dept_id, nd, parent_id, mc, ms, nr, px, create_by, create_time, update_by, update_time, remark, yl1, yl2, yl3, yl4, yl5 from bzsc_cyglqglsc_mbcb select ID, zb_id, parent_id, mc, ms, nr, px, create_by, create_time, update_by, update_time, remark, yl1, yl2, yl3, yl4, yl5 from bzsc_cyglqglsc_mbcb
</sql> </sql>
<select id="selectBzscCyglqglscMbcbList" parameterType="BzscCyglqglscMbcb" resultMap="BzscCyglqglscMbcbResult"> <select id="selectBzscCyglqglscMbcbList" parameterType="BzscCyglqglscMbcb" resultMap="BzscCyglqglscMbcbResult">
<include refid="selectBzscCyglqglscMbcbVo"/> <include refid="selectBzscCyglqglscMbcbVo"/>
<where> <where>
<if test="zbId != null "> and zb_id = #{zbId}</if> <if test="zbId != null "> and zb_id = #{zbId}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="nd != null and nd != ''"> and nd = #{nd}</if>
<if test="parentId != null "> and parent_id = #{parentId}</if> <if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="mc != null and mc != ''"> and mc = #{mc}</if> <if test="mc != null and mc != ''"> and mc = #{mc}</if>
<if test="ms != null and ms != ''"> and ms = #{ms}</if> <if test="ms != null and ms != ''"> and ms = #{ms}</if>
...@@ -66,8 +63,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -66,8 +63,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into bzsc_cyglqglsc_mbcb insert into bzsc_cyglqglsc_mbcb
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="zbId != null">zb_id,</if> <if test="zbId != null">zb_id,</if>
<if test="deptId != null">dept_id,</if>
<if test="nd != null">nd,</if>
<if test="parentId != null">parent_id,</if> <if test="parentId != null">parent_id,</if>
<if test="mc != null">mc,</if> <if test="mc != null">mc,</if>
<if test="ms != null">ms,</if> <if test="ms != null">ms,</if>
...@@ -86,8 +81,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -86,8 +81,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="zbId != null">#{zbId},</if> <if test="zbId != null">#{zbId},</if>
<if test="deptId != null">#{deptId},</if>
<if test="nd != null">#{nd},</if>
<if test="parentId != null">#{parentId},</if> <if test="parentId != null">#{parentId},</if>
<if test="mc != null">#{mc},</if> <if test="mc != null">#{mc},</if>
<if test="ms != null">#{ms},</if> <if test="ms != null">#{ms},</if>
...@@ -110,8 +103,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -110,8 +103,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update bzsc_cyglqglsc_mbcb update bzsc_cyglqglsc_mbcb
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="zbId != null">zb_id = #{zbId},</if> <if test="zbId != null">zb_id = #{zbId},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="nd != null">nd = #{nd},</if>
<if test="parentId != null">parent_id = #{parentId},</if> <if test="parentId != null">parent_id = #{parentId},</if>
<if test="mc != null">mc = #{mc},</if> <if test="mc != null">mc = #{mc},</if>
<if test="ms != null">ms = #{ms},</if> <if test="ms != null">ms = #{ms},</if>
...@@ -141,4 +132,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -141,4 +132,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{ID} #{ID}
</foreach> </foreach>
</delete> </delete>
<select id="hasChildByID" resultType="Integer">
select count(1) from bzsc_cyglqglsc_mbcb where parent_id = #{ID}
</select>
</mapper> </mapper>
\ No newline at end of file
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