From abd420d070693abe6734a4db96693a1692d8441c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=95=8F?= <863302237@qq.com> Date: Thu, 27 Jun 2024 10:26:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=88=91=E8=A6=81=E5=BD=93?= =?UTF-8?q?=E6=88=BF=E4=B8=BB=E6=A8=A1=E5=9D=97=E7=9B=B8=E5=85=B3=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DiscusswoyaodangfangzhuController.java | 203 +++++++ .../com/dao/DiscusswoyaodangfangzhuDao.java | 32 ++ .../entity/DiscusswoyaodangfangzhuEntity.java | 145 +++++ .../model/DiscusswoyaodangfangzhuModel.java | 90 +++ .../view/DiscusswoyaodangfangzhuView.java | 35 ++ .../DiscusswoyaodangfangzhuService.java | 36 ++ .../DiscusswoyaodangfangzhuServiceImpl.java | 62 ++ .../discusswoyaodangfangzhu/add-or-update.vue | 425 ++++++++++++++ .../modules/discusswoyaodangfangzhu/list.vue | 530 ++++++++++++++++++ .../mapper/DiscusswoyaodangfangzhuDao.xml | 38 ++ 10 files changed, 1596 insertions(+) create mode 100644 src/main/java/com/controller/DiscusswoyaodangfangzhuController.java create mode 100644 src/main/java/com/dao/DiscusswoyaodangfangzhuDao.java create mode 100644 src/main/java/com/entity/DiscusswoyaodangfangzhuEntity.java create mode 100644 src/main/java/com/entity/model/DiscusswoyaodangfangzhuModel.java create mode 100644 src/main/java/com/entity/view/DiscusswoyaodangfangzhuView.java create mode 100644 src/main/java/com/service/DiscusswoyaodangfangzhuService.java create mode 100644 src/main/java/com/service/impl/DiscusswoyaodangfangzhuServiceImpl.java create mode 100644 src/main/resources/admin/admin/src/views/modules/discusswoyaodangfangzhu/add-or-update.vue create mode 100644 src/main/resources/admin/admin/src/views/modules/discusswoyaodangfangzhu/list.vue create mode 100644 src/main/resources/mapper/DiscusswoyaodangfangzhuDao.xml diff --git a/src/main/java/com/controller/DiscusswoyaodangfangzhuController.java b/src/main/java/com/controller/DiscusswoyaodangfangzhuController.java new file mode 100644 index 0000000..dbb4912 --- /dev/null +++ b/src/main/java/com/controller/DiscusswoyaodangfangzhuController.java @@ -0,0 +1,203 @@ +package com.controller; + +import java.text.SimpleDateFormat; +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.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.DiscusswoyaodangfangzhuEntity; +import com.entity.view.DiscusswoyaodangfangzhuView; + +import com.service.DiscusswoyaodangfangzhuService; +import com.service.TokenService; +import com.utils.PageUtils; +import com.utils.R; +import com.utils.MD5Util; +import com.utils.MPUtil; +import com.utils.CommonUtil; + + +/** + * 我要当房主评论表 + * 后端接口 + * @author + * @email + */ +@RestController +@RequestMapping("/discusswoyaodangfangzhu") +public class DiscusswoyaodangfangzhuController { + @Autowired + private DiscusswoyaodangfangzhuService discusswoyaodangfangzhuService; + + + + /** + * 后端列表 + */ + @RequestMapping("/page") + public R page(@RequestParam Map params,DiscusswoyaodangfangzhuEntity discusswoyaodangfangzhu, HttpServletRequest request){ + EntityWrapper ew = new EntityWrapper(); + PageUtils page = discusswoyaodangfangzhuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, discusswoyaodangfangzhu), params), params)); + + return R.ok().put("data", page); + } + + /** + * 前端列表 + */ + @IgnoreAuth + @RequestMapping("/list") + public R list(@RequestParam Map params,DiscusswoyaodangfangzhuEntity discusswoyaodangfangzhu, HttpServletRequest request){ + EntityWrapper ew = new EntityWrapper(); + PageUtils page = discusswoyaodangfangzhuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, discusswoyaodangfangzhu), params), params)); + return R.ok().put("data", page); + } + + /** + * 列表 + */ + @RequestMapping("/lists") + public R list( DiscusswoyaodangfangzhuEntity discusswoyaodangfangzhu){ + EntityWrapper ew = new EntityWrapper(); + ew.allEq(MPUtil.allEQMapPre( discusswoyaodangfangzhu, "discusswoyaodangfangzhu")); + return R.ok().put("data", discusswoyaodangfangzhuService.selectListView(ew)); + } + + /** + * 查询 + */ + @RequestMapping("/query") + public R query(DiscusswoyaodangfangzhuEntity discusswoyaodangfangzhu){ + EntityWrapper< DiscusswoyaodangfangzhuEntity> ew = new EntityWrapper< DiscusswoyaodangfangzhuEntity>(); + ew.allEq(MPUtil.allEQMapPre( discusswoyaodangfangzhu, "discusswoyaodangfangzhu")); + DiscusswoyaodangfangzhuView discusswoyaodangfangzhuView = discusswoyaodangfangzhuService.selectView(ew); + return R.ok("查询我要当房主评论表成功").put("data", discusswoyaodangfangzhuView); + } + + /** + * 后端详情 + */ + @RequestMapping("/info/{id}") + public R info(@PathVariable("id") Long id){ + DiscusswoyaodangfangzhuEntity discusswoyaodangfangzhu = discusswoyaodangfangzhuService.selectById(id); + return R.ok().put("data", discusswoyaodangfangzhu); + } + + /** + * 前端详情 + */ + @RequestMapping("/detail/{id}") + public R detail(@PathVariable("id") Long id){ + DiscusswoyaodangfangzhuEntity discusswoyaodangfangzhu = discusswoyaodangfangzhuService.selectById(id); + return R.ok().put("data", discusswoyaodangfangzhu); + } + + + + + /** + * 后端保存 + */ + @RequestMapping("/save") + public R save(@RequestBody DiscusswoyaodangfangzhuEntity discusswoyaodangfangzhu, HttpServletRequest request){ + discusswoyaodangfangzhu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); + //ValidatorUtils.validateEntity(discusswoyaodangfangzhu); + discusswoyaodangfangzhuService.insert(discusswoyaodangfangzhu); + return R.ok(); + } + + /** + * 前端保存 + */ + @RequestMapping("/add") + public R add(@RequestBody DiscusswoyaodangfangzhuEntity discusswoyaodangfangzhu, HttpServletRequest request){ + discusswoyaodangfangzhu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); + //ValidatorUtils.validateEntity(discusswoyaodangfangzhu); + discusswoyaodangfangzhuService.insert(discusswoyaodangfangzhu); + return R.ok(); + } + + /** + * 修改 + */ + @RequestMapping("/update") + public R update(@RequestBody DiscusswoyaodangfangzhuEntity discusswoyaodangfangzhu, HttpServletRequest request){ + //ValidatorUtils.validateEntity(discusswoyaodangfangzhu); + discusswoyaodangfangzhuService.updateById(discusswoyaodangfangzhu);//全部更新 + return R.ok(); + } + + + /** + * 删除 + */ + @RequestMapping("/delete") + public R delete(@RequestBody Long[] ids){ + discusswoyaodangfangzhuService.deleteBatchIds(Arrays.asList(ids)); + return R.ok(); + } + + /** + * 提醒接口 + */ + @RequestMapping("/remind/{columnName}/{type}") + public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, + @PathVariable("type") String type,@RequestParam Map map) { + map.put("column", columnName); + map.put("type", type); + + if(type.equals("2")) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Calendar c = Calendar.getInstance(); + Date remindStartDate = null; + Date remindEndDate = null; + if(map.get("remindstart")!=null) { + Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); + c.setTime(new Date()); + c.add(Calendar.DAY_OF_MONTH,remindStart); + remindStartDate = c.getTime(); + map.put("remindstart", sdf.format(remindStartDate)); + } + if(map.get("remindend")!=null) { + Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); + c.setTime(new Date()); + c.add(Calendar.DAY_OF_MONTH,remindEnd); + remindEndDate = c.getTime(); + map.put("remindend", sdf.format(remindEndDate)); + } + } + + Wrapper wrapper = new EntityWrapper(); + if(map.get("remindstart")!=null) { + wrapper.ge(columnName, map.get("remindstart")); + } + if(map.get("remindend")!=null) { + wrapper.le(columnName, map.get("remindend")); + } + + + int count = discusswoyaodangfangzhuService.selectCount(wrapper); + return R.ok().put("count", count); + } + + + +} diff --git a/src/main/java/com/dao/DiscusswoyaodangfangzhuDao.java b/src/main/java/com/dao/DiscusswoyaodangfangzhuDao.java new file mode 100644 index 0000000..2c5ef3f --- /dev/null +++ b/src/main/java/com/dao/DiscusswoyaodangfangzhuDao.java @@ -0,0 +1,32 @@ +package com.dao; + +import com.entity.DiscusswoyaodangfangzhuEntity; +import com.baomidou.mybatisplus.mapper.BaseMapper; +import java.util.List; +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.plugins.pagination.Pagination; + +import org.apache.ibatis.annotations.Param; +import com.entity.vo.DiscusswoyaodangfangzhuVO; +import com.entity.view.DiscusswoyaodangfangzhuView; + + +/** + * 我要当房主评论表 + * + * @author + * @email + */ +public interface DiscusswoyaodangfangzhuDao extends BaseMapper { + + List selectListVO(@Param("ew") Wrapper wrapper); + + DiscusswoyaodangfangzhuVO selectVO(@Param("ew") Wrapper wrapper); + + List selectListView(@Param("ew") Wrapper wrapper); + + List selectListView(Pagination page,@Param("ew") Wrapper wrapper); + + DiscusswoyaodangfangzhuView selectView(@Param("ew") Wrapper wrapper); + +} diff --git a/src/main/java/com/entity/DiscusswoyaodangfangzhuEntity.java b/src/main/java/com/entity/DiscusswoyaodangfangzhuEntity.java new file mode 100644 index 0000000..5e73012 --- /dev/null +++ b/src/main/java/com/entity/DiscusswoyaodangfangzhuEntity.java @@ -0,0 +1,145 @@ +package com.entity; + +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import java.lang.reflect.InvocationTargetException; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import org.springframework.format.annotation.DateTimeFormat; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.beanutils.BeanUtils; +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.enums.FieldFill; +import com.baomidou.mybatisplus.enums.IdType; + + +/** + * 我要当房主评论表 + * 数据库通用操作实体类(普通增删改查) + * @author + * @email + */ +@TableName("discusswoyaodangfangzhu") +public class DiscusswoyaodangfangzhuEntity implements Serializable { + private static final long serialVersionUID = 1L; + + + public DiscusswoyaodangfangzhuEntity() { + + } + + public DiscusswoyaodangfangzhuEntity(T t) { + try { + BeanUtils.copyProperties(this, t); + } catch (IllegalAccessException | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * 主键id + */ + @TableId + private Long id; + /** + * 关联表id + */ + + private Long refid; + + /** + * 用户id + */ + + private Long userid; + + /** + * 评论内容 + */ + + private String content; + + /** + * 回复内容 + */ + + private String reply; + + + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") + @DateTimeFormat + private Date addtime; + + public Date getAddtime() { + return addtime; + } + public void setAddtime(Date addtime) { + this.addtime = addtime; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + /** + * 设置:关联表id + */ + public void setRefid(Long refid) { + this.refid = refid; + } + /** + * 获取:关联表id + */ + public Long getRefid() { + return refid; + } + /** + * 设置:用户id + */ + public void setUserid(Long userid) { + this.userid = userid; + } + /** + * 获取:用户id + */ + public Long getUserid() { + return userid; + } + /** + * 设置:评论内容 + */ + public void setContent(String content) { + this.content = content; + } + /** + * 获取:评论内容 + */ + public String getContent() { + return content; + } + /** + * 设置:回复内容 + */ + public void setReply(String reply) { + this.reply = reply; + } + /** + * 获取:回复内容 + */ + public String getReply() { + return reply; + } + +} diff --git a/src/main/java/com/entity/model/DiscusswoyaodangfangzhuModel.java b/src/main/java/com/entity/model/DiscusswoyaodangfangzhuModel.java new file mode 100644 index 0000000..8b244f8 --- /dev/null +++ b/src/main/java/com/entity/model/DiscusswoyaodangfangzhuModel.java @@ -0,0 +1,90 @@ +package com.entity.model; + +import com.entity.DiscusswoyaodangfangzhuEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; + +import com.fasterxml.jackson.annotation.JsonFormat; +import java.io.Serializable; + + +/** + * 我要当房主评论表 + * 接收传参的实体类 + * 取自ModelAndView 的model名称 + * @author + * @email + */ +public class DiscusswoyaodangfangzhuModel implements Serializable { + private static final long serialVersionUID = 1L; + + + /** + * 用户id + */ + + private Long userid; + + /** + * 评论内容 + */ + + private String content; + + /** + * 回复内容 + */ + + private String reply; + + + /** + * 设置:用户id + */ + + public void setUserid(Long userid) { + this.userid = userid; + } + + /** + * 获取:用户id + */ + public Long getUserid() { + return userid; + } + + + /** + * 设置:评论内容 + */ + + public void setContent(String content) { + this.content = content; + } + + /** + * 获取:评论内容 + */ + public String getContent() { + return content; + } + + + /** + * 设置:回复内容 + */ + + public void setReply(String reply) { + this.reply = reply; + } + + /** + * 获取:回复内容 + */ + public String getReply() { + return reply; + } + +} diff --git a/src/main/java/com/entity/view/DiscusswoyaodangfangzhuView.java b/src/main/java/com/entity/view/DiscusswoyaodangfangzhuView.java new file mode 100644 index 0000000..9dc4b29 --- /dev/null +++ b/src/main/java/com/entity/view/DiscusswoyaodangfangzhuView.java @@ -0,0 +1,35 @@ +package com.entity.view; + +import com.entity.DiscusswoyaodangfangzhuEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import org.apache.commons.beanutils.BeanUtils; +import java.lang.reflect.InvocationTargetException; + +import java.io.Serializable; + + +/** + * 我要当房主评论表 + * 后端返回视图实体辅助类 + * (通常后端关联的表或者自定义的字段需要返回使用) + * @author + * @email + */ +@TableName("discusswoyaodangfangzhu") +public class DiscusswoyaodangfangzhuView extends DiscusswoyaodangfangzhuEntity implements Serializable { + private static final long serialVersionUID = 1L; + + public DiscusswoyaodangfangzhuView(){ + } + + public DiscusswoyaodangfangzhuView(DiscusswoyaodangfangzhuEntity discusswoyaodangfangzhuEntity){ + try { + BeanUtils.copyProperties(this, discusswoyaodangfangzhuEntity); + } catch (IllegalAccessException | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } +} diff --git a/src/main/java/com/service/DiscusswoyaodangfangzhuService.java b/src/main/java/com/service/DiscusswoyaodangfangzhuService.java new file mode 100644 index 0000000..63ff59e --- /dev/null +++ b/src/main/java/com/service/DiscusswoyaodangfangzhuService.java @@ -0,0 +1,36 @@ +package com.service; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.DiscusswoyaodangfangzhuEntity; +import java.util.List; +import java.util.Map; +import com.entity.vo.DiscusswoyaodangfangzhuVO; +import org.apache.ibatis.annotations.Param; +import com.entity.view.DiscusswoyaodangfangzhuView; + + +/** + * 我要当房主评论表 + * + * @author + * @email + * @date 2021-03-04 18:46:21 + */ +public interface DiscusswoyaodangfangzhuService extends IService { + + PageUtils queryPage(Map params); + + List selectListVO(Wrapper wrapper); + + DiscusswoyaodangfangzhuVO selectVO(@Param("ew") Wrapper wrapper); + + List selectListView(Wrapper wrapper); + + DiscusswoyaodangfangzhuView selectView(@Param("ew") Wrapper wrapper); + + PageUtils queryPage(Map params,Wrapper wrapper); + +} + diff --git a/src/main/java/com/service/impl/DiscusswoyaodangfangzhuServiceImpl.java b/src/main/java/com/service/impl/DiscusswoyaodangfangzhuServiceImpl.java new file mode 100644 index 0000000..1b93e15 --- /dev/null +++ b/src/main/java/com/service/impl/DiscusswoyaodangfangzhuServiceImpl.java @@ -0,0 +1,62 @@ +package com.service.impl; + +import org.springframework.stereotype.Service; +import java.util.Map; +import java.util.List; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.utils.PageUtils; +import com.utils.Query; + + +import com.dao.DiscusswoyaodangfangzhuDao; +import com.entity.DiscusswoyaodangfangzhuEntity; +import com.service.DiscusswoyaodangfangzhuService; +import com.entity.vo.DiscusswoyaodangfangzhuVO; +import com.entity.view.DiscusswoyaodangfangzhuView; + +@Service("discusswoyaodangfangzhuService") +public class DiscusswoyaodangfangzhuServiceImpl extends ServiceImpl implements DiscusswoyaodangfangzhuService { + + + @Override + public PageUtils queryPage(Map params) { + Page page = this.selectPage( + new Query(params).getPage(), + new EntityWrapper() + ); + return new PageUtils(page); + } + + @Override + public PageUtils queryPage(Map params, Wrapper wrapper) { + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,wrapper)); + PageUtils pageUtil = new PageUtils(page); + return pageUtil; + } + + @Override + public List selectListVO(Wrapper wrapper) { + return baseMapper.selectListVO(wrapper); + } + + @Override + public DiscusswoyaodangfangzhuVO selectVO(Wrapper wrapper) { + return baseMapper.selectVO(wrapper); + } + + @Override + public List selectListView(Wrapper wrapper) { + return baseMapper.selectListView(wrapper); + } + + @Override + public DiscusswoyaodangfangzhuView selectView(Wrapper wrapper) { + return baseMapper.selectView(wrapper); + } + +} diff --git a/src/main/resources/admin/admin/src/views/modules/discusswoyaodangfangzhu/add-or-update.vue b/src/main/resources/admin/admin/src/views/modules/discusswoyaodangfangzhu/add-or-update.vue new file mode 100644 index 0000000..764ba52 --- /dev/null +++ b/src/main/resources/admin/admin/src/views/modules/discusswoyaodangfangzhu/add-or-update.vue @@ -0,0 +1,425 @@ + + + diff --git a/src/main/resources/admin/admin/src/views/modules/discusswoyaodangfangzhu/list.vue b/src/main/resources/admin/admin/src/views/modules/discusswoyaodangfangzhu/list.vue new file mode 100644 index 0000000..03102df --- /dev/null +++ b/src/main/resources/admin/admin/src/views/modules/discusswoyaodangfangzhu/list.vue @@ -0,0 +1,530 @@ + + + diff --git a/src/main/resources/mapper/DiscusswoyaodangfangzhuDao.xml b/src/main/resources/mapper/DiscusswoyaodangfangzhuDao.xml new file mode 100644 index 0000000..e961d3b --- /dev/null +++ b/src/main/resources/mapper/DiscusswoyaodangfangzhuDao.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file