Commit d7242be8b7d38a7aa9ad7816f963af4da9bbc550
1 parent
dbfd39cb0d
Exists in
master
添加消息常用语
Showing 6 changed files with 205 additions and 0 deletions
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ComtStatController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsComtstat.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsComtstatMapper.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsComtstatService.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsComtstatServiceImpl.java
- talkonlineweb/src/main/resources/mapper/LymsComtstatMapper.xml
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/ComtStatController.java
View file @
d7242be
| 1 | +package com.lyms.talkonlineweb.controller; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
| 4 | +import com.lyms.talkonlineweb.domain.LymsComtstat; | |
| 5 | +import com.lyms.talkonlineweb.domain.LymsFavor; | |
| 6 | +import com.lyms.talkonlineweb.result.BaseResponse; | |
| 7 | +import com.lyms.talkonlineweb.service.LymsComtstatService; | |
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 9 | +import org.springframework.web.bind.annotation.GetMapping; | |
| 10 | +import org.springframework.web.bind.annotation.PostMapping; | |
| 11 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 12 | +import org.springframework.web.bind.annotation.RestController; | |
| 13 | + | |
| 14 | +import java.util.List; | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * 消息常用语管理 | |
| 18 | + */ | |
| 19 | +@RestController | |
| 20 | +@RequestMapping("com") | |
| 21 | +public class ComtStatController { | |
| 22 | + | |
| 23 | + @Autowired | |
| 24 | + private LymsComtstatService lymsComtstatService; | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * 保存消息常用语 | |
| 28 | + * @param stat | |
| 29 | + * @return | |
| 30 | + */ | |
| 31 | + @PostMapping("saveStat") | |
| 32 | + public BaseResponse saveStat(LymsComtstat stat){ | |
| 33 | + BaseResponse baseResponse=new BaseResponse(); | |
| 34 | + boolean f=lymsComtstatService.saveOrUpdate(stat); | |
| 35 | + baseResponse.setErrorcode(f==true?0:1); | |
| 36 | + return baseResponse; | |
| 37 | + } | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 查询常用语句 | |
| 41 | + * @param stat | |
| 42 | + * @return | |
| 43 | + */ | |
| 44 | + @GetMapping("getStat") | |
| 45 | + public BaseResponse getStat(LymsComtstat stat){ | |
| 46 | + BaseResponse baseResponse=new BaseResponse(); | |
| 47 | + List<LymsComtstat> sLst =lymsComtstatService.list(Wrappers.query(stat)); | |
| 48 | + baseResponse.setObject(sLst); | |
| 49 | + return baseResponse; | |
| 50 | + } | |
| 51 | + | |
| 52 | + /** | |
| 53 | + * 删除常用语 | |
| 54 | + * @param stat | |
| 55 | + * @return | |
| 56 | + */ | |
| 57 | + @GetMapping("delStat") | |
| 58 | + public BaseResponse delStat(LymsComtstat stat){ | |
| 59 | + BaseResponse baseResponse=new BaseResponse(); | |
| 60 | + boolean f=lymsComtstatService.remove(Wrappers.query(stat)); | |
| 61 | + baseResponse.setErrorcode(f==true?0:1); | |
| 62 | + return baseResponse; | |
| 63 | + } | |
| 64 | + | |
| 65 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsComtstat.java
View file @
d7242be
| 1 | +package com.lyms.talkonlineweb.domain; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.annotation.IdType; | |
| 4 | +import com.baomidou.mybatisplus.annotation.TableField; | |
| 5 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 6 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 7 | +import java.io.Serializable; | |
| 8 | +import lombok.Data; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * 常用语 | |
| 12 | + * @TableName lyms_comtstat | |
| 13 | + */ | |
| 14 | +@TableName(value ="lyms_comtstat") | |
| 15 | +@Data | |
| 16 | +public class LymsComtstat implements Serializable { | |
| 17 | + /** | |
| 18 | + * | |
| 19 | + */ | |
| 20 | + @TableId(value = "id", type = IdType.AUTO) | |
| 21 | + private Integer id; | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * 常用语内容 | |
| 25 | + */ | |
| 26 | + @TableField(value = "content") | |
| 27 | + private String content; | |
| 28 | + | |
| 29 | + /** | |
| 30 | + * 排序 | |
| 31 | + */ | |
| 32 | + @TableField(value = "sort") | |
| 33 | + private Byte sort; | |
| 34 | + | |
| 35 | + @TableField(exist = false) | |
| 36 | + private static final long serialVersionUID = 1L; | |
| 37 | + | |
| 38 | + @Override | |
| 39 | + public boolean equals(Object that) { | |
| 40 | + if (this == that) { | |
| 41 | + return true; | |
| 42 | + } | |
| 43 | + if (that == null) { | |
| 44 | + return false; | |
| 45 | + } | |
| 46 | + if (getClass() != that.getClass()) { | |
| 47 | + return false; | |
| 48 | + } | |
| 49 | + LymsComtstat other = (LymsComtstat) that; | |
| 50 | + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) | |
| 51 | + && (this.getContent() == null ? other.getContent() == null : this.getContent().equals(other.getContent())) | |
| 52 | + && (this.getSort() == null ? other.getSort() == null : this.getSort().equals(other.getSort())); | |
| 53 | + } | |
| 54 | + | |
| 55 | + @Override | |
| 56 | + public int hashCode() { | |
| 57 | + final int prime = 31; | |
| 58 | + int result = 1; | |
| 59 | + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); | |
| 60 | + result = prime * result + ((getContent() == null) ? 0 : getContent().hashCode()); | |
| 61 | + result = prime * result + ((getSort() == null) ? 0 : getSort().hashCode()); | |
| 62 | + return result; | |
| 63 | + } | |
| 64 | + | |
| 65 | + @Override | |
| 66 | + public String toString() { | |
| 67 | + StringBuilder sb = new StringBuilder(); | |
| 68 | + sb.append(getClass().getSimpleName()); | |
| 69 | + sb.append(" ["); | |
| 70 | + sb.append("Hash = ").append(hashCode()); | |
| 71 | + sb.append(", id=").append(id); | |
| 72 | + sb.append(", content=").append(content); | |
| 73 | + sb.append(", sort=").append(sort); | |
| 74 | + sb.append(", serialVersionUID=").append(serialVersionUID); | |
| 75 | + sb.append("]"); | |
| 76 | + return sb.toString(); | |
| 77 | + } | |
| 78 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsComtstatMapper.java
View file @
d7242be
| 1 | +package com.lyms.talkonlineweb.mapper; | |
| 2 | + | |
| 3 | +import com.lyms.talkonlineweb.domain.LymsComtstat; | |
| 4 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * @Entity com.lyms.talkonlineweb.domain.LymsComtstat | |
| 8 | + */ | |
| 9 | +public interface LymsComtstatMapper extends BaseMapper<LymsComtstat> { | |
| 10 | + | |
| 11 | +} |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsComtstatService.java
View file @
d7242be
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsComtstatServiceImpl.java
View file @
d7242be
| 1 | +package com.lyms.talkonlineweb.service.impl; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
| 4 | +import com.lyms.talkonlineweb.domain.LymsComtstat; | |
| 5 | +import com.lyms.talkonlineweb.service.LymsComtstatService; | |
| 6 | +import com.lyms.talkonlineweb.mapper.LymsComtstatMapper; | |
| 7 | +import org.springframework.stereotype.Service; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * | |
| 11 | + */ | |
| 12 | +@Service | |
| 13 | +public class LymsComtstatServiceImpl extends ServiceImpl<LymsComtstatMapper, LymsComtstat> | |
| 14 | + implements LymsComtstatService{ | |
| 15 | + | |
| 16 | +} |
talkonlineweb/src/main/resources/mapper/LymsComtstatMapper.xml
View file @
d7242be
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper | |
| 3 | + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |
| 4 | + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 5 | +<mapper namespace="com.lyms.talkonlineweb.mapper.LymsComtstatMapper"> | |
| 6 | + | |
| 7 | + <resultMap id="BaseResultMap" type="com.lyms.talkonlineweb.domain.LymsComtstat"> | |
| 8 | + <id property="id" column="id" jdbcType="INTEGER"/> | |
| 9 | + <result property="content" column="content" jdbcType="VARCHAR"/> | |
| 10 | + <result property="sort" column="sort" jdbcType="TINYINT"/> | |
| 11 | + </resultMap> | |
| 12 | + | |
| 13 | + <sql id="Base_Column_List"> | |
| 14 | + id,content,sort | |
| 15 | + </sql> | |
| 16 | +</mapper> |