Bladeren bron

文章批量删除

XMTT 7 jaren geleden
bovenliggende
commit
c0aca6a1d3

+ 3 - 1
src/main/java/com/ekexiu/console/system/dao/ArticleDao.java

3
import com.ekexiu.console.system.po.Article;
3
import com.ekexiu.console.system.po.Article;
4
import com.ekexiu.console.system.pojo.ArticleInfo;
4
import com.ekexiu.console.system.pojo.ArticleInfo;
5
import org.jfw.apt.annotation.Nullable;
5
import org.jfw.apt.annotation.Nullable;
6
import org.jfw.apt.orm.annotation.dao.Batch;
6
import org.jfw.apt.orm.annotation.dao.Column;
7
import org.jfw.apt.orm.annotation.dao.Column;
7
import org.jfw.apt.orm.annotation.dao.DAO;
8
import org.jfw.apt.orm.annotation.dao.DAO;
8
import org.jfw.apt.orm.annotation.dao.method.From;
9
import org.jfw.apt.orm.annotation.dao.method.From;
40
    @Where("status='1'")
41
    @Where("status='1'")
41
    PageQueryResult<ArticleInfo> queryByPV(Connection con, @Nullable @Like String articleTitle, @SqlColumn(value = {"(p.name is null or p.name like ?)", "(o.name is null or o.name like ?)"}, handlerClass = StringHandler.class) String name, @Nullable @GtEq @Alias("publishTime") String bt, @Nullable @Alias("publishTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
42
    PageQueryResult<ArticleInfo> queryByPV(Connection con, @Nullable @Like String articleTitle, @SqlColumn(value = {"(p.name is null or p.name like ?)", "(o.name is null or o.name like ?)"}, handlerClass = StringHandler.class) String name, @Nullable @GtEq @Alias("publishTime") String bt, @Nullable @Alias("publishTime") @LtEq String et, int pageSize, int pageNo) throws SQLException;
42
43
44
    @Batch
43
    @UpdateWith
45
    @UpdateWith
44
    @From(Article.class)
46
    @From(Article.class)
45
    int updateStatus(Connection con,String articleId,@Set String status) throws SQLException;
47
    int[] updateStatus(Connection con,@Batch String[] articleId,@Set String status) throws SQLException;
46
}
48
}

+ 2 - 2
src/main/java/com/ekexiu/console/system/service/ArticleService.java

44
44
45
    @Post
45
    @Post
46
    @Path("/deleteArticle")
46
    @Path("/deleteArticle")
47
    public void deleteArticle(@JdbcConn(true) Connection con,String articleId) throws SQLException{
47
    public void deleteArticle(@JdbcConn(true) Connection con,String[] articleIds) throws SQLException{
48
        //修改文章状态为删除
48
        //修改文章状态为删除
49
        this.articleDao.updateStatus(con, articleId, "3");
49
        this.articleDao.updateStatus(con, articleIds, "3");
50
    }
50
    }
51
}
51
}