지붕재, 가대 select 추가
This commit is contained in:
parent
9a42f7cef8
commit
2dc2ae303d
@ -0,0 +1,23 @@
|
||||
package com.interplug.qcast.biz.roofmaterial;
|
||||
|
||||
import com.interplug.qcast.biz.roofmaterial.dto.RoofMaterialResponse;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@CrossOrigin
|
||||
@RequestMapping("/api/roof-material")
|
||||
public class RoofMaterialController {
|
||||
private final RoofMaterialService roofService;
|
||||
|
||||
@GetMapping("/v1.0/roof-materials")
|
||||
public ResponseEntity<List<RoofMaterialResponse>> getRoofs() {
|
||||
return ResponseEntity.ok(roofService.getRoofMaterials());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package com.interplug.qcast.biz.roofmaterial;
|
||||
|
||||
import com.interplug.qcast.biz.roofmaterial.dto.RoofMaterialResponse;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface RoofMaterialMapper {
|
||||
List<RoofMaterialResponse> getRoofMaterials();
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.interplug.qcast.biz.roofmaterial;
|
||||
|
||||
import com.interplug.qcast.biz.roofmaterial.dto.RoofMaterialResponse;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class RoofMaterialService {
|
||||
private final RoofMaterialMapper roofMapper;
|
||||
|
||||
public List<RoofMaterialResponse> getRoofMaterials() {
|
||||
return roofMapper.getRoofMaterials();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.interplug.qcast.biz.roofmaterial.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RoofMaterialResponse {
|
||||
|
||||
private Integer id;
|
||||
private String name;
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.interplug.qcast.biz.trestle;
|
||||
|
||||
import com.interplug.qcast.biz.trestle.dto.TrestleResponse;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/trestle")
|
||||
@CrossOrigin
|
||||
public class TrestleController {
|
||||
private final TrestleService trestleService;
|
||||
|
||||
@GetMapping("/v1.0/trestles/{roofMaterialId}")
|
||||
public ResponseEntity<List<TrestleResponse>> getTrestlesByRoofMaterialId(
|
||||
@PathVariable Integer roofMaterialId) {
|
||||
return ResponseEntity.ok(trestleService.getTrestlesByRoofMaterialId(roofMaterialId));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.interplug.qcast.biz.trestle;
|
||||
|
||||
import com.interplug.qcast.biz.trestle.dto.TrestleResponse;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface TrestleMapper {
|
||||
List<TrestleResponse> getTrestlesByRoofMaterialId(Integer roofMaterialId);
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.interplug.qcast.biz.trestle;
|
||||
|
||||
import com.interplug.qcast.biz.trestle.dto.TrestleResponse;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TrestleService {
|
||||
|
||||
private final TrestleMapper trestleMapper;
|
||||
|
||||
public List<TrestleResponse> getTrestlesByRoofMaterialId(Integer roofMaterialId) {
|
||||
return trestleMapper.getTrestlesByRoofMaterialId(roofMaterialId);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.interplug.qcast.biz.trestle.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TrestleResponse {
|
||||
private Integer id;
|
||||
private String name;
|
||||
private String manufacturerName;
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
<?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="com.interplug.qcast.biz.roofmaterial.RoofMaterialMapper">
|
||||
<select id="getRoofMaterials" resultType="com.interplug.qcast.biz.roofmaterial.dto.RoofMaterialResponse">
|
||||
select id
|
||||
, name
|
||||
from TB_ROOF_MATERIAL
|
||||
</select>
|
||||
</mapper>
|
||||
17
src/main/resources/mappers/trestle/trestleMapper.xml
Normal file
17
src/main/resources/mappers/trestle/trestleMapper.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?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="com.interplug.qcast.biz.trestle.TrestleMapper">
|
||||
<select id="getTrestlesByRoofMaterialId" parameterType="integer"
|
||||
resultType="com.interplug.qcast.biz.trestle.dto.TrestleResponse">
|
||||
select a.TRESTLE_ID as id
|
||||
, b.name as name
|
||||
, c.name as manufacturerName
|
||||
from TB_INSTALLABLE_TRESTLE a
|
||||
join TB_TRESTLE b
|
||||
on a.TRESTLE_ID = b.ID
|
||||
join TB_MANUFACTURER c
|
||||
on b.MANUFACTURER_ID = c.ID
|
||||
where a.ROOF_MATERIAL_ID = #{roofMaterialId}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user