CRM项目后端实现删除线索备注及修改线索备注------CRM项目

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);
//    }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值