清空数据表(实则更改状态)

业务需求:
     1.“删除 ”app用户下的文章  补:“删除”为伪删除,即更新文章状态,状态更新后再次调用文章查询接口显示为空
  1. 输入:accessId,appObjectId,这两天参数用来定位到具体的文章数据行
  2. 后台数据清除成功后,页面提示操作成功
  3. 设计到的类和表名如下:
              类:
    • com.contx.cssp.console.article.controller.ContentOperationController
    • com.contx.cssp.console.article.service.ContentOperationService
    • com.contx.cssp.console.article.dao.ContentOperationDao 
                     表:
    • cms.cms_app_content
                    页面:
    • article/appArticleManager/FeedOperation.html
页面:
//对文章数据进行清空
    $("#clearContentBtn").click(function(){
        var appObjectId=$('#appObjectId').val();
        var accessId=$('#accessId').val();
        framework.confirm("确定清空内容?",function() {
            clearContent(accessId,appObjectId)
        },function(){
            return;
        });
    });

    function clearContent(accessId,appObjectId){
        var url = "/content/operation/clearContent";
        $.rest("get",
                url,
                {accessId: accessId, appObjectId: appObjectId},
                {},
                function (data) {
                    if (data) {
                        framework.hint("操作成功");
                        search();
                    } else {
                        framework.hint("操作失败");
                    }
                }, function () {
                });
    }


控制层:
com.contx.cssp.console.article.controller.ContentOperationController     
     /**
     * 清空文章内容
     * @param accessId 频道ID
     * @param appObjectIdappID
     */
    @RequestMapping(value = "/clearContent", method = RequestMethod.GET)
    @ResponseBody
    public boolean clearContentOperation(String accessId, String appObjectId) {
        logger.info("accessId:" + accessId, "appObjectId:" + appObjectId);
        return contentOperationService.clearContentOperation(accessId, appObjectId);
    }
业务层:
com.contx.cssp.console.article.service.ContentOperationService  
     /**
     * 清空文章内容操作
     * @param accessId
     * @param appObjectId
     */
    public boolean clearContentOperation(String accessId ,String appObjectId){
        try {
            contentOperationDao.updatateContentOperationIsdownloadStatus(accessId, appObjectId);
        } catch (Exception e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
             logger.info("数据清除失败!");
             return false;
        }
        return true;
    }
数据层:
    com.contx.cssp.console.article.dao.ContentOperationDao 
    @Transactional
    @Modifying
    @Query(nativeQuery=true,value="update cms.cms_app_content o set o.is_download=2 where o.is_download = 1 and                                      o.access_id =? and o.app_object_id = ?")
    public void updatateContentOperationIsdownloadStatus(String accessId ,String appObjectId);
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值