Commit 36a449a1 by 吴迪

编辑字段 最后编辑字段 修改提交

parent 22bca504
......@@ -14,11 +14,15 @@ import io.office.common.validator.group.UpdateGroup;
import io.office.modules.manage.dao.WebsiteHitCountDetailDao;
import io.office.modules.manage.entity.HomePopupEntity;
import io.office.modules.manage.entity.ImportEntity;
import io.office.modules.manage.entity.TokenCount;
import io.office.modules.manage.form.HomePopupForm;
import io.office.modules.manage.service.HomePopupService;
import io.office.modules.manage.service.TokenCountService;
import io.office.modules.sys.controller.AbstractController;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -128,11 +132,42 @@ public class HomePopupController extends AbstractController {
}
@Autowired
private TokenCountService tokenCountService;
@Value("${token.count}")
private int tokenCountConfig;
@RequestMapping("/api/getHomePopup/{id}/{token}")
public R getHomePopup(@PathVariable("id") Long id,@PathVariable("token") String token) {
if (StringUtils.isNotBlank(token)) {
QueryWrapper<TokenCount> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("token", token);
TokenCount tokenCount = tokenCountService.getOne(queryWrapper);
if (tokenCount == null) {
return R.error("非法请求,请获取正确的预览链接!");
}
if (tokenCount.getCountFlag() > tokenCountConfig) {
//删除无用token
return R.error("预览链接次数已达上限,请联系相关人员重新获取预览链接!");
}
tokenCount.setCountFlag(tokenCount.getCountFlag() + 1);
tokenCountService.updateById(tokenCount);
}
// 使用 Wrapper 来定义查询条件
QueryWrapper<HomePopupEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", id);
HomePopupEntity homePopup = homePopupService.getOne(queryWrapper);
return R.ok().put("data", homePopup);
}
@RequestMapping("/api/getHomePopup")
public R getHomePopup() {
// 使用 Wrapper 来定义查询条件
QueryWrapper<HomePopupEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status", 1);
HomePopupEntity homePopup = homePopupService.getOne(queryWrapper);
return R.ok().put("data", homePopup);
}
......
package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
......@@ -67,4 +68,9 @@ public class HomePopupEntity implements Serializable {
private String checkTime;
@TableField(value = "levels")
private Integer levels;
private String keyWord;
}
package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import lombok.Data;
/**
* ${comments}
......@@ -44,4 +45,7 @@ public class KnowledgecategoryEntity implements Serializable {
*/
private String isshow;
@TableField(value="orderNum")
private Integer orderNum;
}
......@@ -32,11 +32,16 @@ public class HomePopupServiceImpl extends ServiceImpl<HomePopupDao, HomePopupEnt
@Override
public PageUtils queryPage(Map<String, Object> params) {
System.out.println(params.get("levels")!=null&&StringUtils.isNotBlank(params.get("levels").toString()));
IPage<HomePopupEntity> page = this.page(
new Query<HomePopupEntity>().getPage(params),
new QueryWrapper<HomePopupEntity>()
.like(StringUtils.isNotBlank(params.get("title")!=null?params.get("title").toString():""),"title", params.get("title").toString())
.like(StringUtils.isNotBlank(params.get("content")!=null?params.get("content").toString():""),"content", params.get("content").toString())
.like(StringUtils.isNotBlank(params.get("keyWord")!=null?params.get("keyWord").toString():""),"key_word", params.get("keyWord").toString())
.ne(params.get("levels")==null||StringUtils.isBlank(params.get("levels").toString()),"levels", 0)
.eq(params.get("levels")!=null&&StringUtils.isNotBlank(params.get("levels").toString()),"levels", params.get("levels"))
.eq(params.get("status")!=null&&StringUtils.isNotBlank(params.get("status").toString()),"status", params.get("status"))
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment