parent
f3d7045433
commit
a9aa163242
@ -0,0 +1,21 @@
|
|||||||
|
FROM openjdk:11
|
||||||
|
|
||||||
|
MAINTAINER connor
|
||||||
|
|
||||||
|
ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
|
||||||
|
JAVA_OPTS="" \
|
||||||
|
PORT=80 \
|
||||||
|
PROFILES="default"
|
||||||
|
|
||||||
|
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||||
|
|
||||||
|
RUN echo 'Asia/Shanghai' >/etc/timezone
|
||||||
|
|
||||||
|
ADD /src/main/resources/simsun.ttc /usr/share/fonts/
|
||||||
|
|
||||||
|
ADD /target/*.jar /target.jar
|
||||||
|
|
||||||
|
|
||||||
|
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /target.jar --spring.config.location=/home/connor/project/plmservice/config/application.yaml"]
|
||||||
|
|
||||||
|
EXPOSE $PORT
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.connor.plm;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@MapperScan("com.connor.plm.mapper")
|
||||||
|
public class PlmApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(PlmApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.connor.plm.application.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.connor.plm.domain.Project;
|
||||||
|
import com.connor.plm.mapper.ProjectMapper;
|
||||||
|
import com.connor.plm.util.JsonResult;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xukl
|
||||||
|
* @description
|
||||||
|
* @date 2022/12/14
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class ProjectService {
|
||||||
|
private final ProjectMapper projectMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂不考虑分页
|
||||||
|
*
|
||||||
|
* @param query
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public JsonResult projectQuery(String query) {
|
||||||
|
LambdaQueryWrapper<Project> like =
|
||||||
|
new LambdaQueryWrapper<Project>()
|
||||||
|
.like(Objects.nonNull(query), Project::getObjectName, query)
|
||||||
|
.or(wrapper -> wrapper.like(Objects.nonNull(query), Project::getProjectId, query));
|
||||||
|
return JsonResult.success(projectMapper.selectList(like));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.connor.plm.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xukl
|
||||||
|
* @description 项目
|
||||||
|
* @date 2022/12/14
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName(value = "\"UDS_PROJ_INFO\"",schema = "infodba")
|
||||||
|
public class Project implements Serializable {
|
||||||
|
private static final long serialVersionUID = 7577055919154263348L;
|
||||||
|
|
||||||
|
/** 项目编号 */
|
||||||
|
@TableField(value = "\"PROJ_ID\"")
|
||||||
|
String projectId;
|
||||||
|
/** 项目名称 */
|
||||||
|
@TableField(value = "\"PROJ_NAME\"")
|
||||||
|
String objectName;
|
||||||
|
/** 项目经理 */
|
||||||
|
@TableField(value ="\"PROJ_MANAGER1\"")
|
||||||
|
String assignee;
|
||||||
|
/** 项目经理工号 */
|
||||||
|
@TableField(value = "\"PROJ_MANAGER1\"")
|
||||||
|
String jobNumber;
|
||||||
|
/** 三级品类 */
|
||||||
|
@TableField(value = "\"PROJ_CATEGORY123\"")
|
||||||
|
String category;
|
||||||
|
/** 项目等级 */
|
||||||
|
@TableField(value = "\"PROJ_PRODUCTLEVEL\"")
|
||||||
|
String projectLevel;
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.connor.plm.interfaces;
|
||||||
|
|
||||||
|
import com.connor.plm.application.service.ProjectService;
|
||||||
|
import com.connor.plm.util.JsonResult;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xukl
|
||||||
|
* @description
|
||||||
|
* @date 2022/12/14
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/api/awc")
|
||||||
|
public class AWCController {
|
||||||
|
private final ProjectService projectService;
|
||||||
|
|
||||||
|
@PostMapping("/project/query")
|
||||||
|
public JsonResult projectQuery(String query) {
|
||||||
|
log.info("projectQuery() called with: query = {}", query);
|
||||||
|
return projectService.projectQuery(query);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.connor.plm.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.connor.plm.domain.Project;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xukl
|
||||||
|
* @description
|
||||||
|
* @date 2022/12/14
|
||||||
|
*/
|
||||||
|
public interface ProjectMapper extends BaseMapper<Project> {}
|
@ -0,0 +1,73 @@
|
|||||||
|
package com.connor.plm.util;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class JsonResult implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -137556159329235533L;
|
||||||
|
/**
|
||||||
|
* 接口是否完成操作
|
||||||
|
*/
|
||||||
|
private boolean success = true;
|
||||||
|
/**
|
||||||
|
* 接口处理的消息
|
||||||
|
*/
|
||||||
|
private String msg;
|
||||||
|
/**
|
||||||
|
* 状态码
|
||||||
|
*/
|
||||||
|
private Integer code;
|
||||||
|
/**
|
||||||
|
* 返回的对象
|
||||||
|
*/
|
||||||
|
private Object data;
|
||||||
|
|
||||||
|
public JsonResult() {}
|
||||||
|
|
||||||
|
public JsonResult(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JsonResult(String msg, Integer code) {
|
||||||
|
this.msg = msg;
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JsonResult success() {
|
||||||
|
return new JsonResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JsonResult success(Object data) {
|
||||||
|
JsonResult jr = new JsonResult();
|
||||||
|
jr.setData(data);
|
||||||
|
return jr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JsonResult success(String msg, Object data) {
|
||||||
|
JsonResult jr = new JsonResult();
|
||||||
|
jr.setMsg(msg);
|
||||||
|
jr.setData(data);
|
||||||
|
return jr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JsonResult error() {
|
||||||
|
JsonResult jr = new JsonResult();
|
||||||
|
jr.setSuccess(false);
|
||||||
|
return jr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JsonResult error(String msg) {
|
||||||
|
JsonResult jr = new JsonResult(msg);
|
||||||
|
jr.setSuccess(false);
|
||||||
|
return jr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JsonResult error(String msg, Integer code) {
|
||||||
|
JsonResult jr = new JsonResult(msg, code);
|
||||||
|
jr.setSuccess(false);
|
||||||
|
return jr;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.connor.plm;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class PlmApplicationTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {}
|
||||||
|
}
|
Loading…
Reference in new issue