You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
148 lines
7.0 KiB
Java
148 lines
7.0 KiB
Java
3 years ago
|
package com.ibeetl.jlw.service;
|
||
|
|
||
|
import cn.jlw.util.ToolUtils;
|
||
|
import com.alibaba.fastjson.JSON;
|
||
|
import com.alibaba.fastjson.JSONObject;
|
||
|
import com.ibeetl.admin.core.service.CoreBaseService;
|
||
|
import com.ibeetl.admin.core.util.PlatformException;
|
||
|
import com.ibeetl.admin.core.web.JsonResult;
|
||
|
import com.ibeetl.admin.core.web.JsonReturnCode;
|
||
|
import com.ibeetl.jlw.dao.TeacherOpenCourseStudentSigninLogDao;
|
||
|
import com.ibeetl.jlw.entity.TeacherOpenCourseStudentSigninLog;
|
||
|
import com.ibeetl.jlw.web.query.TeacherOpenCourseStudentSigninLogQuery;
|
||
|
import org.apache.commons.lang3.StringUtils;
|
||
|
import org.beetl.sql.core.SqlId;
|
||
|
import org.beetl.sql.core.engine.PageQuery;
|
||
|
import org.springframework.stereotype.Service;
|
||
|
import org.springframework.transaction.annotation.Transactional;
|
||
|
|
||
|
import javax.annotation.Resource;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.List;
|
||
|
|
||
|
/**
|
||
|
* 学生签到记录 Service
|
||
|
* 当分布式ID开启后请勿使用insert(*,true)
|
||
|
*/
|
||
|
|
||
|
@Service
|
||
|
@Transactional
|
||
|
public class TeacherOpenCourseStudentSigninLogService extends CoreBaseService<TeacherOpenCourseStudentSigninLog>{
|
||
|
|
||
|
@Resource private TeacherOpenCourseStudentSigninLogDao teacherOpenCourseStudentSigninLogDao;
|
||
|
|
||
|
public PageQuery<TeacherOpenCourseStudentSigninLog>queryByCondition(PageQuery query){
|
||
|
PageQuery ret = teacherOpenCourseStudentSigninLogDao.queryByCondition(query);
|
||
|
queryListAfter(ret.getList());
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
public PageQuery<TeacherOpenCourseStudentSigninLog>queryByConditionQuery(PageQuery query){
|
||
|
PageQuery ret = teacherOpenCourseStudentSigninLogDao.queryByConditionQuery(query);
|
||
|
queryListAfter(ret.getList());
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
public void deleteByList(List list){
|
||
|
String ids = "";
|
||
|
ToolUtils.deleteNullList(list);
|
||
|
for(int i=0;null != list && i<list.size();i++){
|
||
|
ids += list.get(i).toString()+(i==list.size()-1?"":",");
|
||
|
}
|
||
|
if(StringUtils.isNotBlank(ids)){
|
||
|
teacherOpenCourseStudentSigninLogDao.deleteTeacherOpenCourseStudentSigninLogByIds(ids);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void deleteTeacherOpenCourseStudentSigninLog(String ids){
|
||
|
try {
|
||
|
teacherOpenCourseStudentSigninLogDao.deleteTeacherOpenCourseStudentSigninLogByIds(ids);
|
||
|
} catch (Exception e) {
|
||
|
throw new PlatformException("批量删除学生签到记录失败", e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public String addAll(TeacherOpenCourseStudentSigninLogQuery teacherOpenCourseStudentSigninLogQuery){
|
||
|
String msg = "";
|
||
|
List<TeacherOpenCourseStudentSigninLog> teacherOpenCourseStudentSigninLogList = new ArrayList<>();
|
||
|
try {
|
||
|
teacherOpenCourseStudentSigninLogList = JSON.parseArray(teacherOpenCourseStudentSigninLogQuery.getTeacherOpenCourseStudentSigninLogJsonStr(), TeacherOpenCourseStudentSigninLog.class);
|
||
|
} catch (Exception e) {
|
||
|
try {
|
||
|
teacherOpenCourseStudentSigninLogList.add(JSONObject.parseObject(teacherOpenCourseStudentSigninLogQuery.getTeacherOpenCourseStudentSigninLogJsonStr(), TeacherOpenCourseStudentSigninLog.class));
|
||
|
} catch (Exception e1) {}
|
||
|
}
|
||
|
ToolUtils.deleteNullList(teacherOpenCourseStudentSigninLogList);
|
||
|
if(null != teacherOpenCourseStudentSigninLogList && teacherOpenCourseStudentSigninLogList.size()>0){
|
||
|
for(int i=0;i<teacherOpenCourseStudentSigninLogList.size();i++){
|
||
|
TeacherOpenCourseStudentSigninLog teacherOpenCourseStudentSigninLog = teacherOpenCourseStudentSigninLogList.get(i);
|
||
|
teacherOpenCourseStudentSigninLog.setUserId(teacherOpenCourseStudentSigninLogQuery.getUserId());
|
||
|
teacherOpenCourseStudentSigninLog.setOrgId(teacherOpenCourseStudentSigninLogQuery.getOrgId());
|
||
|
}
|
||
|
insertBatch(teacherOpenCourseStudentSigninLogList);
|
||
|
}
|
||
|
return msg;
|
||
|
}
|
||
|
|
||
|
public JsonResult add(TeacherOpenCourseStudentSigninLogQuery teacherOpenCourseStudentSigninLogQuery){
|
||
|
String msg = "";
|
||
|
TeacherOpenCourseStudentSigninLog teacherOpenCourseStudentSigninLog = teacherOpenCourseStudentSigninLogQuery.pojo();
|
||
|
teacherOpenCourseStudentSigninLogDao.insert(teacherOpenCourseStudentSigninLog);
|
||
|
teacherOpenCourseStudentSigninLogQuery.setTeacherOpenCourseStudentSigninId(teacherOpenCourseStudentSigninLog.getTeacherOpenCourseStudentSigninId());
|
||
|
JsonResult jsonResult = new JsonResult();
|
||
|
jsonResult.setData(teacherOpenCourseStudentSigninLog.getTeacherOpenCourseStudentSigninId());//自增的ID丢进去
|
||
|
jsonResult.setCode(JsonReturnCode.SUCCESS.getCode());
|
||
|
jsonResult.setMsg(msg);
|
||
|
return jsonResult;
|
||
|
}
|
||
|
|
||
|
public String edit(TeacherOpenCourseStudentSigninLogQuery teacherOpenCourseStudentSigninLogQuery){
|
||
|
String msg = "";
|
||
|
TeacherOpenCourseStudentSigninLog teacherOpenCourseStudentSigninLog = teacherOpenCourseStudentSigninLogQuery.pojo();
|
||
|
teacherOpenCourseStudentSigninLogDao.updateTemplateById(teacherOpenCourseStudentSigninLog);
|
||
|
return msg;
|
||
|
}
|
||
|
|
||
|
public String updateGivenByIds(TeacherOpenCourseStudentSigninLogQuery teacherOpenCourseStudentSigninLogQuery){
|
||
|
String msg = "";
|
||
|
if(StringUtils.isNotBlank(teacherOpenCourseStudentSigninLogQuery.get_given())){
|
||
|
boolean flag = teacherOpenCourseStudentSigninLogDao.updateGivenByIds(teacherOpenCourseStudentSigninLogQuery) > 0;
|
||
|
if(!flag){
|
||
|
msg = "更新指定参数失败";
|
||
|
}
|
||
|
}else{
|
||
|
msg = "指定参数为空";
|
||
|
}
|
||
|
return msg;
|
||
|
}
|
||
|
|
||
|
public List<TeacherOpenCourseStudentSigninLog> getValues (Object paras){
|
||
|
return sqlManager.select(SqlId.of("jlw.teacherOpenCourseStudentSigninLog.getTeacherOpenCourseStudentSigninLogValues"), TeacherOpenCourseStudentSigninLog.class, paras);
|
||
|
}
|
||
|
|
||
|
public List<TeacherOpenCourseStudentSigninLog> getValuesByQuery (TeacherOpenCourseStudentSigninLogQuery teacherOpenCourseStudentSigninLogQuery){
|
||
|
return teacherOpenCourseStudentSigninLogDao.getValuesByQuery(teacherOpenCourseStudentSigninLogQuery);
|
||
|
}
|
||
|
|
||
|
public TeacherOpenCourseStudentSigninLog getInfo (Long teacherOpenCourseStudentSigninId){
|
||
|
TeacherOpenCourseStudentSigninLogQuery teacherOpenCourseStudentSigninLogQuery = new TeacherOpenCourseStudentSigninLogQuery();
|
||
|
teacherOpenCourseStudentSigninLogQuery.setTeacherOpenCourseStudentSigninId(teacherOpenCourseStudentSigninId);
|
||
|
List<TeacherOpenCourseStudentSigninLog> list = teacherOpenCourseStudentSigninLogDao.getValuesByQuery(teacherOpenCourseStudentSigninLogQuery);
|
||
|
if(null != list && list.size()>0){
|
||
|
return list.get(0);
|
||
|
}else{
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public TeacherOpenCourseStudentSigninLog getInfo (TeacherOpenCourseStudentSigninLogQuery teacherOpenCourseStudentSigninLogQuery){
|
||
|
List<TeacherOpenCourseStudentSigninLog> list = teacherOpenCourseStudentSigninLogDao.getValuesByQuery(teacherOpenCourseStudentSigninLogQuery);
|
||
|
if(null != list && list.size()>0){
|
||
|
return list.get(0);
|
||
|
}else{
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|