git 5 år sedan
förälder
incheckning
8014f481d5

+ 9 - 1
core/src/main/java/com/mooctest/crowd/domain/dao/ResourceDao.java

@@ -1,19 +1,27 @@
 package com.mooctest.crowd.domain.dao;
 
+import com.mooctest.crowd.domain.model.CompetitionPO;
 import com.mooctest.crowd.domain.model.ResourcePO;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.repository.CrudRepository;
+import org.springframework.data.repository.PagingAndSortingRepository;
 
 import javax.transaction.Transactional;
 import java.util.List;
 import java.util.Optional;
 
 @Transactional
-public interface ResourceDao extends CrudRepository<ResourcePO, Long>, JpaSpecificationExecutor<ResourcePO> {
+public interface ResourceDao extends CrudRepository<ResourcePO, Long>, JpaSpecificationExecutor<ResourcePO>,PagingAndSortingRepository<ResourcePO, Long>,JpaRepository<ResourcePO, Long> {
 
     Optional<ResourcePO> findByCode(String code);
 
     Optional<ResourcePO> findById(Long id);
 
     List<ResourcePO> findAll();
+
+    Page<ResourcePO> findAll(Specification<ResourcePO> spec , Pageable pageable);
 }

+ 13 - 0
core/src/main/java/com/mooctest/crowd/domain/dao/ResourceTypeDao.java

@@ -0,0 +1,13 @@
+package com.mooctest.crowd.domain.dao;
+
+import com.mooctest.crowd.domain.model.ResourceTypePO;
+import org.springframework.data.repository.CrudRepository;
+
+
+import javax.transaction.Transactional;
+import java.util.Optional;
+
+@Transactional
+public interface ResourceTypeDao extends CrudRepository<ResourceTypePO, Long>{
+    Optional<ResourceTypePO> findByCode(String code);
+}

+ 14 - 0
core/src/main/java/com/mooctest/crowd/domain/domainobject/Resource.java

@@ -2,6 +2,8 @@ package com.mooctest.crowd.domain.domainobject;
 
 import lombok.Data;
 
+import java.sql.Timestamp;
+
 /**
  * @author guochao
  * @date 2019/7/6 17:54
@@ -11,4 +13,16 @@ public class Resource {
     private Long id;
     private String code;
     private String name;
+    private String type;
+    private int quantity;
+    private String photoUrl;
+    private String description;
+    private String scene;
+    private String unitWork;
+    private String standard;
+    private String unit;
+    private String state;
+    private Timestamp startTime;
+    private String personnel;
+    private String remarks;
 }

+ 9 - 0
core/src/main/java/com/mooctest/crowd/domain/domainobject/ResourceStatus.java

@@ -0,0 +1,9 @@
+package com.mooctest.crowd.domain.domainobject;
+
+
+public class ResourceStatus {
+    public static final int R_FREE = 0;  //空闲
+    public static final int R_OCCUPY = 1; //占用
+    public static final int R_USABLE = 2; //可用
+    public static final int R_FAULT = 4; //故障
+}

+ 35 - 0
core/src/main/java/com/mooctest/crowd/domain/model/ResourcePO.java

@@ -3,6 +3,7 @@ package com.mooctest.crowd.domain.model;
 import lombok.Data;
 
 import javax.persistence.*;
+import java.sql.Timestamp;
 
 /**
  * @author guochao
@@ -22,5 +23,39 @@ public class ResourcePO {
     @Column(name = "R_NAME")
     private String name;
 
+    @Column(name = "R_RT_CODE")
+    private String type;
 
+    @Column(name = "R_QUANTITY")
+    private int quantity;
+
+    @Column(name = "R_PHOTO_URL")
+    private String photoUrl;
+
+    @Column(name = "R_DESCRIPTION")
+    private String description;
+
+    @Column(name = "R_SCENE")
+    private String scene;
+
+    @Column(name = "R_UNIT_WORK")
+    private String unitWork;
+
+    @Column(name = "R_STANDARD")
+    private String standard;
+
+    @Column(name = "R_UNIT")
+    private String unit;
+
+    @Column(name = "R_STATE")
+    private String state;
+
+    @Column(name = "R_DATE")
+    private Timestamp startTime;
+
+    @Column(name = "R_PERSONNEL")
+    private String personnel;
+
+    @Column(name = "R_REMARKS")
+    private String remarks;
 }

+ 3 - 1
core/src/main/java/com/mooctest/crowd/domain/repository/CommonRepo.java

@@ -59,6 +59,9 @@ public class CommonRepo {
     @Autowired
     private  CompetitionsDao competitionsDao;
 
+    @Autowired
+    private  ResourceTypeDao resourceTypeDao;
+
     public List<TestType> getAllTestType(){
         return testTypeDao.findAll().stream().map(testTypePO -> Converter.convert(TestType.class, testTypePO)).collect(Collectors.toList());
     }
@@ -158,7 +161,6 @@ public class CommonRepo {
         Specifications<ResourcePO> where =  Specifications.where(getResource(keyword));
         return resourceDao.findAll(where, pageable).map(resourcePO -> Converter.convert(Resource.class, resourcePO));
     }
-
     private Specification<ResourcePO> getResource(String keyword) {
         return new Specification<ResourcePO>() {
             @Override

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 0 - 0
site/src/main/java/com/mooctest/crowd/site/controller/CommonController.java


+ 25 - 0
site/src/main/java/com/mooctest/crowd/site/data/vo/ResourceVO.java

@@ -6,6 +6,7 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 
 import java.io.Serializable;
+import java.sql.Timestamp;
 
 /**
  * @author guochao
@@ -17,9 +18,33 @@ import java.io.Serializable;
 public class ResourceVO implements Serializable {
     private String code;
     private String name;
+    private String type;
+    private int quantity;
+    private String photoUrl;
+    private String description;
+    private String scene;
+    private String unitWork;
+    private String standard;
+    private String unit;
+    private String state;
+    private Timestamp startTime;
+    private String personnel;
+    private String remarks;
 
     public ResourceVO(Resource resource){
         code = resource.getCode();
         name = resource.getName();
+        type=  resource.getType();
+        quantity=resource.getQuantity();
+        photoUrl=resource.getPhotoUrl();
+        description=resource.getDescription();
+        scene=resource.getScene();
+        unitWork=resource.getUnitWork();
+        standard=resource.getStandard();
+        unit=resource.getUnit();
+        state=resource.getState();
+        startTime=resource.getStartTime();
+        personnel=resource.getPersonnel();
+        remarks=resource.getRemarks();
     }
 }

+ 0 - 3
site/src/main/java/com/mooctest/crowd/site/mediator/impl/WebMediatorImpl.java

@@ -103,9 +103,6 @@ public class WebMediatorImpl implements ViewMediator {
     @Autowired
     private BankLogoDao bankLogoDao;
 
-    @Autowired
-    private UploadService uploadService;
-
     @Value("${agency}")
     private String agencyId;
 

+ 2 - 0
site/src/main/java/com/mooctest/crowd/site/service/CommonService.java

@@ -32,4 +32,6 @@ public interface CommonService {
     Page<ApplicationTypeVO> getHotTesting(Pageable pageable,String keyword);
 
     Page<CompetitionVO> getCompetition(Pageable pageable,String keyword);
+
+    Page<ResourceVO> getResource(Pageable pageable,String keyword);
 }

+ 4 - 0
site/src/main/java/com/mooctest/crowd/site/service/impl/CommonServiceImpl.java

@@ -102,4 +102,8 @@ public class CommonServiceImpl implements CommonService {
         return commonRepo.findAllCompetition(pageable,keyword).map(competition -> new CompetitionVO(competition));
     }
 
+    @Override
+    public Page<ResourceVO> getResource(Pageable pageable, String keyword) {
+        return commonRepo.findAllResourceByPage(pageable, keyword).map(resource -> new ResourceVO(resource));
+    }
 }

Vissa filer visades inte eftersom för många filer har ändrats