package com.controller;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;
import com.entity.LiulangmaogouEntity;
import com.entity.view.LiulangmaogouView;
import com.service.LiulangmaogouService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
import java.io.IOException;
import com.service.StoreupService;
import com.entity.StoreupEntity;
/**
* 流浪猫狗
* 后端接口
* @author
* @email
* @date 2023-05-04 23:10:31
*/
@RestController
@RequestMapping("/liulangmaogou")
public class LiulangmaogouController {
@Autowired
private LiulangmaogouService liulangmaogouService;
@Autowired
private StoreupService storeupService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,LiulangmaogouEntity liulangmaogou,
HttpServletRequest request){
EntityWrapper<LiulangmaogouEntity> ew = new EntityWrapper<LiulangmaogouEntity>();
PageUtils page = liulangmaogouService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, liulangmaogou), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,LiulangmaogouEntity liulangmaogou,
HttpServletRequest request){
EntityWrapper<LiulangmaogouEntity> ew = new EntityWrapper<LiulangmaogouEntity>();
PageUtils page = liulangmaogouService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, liulangmaogou), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( LiulangmaogouEntity liulangmaogou){
EntityWrapper<LiulangmaogouEntity> ew = new EntityWrapper<LiulangmaogouEntity>();
ew.allEq(MPUtil.allEQMapPre( liulangmaogou, "liulangmaogou"));
return R.ok().put("data", liulangmaogouService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(LiulangmaogouEntity liulangmaogou){
EntityWrapper< LiulangmaogouEntity> ew = new EntityWrapper< LiulangmaogouEntity>();
ew.allEq(MPUtil.allEQMapPre( liulangmaogou, "liulangmaogou"));
LiulangmaogouView liulangmaogouView = liulangmaogouService.selectView(ew);
return R.ok("查询流浪猫狗成功").put("data", liulangmaogouView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
LiulangmaogouEntity liulangmaogou = liulangmaogouService.selectById(id);
liulangmaogou.setClicktime(new Date());
liulangmaogouService.updateById(liulangmaogou);
return R.ok().put("data", liulangmaogou);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
LiulangmaogouEntity liulangmaogou = liulangmaogouService.selectById(id);
liulangmaogou.setClicktime(new Date());
liulangmaogouService.updateById(liulangmaogou);
return R.ok().put("data", liulangmaogou);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody LiulangmaogouEntity liulangmaogou, HttpServletRequest request){
liulangmaogou.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(liulangmaogou);
liulangmaogouService.insert(liulangmaogou);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody LiulangmaogouEntity liulangmaogou, HttpServletRequest request){
liulangmaogou.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(liulangmaogou);
liulangmaogouService.insert(liulangmaogou);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@Transactional
public R update(@RequestBody LiulangmaogouEntity liulangmaogou, HttpServletRequest request){
//ValidatorUtils.validateEntity(liulangmaogou);
liulangmaogouService.updateById(liulangmaogou);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
liulangmaogouService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 前端智能排序
*/
@IgnoreAuth
@RequestMapping("/autoSort")
public R autoSort(@RequestParam Map<String, Object> params,LiulangmaogouEntity liulangmaogou, HttpServletRequest request,String pre){
EntityWrapper<LiulangmaogouEntity> ew = new EntityWrapper<LiulangmaogouEntity>();
Map<String, Object> newMap = new HashMap<String, Object>();
Map<String, Object> param = new HashMap<String, Object>();
Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next();
String key = entry.getKey();
String newKey = entry.getKey();
if (pre.endsWith(".")) {
newMap.put(pre + newKey, entry.getValue());
} else if (StringUtils.isEmpty(pre)) {
newMap.put(newKey, entry.getValue());
} else {
newMap.put(pre + "." + newKey, entry.getValue());
}
}
params.put("sort", "clicktime");
params.put("order", "desc");
PageUtils page = liulangmaogouService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, liulangmaogou), params), params));
return R.ok().put("data", page);
}
/**
* 协同算法(按收藏推荐)
*/
@RequestMapping("/autoSort2")
public R autoSort2(@RequestParam Map<String, Object> params,LiulangmaogouEntity liulangmaogou, HttpServletRequest request){
String userId = request.getSession().getAttribute("userId").toString();
String inteltypeColumn = "chongwufenlei";
List<StoreupEntity> storeups = storeupService.selectList(new EntityWrapper<StoreupEntity>().eq("type", 1).eq("userid", userId).eq("tablename", "liulangmaogou").orderBy("addtime", false));
List<String> inteltypes = new ArrayList<String>();
Integer limit = params.get("limit")==null?10:Integer.parseInt(params.get("limit").toString());
List<LiulangmaogouEntity> liulangmaogouList = new ArrayList<LiulangmaogouEntity>();
//去重
if(storeups!=null && storeups.size()>0) {
for(StoreupEntity s : storeups) {
liulangmaogouList.addAll(liulangmaogouService.selectList(new EntityWrapper<LiulangmaogouEntity>
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
SpringBoot流浪猫狗救助救援网站及源码数据库和论文 (715个子文件)
update-password.vue.bak 3KB
main.js.bak 2KB
IndexMain.vue.bak 2KB
IndexAsideStatic.vue.bak 2KB
BreadCrumbs.vue.bak 2KB
IndexHeader.vue.bak 2KB
3-build.bat 15B
2-run.bat 14B
build.bat 14B
run.bat 14B
1-install.bat 12B
install.bat 12B
.classpath 2KB
mvnw.cmd 7KB
app.18ac90bb.css 382KB
chunk-vendors.311506b8.css 242KB
app.da31ca33.css 189KB
chunk-vendors.a48a7cc1.css 37KB
swiper.min.css 13KB
swiper.min.css 13KB
iconfont.css 622B
canvas-bg-1.css 391B
canvas-bg-1.css 391B
canvas-bg-2.css 83B
canvas-bg-2.css 83B
canvas-bg-3.css 61B
canvas-bg-4.css 61B
canvas-bg-5.css 61B
canvas-bg-3.css 61B
springboot开发文档.docx 14KB
.factorypath 15KB
.gitignore 364B
index.html 1KB
index.html 980B
index.html 806B
index.html 614B
favicon.ico 4KB
favicon.ico 4KB
favicon.ico 4KB
favicon.ico 4KB
maven-wrapper.jar 50KB
LiulangmaogouController.java 15KB
ZhiyuanshenqingController.java 13KB
BaiduUtil.java 8KB
CommonController.java 7KB
YonghuController.java 7KB
DiscussliulangmaogouzhishiController.java 6KB
LingyangxinxiController.java 6KB
LiulangmaogouzhishiController.java 6KB
DiscussliulangmaogouController.java 6KB
LingyangxinxiEntity.java 6KB
DiscusshuodongxinxiController.java 6KB
DiscusstuanduixinxiController.java 6KB
ZhiyuanshenqingEntity.java 6KB
HuodongxinxiEntity.java 6KB
HuodongxinxiController.java 5KB
TuanduixinxiController.java 5KB
ChongwufenleiController.java 5KB
HuodongfenleiController.java 5KB
ZhishileixingController.java 5KB
SystemintroController.java 5KB
StoreupController.java 5KB
LiulangmaogouEntity.java 5KB
UsersController.java 5KB
MPUtil.java 5KB
AboutusController.java 5KB
MavenWrapperDownloader.java 5KB
NewsController.java 5KB
LiulangmaogouzhishiEntity.java 5KB
TuanduixinxiEntity.java 5KB
LingyangxinxiModel.java 5KB
LingyangxinxiVO.java 4KB
ZhiyuanshenqingModel.java 4KB
HuodongxinxiModel.java 4KB
FileController.java 4KB
ZhiyuanshenqingVO.java 4KB
HuodongxinxiVO.java 4KB
CommonUtil.java 4KB
LiulangmaogouModel.java 4KB
LiulangmaogouVO.java 4KB
StoreupEntity.java 4KB
YonghuEntity.java 3KB
LiulangmaogouzhishiModel.java 3KB
DiscussliulangmaogouzhishiEntity.java 3KB
TuanduixinxiModel.java 3KB
AuthorizationInterceptor.java 3KB
DiscussliulangmaogouEntity.java 3KB
DiscusshuodongxinxiEntity.java 3KB
DiscusstuanduixinxiEntity.java 3KB
LiulangmaogouzhishiVO.java 3KB
SystemintroEntity.java 3KB
AboutusEntity.java 3KB
TuanduixinxiVO.java 3KB
ConfigController.java 3KB
NewsEntity.java 3KB
ZhiyuanshenqingServiceImpl.java 3KB
StoreupModel.java 3KB
Query.java 3KB
LiulangmaogouServiceImpl.java 3KB
StoreupVO.java 3KB
共 715 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
Java旅途
- 粉丝: 1w+
- 资源: 3049
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功