|
@@ -1,69 +0,0 @@
|
|
|
-package com.zy.omp.service;
|
|
|
-
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.zy.omp.mapper.IdiomsMapper;
|
|
|
-import com.zy.omp.model.UserIdioms;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-/**
|
|
|
- * 常用语 Service
|
|
|
- *
|
|
|
- * @author chenyi
|
|
|
- * Create on 2020/4/10
|
|
|
- */
|
|
|
-@Service
|
|
|
-@Deprecated
|
|
|
-public class IdiomsService extends ServiceImpl<IdiomsMapper, UserIdioms> {
|
|
|
-
|
|
|
- /**
|
|
|
- * 添加常用语
|
|
|
- *
|
|
|
- * @param userId 用户Id
|
|
|
- * @param content 常用语内容
|
|
|
- */
|
|
|
- public void saveEntity(String userId, String content) {
|
|
|
- UserIdioms entity = new UserIdioms();
|
|
|
- entity.setUserId(userId);
|
|
|
- entity.setContent(content);
|
|
|
- baseMapper.insert(entity);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 通过用户ID 查询用户常用语
|
|
|
- *
|
|
|
- * @param userId 用户ID
|
|
|
- */
|
|
|
- public List<UserIdioms> getListByUserId(String userId) {
|
|
|
- QueryWrapper<UserIdioms> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("userId", userId);
|
|
|
- queryWrapper.orderByDesc("createTime");
|
|
|
- return baseMapper.selectList(queryWrapper);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询用户常用语数量
|
|
|
- *
|
|
|
- * @param userId 用户ID
|
|
|
- */
|
|
|
- public int countByUserId(String userId) {
|
|
|
- QueryWrapper<UserIdioms> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("userId", userId);
|
|
|
- return baseMapper.selectCount(queryWrapper);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 删除常用语
|
|
|
- *
|
|
|
- * @param id 常用语主键ID
|
|
|
- * @param userId 用户ID
|
|
|
- */
|
|
|
- public int delById(Integer id, String userId) {
|
|
|
- QueryWrapper<UserIdioms> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("id", id);
|
|
|
- queryWrapper.eq("userId", userId);
|
|
|
- return baseMapper.delete(queryWrapper);
|
|
|
- }
|
|
|
-}
|