게시판 샘플 추가 작업
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>sample.ustraframework.java</groupId>
|
||||
<artifactId>back</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>bo</artifactId>
|
||||
<name>bo</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.gsitm.ustra.java.starter</groupId>
|
||||
<artifactId>ustra-starter-vue-bo</artifactId>
|
||||
<version>${ustra.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>sample.ustraframework.java</groupId>
|
||||
<artifactId>cmm</artifactId>
|
||||
<version>${parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,35 @@
|
||||
package sample.ustraframework.java.bo.sample.board;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/sample/board")
|
||||
public class SampleBoardController {
|
||||
|
||||
@Autowired private SampleBoardService sampleBoardService;
|
||||
|
||||
@GetMapping("")
|
||||
List<SampleBoardModel> getList(String title) {
|
||||
return sampleBoardService.getList(title);
|
||||
}
|
||||
|
||||
@GetMapping("/{boardIdx}")
|
||||
SampleBoardModel getCodeGroups(@PathVariable Integer boardIdx) {
|
||||
return sampleBoardService.get(boardIdx);
|
||||
}
|
||||
|
||||
@PostMapping("")
|
||||
SampleBoardModel add(@RequestBody SampleBoardModel board) {
|
||||
return sampleBoardService.add(board);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package sample.ustraframework.java.bo.sample.board;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SampleBoardMapper {
|
||||
|
||||
List<SampleBoardModel> select(String title);
|
||||
SampleBoardModel selectDetail(Integer boardIdx);
|
||||
int insert(SampleBoardModel model);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package sample.ustraframework.java.bo.sample.board;
|
||||
|
||||
import com.gsitm.ustra.java.management.models.base.UstraManagementBaseModel;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SampleBoardModel extends UstraManagementBaseModel {
|
||||
|
||||
private Integer boardIdx;
|
||||
private String categoryCd;
|
||||
private String title;
|
||||
private String content;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package sample.ustraframework.java.bo.sample.board;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.gsitm.ustra.java.data.exception.UstraDataResponseCode;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class SampleBoardService {
|
||||
|
||||
@Autowired private SampleBoardMapper sampleBoardMapper;
|
||||
|
||||
public List<SampleBoardModel> getList(String title) {
|
||||
return sampleBoardMapper.select(title);
|
||||
}
|
||||
|
||||
public SampleBoardModel get(Integer boardIdx) {
|
||||
return sampleBoardMapper.selectDetail(boardIdx);
|
||||
}
|
||||
|
||||
public SampleBoardModel add(SampleBoardModel board) {
|
||||
int result = sampleBoardMapper.insert(board);
|
||||
|
||||
if (result < 1) {
|
||||
throw UstraDataResponseCode.CANNOT_SAVE_RECORD.exception();
|
||||
}
|
||||
|
||||
return board;
|
||||
}
|
||||
|
||||
}
|
||||
51
back/root/bo/src/main/resources/mapper/SampleBoardMapper.xml
Normal file
51
back/root/bo/src/main/resources/mapper/SampleBoardMapper.xml
Normal file
@@ -0,0 +1,51 @@
|
||||
<?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="sample.ustraframework.java.bo.sample.board.SampleBoardMapper">
|
||||
|
||||
<select id="select" resultType="sample.ustraframework.java.bo.sample.board.SampleBoardModel">
|
||||
SELECT BOARD_IDX,
|
||||
TITLE,
|
||||
CONTENT,
|
||||
CATEGORY_CD
|
||||
FROM USTRA_SAMPLE_BOARD
|
||||
WHERE TITLE LIKE '%%'
|
||||
</select>
|
||||
|
||||
<select id="selectDetail" resultType="sample.ustraframework.java.bo.sample.board.SampleBoardModel">
|
||||
SELECT BOARD_IDX,
|
||||
TITLE,
|
||||
CONTENT,
|
||||
CATEGORY_CD
|
||||
FROM USTRA_SAMPLE_BOARD
|
||||
WHERE BOARD_IDX = #{boardIdx}
|
||||
</select>
|
||||
|
||||
<insert id="insert">
|
||||
INSERT INTO USTRA_SAMPLE_BOARD (
|
||||
BOARD_IDX,
|
||||
TITLE,
|
||||
CONTENT,
|
||||
CATEGORY_CD,
|
||||
REG_DTTM,
|
||||
REG_USR_ID,
|
||||
REG_USR_IP,
|
||||
UPD_DTTM,
|
||||
UPD_USR_ID,
|
||||
UPD_USR_IP
|
||||
) SELECT ISNULL(MAX(BOARD_IDX), 0) + 1
|
||||
,#{title}
|
||||
,#{content}
|
||||
,#{categoryCd}
|
||||
,CURRENT_TIMESTAMP,
|
||||
#{regUsrId},
|
||||
#{regUsrIp},
|
||||
CURRENT_TIMESTAMP,
|
||||
#{updUsrId},
|
||||
#{updUsrIp}
|
||||
FROM USTRA_SAMPLE_BOARD
|
||||
</insert>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -56,7 +56,7 @@ subprojects {
|
||||
|
||||
ext {
|
||||
set('springCloudVersion', "Hoxton.SR3")
|
||||
ustraVersion = '2.0.50.8-SNAPSHOT'
|
||||
ustraVersion = '2.0.50.RELEASE'
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>sample.ustraframework.java</groupId>
|
||||
<artifactId>back</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>cmm</artifactId>
|
||||
<name>cmm</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.gsitm.ustra.java.starter</groupId>
|
||||
<artifactId>ustra-starter-restapi</artifactId>
|
||||
<version>${ustra.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -1,47 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>sample.ustraframework.java</groupId>
|
||||
<artifactId>back</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>fo</artifactId>
|
||||
<name>fo</name>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.gsitm.ustra.java.starter</groupId>
|
||||
<artifactId>ustra-starter-restapi</artifactId>
|
||||
<version>${ustra.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.gsitm.ustra.java</groupId>
|
||||
<artifactId>ustra-mvc-view</artifactId>
|
||||
<version>${ustra.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.gsitm.ustra.java</groupId>
|
||||
<artifactId>ustra-data-mybatis</artifactId>
|
||||
<version>${ustra.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.gsitm.ustra.java</groupId>
|
||||
<artifactId>ustra-security-jwt</artifactId>
|
||||
<version>${ustra.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.gsitm.ustra.java</groupId>
|
||||
<artifactId>ustra-management-core</artifactId>
|
||||
<version>${ustra.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>sample.ustraframework.java</groupId>
|
||||
<artifactId>cmm</artifactId>
|
||||
<version>${parent.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -1,158 +0,0 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>sample.ustraframework.java</groupId>
|
||||
<artifactId>back</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>cmm</module>
|
||||
<module>fo</module>
|
||||
<module>bo</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<parent.version>0.0.1-SNAPSHOT</parent.version>
|
||||
<ustra.version>2.0.50.8-SNAPSHOT</ustra.version>
|
||||
<spring-boot.version>2.2.5.RELEASE</spring-boot.version>
|
||||
<log4j2.version>2.15.0</log4j2.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>nexus</id>
|
||||
<url>https://repo.gsitm.com/repository/m2-public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>central</id>
|
||||
<url>https://repo1.maven.org/maven2/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>nexus</id>
|
||||
<name>Maven Plugin Nexus Repository</name>
|
||||
<url>https://repo.gsitm.com/repository/m2-public/</url>
|
||||
</pluginRepository>
|
||||
<pluginRepository>
|
||||
<id>central</id>
|
||||
<name>Maven Plugin Repository</name>
|
||||
<url>https://repo1.maven.org/maven2/</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-core</artifactId>
|
||||
<version>1.2.9</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.2.9</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-to-slf4j</artifactId>
|
||||
<version>${log4j2.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>${log4j2.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-test -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.junit.vintage</groupId>
|
||||
<artifactId>junit-vintage-engine</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.junit.platform/junit-platform-launcher -->
|
||||
<dependency>
|
||||
<groupId>org.junit.platform</groupId>
|
||||
<artifactId>junit-platform-launcher</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-aop -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-configuration-processor -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies> <!-- The parent should provide all that -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
52
front/bo/client/components/samples/sub-component.vue
Normal file
52
front/bo/client/components/samples/sub-component.vue
Normal file
@@ -0,0 +1,52 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>하위 컴포넌트</div>
|
||||
<div>타이틀 : {{ title }}</div>
|
||||
|
||||
<dx-button
|
||||
text="하위 컴포넌트 타이틀 변경"
|
||||
@click="
|
||||
() => {
|
||||
syncTitle = '타이틀 변경됨.'
|
||||
$emit('title-changed', syncTitle)
|
||||
}
|
||||
"
|
||||
></dx-button>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { Vue, Component, Prop, Model, Ref, Watch, Inject, InjectReactive, Provide, ProvideReactive, PropSync, Emit } from 'vue-property-decorator'
|
||||
import { SampleBoComponent } from '~/components/sample-bo-component'
|
||||
import { sampleEventBus } from '~/event-bus/sample-event-bus'
|
||||
|
||||
@Component({
|
||||
middleware: async ctx => {
|
||||
// todo: middleware
|
||||
},
|
||||
validate: async ctx => {
|
||||
// todo: validate
|
||||
return true
|
||||
},
|
||||
asyncData: async ctx => {
|
||||
// todo: asyncData
|
||||
},
|
||||
})
|
||||
export default class extends SampleBoComponent {
|
||||
// #region variables
|
||||
@PropSync('title') syncTitle: string
|
||||
// #endregion
|
||||
// #region hooks
|
||||
created() {
|
||||
console.log('eventbus')
|
||||
this.$ustra.utils.eventBus(this, sampleEventBus, state => {
|
||||
console.log('state', state)
|
||||
})
|
||||
}
|
||||
// #endregion
|
||||
// #region methods
|
||||
// #endregion
|
||||
// #region watches
|
||||
// #endregion
|
||||
}
|
||||
</script>
|
||||
<style lang="scss"></style>
|
||||
0
front/bo/client/components/system/board/input.vue
Normal file
0
front/bo/client/components/system/board/input.vue
Normal file
29
front/bo/client/components/system/board/list.vue
Normal file
29
front/bo/client/components/system/board/list.vue
Normal file
@@ -0,0 +1,29 @@
|
||||
<template>
|
||||
<dx-data-grid width="100%" :height="300" :data-source="gridData">
|
||||
<dx-column caption="순번" :width="100" data-field="boardIdx" alignment="center" />
|
||||
<dx-column caption="카테고리구분" :width="150" data-field="categoryCd" />
|
||||
<dx-column caption="제목" :width="150" data-field="title" />
|
||||
</dx-data-grid>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { Vue, Component, Prop, Model, Ref, Watch, Inject, InjectReactive, Provide, ProvideReactive, PropSync, Emit } from 'vue-property-decorator'
|
||||
import { SampleBoComponent } from '~/components/sample-bo-component'
|
||||
import { sampleBoardService, Board } from '~/services/sample-board-service'
|
||||
|
||||
@Component
|
||||
export default class extends SampleBoComponent {
|
||||
// #region variables
|
||||
gridData: Board[] = []
|
||||
// #endregion
|
||||
// #region hooks
|
||||
// #endregion
|
||||
// #region methods
|
||||
async search(title: string) {
|
||||
this.gridData = await sampleBoardService.getList(title)
|
||||
}
|
||||
// #endregion
|
||||
// #region watches
|
||||
// #endregion
|
||||
}
|
||||
</script>
|
||||
<style lang="scss"></style>
|
||||
32
front/bo/client/components/system/board/search-bar.vue
Normal file
32
front/bo/client/components/system/board/search-bar.vue
Normal file
@@ -0,0 +1,32 @@
|
||||
<template>
|
||||
<u-button-bar>
|
||||
<u-field-row :wrap="false">
|
||||
<u-field-set :show-borders="true">
|
||||
<u-field-row :wrap="false">
|
||||
<u-field label="제목" :width="200">
|
||||
<dx-text-box v-model="title" />
|
||||
</u-field>
|
||||
<dx-button class="right" text="검색" icon="search" @click="$emit('search', title)"></dx-button>
|
||||
</u-field-row>
|
||||
</u-field-set>
|
||||
</u-field-row>
|
||||
</u-button-bar>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { Vue, Component, Prop, Model, Ref, Watch, Inject, InjectReactive, Provide, ProvideReactive, PropSync, Emit } from 'vue-property-decorator'
|
||||
import { SampleBoComponent } from '~/components/sample-bo-component'
|
||||
|
||||
@Component
|
||||
export default class extends SampleBoComponent {
|
||||
// #region variables
|
||||
title: string = null
|
||||
// #endregion
|
||||
// #region hooks
|
||||
// #endregion
|
||||
// #region methods
|
||||
// #endregion
|
||||
// #region watches
|
||||
// #endregion
|
||||
}
|
||||
</script>
|
||||
<style lang="scss"></style>
|
||||
23
front/bo/client/event-bus/sample-event-bus.ts
Normal file
23
front/bo/client/event-bus/sample-event-bus.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import EventBus from '@ustra/nuxt/src/vue/event-bus'
|
||||
|
||||
export interface SampleEventBusState {
|
||||
/**
|
||||
* 유형
|
||||
*/
|
||||
type: string
|
||||
|
||||
/**
|
||||
* 값
|
||||
*/
|
||||
value: string
|
||||
}
|
||||
|
||||
export class SampleEventBus extends EventBus<SampleEventBusState> {
|
||||
name(): string {
|
||||
return 'sampleEventBus'
|
||||
}
|
||||
}
|
||||
|
||||
const sampleEventBus = new SampleEventBus()
|
||||
export default sampleEventBus
|
||||
export { sampleEventBus }
|
||||
25
front/bo/client/layouts/sample.vue
Normal file
25
front/bo/client/layouts/sample.vue
Normal file
@@ -0,0 +1,25 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>샘플 레이아웃</div>
|
||||
<nuxt />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { Vue, Component, Prop, Model, Ref, Watch, Inject, InjectReactive, Provide, ProvideReactive, PropSync, Emit } from 'vue-property-decorator'
|
||||
import { SampleBoComponent } from '~/components/sample-bo-component'
|
||||
|
||||
@Component({
|
||||
name: 'sampleLayout',
|
||||
})
|
||||
export default class extends SampleBoComponent {
|
||||
// #region variables
|
||||
// #endregion
|
||||
// #region hooks
|
||||
// #endregion
|
||||
// #region methods
|
||||
// #endregion
|
||||
// #region watches
|
||||
// #endregion
|
||||
}
|
||||
</script>
|
||||
<style lang="scss"></style>
|
||||
68
front/bo/client/pages/samples/index.vue
Normal file
68
front/bo/client/pages/samples/index.vue
Normal file
@@ -0,0 +1,68 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>{{ displayTitle }}</div>
|
||||
<dx-button text="타이틀 변경" @click="changeTitle"></dx-button>
|
||||
<sub-component :title.sync="subComponentTitle" @title-changed="e => $logger().info(e)" />
|
||||
<div>{{ subComponentTitle }}</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { Vue, Component, Prop, Model, Ref, Watch, Inject, InjectReactive, Provide, ProvideReactive, PropSync, Emit } from 'vue-property-decorator'
|
||||
import { SampleBoComponent } from '~/components/sample-bo-component'
|
||||
import SubComponent from '~/components/samples/sub-component.vue'
|
||||
import { sampleEventBus } from '~/event-bus/sample-event-bus'
|
||||
|
||||
@Component({
|
||||
name: 'samples',
|
||||
layout: 'sample',
|
||||
config: {
|
||||
auth: {
|
||||
required: false,
|
||||
},
|
||||
},
|
||||
components: {
|
||||
SubComponent,
|
||||
},
|
||||
validate(ctx) {
|
||||
return !!ctx.route.query.v
|
||||
},
|
||||
async middleware(ctx, cb) {
|
||||
if (ctx.route.query.v === '1') {
|
||||
ctx.app.router.push('/')
|
||||
}
|
||||
cb()
|
||||
},
|
||||
})
|
||||
export default class extends SampleBoComponent {
|
||||
// #region variables
|
||||
title: string = null
|
||||
subTitle: string = '서브 타이틀'
|
||||
subComponentTitle: string = null
|
||||
|
||||
get displayTitle() {
|
||||
return this.title + ' - ' + this.subTitle
|
||||
}
|
||||
|
||||
// #endregion
|
||||
// #region hooks
|
||||
created() {
|
||||
this.title = '샘플 페이지 화면1'
|
||||
}
|
||||
// #endregion
|
||||
// #region methods
|
||||
changeTitle() {
|
||||
this.title = '변경 타이틀'
|
||||
|
||||
this.subComponentTitle = '하위 컴포넌트 제목 변경'
|
||||
|
||||
sampleEventBus.emit({
|
||||
type: 'title',
|
||||
value: this.title,
|
||||
})
|
||||
}
|
||||
// #endregion
|
||||
// #region watches
|
||||
// #endregion
|
||||
}
|
||||
</script>
|
||||
<style lang="scss"></style>
|
||||
53
front/bo/client/pages/system/board.vue
Normal file
53
front/bo/client/pages/system/board.vue
Normal file
@@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<dx-box direction="col" height="100%">
|
||||
<dx-item base-size="auto">
|
||||
<template #default>
|
||||
<search-bar
|
||||
@search="
|
||||
e => {
|
||||
$logger().info(e)
|
||||
list.search(e)
|
||||
}
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
</dx-item>
|
||||
<dx-item :ratio="1">
|
||||
<template #default>
|
||||
<dx-box direction="row" height="100%">
|
||||
<dx-item :ratio="1">
|
||||
<template #default>
|
||||
<list ref="list" />
|
||||
</template>
|
||||
</dx-item>
|
||||
<dx-item #default="_" :ratio="1">
|
||||
<div class="box2">Right</div>
|
||||
</dx-item>
|
||||
</dx-box>
|
||||
</template>
|
||||
</dx-item>
|
||||
</dx-box>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Vue, Component, Prop, Model, Ref, Watch, Inject, InjectReactive, Provide, ProvideReactive, PropSync, Emit } from 'vue-property-decorator'
|
||||
import { SampleBoComponent } from '~/components/sample-bo-component'
|
||||
import SearchBar from '~/components/system/board/search-bar.vue'
|
||||
import List from '~/components/system/board/list.vue'
|
||||
|
||||
@Component({
|
||||
components: { SearchBar, List },
|
||||
})
|
||||
export default class extends SampleBoComponent {
|
||||
// #region variables
|
||||
@Ref() readonly list: List
|
||||
// #endregion
|
||||
// #region hooks
|
||||
// #endregion
|
||||
// #region methods
|
||||
// #endregion
|
||||
// #region watches
|
||||
// #endregion
|
||||
}
|
||||
</script>
|
||||
<style lang="scss"></style>
|
||||
30
front/bo/client/pages/system/list.vue
Normal file
30
front/bo/client/pages/system/list.vue
Normal file
@@ -0,0 +1,30 @@
|
||||
<template>
|
||||
<dx-data-grid width="100%" :height="300" :data-source="gridData">
|
||||
<dx-column caption="순번" :width="100" data-field="boardIdx" alignment="center" />
|
||||
<dx-column caption="카테고리구분" :width="150" data-field="categoryCd" />
|
||||
<dx-column caption="제목" :width="150" data-field="title" />
|
||||
</dx-data-grid>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { Vue, Component, Prop, Model, Ref, Watch, Inject, InjectReactive, Provide, ProvideReactive, PropSync, Emit } from 'vue-property-decorator'
|
||||
import { SampleBoComponent } from '~/components/sample-bo-component'
|
||||
import { sampleBoardService, Board } from '~/services/sample-board-service'
|
||||
|
||||
@Component
|
||||
export default class extends SampleBoComponent {
|
||||
// #region variables
|
||||
gridData: Board[] = []
|
||||
// #endregion
|
||||
// #region hooks
|
||||
// #endregion
|
||||
// #region methods
|
||||
async search(title: string) {
|
||||
console.log('search')
|
||||
this.gridData = await sampleBoardService.getList(title)
|
||||
}
|
||||
// #endregion
|
||||
// #region watches
|
||||
// #endregion
|
||||
}
|
||||
</script>
|
||||
<style lang="scss"></style>
|
||||
50
front/bo/client/services/sample-board-service.ts
Normal file
50
front/bo/client/services/sample-board-service.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { UtraService } from '@ustra/nuxt/src/services/ustra-service'
|
||||
import { BaseModel } from '@ustra/data/src/models/base-models'
|
||||
import { ApiResponse } from '@ustra/data/src/models/api-model'
|
||||
import { PaginationRequest } from '@ustra/data/src/models/pagination-model'
|
||||
import { HttpMethod } from '@ustra/core/src/server/http/const'
|
||||
|
||||
export interface Board extends BaseModel {
|
||||
boardIdx: number
|
||||
categoryCd: string
|
||||
title: string
|
||||
content: string
|
||||
}
|
||||
|
||||
export class SampleBoardService extends UtraService {
|
||||
/**
|
||||
* 게시판 목록 조회
|
||||
*/
|
||||
async getList(title) {
|
||||
const url = this.$ustra.api.urlBuilder('/api/sample/board').add('title', title).build()
|
||||
|
||||
return (
|
||||
await this.$ustra.api.call<ApiResponse<Board[]>>({
|
||||
url,
|
||||
method: HttpMethod.GET,
|
||||
})
|
||||
).data.body
|
||||
}
|
||||
|
||||
async get(boardIdx: number) {
|
||||
return (
|
||||
await this.$ustra.api.call<ApiResponse<Board[]>>({
|
||||
url: '/api/sample/board/' + boardIdx,
|
||||
method: HttpMethod.GET,
|
||||
})
|
||||
).data.body
|
||||
}
|
||||
|
||||
async add(board: Board) {
|
||||
return (
|
||||
await this.$ustra.api.call<ApiResponse<Board[]>>({
|
||||
url: '/api/sample/board',
|
||||
method: HttpMethod.POST,
|
||||
data: board,
|
||||
})
|
||||
).data.body
|
||||
}
|
||||
}
|
||||
|
||||
export const sampleBoardService = new SampleBoardService()
|
||||
export default sampleBoardService
|
||||
@@ -28,7 +28,7 @@
|
||||
"@/*": ["./client/*"],
|
||||
"@ustra-sample/*": ["../node_modules/@ustra-sample/*"]
|
||||
},
|
||||
"types": ["@types/node", "@types/jest", "@nuxt/types", "@ustra/nuxt", "@ustra/nuxt-mng-bo", "@ustra-sample/cmm", "./types"]
|
||||
"types": ["@types/node", "@types/jest", "@nuxt/types", "@ustra/nuxt", "@ustra/nuxt-dx", "@ustra/nuxt-mng-bo", "@ustra-sample/cmm", "./types"]
|
||||
},
|
||||
"exclude": ["node_modules", ".nuxt", "dist", "src/**/*.test.ts", "**/src/static/**/*", "**/*.js"],
|
||||
"typedocOptions": {
|
||||
|
||||
@@ -15,6 +15,7 @@ export default class extends CustomFoComponent {
|
||||
// #region variables
|
||||
// #endregion
|
||||
// #region hooks
|
||||
created() {}
|
||||
// #endregion
|
||||
// #region methods
|
||||
// #endregion
|
||||
|
||||
@@ -11,7 +11,7 @@ export class SampleModule extends VuexModule {
|
||||
list: Array<string> = null
|
||||
|
||||
@Mutation
|
||||
@Storage({ propertyKey: 'sample.list', defaultValue: [], type: "local" })
|
||||
@Storage({ propertyKey: 'sample.list', defaultValue: [], type: 'local' })
|
||||
setList(list: Array<string>) {
|
||||
this.list = list
|
||||
}
|
||||
@@ -25,5 +25,4 @@ export class SampleModule extends VuexModule {
|
||||
nuxtClientInit(ctx: CombinedContext) {
|
||||
console.log('nuxtClientInit')
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"@/*": ["./fo/client/*", "./bo/client/*"],
|
||||
"@ustra-sample/*": ["./node_modules/@ustra-sample/*"]
|
||||
},
|
||||
"types": ["@types/node", "@types/jest", "@nuxt/types", "@ustra/nuxt", "@ustra/nuxt-mng-bo", "@ustra-sample/cmm", "@ustra/buefy", "buefy", "@ustra-sample/bo", "@ustra-sample/fo"]
|
||||
"types": ["@types/node", "@types/jest", "@nuxt/types", "@ustra/nuxt", "@ustra/nuxt-dx", "@ustra/nuxt-mng-bo", "@ustra-sample/cmm", "@ustra/buefy", "buefy", "@ustra-sample/bo", "@ustra-sample/fo"]
|
||||
},
|
||||
"exclude": ["node_modules", ".nuxt", "dist", "src/**/*.test.ts", "**/src/static/**/*", "**/*.js"],
|
||||
"typedocOptions": {
|
||||
|
||||
Reference in New Issue
Block a user