Blame view

parking-module-system/src/main/java/com/zteits/sys/dao/impl/SysJobFuncDaoImpl.java 3.39 KB
55f68655   王彪总   新项目
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
  package com.zteits.sys.dao.impl;
  
  import java.util.List;
  
  import com.github.pagehelper.PageHelper;
  import com.github.pagehelper.PageInfo;
  import com.zteits.clouds.api.dto.sys.param.QueryRolesByJobIdRequest;
  import com.zteits.clouds.api.dto.sys.param.RoleJobFunByJobFunIdSaveRequest;
  import com.zteits.clouds.api.dto.sys.param.RoleJobFunByRoleIdSaveRequest;
  import com.zteits.clouds.api.dto.sys.param.SysJobFuncPageQueryRequest;
  import com.zteits.sys.dao.SysJobFuncDao;
  import com.zteits.sys.domain.SysJobfunc;
  import com.zteits.sys.domain.SysRole;
  import com.zteits.sys.mapper.SysJobfuncMapper;
  import com.zteits.sys.mapper.smapper.SysJobfuncSMapper;
  import org.springframework.beans.BeanUtils;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Component;
  import org.springframework.util.CollectionUtils;
  
  @Component
  public class SysJobFuncDaoImpl implements SysJobFuncDao {
      @Autowired
      private SysJobfuncMapper sysJobfuncMapper;
      @Autowired
      private SysJobfuncSMapper sysJobfuncSMapper;
  
      @Override
      public Boolean deleteSysJobFuncByIds(List<Long> ids) {
          if (CollectionUtils.isEmpty(ids)) {
              return true;
          }
          if (ids.size() == 1) {
              return sysJobfuncMapper.deleteByPrimaryKey(ids.get(0)) >= 0;
          }
          return sysJobfuncSMapper.deleteBatchForLogicByPrimaryKey(ids) >= 0;
      }
  
      @Override
      public Boolean saveSysJobFunc(SysJobfunc sysJobfunc) {
          return sysJobfuncSMapper.saveSysJobFunc(sysJobfunc) > 0;
      }
  
      @Override
      public Boolean updateSysJobFuncById(SysJobfunc sysJobfunc) {
          return sysJobfuncMapper.updateByPrimaryKeySelective(sysJobfunc) > 0;
      }
  
      @Override
      public PageInfo<SysJobfunc> pageQuerySysJobfunc(SysJobFuncPageQueryRequest request) {
          SysJobfunc sysJobfunc = new SysJobfunc();
          BeanUtils.copyProperties(request, sysJobfunc);
          sysJobfunc.setId(request.getJobfuncId());
          sysJobfunc.setSysCode(request.getSysCode());
          // 1.设置分页信息
          PageHelper.startPage(request.getBaseRequest().getPageNum(), request.getBaseRequest().getPageSize());
          //2.查询数据
          List<SysJobfunc> list = sysJobfuncSMapper.querySysJobfunConditionForList(sysJobfunc,
              request.getStartCreateTime(), request.getEndCreateTime());
          return new PageInfo<SysJobfunc>(list);
      }
  
      @Override
      public SysJobfunc getSysJobFuncById(Long id) {
          return sysJobfuncMapper.selectByPrimaryKey(id);
      }
  
  	@Override
  	public List<SysRole> queryRolesByJobId(QueryRolesByJobIdRequest queryRolesByJobIdRequest) {
  		return sysJobfuncSMapper.queryRolesByJobId(queryRolesByJobIdRequest);
  	}
  
  	@Override
  	public Boolean updateJobFunOrgIdByRoleOrgIg(RoleJobFunByJobFunIdSaveRequest roleJobFunByJobFunIdSaveRequest) {
  		SysJobfunc record = new SysJobfunc();
  		record.setId(roleJobFunByJobFunIdSaveRequest.getJobFunId());
  		record.setOrgId(roleJobFunByJobFunIdSaveRequest.getOrgId());
  		Integer updateCount = sysJobfuncMapper.updateByPrimaryKeySelective(record);
  		return updateCount >0 ? true :false;
  	}
  	
  	@Override
  	public Boolean updateJobFunOrgIdByRoleOrgIgs(RoleJobFunByRoleIdSaveRequest roleJobFunByJobFunIdSaveRequest) {
  	    Integer updateCount = sysJobfuncSMapper.updateJobFunOrgIdByRoleOrgIgs(
  	            roleJobFunByJobFunIdSaveRequest.getJobFunIds(),roleJobFunByJobFunIdSaveRequest.getOrgId());
  	    return updateCount >0 ? true :false;
  	}
  
  }