提交 bdb5efab 编写于 作者: Skyeye云's avatar Skyeye云

样式属性添加删除限制

上级 5b6c2dbf
......@@ -22,4 +22,6 @@ public interface RmPropertyDao {
public List<Map<String, Object>> queryRmPropertyListToShow(Map<String, Object> map) throws Exception;
public Map<String, Object> queryRmPropertyValueNumById(Map<String, Object> map) throws Exception;
}
......@@ -77,7 +77,17 @@ public class RmPropertyServiceImpl implements RmPropertyService{
@Override
public void deleteRmPropertyMationById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
rmPropertyDao.deleteRmPropertyMationById(map);
Map<String, Object> bean = rmPropertyDao.queryRmPropertyValueNumById(map);
if(bean == null){
rmPropertyDao.deleteRmPropertyMationById(map);
}else{
if(Integer.parseInt(bean.get("propertyValueNum").toString()) == 0){//该样式属性下有值
rmPropertyDao.deleteRmPropertyMationById(map);
}else{
outputObject.setreturnMessage("该样式属性下存在值,无法删除。");
}
}
}
/**
......
......@@ -13,6 +13,7 @@
a.js_content jsContent,
a.js_rely_on jsRelyOn,
a.property_unit propertyUnit,
(SELECT COUNT(*) FROM rm_property_value c WHERE c.property_id = a.id) propertyValueNum,
CONVERT(a.create_time, char) createTime
FROM
rm_property a
......@@ -48,6 +49,14 @@
(#{id}, #{title}, #{propertyTag}, #{propertyOut}, #{propertyUnit}, #{dsFormContentId}, #{htmlContent}, #{jsContent}, #{jsRelyOn}, #{createId}, #{createTime})
</insert>
<select id="queryRmPropertyValueNumById" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
COUNT(*) propertyValueNum
FROM
rm_property_value a
WHERE a.property_id = #{id}
</select>
<delete id="deleteRmPropertyMationById" parameterType="java.util.Map">
DELETE
FROM
......
......@@ -30,6 +30,7 @@ layui.config({
{ field: 'propertyUnit', title: '属性单位', width: 180 },
{ field: 'propertyOut', title: '外部属性', width: 150 },
{ field: 'contentName', title: '展现形式', width: 180 },
{ field: 'propertyValueNum', title: '属性值数量', width: 150 },
{ field: 'id', title: 'HTML内容', width: 180, templet: function(d){
if(!isNull(d.htmlContent)){
return '<i class="fa fa-fw fa-html5 cursor" lay-event="htmlContent"></i>';
......
......@@ -52,7 +52,9 @@
<table id="messageTable" lay-filter="messageTable"></table>
<script type="text/html" id="tableBar">
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
{{# if(d.propertyValueNum == 0){ }}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
{{# } }}
</script>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册