Commit 7ce1d5eb by 吴迪

【新增】首页接口提交

parent ada5b913
package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.DocEntity;
import io.office.modules.manage.vo.request.TopicNewsPartyRequestVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.office.modules.manage.service.DocService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-11-14 14:32:42
*/
@Slf4j
@RestController
@RequestMapping("/doc")
public class DocController {
@Autowired
private DocService docService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("manage:doc:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = docService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
// @RequiresPermissions("manage:doc:info")
public R info(@PathVariable("id") Integer id){
DocEntity doc = docService.getById(id);
return R.ok().put("doc", doc);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("manage:doc:save")
public R save(@RequestBody DocEntity doc){
docService.save(doc);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("manage:doc:update")
public R update(@RequestBody DocEntity doc){
docService.updateById(doc);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("manage:doc:delete")
public R delete(@RequestBody Integer[] ids){
docService.removeByIds(Arrays.asList(ids));
return R.ok();
}
@Login
@PostMapping("/api/downLoad")
// @RequiresPermissions("generator:indexcarouselmanage:pictureImageList")
public R downLoad() {
try {
QueryWrapper<DocEntity> docEntityQueryWrapper = new QueryWrapper<>();
docEntityQueryWrapper.select("top 4 *");
docEntityQueryWrapper.eq("category","1");
docEntityQueryWrapper.eq("status","1");
docEntityQueryWrapper.orderByDesc("id");
return R.ok().put("data",docService.list(docEntityQueryWrapper));
} catch (Exception e) {
log.error("get4PartyTopNews error: {}", e);
return R.error(e.getMessage());
}
}
}
...@@ -3,17 +3,17 @@ package io.office.modules.manage.controller; ...@@ -3,17 +3,17 @@ package io.office.modules.manage.controller;
import java.util.Arrays; import java.util.Arrays;
import java.util.Map; import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.utils.PageUtils; import io.office.common.utils.PageUtils;
import io.office.common.utils.R; import io.office.common.utils.R;
import io.office.modules.manage.entity.NewsEntity; import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.PictureEntity; import io.office.modules.manage.entity.PictureEntity;
import io.office.modules.manage.entity.PolicyEntity; import io.office.modules.manage.entity.PolicyEntity;
import io.office.modules.manage.entity.dto.PolicyParams; import io.office.modules.manage.entity.dto.PolicyParams;
import io.office.modules.manage.service.PolicyService; import io.office.modules.manage.service.PolicyService;
import io.office.modules.sys.controller.AbstractController; import io.office.modules.sys.controller.AbstractController;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -115,4 +115,26 @@ public class PolicyController extends AbstractController { ...@@ -115,4 +115,26 @@ public class PolicyController extends AbstractController {
} }
} }
@Login
@PostMapping("/api/getTop4")
// @RequiresPermissions("generator:indexcarouselmanage:pictureImageList")
public R getTop4() {
try {
QueryWrapper<PolicyEntity> policyEntityQueryWrapper = new QueryWrapper<>();
policyEntityQueryWrapper.select("top 4 *");
policyEntityQueryWrapper.eq("class","法律法规");
policyEntityQueryWrapper.gt("levels","0");
policyEntityQueryWrapper.gt("status ","0");
policyEntityQueryWrapper.orderByDesc("id");
policyEntityQueryWrapper.orderByDesc("releasedate ");
return R.ok().put("data",policyService.list(policyEntityQueryWrapper));
} catch (Exception e) {
log.error("get4PartyTopNews error: {}", e);
return R.error(e.getMessage());
}
}
} }
package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.office.common.utils.IPUtils;
import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.PolicyEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.office.modules.manage.entity.SearchgtinlogEntity;
import io.office.modules.manage.service.SearchgtinlogService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import javax.servlet.http.HttpServletRequest;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-11-14 15:05:03
*/
@RestController
@RequestMapping("/searchgtinlog/api")
public class SearchgtinlogController {
@Autowired
private SearchgtinlogService searchgtinlogService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("manage:searchgtinlog:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = searchgtinlogService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
// @RequiresPermissions("manage:searchgtinlog:info")
public R info(@PathVariable("id") Integer id){
SearchgtinlogEntity searchgtinlog = searchgtinlogService.getById(id);
return R.ok().put("searchgtinlog", searchgtinlog);
}
/**
* 保存
*/
@Login
@RequestMapping("/save")
// @RequiresPermissions("manage:searchgtinlog:save")
public R save(@RequestBody SearchgtinlogEntity searchgtinlog, HttpServletRequest request){
String ipAddr = IPUtils.getIpAddr(request);
searchgtinlog.setIp(ipAddr);
searchgtinlog.setCreatedate(new Date());
searchgtinlogService.save(searchgtinlog);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("manage:searchgtinlog:update")
public R update(@RequestBody SearchgtinlogEntity searchgtinlog){
searchgtinlogService.updateById(searchgtinlog);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("manage:searchgtinlog:delete")
public R delete(@RequestBody Integer[] ids){
searchgtinlogService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}
package io.office.modules.manage.dao;
import io.office.modules.manage.entity.DocEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-11-14 14:32:42
*/
@Mapper
public interface DocDao extends BaseMapper<DocEntity> {
}
package io.office.modules.manage.dao;
import io.office.modules.manage.entity.SearchgtinlogEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-11-14 15:05:03
*/
@Mapper
public interface SearchgtinlogDao extends BaseMapper<SearchgtinlogEntity> {
}
package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-11-14 14:32:42
*/
@Data
@TableName("doc")
public class DocEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
@TableId
private Integer id;
/**
* $column.comments
*/
private String title;
/**
* $column.comments
*/
private String author;
/**
* $column.comments
*/
private Integer levels;
/**
* $column.comments
*/
private Integer category;
/**
* $column.comments
*/
private String docfile;
/**
* $column.comments
*/
private String stand;
/**
* 0等待审核;1审核成功;2审核失败
*/
private Integer status;
/**
* $column.comments
*/
private String auditor;
}
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 java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-11-14 15:05:03
*/
@Data
@TableName("SearchGTINLog")
public class SearchgtinlogEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
@TableId
private Integer id;
/**
* $column.comments
*/
private String keyword;
/**
* $column.comments
*/
@TableField("class")
private String classStr;
/**
* $column.comments
*/
private String ip;
/**
* $column.comments
*/
private Date createdate;
/**
* $column.comments
*/
private Integer searchsource;
}
package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils;
import io.office.modules.manage.entity.DocEntity;
import java.util.Map;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-11-14 14:32:42
*/
public interface DocService extends IService<DocEntity> {
PageUtils queryPage(Map<String, Object> params);
}
package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils;
import io.office.modules.manage.entity.SearchgtinlogEntity;
import java.util.Map;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-11-14 15:05:03
*/
public interface SearchgtinlogService extends IService<SearchgtinlogEntity> {
PageUtils queryPage(Map<String, Object> params);
}
package io.office.modules.manage.service.impl;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.modules.manage.dao.DocDao;
import io.office.modules.manage.entity.DocEntity;
import io.office.modules.manage.service.DocService;
@Service("docService")
public class DocServiceImpl extends ServiceImpl<DocDao, DocEntity> implements DocService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<DocEntity> page = this.page(
new Query<DocEntity>().getPage(params),
new QueryWrapper<DocEntity>()
);
return new PageUtils(page);
}
}
\ No newline at end of file
package io.office.modules.manage.service.impl;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.modules.manage.dao.SearchgtinlogDao;
import io.office.modules.manage.entity.SearchgtinlogEntity;
import io.office.modules.manage.service.SearchgtinlogService;
@Service("searchgtinlogService")
public class SearchgtinlogServiceImpl extends ServiceImpl<SearchgtinlogDao, SearchgtinlogEntity> implements SearchgtinlogService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<SearchgtinlogEntity> page = this.page(
new Query<SearchgtinlogEntity>().getPage(params),
new QueryWrapper<SearchgtinlogEntity>()
);
return new PageUtils(page);
}
}
\ No newline at end of file
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