wangwei před 7 roky
rodič
revize
f54b7c0797

+ 1 - 4
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/OrgController.java

@@ -4,7 +4,6 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -92,7 +91,7 @@ public class OrgController extends ControllerSupport {
 	}
 
 	@ApiOperation(value = "查询机构不分页带查询", notes = "不分页带查询")
-	@GetMapping("/alls/{type}")
+	// @GetMapping("/alls/{type}")
 	public ResponseEntity getAllExam(@PathVariable String type, HttpServletRequest request) {
 		cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
 		if (accessUser != null) {
@@ -251,7 +250,6 @@ public class OrgController extends ControllerSupport {
 			throw new StatusException("B-140001", "非法访问");
 		}
 
-		org.setCreateTime(new Date());
 		org.setParentId(null);
 		// 临时
 		org.setRootId(-1L);
@@ -292,7 +290,6 @@ public class OrgController extends ControllerSupport {
 	@ApiOperation(value = "新增子机构", notes = "新增")
 	@PostMapping("addSubOrg")
 	public Org addSubOrg(@RequestBody Org org) {
-		org.setCreateTime(new Date());
 		cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
 		org.setParentId(accessUser.getRootOrgId());
 		org.setRootId(accessUser.getRootOrgId());

+ 1 - 22
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/OrgRepo.java

@@ -4,8 +4,6 @@ import java.util.List;
 
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
-import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
 import org.springframework.data.repository.query.QueryByExampleExecutor;
 
 import cn.com.qmth.examcloud.core.basic.dao.entity.Org;
@@ -21,27 +19,8 @@ public interface OrgRepo
 
 	List<Org> findByRootId(Long rootId);
 
-	List<Org> findByRootIdAndNameLike(long rootId, String name);
-
 	List<Org> findByParentIdAndNameLikeAndEnable(long parentId, String name, Boolean enable);
 
-	List<Org> findById(Long id);
-
-	@Query(nativeQuery = true, value = "select *from ecs_core_org where parent_id=:parentId")
-	List<Org> findBothByParentId(@Param("parentId") long parentId);
-
-	@Query(nativeQuery = true, value = "select *from ecs_core_org where parent_id=:parentId and enable = 1")
-	List<Org> findByParentId(@Param("parentId") Long parentId);
-
-	@Query(nativeQuery = true, value = "select *from ecs_core_org where (id=:parentId or parent_id=:parentId) and enable = 1 and type = \"SCHOOL\"")
-	List<Org> findAllSchoolByParentId(@Param("parentId") long parentId);
-
-	@Query(nativeQuery = true, value = "select *from ecs_core_org where (id=:parentId or parent_id=:parentId) and enable = 1 and type in (\"PRINT_QMTH\",\"PRINT_SUPPLIER\")")
-	List<Org> findAllPrintByParentId(@Param("parentId") long parentId);
-
-	@Query(nativeQuery = true, value = "select *from ecs_core_org where parent_id=:parentId and code=:code and enable = 1")
-	Org findFirstByParentIdAndCode(@Param("parentId") Long parentId, @Param("code") String code);
+	List<Org> findByParentIdAndEnable(Long parentId, Boolean enable);
 
-	@Query(nativeQuery = true, value = "select * from ecs_core_org t where t.parent_id is null and t.enable = 1 order by t.id")
-	List<Org> findAllParentOrg();
 }

+ 2 - 32
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/Org.java

@@ -1,21 +1,15 @@
 package cn.com.qmth.examcloud.core.basic.dao.entity;
 
-import java.util.Date;
-
 import javax.persistence.Entity;
 import javax.persistence.EnumType;
 import javax.persistence.Enumerated;
 import javax.persistence.GeneratedValue;
 import javax.persistence.Id;
 import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
 import javax.validation.constraints.NotNull;
 
-import org.springframework.format.annotation.DateTimeFormat;
-
 import cn.com.qmth.examcloud.commons.base.util.excel.ExcelProperty;
-import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
+import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
 import cn.com.qmth.examcloud.core.basic.dao.enums.OrgType;
 
 /**
@@ -23,7 +17,7 @@ import cn.com.qmth.examcloud.core.basic.dao.enums.OrgType;
  */
 @Entity
 @Table(name = "ecs_core_org")
-public class Org implements JsonSerializable {
+public class Org extends JpaEntity {
 
 	private static final long serialVersionUID = -592353272256492483L;
 
@@ -79,14 +73,6 @@ public class Org implements JsonSerializable {
 	@ExcelProperty(name = "联系人", index = 2)
 	private String contacts;
 
-	@Temporal(value = TemporalType.DATE)
-	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-	private Date createTime;
-
-	@Temporal(value = TemporalType.DATE)
-	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-	private Date updateTime;
-
 	/**
 	 * 机构类型:学校,启明,印刷
 	 */
@@ -189,22 +175,6 @@ public class Org implements JsonSerializable {
 		this.enable = enable;
 	}
 
-	public Date getCreateTime() {
-		return createTime;
-	}
-
-	public void setCreateTime(Date createTime) {
-		this.createTime = createTime;
-	}
-
-	public Date getUpdateTime() {
-		return updateTime;
-	}
-
-	public void setUpdateTime(Date updateTime) {
-		this.updateTime = updateTime;
-	}
-
 	public String getCode() {
 		return code;
 	}

+ 0 - 2
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/OrgService.java

@@ -130,7 +130,6 @@ public class OrgService {
 		org.setName(orgDto.getName());
 		org.setContacts(orgDto.getContacts());
 		org.setTelphone(orgDto.getTelphone());
-		org.setCreateTime(new Date());
 		org.setEnable(true);
 		//添加机构类型
 		org.setType(OrgType.SCHOOL);
@@ -232,7 +231,6 @@ public class OrgService {
 
 	public Org save(Org org){
 		checkCode(org.getParentId(),org.getCode());
-		org.setCreateTime(new Date());
 		Org reOrg = orgRepo.save(org);
 		dataSendService.sendOrg(reOrg);
 		//删除缓存