Commit 1aa02a49 authored by 李博今's avatar 李博今

增加年级,教学班,节点

更新分页查询
parent 60653c01
......@@ -389,6 +389,11 @@
<artifactId>eduLk</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.44</version>
</dependency>
</dependencies>
......
......@@ -37,6 +37,14 @@ public class BClass extends IdEntity<BClass> {
@NotBlank
private String studentNum;
/*班级类型*/
@Length(min = 1,max = 1,message = "长度为1")
@NotBlank
private String type;
/*学年ID*/
private String gradeId;
public BClass(String code) {
this.code = code;
}
......
package org.rcisoft.business.bcoursecode.controller;
/*固定导入*/
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import jdk.nashorn.internal.ir.annotations.Ignore;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.rcisoft.core.result.Result;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.common.controller.PaginationController;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.common.model.GridModel;
import org.rcisoft.core.exception.ServiceException;
import javax.validation.Valid;
import org.rcisoft.business.bcoursecode.entity.BCourseCode;
import org.rcisoft.business.bcoursecode.service.BCourseCodeService;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
/**
* Created by on 2018-4-17 11:12:17.
*/
@RestController
@RequestMapping("/bcoursecode")
public class BCourseCodeController extends PaginationController<BCourseCode> {
@Autowired
private BCourseCodeService bCourseCodeServiceImpl;
@ApiOperation(value="修改", notes="修改")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId,拼在地址栏中", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "flag", value = "激活标志位 length(1)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "seq", value = "节点顺序 length(1~10)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "start_date", value = "开始时间 length(1~50)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "end_date", value = "结束时间 length(1~50)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "date_desc", value = "节点描述 length(1)", required = false, dataType = "varchar")
})
@PutMapping("/update/{businessId}")
@PreAuthorize("hasRole('ROLE_1001')")
public Result update(@ApiIgnore BCourseCode bCourseCode, BindingResult bindingResult) {
bCourseCode.setToken(getToken());
PersistModel data = bCourseCodeServiceImpl.merge(bCourseCode);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bCourseCode);
}
@ApiOperation(value="查看集合", notes="查看集合")
@ApiImplicitParams({@ApiImplicitParam(name = "rows", value = "每页显示多少行(若不传默认为前10条)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "page", value = "第几页(若不传默认为前10条)", required = false, dataType = "varchar")
})
@GetMapping(value = "/queryBCourseCode")
@PreAuthorize("hasRole('ROLE_1001')")
public Result listByPagination(@ApiIgnore BCourseCode bCourseCode) {
bCourseCode.setCreateBy(UserUtil.getUserInfoProp(getToken(),UserUtil.USER_ID));
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bCourseCodeServiceImpl.findAll(bCourseCode));
}
}
package org.rcisoft.business.bcoursecode.dao;
import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.business.bcoursecode.entity.BCourseCode;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created with on 2018-4-17 11:12:17.
*/
@Repository
public interface BCourseCodeRepository extends BaseMapper<BCourseCode> {
/**
* 分页查询 bCourseCode
*
*/
@Select("<script>select * from b_course_code where 1=1 "
+ "<if test=\"delFlag !=null and delFlag != '' \">and del_flag = #{delFlag} </if> "
+ "<if test=\"flag !=null and flag != '' \">and flag = #{flag} </if> "
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<BCourseCode> queryBCourseCodes(BCourseCode bCourseCode);
}
package org.rcisoft.business.bcoursecode.entity;
import lombok.*;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.rcisoft.core.entity.IdEntity;
import javax.persistence.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* Created with on 2018-4-17 11:12:17.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "b_course_code")
public class BCourseCode extends IdEntity<BCourseCode> {
/*节点顺序*/
@Length(min = 1,max = 10,message = "长度最小为1,最大为10")
@NotBlank
private Integer seq;
/*开始时间*/
@Length(min = 1,max = 50,message = "长度最小为1,最大为50")
@NotBlank
private String startDate;
/*结束时间*/
@Length(min = 1,max = 50,message = "长度最小为1,最大为50")
@NotBlank
private String endDate;
/*节点描述*/
@Length(min = 1,max = 1,message = "长度为1")
@NotBlank
private String dateDesc;
public String getDateDesc(){
switch (this.dateDesc) {
case "0":
return "上午";
case "1":
return "下午";
default:
return "晚上";
}
}
}
package org.rcisoft.business.bcoursecode.service;
import org.rcisoft.business.bcoursecode.entity.BCourseCode;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.aop.PageUtil;
import java.util.List;
/**
* Created by on 2018-4-17 11:12:17.
*/
public interface BCourseCodeService {
/**
* 修改
* @param bCourseCode
* @return
*/
PersistModel merge(BCourseCode bCourseCode);
/**
* 分页查询
* @param bCourseCode
* @return
*/
List<BCourseCode> findAll(BCourseCode bCourseCode);
}
package org.rcisoft.business.bcoursecode.service.impl;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.business.bcoursecode.dao.BCourseCodeRepository;
import org.rcisoft.business.bcoursecode.entity.BCourseCode;
import org.rcisoft.business.bcoursecode.service.BCourseCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* Created by on 2018-4-17 11:12:17.
*/
@Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
@Slf4j
public class BCourseCodeServiceImpl implements BCourseCodeService {
@Autowired
private BCourseCodeRepository bCourseCodeRepository;
/**
* 修改 bCourseCode
* @param bCourseCode
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel merge(BCourseCode bCourseCode){
UserUtil.setCurrentMergeOperation(bCourseCode);
int line = bCourseCodeRepository.updateByPrimaryKeySelective(bCourseCode);
log.info(UserUtil.getUserInfoProp(bCourseCode.getToken(),UserUtil.USER_USERNAME)+"修改了ID为"+
bCourseCode.getBusinessId()+"的信息");
return new PersistModel(line);
}
/**
* 分页查询 bCourseCode
* @param bCourseCode
* @return
*/
public List<BCourseCode> findAll(BCourseCode bCourseCode){
bCourseCode.setStart();
bCourseCode.setNotDeleted();
return bCourseCodeRepository.queryBCourseCodes(bCourseCode);
}
}
package org.rcisoft.business.beduclass.controller;
/*固定导入*/
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.rcisoft.core.result.Result;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.common.controller.PaginationController;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.common.model.GridModel;
import org.rcisoft.core.exception.ServiceException;
import javax.validation.Valid;
import org.rcisoft.business.beduclass.entity.BEduClass;
import org.rcisoft.business.beduclass.service.BEduClassService;
import java.util.List;
/**
* Created by on 2018-4-17 14:33:36.
*/
@RestController
@RequestMapping("/beduclass")
public class BEduClassController extends PaginationController<BEduClass> {
@Autowired
private BEduClassService bEduClassServiceImpl;
@ApiOperation(value="添加", notes="添加")
@ApiImplicitParams({@ApiImplicitParam(name = "code", value = "教学班编码 length(1~40)", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "className", value = "教学班名 length(1~150)", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "agencyId", value = "企业ID", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "type", value = "班级类型", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "classedId", value = "教学班ID串", required = false, dataType = "varchar")})
@PostMapping(value = "/add")
@PreAuthorize("hasRole('ROLE_1001')")
public Result add(@Valid BEduClass bEduClass, BindingResult bindingResult) {
bEduClass.setToken(getToken());
PersistModel data = bEduClassServiceImpl.save(bEduClass);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bEduClass);
}
@ApiOperation(value="逻辑删除", notes="逻辑删除")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = false, dataType = "varchar")})
@DeleteMapping("/delete/{id:\\w+}")
@PreAuthorize("hasRole('ROLE_1001')")
public Result delete(@PathVariable String id) {
BEduClass bEduClass = new BEduClass();
bEduClass.setBusinessId(id);
bEduClass.setToken(getToken());
PersistModel data = bEduClassServiceImpl.remove(bEduClass);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
id);
}
@ApiOperation(value="修改", notes="修改")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "code", value = "教学班编码 length(1~40)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "className", value = "教学班名 length(1~150)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "agencyId", value = "企业ID", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "type", value = "班级类型 length(1)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "classedId", value = "教学班ID串 length(1~150)", required = false, dataType = "varchar")})
@PutMapping("/update/{businessId:\\w+}")
@PreAuthorize("hasRole('ROLE_1001')")
public Result update(BEduClass bEduClass, BindingResult bindingResult) {
bEduClass.setToken(getToken());
PersistModel data = bEduClassServiceImpl.merge(bEduClass);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bEduClass);
}
@ApiOperation(value="查看单 ", notes="查看单 ")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = false, dataType = "varchar")})
@GetMapping("/detail/{id:\\w+}")
@PreAuthorize("hasRole('ROLE_1001')")
public Result detail(@PathVariable String id) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bEduClassServiceImpl.findById(id));
}
@ApiOperation(value="查看 集合", notes="查看单 集合")
@ApiImplicitParams({@ApiImplicitParam(name = "rows", value = "每页显示多少行(若不传默认为前10条)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "page", value = "第几页(若不传默认为前10条)", required = false, dataType = "varchar")
})
@GetMapping(value = "/queryBEduClassByPagination")
@PreAuthorize("hasRole('ROLE_1001')")
public GridModel listByPagination(BEduClass bEduClass) {
bEduClass.setCreateBy(UserUtil.getUserInfoProp(getToken(),UserUtil.USER_ID));
bEduClassServiceImpl.findAllByPagination(getPaginationUtility(), bEduClass);
return getGridModelResponse();
}
}
package org.rcisoft.business.beduclass.dao;
import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.business.beduclass.entity.BEduClass;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created with on 2018-4-17 14:33:36.
*/
@Repository
public interface BEduClassRepository extends BaseMapper<BEduClass> {
/**
* 分页查询 bEduClass
*
*/
@Select("<script>select * from b_edu_class where 1=1 "
+ "<if test=\"delFlag !=null and delFlag != '' \">and del_flag = #{delFlag} </if> "
+ "<if test=\"flag !=null and flag != '' \">and flag = #{flag} </if> "
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<BEduClass> queryBEduClasss(BEduClass bEduClass);
}
package org.rcisoft.business.beduclass.entity;
import lombok.*;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.rcisoft.core.entity.IdEntity;
import javax.persistence.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* Created with on 2018-4-17 14:33:36.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "b_edu_class")
public class BEduClass extends IdEntity<BEduClass> {
/*教学班编号*/
@Length(min = 1,max = 50,message = "长度最小为1,最大为50")
@NotBlank
private String code;
/*教学班名*/
@Length(min = 1,max = 150,message = "长度最小为1,最大为50")
@NotBlank
private String className;
/*企业Id*/
private String agencyId;
/*教学班类型*/
private String type;
/*子班级ID串*/
private String classesId;
/*学年ID*/
private String gradeId;
}
package org.rcisoft.business.beduclass.service;
import org.rcisoft.business.beduclass.entity.BEduClass;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.aop.PageUtil;
import java.util.List;
/**
* Created by on 2018-4-17 14:33:36.
*/
public interface BEduClassService {
/**
* 保存
* @param bEduClass
* @return
*/
PersistModel save(BEduClass bEduClass);
/**
* 逻辑删除
* @param bEduClass
* @return
*/
PersistModel remove(BEduClass bEduClass);
/**
* 修改
* @param bEduClass
* @return
*/
PersistModel merge(BEduClass bEduClass);
/**
* 根据id查询
* @param id
* @return
*/
BEduClass findById(String id);
/**
* 分页查询
* @param bEduClass
* @return
*/
List<BEduClass> findAllByPagination(PageUtil<BEduClass> paginationUtility,
BEduClass bEduClass);
}
package org.rcisoft.business.beduclass.service.impl;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.business.beduclass.dao.BEduClassRepository;
import org.rcisoft.business.beduclass.entity.BEduClass;
import org.rcisoft.business.beduclass.service.BEduClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* Created by on 2018-4-17 14:33:36.
*/
@Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
@Slf4j
public class BEduClassServiceImpl implements BEduClassService {
@Autowired
private BEduClassRepository bEduClassRepository;
/**
* 保存 bEduClass
* @param bEduClass
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel save(BEduClass bEduClass){
bEduClass.setCommonBusinessId();
//增加操作
UserUtil.setCurrentPersistOperation(bEduClass);
int line = bEduClassRepository.insertSelective(bEduClass);
log.info(UserUtil.getUserInfoProp(bEduClass.getToken(),UserUtil.USER_USERNAME)+"新增了ID为"+
bEduClass.getBusinessId()+"的信息");
return new PersistModel(line);
}
/**
* 逻辑删除
* @param bEduClass
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel remove(BEduClass bEduClass){
UserUtil.setCurrentMergeOperation(bEduClass);
bEduClass.setDeleted();
int line = bEduClassRepository.logicalDelete(bEduClass);
log.info(UserUtil.getUserInfoProp(bEduClass.getToken(),UserUtil.USER_USERNAME)+"逻辑删除了ID为"+
bEduClass.getBusinessId()+"的信息");
return new PersistModel(line);
}
/**
* 修改 bEduClass
* @param bEduClass
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel merge(BEduClass bEduClass){
UserUtil.setCurrentMergeOperation(bEduClass);
int line = bEduClassRepository.updateByPrimaryKeySelective(bEduClass);
log.info(UserUtil.getUserInfoProp(bEduClass.getToken(),UserUtil.USER_USERNAME)+"修改了ID为"+
bEduClass.getBusinessId()+"的信息");
return new PersistModel(line);
}
/**
* 根据id查询 bEduClass
* @param id
* @return
*/
public BEduClass findById(String id){
return bEduClassRepository.selectByPrimaryKey(id);
}
/**
* 分页查询 bEduClass
* @param bEduClass
* @return
*/
public List<BEduClass> findAllByPagination(PageUtil<BEduClass> paginationUtility,
BEduClass bEduClass){
bEduClass.setStart();
bEduClass.setNotDeleted();
return bEduClassRepository.queryBEduClasss(bEduClass);
}
}
package org.rcisoft.business.bgrade.controller;
/*固定导入*/
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.rcisoft.core.result.Result;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.common.controller.PaginationController;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.common.model.GridModel;
import org.rcisoft.core.exception.ServiceException;
import javax.validation.Valid;
import org.rcisoft.business.bgrade.entity.BGrade;
import org.rcisoft.business.bgrade.service.BGradeService;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
/**
* Created by on 2018-4-17 15:09:18.
*/
@RestController
@RequestMapping("/bgrade")
public class BGradeController extends PaginationController<BGrade> {
@Autowired
private BGradeService bGradeServiceImpl;
@ApiOperation(value="添加", notes="添加")
@ApiImplicitParams({@ApiImplicitParam(name = "code", value = "年级编号 length(1~50)", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "name", value = "年级名称 length(1~150)", required = true, dataType = "varchar")})
@PostMapping(value = "/add")
@PreAuthorize("hasRole('ROLE_1001')")
public Result add(@ApiIgnore @Valid BGrade bGrade, BindingResult bindingResult) {
bGrade.setToken(getToken());
PersistModel data = bGradeServiceImpl.save(bGrade);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bGrade);
}
@ApiOperation(value="逻辑删除", notes="逻辑删除")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "varchar")})
@DeleteMapping("/delete/{id:\\w+}")
@PreAuthorize("hasRole('ROLE_1001')")
public Result delete(@PathVariable String id) {
BGrade bGrade = new BGrade();
bGrade.setBusinessId(id);
bGrade.setToken(getToken());
PersistModel data = bGradeServiceImpl.remove(bGrade);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
id);
}
@ApiOperation(value="修改", notes="修改")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId 拼在地址栏", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "code", value = "年级编号 length(1~50)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "name", value = "年级名称 length(1~150)", required = false, dataType = "varchar")})
@PutMapping("/update/{businessId:\\w+}")
@PreAuthorize("hasRole('ROLE_1001')")
public Result update(@ApiIgnore BGrade bGrade, BindingResult bindingResult) {
bGrade.setToken(getToken());
PersistModel data = bGradeServiceImpl.merge(bGrade);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bGrade);
}
@ApiOperation(value="查看单 ", notes="查看单 ")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId 拼在地址栏", required = true, dataType = "varchar")})
@GetMapping("/detail/{businessId:\\w+}")
@PreAuthorize("hasRole('ROLE_1001')")
public Result detail(@PathVariable String businessId) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bGradeServiceImpl.findById(businessId));
}
@ApiOperation(value="查看 集合", notes="查看单 集合")
@ApiImplicitParams({@ApiImplicitParam(name = "rows", value = "每页显示多少行(若不传默认为前10条)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "page", value = "第几页(若不传默认为前10条)", required = false, dataType = "varchar")
})
@GetMapping(value = "/queryBGradeByPagination")
@PreAuthorize("hasRole('ROLE_1001')")
public GridModel listByPagination(@ApiIgnore BGrade bGrade) {
bGrade.setCreateBy(UserUtil.getUserInfoProp(getToken(),UserUtil.USER_ID));
bGradeServiceImpl.findAllByPagination(getPaginationUtility(), bGrade);
return getGridModelResponse();
}
}
package org.rcisoft.business.bgrade.dao;
import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.business.bgrade.entity.BGrade;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created with on 2018-4-17 15:09:18.
*/
@Repository
public interface BGradeRepository extends BaseMapper<BGrade> {
/**
* 分页查询 bGrade
*
*/
@Select("<script>select * from b_grade where 1=1 "
+ "<if test=\"delFlag !=null and delFlag != '' \">and del_flag = #{delFlag} </if> "
+ "<if test=\"flag !=null and flag != '' \">and flag = #{flag} </if> "
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<BGrade> queryBGrades(BGrade bGrade);
}
package org.rcisoft.business.bgrade.entity;
import lombok.*;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.rcisoft.core.entity.IdEntity;
import javax.persistence.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* Created with on 2018-4-17 15:09:18.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "b_grade")
public class BGrade extends IdEntity<BGrade> {
/*年级编号*/
@NotBlank
@Length(min = 1,max = 50,message = "长度最小为1,最大为50")
private String code;
/*年级名称*/
@NotBlank
@Length(min = 1,max = 150,message = "长度最小为1,最大为150")
private String name;
}
package org.rcisoft.business.bgrade.service;
import org.rcisoft.business.bgrade.entity.BGrade;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.aop.PageUtil;
import java.util.List;
/**
* Created by on 2018-4-17 15:09:18.
*/
public interface BGradeService {
/**
* 保存
* @param bGrade
* @return
*/
PersistModel save(BGrade bGrade);
/**
* 逻辑删除
* @param bGrade
* @return
*/
PersistModel remove(BGrade bGrade);
/**
* 修改
* @param bGrade
* @return
*/
PersistModel merge(BGrade bGrade);
/**
* 根据id查询
* @param id
* @return
*/
BGrade findById(String id);
/**
* 分页查询
* @param bGrade
* @return
*/
List<BGrade> findAllByPagination(PageUtil<BGrade> paginationUtility,
BGrade bGrade);
}
package org.rcisoft.business.bgrade.service.impl;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.business.bgrade.dao.BGradeRepository;
import org.rcisoft.business.bgrade.entity.BGrade;
import org.rcisoft.business.bgrade.service.BGradeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* Created by on 2018-4-17 15:09:18.
*/
@Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
@Slf4j
public class BGradeServiceImpl implements BGradeService {
@Autowired
private BGradeRepository bGradeRepository;
/**
* 保存 bGrade
* @param bGrade
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel save(BGrade bGrade){
bGrade.setCommonBusinessId();
//增加操作
UserUtil.setCurrentPersistOperation(bGrade);
int line = bGradeRepository.insertSelective(bGrade);
log.info(UserUtil.getUserInfoProp(bGrade.getToken(),UserUtil.USER_USERNAME)+"新增了ID为"+
bGrade.getBusinessId()+"的信息");
return new PersistModel(line);
}
/**
* 逻辑删除
* @param bGrade
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel remove(BGrade bGrade){
UserUtil.setCurrentMergeOperation(bGrade);
bGrade.setDeleted();
int line = bGradeRepository.logicalDelete(bGrade);
log.info(UserUtil.getUserInfoProp(bGrade.getToken(),UserUtil.USER_USERNAME)+"逻辑删除了ID为"+
bGrade.getBusinessId()+"的信息");
return new PersistModel(line);
}
/**
* 修改 bGrade
* @param bGrade
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel merge(BGrade bGrade){
UserUtil.setCurrentMergeOperation(bGrade);
int line = bGradeRepository.updateByPrimaryKeySelective(bGrade);
log.info(UserUtil.getUserInfoProp(bGrade.getToken(),UserUtil.USER_USERNAME)+"修改了ID为"+
bGrade.getBusinessId()+"的信息");
return new PersistModel(line);
}
/**
* 根据id查询 bGrade
* @param id
* @return
*/
public BGrade findById(String id){
return bGradeRepository.selectByPrimaryKey(id);
}
/**
* 分页查询 bGrade
* @param bGrade
* @return
*/
public List<BGrade> findAllByPagination(PageUtil<BGrade> paginationUtility,
BGrade bGrade){
bGrade.setStart();
bGrade.setNotDeleted();
return bGradeRepository.queryBGrades(bGrade);
}
}
......@@ -34,6 +34,8 @@ public class Global {
@Value("${global.path.base_upload_server_location}")
private String BASE_UPLOAD_SERVER_LOCATION;
/*容器外路径*/
@Value("${global.path.physical_upload_server_location}")
private String PHYSICAL_UPLOAD_SERVER_LOCATION;
......
package org.rcisoft.common.controller;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.common.model.CommonPageGridModel;
import org.rcisoft.common.model.GridModel;
import org.rcisoft.core.model.DlswPageGridModel;
import org.rcisoft.core.util.DlswPageGridUtil;
import org.springframework.web.bind.annotation.ModelAttribute;
import javax.servlet.http.HttpServletRequest;
......@@ -15,6 +19,7 @@ import javax.servlet.http.HttpServletRequest;
* description: 分页初始化
*/
@Slf4j
public class PaginationController<T> extends ResponseController {
protected static final String PAGINATIONKEY = "pagination";
......@@ -36,8 +41,21 @@ public class PaginationController<T> extends ResponseController {
}
@ModelAttribute
private void setPagnationAttribute(HttpServletRequest request, Integer rows, Integer page, String sort) {
private void setPagnationAttribute(HttpServletRequest request,String gridPager, Integer rows, Integer page, String sort) {
PageUtil _paginationUtility = new PageUtil();
/*dlsw gridModel*/
if(StringUtils.isNotBlank(gridPager)) {
try {
DlswPageGridModel gridModel = DlswPageGridUtil.transform(gridPager);
_paginationUtility.setGridModel(gridModel);
_paginationUtility.setPageNum(gridModel.getNowPage());
_paginationUtility.setPageSize(gridModel.getPageSize());
request.setAttribute(PAGINATIONKEY, _paginationUtility);
return;
} catch (Exception e) {
log.error(e.getMessage());
}
}
if(rows != null && page != null && sort != null ) {
_paginationUtility.setPageNum(page.intValue());
_paginationUtility.setPageSize(rows.intValue());
......@@ -53,8 +71,8 @@ public class PaginationController<T> extends ResponseController {
_paginationUtility.setOrderBy(sort);
}
else{
_paginationUtility.setPageNum(INIT_ROWS);
_paginationUtility.setPageSize(INIT_PAGE);
_paginationUtility.setPageNum(INIT_PAGE);
_paginationUtility.setPageSize(INIT_ROWS);
}
request.setAttribute(PAGINATIONKEY, _paginationUtility);
......
package org.rcisoft.core.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.rcisoft.common.model.GridModel;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.dlsw.Column;
import org.rcisoft.core.model.dlsw.Condition;
import org.rcisoft.core.model.dlsw.Sort;
import java.util.List;
import java.util.Map;
/**
* service dlsw grid
* Created by lcy on 18/3/13.
*/
@Data
public class DlswPageGridModel implements GridModel {
private static final long serialVersionUID = -13317137312873392L;
/**
* 是否出错
*/
@JsonProperty(value = "isSuccess")
private boolean isSuccess;
/**
* 每页显示条数
*/
private int pageSize;
/**
* 开始记录数
*/
private int startRecord;
/**
* 当前页数
*/
private int nowPage;
/**
* 记录总数
*/
private long recordCount;
/**
* 总页数
*/
private int pageCount;
/**
* 参数列表
*/
private Map<String, Object> parameters;
/**
* 快速查询参数列表
*/
private Map<String, Object> fastQueryParameters;
/**
* 高级查询列表
*/
private List<Condition> advanceQueryConditions;
/**
* 高级排序列表
*/
private List<Sort> advanceQuerySorts;
/**
* 显示数据集
*/
//private List<Map<String, Object>> exhibitDatas;
private List<Object> exhibitDatas;
/**
* 是否导出:1-是,0-否
*/
@JsonProperty(value = "isExport")
private boolean isExport;
/**
* 导出类型,支持excel、pdf、txt、cvs
*/
private String exportType;
/**
* 导出文件名
*/
private String exportFileName;
/**
* 导出列
*/
private List<Column> exportColumns;
/**
* 全部数据导出
*/
private boolean exportAllData;
/**
* 导出数据是否已被加工
*/
private boolean exportDataIsProcessed;
/**
* 导出数据
*/
private List<Map<String, Object>> exportDatas;
/**
* 复制数据
* @param paginationUtility
*/
public void setPageData(PageUtil paginationUtility) {
this.exhibitDatas = paginationUtility.getList();
this.isSuccess = true;
this.nowPage = paginationUtility.getPageNum();
this.pageSize = paginationUtility.getPageSize();
this.pageCount = paginationUtility.getPages();
this.recordCount = paginationUtility.getTotal();
this.startRecord = paginationUtility.getStartRow();
}
}
package org.rcisoft.core.model.dlsw;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Map;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Column implements Serializable {
private static final long serialVersionUID = 4593380846718461149L;
/**
* 编号
*/
private String id;
/**
* 是否参与高级查询
*/
private String search;
/**
* 是否作为导出列导出[default:true]
*/
private boolean export = true;
/**
* 是否作为打印列打印[default:true]
*/
private boolean print = true;
/**
* 是否作为扩展列隐藏备用[default:true(对于自定义的复选或相关操作内容,请设置为false以免数据冲突)]
*/
private boolean extra = true;
/**
* 显示的列名
*/
private String title;
/**
* 数据类型
*/
private String type;
/**
* 格式化
*/
private String format;
/**
* 原始数据类型
*/
private String otype;
/**
* 原始格式
*/
private String oformat;
/**
* 码表映射,用于高级查询及显示
*/
private Map<String, Object> codeTable;
/**
* 列样式
*/
private String columnStyle;
/**
* 列样式表
*/
private String columnClass;
/**
* 列头样式
*/
private String headerStyle;
/**
* 列头样式表
*/
private String headerClass;
/**
* 彻底隐藏
*/
private boolean hide = false;
/**
* 隐藏类别
*/
private String hideType;
/**
* 快速查询
*/
private boolean fastQuery;
/**
* 快速查询类别
*/
private String fastQueryType;
/**
* 高级查询
*/
private boolean advanceQuery;
/**
* 回调方法,参数:record value
*/
private String resolution;
}
package org.rcisoft.core.model.dlsw;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Condition implements Serializable {
private static final long serialVersionUID = -811804260626675487L;
/**
* 左括号
*/
private String left_parentheses;
/**
* 字段名称
*/
private String condition_field;
/**
* 条件
*/
private String condition_type;
/**
* 值
*/
private String condition_value;
/**
* 右括号
*/
private String right_parentheses;
/**
* 查询逻辑
*/
private String logic;
}
package org.rcisoft.core.model.dlsw;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Sort implements Serializable {
private static final long serialVersionUID = 6144460159065003975L;
/**
* 字段
*/
private String sort_field;
/**
* 排序逻辑
*/
private String sort_logic;
}
......@@ -52,14 +52,14 @@ public class JwtAuthenTokenFilter extends OncePerRequestFilter {
/**/
String lk = rcRedisServiceImpl.get("lk");
if(StringUtils.isBlank(lk) || !"1".equals(lk)){
if(permitRes==-1) {
Result result = new Result();
result.setCode(202);
ResponseUtil.responseResult(response, result);
return;
}
}
// if(StringUtils.isBlank(lk) || !"1".equals(lk)){
// if(permitRes==-1) {
// Result result = new Result();
// result.setCode(202);
// ResponseUtil.responseResult(response, result);
// return;
// }
// }
// 取得header
String authHeader = request.getHeader(this.tokenHeader);
//判断header头
......
package org.rcisoft.core.util;
import com.alibaba.fastjson.JSONObject;
import org.rcisoft.core.model.DlswPageGridModel;
import org.rcisoft.core.model.dlsw.Column;
import org.rcisoft.core.model.dlsw.Condition;
import org.rcisoft.core.model.dlsw.Sort;
import java.util.HashMap;
import java.util.Map;
/**
* Created by lcy on 18/3/13.
*
* product DlswPageGridModel
*/
@SuppressWarnings("rawtypes")
public class DlswPageGridUtil {
/**
* 将JSON对象映射为Pager对象
* @param jsonStr 原JSON对象
* @throws Exception
*/
public static DlswPageGridModel transform(String jsonStr) throws Exception{
Map<String, Class> classMap = new HashMap<String, Class>();
classMap.put("parameters", Map.class);
classMap.put("fastQueryParameters", Map.class);
classMap.put("advanceQueryConditions", Condition.class);
classMap.put("advanceQuerySorts", Sort.class);
classMap.put("exhibitDatas", Map.class);
classMap.put("exportColumns", Column.class);
classMap.put("exportDatas", Map.class);
DlswPageGridModel pager = (DlswPageGridModel)JSONObject.parseObject(jsonStr, DlswPageGridModel.class);
return pager;
}
}
......@@ -13,7 +13,7 @@ server:
druid:
url: jdbc:mysql://127.0.0.1:3306/edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
username: root
password: cy
password: 123456
initial-size: 1
min-idle: 1
max-active: 20
......@@ -113,8 +113,8 @@ global:
min_password: 6
max_password: 16
path:
base_upload_server_location: /working/resource/eduServer
physical_upload_server_location: /working/resource/eduServer
base_upload_server_location: G:/education_res
physical_upload_server_location: G:/education_res
course_location: course
lesson_location: lesson
sl_location: sl
......
......@@ -13,6 +13,8 @@
<result column="del_flag" jdbcType="VARCHAR" property="delFlag"/>
<result column="flag" jdbcType="VARCHAR" property="flag"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="grade_id" jdbcType="VARCHAR" property="gradeId"/>
</resultMap>
<select id="queryBClasss" resultMap="BaseResultMap">
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.rcisoft.business.bcoursecode.dao.BCourseCodeRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.bcoursecode.entity.BCourseCode">
<id column="business_id" jdbcType="VARCHAR" property="businessId"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="flag" jdbcType="VARCHAR" property="flag"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="seq" jdbcType="INTEGER" property="seq"/>
<result column="start_date" jdbcType="VARCHAR" property="startDate"/>
<result column="end_date" jdbcType="VARCHAR" property="endDate"/>
<result column="del_flag" jdbcType="VARCHAR" property="delFlag"/>
<result column="date_desc" jdbcType="VARCHAR" property="dateDesc"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.rcisoft.business.beduclass.dao.BEduClassRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.beduclass.entity.BEduClass">
<id column="business_id" jdbcType="VARCHAR" property="businessId"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="del_flag" jdbcType="VARCHAR" property="delFlag"/>
<result column="flag" jdbcType="VARCHAR" property="flag"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="code" jdbcType="VARCHAR" property="code"/>
<result column="class_name" jdbcType="VARCHAR" property="className"/>
<result column="agency_id" jdbcType="VARCHAR" property="agencyId"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
<result column="classes_id" jdbcType="VARCHAR" property="classesId"/>
<result column="grade_id" jdbcType="VARCHAR" property="gradeId"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.rcisoft.business.bgrade.dao.BGradeRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.bgrade.entity.BGrade">
<id column="business_id" jdbcType="VARCHAR" property="businessId"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="del_flag" jdbcType="VARCHAR" property="delFlag"/>
<result column="flag" jdbcType="VARCHAR" property="flag"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="code" jdbcType="VARCHAR" property="code"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment