|
|
@@ -0,0 +1,111 @@
|
|
|
+package com.goafanti.LectureUser.service.impl;
|
|
|
+
|
|
|
+import java.util.Calendar;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import com.goafanti.LectureUser.bo.LectureUserListBo;
|
|
|
+import com.goafanti.LectureUser.service.LectureUserService;
|
|
|
+import com.goafanti.common.dao.LectureUserMapper;
|
|
|
+import com.goafanti.common.model.LectureUser;
|
|
|
+import com.goafanti.common.model.LectureUserKey;
|
|
|
+import com.goafanti.common.utils.StringUtils;
|
|
|
+import com.goafanti.core.mybatis.BaseMybatisDao;
|
|
|
+import com.goafanti.core.mybatis.page.Pagination;
|
|
|
+import com.goafanti.core.shiro.token.TokenManager;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class LectureUserServiceImpl extends BaseMybatisDao<LectureUserMapper> implements LectureUserService {
|
|
|
+ @Autowired
|
|
|
+ private LectureUserMapper lectureUserMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void save(Long lid) {
|
|
|
+ LectureUser lu = new LectureUser();
|
|
|
+ lu.setLid(lid);
|
|
|
+ lu.setUid(TokenManager.getUserId());
|
|
|
+ Calendar now = Calendar.getInstance();
|
|
|
+ now.set(Calendar.MILLISECOND, 0);
|
|
|
+ lu.setCreateTime(now.getTime());
|
|
|
+ lu.setLastUpdateTime(lu.getCreateTime());
|
|
|
+ lectureUserMapper.insert(lu);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int update(LectureUser lu) {
|
|
|
+ Calendar now = Calendar.getInstance();
|
|
|
+ now.set(Calendar.MILLISECOND, 0);
|
|
|
+ lu.setLastUpdateTime(now.getTime());
|
|
|
+ return lectureUserMapper.updateByPrimaryKeySelective(lu);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int batchDeleteByPrimaryKey(List<String> id) {
|
|
|
+ return lectureUserMapper.batchDeleteByPrimaryKey(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public LectureUser selectByPrimaryKey(LectureUserKey key) {
|
|
|
+ return lectureUserMapper.selectByPrimaryKey(key);
|
|
|
+ }
|
|
|
+
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ @Override
|
|
|
+ public Pagination<LectureUserListBo> listLectureUser(String lectureName, String mobile, String username,
|
|
|
+ Integer number, Integer pSize, Integer pNo) {
|
|
|
+ if (pNo == null || pNo < 0) {
|
|
|
+ pNo = 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (pSize == null || pSize < 0 || pSize > 10) {
|
|
|
+ pSize = 10;
|
|
|
+ }
|
|
|
+ return (Pagination<LectureUserListBo>) findPage("findActivityUserListByPage", "findActivityUserCount",
|
|
|
+ disposeLectureList(lectureName, mobile, number, username, null), pNo, pSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ @Override
|
|
|
+ public Pagination<LectureUserListBo> listLectureOrg(String lectureName, String mobile, String unitName,
|
|
|
+ Integer number, Integer pSize, Integer pNo) {
|
|
|
+ if (pNo == null || pNo < 0) {
|
|
|
+ pNo = 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (pSize == null || pSize < 0 || pSize > 10) {
|
|
|
+ pSize = 10;
|
|
|
+ }
|
|
|
+ return (Pagination<LectureUserListBo>) findPage("findActivityOrgListByPage", "findActivityOrgCount",
|
|
|
+ disposeLectureList(lectureName, mobile, number, null, unitName), pNo, pSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map<String, Object> disposeLectureList(String lectureName, String mobile, Integer number, String username,
|
|
|
+ String unitName) {
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(mobile)) {
|
|
|
+ params.put("mobile", mobile);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null != number) {
|
|
|
+ params.put("number", number);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(lectureName)) {
|
|
|
+ params.put("lectureName", lectureName);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(username)) {
|
|
|
+ params.put("username", username);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(unitName)) {
|
|
|
+ params.put("unitName", unitName);
|
|
|
+ }
|
|
|
+ return params;
|
|
|
+ }
|
|
|
+}
|