Commit df7baf31 by wangqi

管理区手册模板

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