测试事务

beetlsql3-dev
Mlxa0324
parent 26abcb0c24
commit c2d2486500

@ -9,6 +9,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.jlw.util.ToolUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.dynamic.datasource.annotation.Master;
import com.ibeetl.admin.core.service.CoreBaseService;
@ -26,6 +27,7 @@ import com.ibeetl.jlw.web.query.TeacherOpenCourseScheduleSessionQuery;
import org.apache.commons.lang3.StringUtils;
import org.beetl.sql.core.SqlId;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -48,6 +50,9 @@ public class TeacherOpenCourseScheduleSessionService extends CoreBaseService<Tea
@Resource private TeacherOpenCourseScheduleSessionDao teacherOpenCourseScheduleSessionDao;
@Lazy
@Resource TeacherOpenCourseScheduleSessionService teacherOpenCourseScheduleSessionService;
@Master
public PageQuery<TeacherOpenCourseScheduleSession>queryByCondition(PageQuery query){
PageQuery ret = teacherOpenCourseScheduleSessionDao.queryByCondition(query);
@ -102,6 +107,7 @@ public class TeacherOpenCourseScheduleSessionService extends CoreBaseService<Tea
return msg;
}
@Master
public JsonResult add(TeacherOpenCourseScheduleSessionQuery teacherOpenCourseScheduleSessionQuery){
String msg = "";
TeacherOpenCourseScheduleSession teacherOpenCourseScheduleSession = teacherOpenCourseScheduleSessionQuery.pojo();
@ -114,6 +120,22 @@ public class TeacherOpenCourseScheduleSessionService extends CoreBaseService<Tea
return jsonResult;
}
@DS("ds2")
public JsonResult mAdd(TeacherOpenCourseScheduleSessionQuery teacherOpenCourseScheduleSessionQuery){
String msg = "";
TeacherOpenCourseScheduleSession teacherOpenCourseScheduleSession = teacherOpenCourseScheduleSessionQuery.pojo();
teacherOpenCourseScheduleSessionDao.insert(teacherOpenCourseScheduleSession);
teacherOpenCourseScheduleSessionQuery.setTeacherOpenCourseScheduleSessionId(teacherOpenCourseScheduleSession.getTeacherOpenCourseScheduleSessionId());
JsonResult jsonResult = new JsonResult();
jsonResult.setData(teacherOpenCourseScheduleSession.getTeacherOpenCourseScheduleSessionId());//自增的ID丢进去
jsonResult.setCode(JsonReturnCode.SUCCESS.getCode());
jsonResult.setMsg(msg);
if(1==1){
throw new RuntimeException("模拟异常");
}
return jsonResult;
}
public String edit(TeacherOpenCourseScheduleSessionQuery teacherOpenCourseScheduleSessionQuery){
String msg = "";
TeacherOpenCourseScheduleSession teacherOpenCourseScheduleSession = teacherOpenCourseScheduleSessionQuery.pojo();

@ -159,7 +159,9 @@ public class TeacherOpenCourseScheduleSessionController{
if(null == teacherOpenCourseScheduleSessionQuery.getTeacherOpenCourseScheduleSessionStatus()){
teacherOpenCourseScheduleSessionQuery.setTeacherOpenCourseScheduleSessionStatus(1);
}
return teacherOpenCourseScheduleSessionService.add(teacherOpenCourseScheduleSessionQuery);
teacherOpenCourseScheduleSessionService.add(teacherOpenCourseScheduleSessionQuery);
teacherOpenCourseScheduleSessionService.mAdd(teacherOpenCourseScheduleSessionQuery);
return JsonResult.success();
}
}

@ -5,8 +5,8 @@ layui.define([], function(exports) {
Lib.submitForm("/jlw/teacherOpenCourseScheduleSession/edit.json",form,{},callback)
},
addTeacherOpenCourseScheduleSession:function(form,callback){
// Lib.submitForm("/jlw/teacherOpenCourseScheduleSession/add.json",form,{},callback)
Lib.submitForm("/jlw/teacherOpenCourseScheduleSession/addSession.json",form,{},callback)
Lib.submitForm("/jlw/teacherOpenCourseScheduleSession/add.json",form,{},callback)
// Lib.submitForm("/jlw/teacherOpenCourseScheduleSession/addSession.json",form,{},callback)
},
del:function(ids,callback){
Common.post("/jlw/teacherOpenCourseScheduleSession/delete.json",{"ids":ids},function(){

Loading…
Cancel
Save