新增删除规则功能

master
星期八 6 years ago
parent 3c982465db
commit f37f7973e1
  1. 4
      src/main/java/com/lq/cms/service/WechatRuleService.java
  2. 14
      src/main/java/com/lq/cms/service/impl/WechatRuleServiceImpl.java
  3. 8
      src/main/java/com/lq/cms/web/wechat/WechatRuleController.java
  4. 10
      src/main/webapp/WEB-INF/views/jsp/cms/wechat/rule/index.jsp

@ -42,4 +42,8 @@ public interface WechatRuleService extends BaseService<WechatRule> {
* 通过规则ID查找规则详情
*/
WechatRuleVo getWechatRuleVoById(Long wechatRuleId);
/**
* 通过规则ID删除规则
*/
void deleteWechatRuleById(Long id);
}

@ -110,6 +110,20 @@ public class WechatRuleServiceImpl extends BaseServiceImpl<WechatRule> implement
return wechatRuleVo;
}
@Transactional(rollbackFor = Exception.class)
@Override
public void deleteWechatRuleById(Long id) {
WechatRule wechatRule = wechatRuleDao.findOne(id);
if (wechatRule!=null){
List<WechatKeyword> wechatKeywordList = wechatKeywordDao.findByWechatRuleIdAndStatus(id,StatusTypeEnum.STATUS_ACTIVITY_YES.getValue());
wechatKeywordList.forEach(wechatKeyword -> {
wechatKeywordDao.delete(wechatKeyword.getId());
});
wechatRuleDao.delete(id);
}
}
@Override
public BaseDao<WechatRule> getBaseDao() {
return wechatRuleDao;

@ -69,6 +69,14 @@ public class WechatRuleController {
return ajaxResult;
}
@ResponseBody
@RequestMapping("/delete")
public AjaxResult delete(Long id){
AjaxResult ajaxResult = new AjaxResult();
wechatRuleService.deleteWechatRuleById(id);
return ajaxResult;
}
@ResponseBody
@RequestMapping("/getWechatRuleById")
public Object getWechatRuleById(Long wechatRuleId){

@ -609,10 +609,9 @@
function delRule(ruleId){
var data = new Object();
data.id = ruleId;
$.ajax({
type:"post",
url:"${ctx}/admin/wechat/delWechatRule.htm",
url:"${ctx}/cms/wechat/rule/delete.htm",
traditional:true,
data:data,
dataType:"json",
@ -647,13 +646,16 @@
}else{
isShow = 'classhide';
}
var updateStr = '';
if (wechatMessage.updateTime!=null||wechatMessage.updateTime!=""||wechatMessage.updateTime!=undefined){
updateStr = wechatMessage.updateTime.substring(0,10);
}
html += ' <div class="message-row" onclick="onMessaegRow(this)">';
html += '<input type="hidden" value="'+wechatMessage.id+'" />';
html +='<div class="message-title">'+wechatMessage.title+'</div>';
html +='<img class="message-image" src="${ctx}/loadFile/'+wechatMessage.imageUrl+'" width="50" height="60">';
html +='<div class="message-content">'+content +'</div>';
html +='<div class="message-createTime">更新于 '+wechatMessage.updateTime+' </div>';
html +='<div class="message-createTime">更新于 '+updateStr+' </div>';
html +='<div class="chekc-Div '+isShow+'" > <img class ="check-image" src="${ctx}/resources/cms/wechat/rule/image/u710.png"></div>';
html += '</div>';
}

Loading…
Cancel
Save