xiaoyong931011
2021-08-04 ea868a98b776b9e89db429a195704a1412ca8905
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.xzx.gc.user.service;
 
import cn.hutool.core.convert.Convert;
import com.xzx.gc.common.constant.Constants;
import com.xzx.gc.entity.UserVehicleRel;
import com.xzx.gc.user.mapper.UserVehicleRelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
 
@Service
@Transactional
public class UserVehicleRelService {
 
    @Autowired
    private UserVehicleRelMapper userVehicleRelMapper;
 
    public void save(UserVehicleRel rel) {
        userVehicleRelMapper.insertSelective(rel);
    }
 
    public UserVehicleRel queryById(long l) {
        return userVehicleRelMapper.selectByPrimaryKey(l);
 
    }
 
    public boolean update(UserVehicleRel rel) {
        return userVehicleRelMapper.updateByPrimaryKeySelective(rel)>0?true:false;
    }
 
 
    public void deleteByUserId(String userId){
        UserVehicleRel userVehicleRel=new UserVehicleRel();
        userVehicleRel.setDelFlag(Convert.toShort(Constants.DEL_FLAG));
 
        Example example=new Example(UserVehicleRel.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("userId",userId);
        userVehicleRelMapper.updateByExampleSelective(userVehicleRel,example);
    }
 
}