package com.alatus.web;
import com.alatus.constant.Constants;
import com.alatus.model.TClueRemark;
import com.alatus.query.ClueRemarkQuery;
import com.alatus.result.Result;
import com.alatus.service.ClueRemarkService;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
@RestController
public class ClueRemarkController {
@Resource
private ClueRemarkService clueRemarkService;
@PostMapping(value = "/api/clue/remark/add")
public Result addClueRemark(@RequestBody ClueRemarkQuery clueRemarkQuery, @RequestHeader(value = Constants.TOKEN_NAME)String token){
clueRemarkQuery.setToken(token);
int save = clueRemarkService.saveClueRemark(clueRemarkQuery);
return save >= 1 ? Result.OK() : Result.FAIL();
}
@GetMapping(value = "/api/clue/remark/page")
public Result getClueRemarkPage(@RequestParam(value = Constants.CURRENT,required = false)Integer current, @RequestParam(value = Constants.ID)Integer clueId){
if(current == null){
current = 1;
}
ClueRemarkQuery clueRemarkQuery = new ClueRemarkQuery();
clueRemarkQuery.setClueId(clueId);
PageInfo<TClueRemark> remarkList = clueRemarkService.getClueRemarkByPage(current,clueRemarkQuery);
return Result.OK(remarkList);
}
@DeleteMapping(value = "/api/clue/remark/delete/{id}")
public Result delClueRemark(@PathVariable(value = Constants.ID)Integer id){
int result = clueRemarkService.deleteClueRemarkById(id);
return result >= 1 ? Result.OK() : Result.FAIL();
}
@PutMapping(value = "/api/clue/remark/edit")
public Result editClueRemark(@RequestHeader(value = Constants.TOKEN_NAME)String token,@RequestBody ClueRemarkQuery clueRemarkQuery){
clueRemarkQuery.setToken(token);
int update = clueRemarkService.updateClueRemark(clueRemarkQuery);
return update >= 1 ? Result.OK() : Result.FAIL();
}
}
package com.alatus.web;
import com.alatus.constant.Constants;
import com.alatus.model.TClueRemark;
import com.alatus.query.ClueRemarkQuery;
import com.alatus.result.Result;
import com.alatus.service.ClueRemarkService;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
@RestController
public class ClueRemarkController {
@Resource
private ClueRemarkService clueRemarkService;
@PostMapping(value = "/api/clue/remark/add")
public Result addClueRemark(@RequestBody ClueRemarkQuery clueRemarkQuery, @RequestHeader(value = Constants.TOKEN_NAME)String token){
clueRemarkQuery.setToken(token);
int save = clueRemarkService.saveClueRemark(clueRemarkQuery);
return save >= 1 ? Result.OK() : Result.FAIL();
}
@GetMapping(value = "/api/clue/remark/page")
public Result getClueRemarkPage(@RequestParam(value = Constants.CURRENT,required = false)Integer current, @RequestParam(value = Constants.ID)Integer clueId){
if(current == null){
current = 1;
}
ClueRemarkQuery clueRemarkQuery = new ClueRemarkQuery();
clueRemarkQuery.setClueId(clueId);
PageInfo<TClueRemark> remarkList = clueRemarkService.getClueRemarkByPage(current,clueRemarkQuery);
return Result.OK(remarkList);
}
@DeleteMapping(value = "/api/clue/remark/delete/{id}")
public Result delClueRemark(@PathVariable(value = Constants.ID)Integer id){
int result = clueRemarkService.deleteClueRemarkById(id);
return result >= 1 ? Result.OK() : Result.FAIL();
}
@PutMapping(value = "/api/clue/remark/edit")
public Result editClueRemark(@RequestHeader(value = Constants.TOKEN_NAME)String token,@RequestBody ClueRemarkQuery clueRemarkQuery){
clueRemarkQuery.setToken(token);
int update = clueRemarkService.updateClueRemark(clueRemarkQuery);
return update >= 1 ? Result.OK() : Result.FAIL();
}
}
package com.alatus.service;
import com.alatus.model.TActivityRemark;
import com.alatus.model.TClueRemark;
import com.alatus.query.ClueRemarkQuery;
import com.github.pagehelper.PageInfo;
public interface ClueRemarkService {
int saveClueRemark(ClueRemarkQuery clueRemarkQuery);
PageInfo<TClueRemark> getClueRemarkByPage(Integer current, ClueRemarkQuery clueRemarkQuery);
int deleteClueRemarkById(Integer id);
int updateClueRemark(ClueRemarkQuery clueRemarkQuery);
}
package com.alatus.service;
import com.alatus.model.TActivityRemark;
import com.alatus.model.TClueRemark;
import com.alatus.query.ClueRemarkQuery;
import com.github.pagehelper.PageInfo;
public interface ClueRemarkService {
int saveClueRemark(ClueRemarkQuery clueRemarkQuery);
PageInfo<TClueRemark> getClueRemarkByPage(Integer current, ClueRemarkQuery clueRemarkQuery);
int deleteClueRemarkById(Integer id);
int updateClueRemark(ClueRemarkQuery clueRemarkQuery);
}
package com.alatus.service.impl;
import com.alatus.constant.Constants;
import com.alatus.mapper.TClueRemarkMapper;
import com.alatus.model.TClueRemark;
import com.alatus.query.ClueRemarkQuery;
import com.alatus.service.ClueRemarkService;
import com.alatus.util.JWTUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service
public class ClueRemarkServiceImpl implements ClueRemarkService {
@Resource
private TClueRemarkMapper tClueRemarkMapper;
@Override
public int saveClueRemark(ClueRemarkQuery clueRemarkQuery) {
TClueRemark tClueRemark = new TClueRemark();
tClueRemark.setCreateBy(JWTUtils.parseUserFromJWT(clueRemarkQuery.getToken()).getId());
tClueRemark.setCreateTime(new Date());
BeanUtils.copyProperties(clueRemarkQuery,tClueRemark);
return tClueRemarkMapper.insert(tClueRemark);
}
@Override
public PageInfo<TClueRemark> getClueRemarkByPage(Integer current, ClueRemarkQuery clueRemarkQuery) {
// 设置PageHelper和分页情况
PageHelper.startPage(current, Constants.PAGE_SIZE);
List<TClueRemark> list = tClueRemarkMapper.selectClueRemarkByPage(clueRemarkQuery);
PageInfo<TClueRemark> info = new PageInfo<>(list);
return info;
}
@Override
public int deleteClueRemarkById(Integer id) {
// 修改删除状态法,可恢复
// TClueRemark tClueRemark = new TClueRemark();
// tClueRemark.setId(id);
// tClueRemark.setDeleted(1);
// return tClueRemarkMapper.updateByPrimaryKeySelective(tClueRemark);
return tClueRemarkMapper.deleteByPrimaryKey(id);
}
@Override
public int updateClueRemark(ClueRemarkQuery clueRemarkQuery) {
TClueRemark tClueRemark = new TClueRemark();
BeanUtils.copyProperties(clueRemarkQuery,tClueRemark);
tClueRemark.setEditTime(new Date());
tClueRemark.setEditBy(JWTUtils.parseUserFromJWT(clueRemarkQuery.getToken()).getId());
return tClueRemarkMapper.updateByPrimaryKeySelective(tClueRemark);
}
}
package com.alatus.service.impl;
import com.alatus.constant.Constants;
import com.alatus.mapper.TClueRemarkMapper;
import com.alatus.model.TClueRemark;
import com.alatus.query.ClueRemarkQuery;
import com.alatus.service.ClueRemarkService;
import com.alatus.util.JWTUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service
public class ClueRemarkServiceImpl implements ClueRemarkService {
@Resource
private TClueRemarkMapper tClueRemarkMapper;
@Override
public int saveClueRemark(ClueRemarkQuery clueRemarkQuery) {
TClueRemark tClueRemark = new TClueRemark();
tClueRemark.setCreateBy(JWTUtils.parseUserFromJWT(clueRemarkQuery.getToken()).getId());
tClueRemark.setCreateTime(new Date());
BeanUtils.copyProperties(clueRemarkQuery,tClueRemark);
return tClueRemarkMapper.insert(tClueRemark);
}
@Override
public PageInfo<TClueRemark> getClueRemarkByPage(Integer current, ClueRemarkQuery clueRemarkQuery) {
// 设置PageHelper和分页情况
PageHelper.startPage(current, Constants.PAGE_SIZE);
List<TClueRemark> list = tClueRemarkMapper.selectClueRemarkByPage(clueRemarkQuery);
PageInfo<TClueRemark> info = new PageInfo<>(list);
return info;
}
@Override
public int deleteClueRemarkById(Integer id) {
// 修改删除状态法,可恢复
// TClueRemark tClueRemark = new TClueRemark();
// tClueRemark.setId(id);
// tClueRemark.setDeleted(1);
// return tClueRemarkMapper.updateByPrimaryKeySelective(tClueRemark);
return tClueRemarkMapper.deleteByPrimaryKey(id);
}
@Override
public int updateClueRemark(ClueRemarkQuery clueRemarkQuery) {
TClueRemark tClueRemark = new TClueRemark();
BeanUtils.copyProperties(clueRemarkQuery,tClueRemark);
tClueRemark.setEditTime(new Date());
tClueRemark.setEditBy(JWTUtils.parseUserFromJWT(clueRemarkQuery.getToken()).getId());
return tClueRemarkMapper.updateByPrimaryKeySelective(tClueRemark);
}
}
package com.alatus.query;
import lombok.Data;
@Data
public class ClueRemarkQuery extends BaseQuery{
private Integer clueId;
private Integer id;
private String noteContent;
private Integer noteWay;
}
package com.alatus.query;
import lombok.Data;
@Data
public class ClueRemarkQuery extends BaseQuery{
private Integer clueId;
private Integer id;
private String noteContent;
private Integer noteWay;
}
package com.alatus.service.impl;
import com.alatus.constant.Constants;
import com.alatus.mapper.TActivityRemarkMapper;
import com.alatus.model.TActivityRemark;
import com.alatus.query.ActivityRemarkQuery;
import com.alatus.service.ActivityRemarkService;
import com.alatus.util.JWTUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service
public class ActivityRemarkServiceImpl implements ActivityRemarkService {
@Resource
private TActivityRemarkMapper tActivityRemarkMapper;
@Override
public int saveActivityRemark(ActivityRemarkQuery activityRemarkQuery) {
TActivityRemark tActivityRemark = new TActivityRemark();
tActivityRemark.setCreateBy(JWTUtils.parseUserFromJWT(activityRemarkQuery.getToken()).getId());
tActivityRemark.setCreateTime(new Date());
BeanUtils.copyProperties(activityRemarkQuery,tActivityRemark);
return tActivityRemarkMapper.insert(tActivityRemark);
}
@Override
public PageInfo<TActivityRemark> getActivityRemarkByPage(Integer current,ActivityRemarkQuery activityRemarkQuery) {
// 设置PageHelper和分页情况
PageHelper.startPage(current, Constants.PAGE_SIZE);
List<TActivityRemark> list = tActivityRemarkMapper.selectActivityRemarkByPage(activityRemarkQuery);
PageInfo<TActivityRemark> info = new PageInfo<>(list);
return info;
}
@Override
public int updateActivityRemark(ActivityRemarkQuery activityRemarkQuery) {
TActivityRemark tActivityRemark = new TActivityRemark();
BeanUtils.copyProperties(activityRemarkQuery,tActivityRemark);
tActivityRemark.setEditTime(new Date());
tActivityRemark.setEditBy(JWTUtils.parseUserFromJWT(activityRemarkQuery.getToken()).getId());
return tActivityRemarkMapper.updateByPrimaryKeySelective(tActivityRemark);
}
@Override
public int deleteActivtyRemarkById(Integer id) {
// 修改删除状态法,可恢复
// TActivityRemark tActivityRemark = new TActivityRemark();
// tActivityRemark.setId(id);
// tActivityRemark.setDeleted(1);
// return tActivityRemarkMapper.updateByPrimaryKeySelective(tActivityRemark);
return tActivityRemarkMapper.deleteByPrimaryKey(id);
}
// @Override
// public TActivityRemark getActivityRemarkById(Integer id) {
// return tActivityRemarkMapper.selectByPrimaryKey(id);
// }
}
package com.alatus.service.impl;
import com.alatus.constant.Constants;
import com.alatus.mapper.TActivityRemarkMapper;
import com.alatus.model.TActivityRemark;
import com.alatus.query.ActivityRemarkQuery;
import com.alatus.service.ActivityRemarkService;
import com.alatus.util.JWTUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service
public class ActivityRemarkServiceImpl implements ActivityRemarkService {
@Resource
private TActivityRemarkMapper tActivityRemarkMapper;
@Override
public int saveActivityRemark(ActivityRemarkQuery activityRemarkQuery) {
TActivityRemark tActivityRemark = new TActivityRemark();
tActivityRemark.setCreateBy(JWTUtils.parseUserFromJWT(activityRemarkQuery.getToken()).getId());
tActivityRemark.setCreateTime(new Date());
BeanUtils.copyProperties(activityRemarkQuery,tActivityRemark);
return tActivityRemarkMapper.insert(tActivityRemark);
}
@Override
public PageInfo<TActivityRemark> getActivityRemarkByPage(Integer current,ActivityRemarkQuery activityRemarkQuery) {
// 设置PageHelper和分页情况
PageHelper.startPage(current, Constants.PAGE_SIZE);
List<TActivityRemark> list = tActivityRemarkMapper.selectActivityRemarkByPage(activityRemarkQuery);
PageInfo<TActivityRemark> info = new PageInfo<>(list);
return info;
}
@Override
public int updateActivityRemark(ActivityRemarkQuery activityRemarkQuery) {
TActivityRemark tActivityRemark = new TActivityRemark();
BeanUtils.copyProperties(activityRemarkQuery,tActivityRemark);
tActivityRemark.setEditTime(new Date());
tActivityRemark.setEditBy(JWTUtils.parseUserFromJWT(activityRemarkQuery.getToken()).getId());
return tActivityRemarkMapper.updateByPrimaryKeySelective(tActivityRemark);
}
@Override
public int deleteActivtyRemarkById(Integer id) {
// 修改删除状态法,可恢复
// TActivityRemark tActivityRemark = new TActivityRemark();
// tActivityRemark.setId(id);
// tActivityRemark.setDeleted(1);
// return tActivityRemarkMapper.updateByPrimaryKeySelective(tActivityRemark);
return tActivityRemarkMapper.deleteByPrimaryKey(id);
}
// @Override
// public TActivityRemark getActivityRemarkById(Integer id) {
// return tActivityRemarkMapper.selectByPrimaryKey(id);
// }
}