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

小程序属性标签删除条件修改

上级 0695b4b2
......@@ -24,4 +24,6 @@ public interface RmPropertyDao {
public Map<String, Object> queryRmPropertyValueNumById(Map<String, Object> map) throws Exception;
public Map<String, Object> queryUseRmPropertyNumById(Map<String, Object> map) throws Exception;
}
......@@ -79,10 +79,28 @@ public class RmPropertyServiceImpl implements RmPropertyService{
Map<String, Object> map = inputObject.getParams();
Map<String, Object> bean = rmPropertyDao.queryRmPropertyValueNumById(map);
if(bean == null){
rmPropertyDao.deleteRmPropertyMationById(map);
}else{
if(Integer.parseInt(bean.get("propertyValueNum").toString()) == 0){//该样式属性下有值
Map<String, Object> useThisBean = rmPropertyDao.queryUseRmPropertyNumById(map);
if(useThisBean == null){
rmPropertyDao.deleteRmPropertyMationById(map);
}else{
if(Integer.parseInt(useThisBean.get("usePropertyNum").toString()) == 0){//该样式属性没有被使用
rmPropertyDao.deleteRmPropertyMationById(map);
}else{
outputObject.setreturnMessage("该样式属性正在使用中,无法删除。");
}
}
}else{
if(Integer.parseInt(bean.get("propertyValueNum").toString()) == 0){//该样式属性下没有值
Map<String, Object> useThisBean = rmPropertyDao.queryUseRmPropertyNumById(map);
if(useThisBean == null){
rmPropertyDao.deleteRmPropertyMationById(map);
}else{
if(Integer.parseInt(useThisBean.get("usePropertyNum").toString()) == 0){//该样式属性没有被使用
rmPropertyDao.deleteRmPropertyMationById(map);
}else{
outputObject.setreturnMessage("该样式属性正在使用中,无法删除。");
}
}
}else{
outputObject.setreturnMessage("该样式属性下存在值,无法删除。");
}
......
......@@ -14,6 +14,7 @@
a.js_rely_on jsRelyOn,
a.property_unit propertyUnit,
(SELECT COUNT(*) FROM rm_property_value c WHERE c.property_id = a.id) propertyValueNum,
(SELECT COUNT(*) FROM rm_group_member_property d WHERE d.property_id = a.id) useNum,
CONVERT(a.create_time, char) createTime
FROM
rm_property a
......@@ -57,6 +58,14 @@
WHERE a.property_id = #{id}
</select>
<select id="queryUseRmPropertyNumById" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
COUNT(*) usePropertyNum
FROM
rm_group_member_property a
WHERE a.property_id = #{id}
</select>
<delete id="deleteRmPropertyMationById" parameterType="java.util.Map">
DELETE
FROM
......
......@@ -31,6 +31,7 @@ layui.config({
{ field: 'propertyOut', title: '外部属性', width: 150 },
{ field: 'contentName', title: '展现形式', width: 180 },
{ field: 'propertyValueNum', title: '属性值数量', width: 150 },
{ field: 'useNum', 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,7 @@
<table id="messageTable" lay-filter="messageTable"></table>
<script type="text/html" id="tableBar">
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
{{# if(d.propertyValueNum == 0){ }}
{{# if(d.propertyValueNum == 0 && d.useNum == 0){ }}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
{{# } }}
</script>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册