| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- package com.goafanti.copyright.service.impl;
- import java.util.Calendar;
- import java.util.List;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import com.goafanti.common.dao.CopyrightInfoMapper;
- import com.goafanti.common.dao.CopyrightLogMapper;
- import com.goafanti.common.model.CopyrightInfo;
- import com.goafanti.common.model.CopyrightLog;
- import com.goafanti.copyright.service.CopyrightInfoService;
- import com.goafanti.core.mybatis.BaseMybatisDao;
- import com.goafanti.core.shiro.token.TokenManager;
- @Service
- public class CopyrightInfoServiceImpl extends BaseMybatisDao<CopyrightInfoMapper> implements CopyrightInfoService {
- @Autowired
- private CopyrightInfoMapper copyrightInfoMapper;
- @Autowired
- private CopyrightLogMapper copyrightLogMapper;
- @Override
- public CopyrightInfo insert(CopyrightInfo copyrightInfo) {
- Calendar now = Calendar.getInstance();
- now.set(Calendar.MILLISECOND, 0);
- copyrightInfo.setCreateTime(now.getTime());
- CopyrightLog log = new CopyrightLog();
- log.setCid(copyrightInfo.getId());
- log.setRecordTime(copyrightInfo.getCreateTime());
- log.setComment(copyrightInfo.getComment());
- log.setOperator(TokenManager.getAdminId());
- log.setPrincipal(copyrightInfo.getPrincipal());
- log.setStatus(copyrightInfo.getStatus());
- copyrightInfoMapper.insertSelective(copyrightInfo);
- copyrightLogMapper.insertSelective(log);
- return copyrightInfo;
- }
- @Override
- public void updateByPrimaryKeySelective(CopyrightInfo copyrightInfo, CopyrightLog copyrightLog) {
- copyrightInfoMapper.updateByPrimaryKeySelective(copyrightInfo);
- if (copyrightLog.getRecordTime() != null && copyrightLog.getStatus() != null
- && copyrightLog.getPrincipal() != null) {
- copyrightLogMapper.insertSelective(copyrightLog);
- }
- }
- @Override
- public CopyrightInfo selectByPrimaryKey(String id) {
- return copyrightInfoMapper.selectByPrimaryKey(id);
- }
- @Override
- public int batchDeleteByPrimaryKey(List<String> id) {
- return 0;
- }
- }
|