Commit 0cfca247 by Suvalue

预算编制接口

parent 1459310c
...@@ -101,6 +101,12 @@ ...@@ -101,6 +101,12 @@
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.10</version>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
package com.bsoft.api.common.enums; package com.bsoft.api.common.enums;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public enum ProjectType { public enum ProjectType {
OUTPATIENT(1,"门诊"),
HOSPITALIZED(2,"住院"), HOSPITALIZED(2,"住院"),
OUTPATIENT(1,"门诊"),
SUMMARY(3,"汇总"); SUMMARY(3,"汇总");
private int value; private int value;
...@@ -20,4 +25,18 @@ public enum ProjectType { ...@@ -20,4 +25,18 @@ public enum ProjectType {
public String getDesc() { public String getDesc() {
return desc; return desc;
} }
public static List<Map<String,Object>> all() {
List<Map<String,Object>> list = new ArrayList<>();
for(ProjectType projectType : values()){
Map<String,Object> map = new HashMap<String,Object>() {
{
put("value",projectType.getValue());
put("description",projectType.getDesc());
}
};
list.add(map);
}
return list;
}
} }
...@@ -3,7 +3,8 @@ package com.bsoft.api.controller; ...@@ -3,7 +3,8 @@ package com.bsoft.api.controller;
import com.bsoft.api.common.Result; import com.bsoft.api.common.Result;
import com.bsoft.api.common.annotations.Token; import com.bsoft.api.common.annotations.Token;
import com.bsoft.api.model.reqmodel.AddBudgetValue; import com.bsoft.api.model.reqmodel.AddBudgetValue;
import com.bsoft.api.model.reqmodel.BudgetValue; import com.bsoft.api.model.reqmodel.QueryBudgetValue;
import com.bsoft.api.model.reqmodel.QuerySummary;
import com.bsoft.api.service.SerProjValueService; import com.bsoft.api.service.SerProjValueService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -22,7 +23,7 @@ public class SerProjValueController { ...@@ -22,7 +23,7 @@ public class SerProjValueController {
@PostMapping("budget/value") @PostMapping("budget/value")
@Token @Token
@ApiOperation("查询预算编制数据") @ApiOperation("查询预算编制数据")
public Object getProjValue(@RequestBody BudgetValue request) throws Throwable { public Object getProjValue(@RequestBody QueryBudgetValue request) throws Throwable {
Object result = projValueService.getValue(request.getProjectType(),request.getDate(),request.getDeptCode()); Object result = projValueService.getValue(request.getProjectType(),request.getDate(),request.getDeptCode());
return Result.success(result); return Result.success(result);
...@@ -38,4 +39,12 @@ public class SerProjValueController { ...@@ -38,4 +39,12 @@ public class SerProjValueController {
else else
return Result.error(); return Result.error();
} }
@PostMapping("budget/summary")
@Token
@ApiOperation("查询预算编制汇总数据")
public Object getSummary(@RequestBody QuerySummary request) throws Throwable {
Object result = projValueService.getSummary(request.getDate());
return Result.success(result);
}
} }
...@@ -2,6 +2,7 @@ package com.bsoft.api.mapper; ...@@ -2,6 +2,7 @@ package com.bsoft.api.mapper;
import com.bsoft.api.model.SerProj; import com.bsoft.api.model.SerProj;
import com.bsoft.api.model.respmodel.ProjectInfo; import com.bsoft.api.model.respmodel.ProjectInfo;
import com.bsoft.api.model.respmodel.Summary;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -20,4 +21,6 @@ public interface SerProjMapper { ...@@ -20,4 +21,6 @@ public interface SerProjMapper {
List<ProjectInfo> selectState(@Param("projType") Integer projType, List<ProjectInfo> selectState(@Param("projType") Integer projType,
@Param("typeState") Integer typeState); @Param("typeState") Integer typeState);
List<Summary> selectDept(@Param("date") Integer date);
} }
\ No newline at end of file
...@@ -21,5 +21,6 @@ public interface SerProjValueMapper { ...@@ -21,5 +21,6 @@ public interface SerProjValueMapper {
List<SerProjValueResp> selectValue(@Param("projType") Integer projType, List<SerProjValueResp> selectValue(@Param("projType") Integer projType,
@Param("typeState") Integer typeState, @Param("typeState") Integer typeState,
@Param("exponentId") Integer exponentId, @Param("exponentId") Integer exponentId,
@Param("dept") String dept,@Param("date") Integer date); @Param("dept") String dept,@Param("date") Integer date,
@Param("isBudget") Integer isBudget);
} }
\ No newline at end of file
package com.bsoft.api.model; package com.bsoft.api.model;
import com.bsoft.api.model.reqmodel.AddBudgetValue; import com.bsoft.api.model.reqmodel.BudgetValue;
import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
@Data
public class SerProjValue { public class SerProjValue {
public SerProjValue() { public SerProjValue() {
} }
public SerProjValue(AddBudgetValue request) { public SerProjValue(BudgetValue request) {
this.projId = request.getProjId(); this.projId = request.getProjId();
this.qnz = request.getQnz(); this.qnz = request.getQnz();
this.wqqs = request.getWqqs(); this.wqqs = request.getWqqs();
this.ls = request.getLs(); this.ls = request.getLs();
this.mb = request.getMb(); this.mb = request.getMb();
this.csysz = request.getCsysz(); this.csysz = request.getCsysz();
this.csyszTb = request.getCsyszTb();
this.ysz = request.getYsz(); this.ysz = request.getYsz();
this.yszTb = request.getYszTb();
this.sz = request.getSz(); this.sz = request.getSz();
this.zxpl = request.getZxpl(); this.zxpl = request.getZxpl();
this.date = request.getDate();
this.deptCode = request.getDeptCode();
this.sort = request.getSort(); this.sort = request.getSort();
this.qnzUnit = request.getQnzUnit();
this.csyszUnit = request.getCsyszUnit();
this.yszUnit = request.getYszUnit();
this.szUnit = request.getSzUnit();
} }
private BigDecimal id; private BigDecimal id;
...@@ -35,23 +41,23 @@ public class SerProjValue { ...@@ -35,23 +41,23 @@ public class SerProjValue {
private BigDecimal projId; private BigDecimal projId;
private String qnz; private BigDecimal qnz;
private BigDecimal wqqs; private BigDecimal wqqs;
private String ls; private BigDecimal ls;
private String mb; private BigDecimal mb;
private String csysz; private BigDecimal csysz;
private BigDecimal csyszTb; private BigDecimal csyszTb;
private String ysz; private BigDecimal ysz;
private BigDecimal yszTb; private BigDecimal yszTb;
private String sz; private BigDecimal sz;
private BigDecimal zxpl; private BigDecimal zxpl;
...@@ -61,147 +67,14 @@ public class SerProjValue { ...@@ -61,147 +67,14 @@ public class SerProjValue {
private BigDecimal sort; private BigDecimal sort;
public BigDecimal getId() { private String version;
return id;
}
public void setId(BigDecimal id) {
this.id = id;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public BigDecimal getCreateUserid() {
return createUserid;
}
public void setCreateUserid(BigDecimal createUserid) {
this.createUserid = createUserid;
}
public BigDecimal getState() {
return state;
}
public void setState(BigDecimal state) {
this.state = state;
}
public BigDecimal getProjId() {
return projId;
}
public void setProjId(BigDecimal projId) {
this.projId = projId;
}
public String getQnz() {
return qnz;
}
public void setQnz(String qnz) {
this.qnz = qnz;
}
public BigDecimal getWqqs() {
return wqqs;
}
public void setWqqs(BigDecimal wqqs) {
this.wqqs = wqqs;
}
public String getLs() {
return ls;
}
public void setLs(String ls) {
this.ls = ls;
}
public String getMb() {
return mb;
}
public void setMb(String mb) { private String qnzUnit;
this.mb = mb;
}
public String getCsysz() { private String csyszUnit;
return csysz;
}
public void setCsysz(String csysz) { private String yszUnit;
this.csysz = csysz;
}
public BigDecimal getCsyszTb() { private String szUnit;
return csyszTb;
}
public void setCsyszTb(BigDecimal csyszTb) {
this.csyszTb = csyszTb;
}
public String getYsz() {
return ysz;
}
public void setYsz(String ysz) {
this.ysz = ysz;
}
public BigDecimal getYszTb() {
return yszTb;
}
public void setYszTb(BigDecimal yszTb) {
this.yszTb = yszTb;
}
public String getSz() {
return sz;
}
public void setSz(String sz) {
this.sz = sz;
}
public BigDecimal getZxpl() {
return zxpl;
}
public void setZxpl(BigDecimal zxpl) {
this.zxpl = zxpl;
}
public BigDecimal getDate() {
return date;
}
public void setDate(BigDecimal date) {
this.date = date;
}
public String getDeptCode() {
return deptCode;
}
public void setDeptCode(String deptCode) {
this.deptCode = deptCode;
}
public BigDecimal getSort() {
return sort;
}
public void setSort(BigDecimal sort) {
this.sort = sort;
}
} }
\ No newline at end of file
...@@ -2,125 +2,23 @@ package com.bsoft.api.model.reqmodel; ...@@ -2,125 +2,23 @@ package com.bsoft.api.model.reqmodel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
public class AddBudgetValue { public class AddBudgetValue {
@ApiModelProperty(value = "项目id")
private BigDecimal projId;
@ApiModelProperty(value = "去年值")
private String qnz;
@ApiModelProperty(value = "往期趋势")
private BigDecimal wqqs;
@ApiModelProperty(value = "同级同类位置历史")
private String ls;
@ApiModelProperty(value = "同级同类位置目标")
private String mb;
@ApiModelProperty(value = "初始运算值")
private String csysz;
@ApiModelProperty(value = "初始运算值同比")
private BigDecimal csyszTb;
@ApiModelProperty(value = "预算值")
private String ysz;
@ApiModelProperty(value = "预算值同比")
private BigDecimal yszTb;
@ApiModelProperty(value = "实值")
private String sz;
@ApiModelProperty(value = "执行偏离")
private BigDecimal zxpl;
@ApiModelProperty(value = "时间") @ApiModelProperty(value = "时间")
@NotNull(message = "时间不能为空")
private BigDecimal date; private BigDecimal date;
@ApiModelProperty(value = "科室code")
private String deptCode;
@ApiModelProperty(value = "排序")
private BigDecimal sort;
public BigDecimal getProjId() {
return projId;
}
public void setProjId(BigDecimal projId) {
this.projId = projId;
}
public String getQnz() {
return qnz;
}
public void setQnz(String qnz) {
this.qnz = qnz;
}
public BigDecimal getWqqs() {
return wqqs;
}
public void setWqqs(BigDecimal wqqs) {
this.wqqs = wqqs;
}
public String getLs() {
return ls;
}
public void setLs(String ls) {
this.ls = ls;
}
public String getMb() {
return mb;
}
public void setMb(String mb) {
this.mb = mb;
}
public String getCsysz() {
return csysz;
}
public void setCsysz(String csysz) { @ApiModelProperty(value = "科室")
this.csysz = csysz; @NotBlank(message = "科室不能为空")
} private String deptCode;
public BigDecimal getCsyszTb() {
return csyszTb;
}
public void setCsyszTb(BigDecimal csyszTb) {
this.csyszTb = csyszTb;
}
public String getYsz() {
return ysz;
}
public void setYsz(String ysz) {
this.ysz = ysz;
}
public BigDecimal getYszTb() {
return yszTb;
}
public void setYszTb(BigDecimal yszTb) {
this.yszTb = yszTb;
}
public String getSz() {
return sz;
}
public void setSz(String sz) {
this.sz = sz;
}
public BigDecimal getZxpl() { @ApiModelProperty(value = "数值")
return zxpl; @NotNull(message = "数值不能为空")
} private List<BudgetValue> budgetValues;
public void setZxpl(BigDecimal zxpl) {
this.zxpl = zxpl;
}
public BigDecimal getDate() { public BigDecimal getDate() {
return date; return date;
...@@ -138,11 +36,12 @@ public class AddBudgetValue { ...@@ -138,11 +36,12 @@ public class AddBudgetValue {
this.deptCode = deptCode; this.deptCode = deptCode;
} }
public BigDecimal getSort() { public List<BudgetValue> getBudgetValues() {
return sort; return budgetValues;
} }
public void setSort(BigDecimal sort) { public void setBudgetValues(List<BudgetValue> budgetValues) {
this.sort = sort; this.budgetValues = budgetValues;
} }
} }
package com.bsoft.api.model.reqmodel; package com.bsoft.api.model.reqmodel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class BudgetValue { public class BudgetValue {
@ApiModelProperty(value = "项目id")
private BigDecimal projId;
@ApiModelProperty(value = "项目类型(1=门诊/2=住院/3=汇总)",required = true) @ApiModelProperty(value = "去年值")
private Integer projectType; private BigDecimal qnz;
@ApiModelProperty(value = "时间",required = true)
private Integer date;
@ApiModelProperty(value = "科室",required = true)
private String deptCode;
public Integer getProjectType() { @ApiModelProperty(value = "往期趋势")
return projectType; private BigDecimal wqqs;
}
public void setProjectType(Integer projectType) { @ApiModelProperty(value = "同级同类位置历史")
this.projectType = projectType; private BigDecimal ls;
}
public Integer getDate() { @ApiModelProperty(value = "同级同类位置目标")
return date; private BigDecimal mb;
}
public void setDate(Integer date) { @ApiModelProperty(value = "初始运算值")
this.date = date; private BigDecimal csysz;
}
public String getDeptCode() { @ApiModelProperty(value = "初始运算值同比")
return deptCode; private BigDecimal csyszTb;
}
@ApiModelProperty(value = "预算值")
private BigDecimal ysz;
@ApiModelProperty(value = "预算值同比")
private BigDecimal yszTb;
@ApiModelProperty(value = "实值")
private BigDecimal sz;
@ApiModelProperty(value = "执行偏离")
private BigDecimal zxpl;
@ApiModelProperty(value = "排序")
private BigDecimal sort;
@ApiModelProperty(value = "去年值单位")
private String qnzUnit;
@ApiModelProperty(value = "初始运算值单位")
private String csyszUnit;
@ApiModelProperty(value = "运算值单位")
private String yszUnit;
@ApiModelProperty(value = "实值单位")
private String szUnit;
public void setDeptCode(String deptCode) {
this.deptCode = deptCode;
}
} }
package com.bsoft.api.model.reqmodel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
public class QueryBudgetValue {
@ApiModelProperty(value = "项目类型(1=门诊/2=住院/3=汇总)")
private Integer projectType;
@ApiModelProperty(value = "时间", required = true)
private Integer date;
@ApiModelProperty(value = "科室")
private String deptCode;
public Integer getProjectType() {
return projectType;
}
public void setProjectType(Integer projectType) {
this.projectType = projectType;
}
public Integer getDate() {
return date;
}
public void setDate(Integer date) {
this.date = date;
}
public String getDeptCode() {
return deptCode;
}
public void setDeptCode(String deptCode) {
this.deptCode = deptCode;
}
}
package com.bsoft.api.model.reqmodel;
import io.swagger.annotations.ApiModelProperty;
public class QuerySummary {
@ApiModelProperty(value = "时间", required = true)
private Integer date;
public Integer getDate() {
return date;
}
public void setDate(Integer date) {
this.date = date;
}
}
package com.bsoft.api.model.respmodel;
import java.util.List;
public class Summary {
private String deptCode;
private List<SummaryProjType> projTypeList;
public String getDeptCode() {
return deptCode;
}
public void setDeptCode(String deptCode) {
this.deptCode = deptCode;
}
public List<SummaryProjType> getProjTypeList() {
return projTypeList;
}
public void setProjTypeList(List<SummaryProjType> projTypeList) {
this.projTypeList = projTypeList;
}
}
package com.bsoft.api.model.respmodel;
import java.util.List;
public class SummaryProjType {
private String projTypeName;
private List<SerProjValueResp> project;
public String getProjTypeName() {
return projTypeName;
}
public void setProjTypeName(String projTypeName) {
this.projTypeName = projTypeName;
}
public List<SerProjValueResp> getProject() {
return project;
}
public void setProject(List<SerProjValueResp> project) {
this.project = project;
}
}
package com.bsoft.api.service.Impl; package com.bsoft.api.service.Impl;
import com.bsoft.api.common.enums.ProjectType;
import com.bsoft.api.common.enums.StateType; import com.bsoft.api.common.enums.StateType;
import com.bsoft.api.common.enums.TypeState; import com.bsoft.api.common.enums.TypeState;
import com.bsoft.api.mapper.SerProjMapper; import com.bsoft.api.mapper.SerProjMapper;
import com.bsoft.api.mapper.SerProjValueMapper; import com.bsoft.api.mapper.SerProjValueMapper;
import com.bsoft.api.model.SerProjValue; import com.bsoft.api.model.SerProjValue;
import com.bsoft.api.model.reqmodel.AddBudgetValue; import com.bsoft.api.model.reqmodel.AddBudgetValue;
import com.bsoft.api.model.respmodel.ProjectInfo; import com.bsoft.api.model.reqmodel.BudgetValue;
import com.bsoft.api.model.respmodel.ProjectValue; import com.bsoft.api.model.respmodel.*;
import com.bsoft.api.model.respmodel.SerProjValueResp;
import com.bsoft.api.service.SerProjValueService; import com.bsoft.api.service.SerProjValueService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -42,7 +43,7 @@ public class SerProjValueServiceImpl implements SerProjValueService { ...@@ -42,7 +43,7 @@ public class SerProjValueServiceImpl implements SerProjValueService {
if(projectInfo != null && projectInfo.size() > 0){ if(projectInfo != null && projectInfo.size() > 0){
for(ProjectInfo projInfo : projectInfo){ for(ProjectInfo projInfo : projectInfo){
List<SerProjValueResp> values = serProjValueMapper.selectValue(projectType,(Integer)enumInfo.get("value"), List<SerProjValueResp> values = serProjValueMapper.selectValue(projectType,(Integer)enumInfo.get("value"),
projInfo.getExponentId(),deptCode,date); projInfo.getExponentId(),deptCode,date,null);
if(values != null && values.size() > 0) if(values != null && values.size() > 0)
projInfo.setProjectValues(values); projInfo.setProjectValues(values);
} }
...@@ -55,16 +56,51 @@ public class SerProjValueServiceImpl implements SerProjValueService { ...@@ -55,16 +56,51 @@ public class SerProjValueServiceImpl implements SerProjValueService {
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public boolean save(AddBudgetValue request) { public boolean save(AddBudgetValue request) {
int result = 0; int result = 0;
if(request != null){ if(request != null && request.getBudgetValues() != null && request.getBudgetValues().size() > 0){
SerProjValue info = new SerProjValue(request); SerProjValue info = null;
info.setCreateDate(new Date()); long version = System.currentTimeMillis();
info.setState(BigDecimal.valueOf(StateType.ON.getValue())); for(BudgetValue budgetValue : request.getBudgetValues()){
result = serProjValueMapper.insert(info); info = new SerProjValue(budgetValue);
info.setDate(request.getDate());
info.setDeptCode(request.getDeptCode());
info.setCreateDate(new Date());
info.setState(BigDecimal.valueOf(StateType.ON.getValue()));
info.setVersion(String.valueOf(version));
result = serProjValueMapper.insert(info);
}
} }
return result > 0; return result > 0;
} }
@Override
public Object getSummary(Integer date) {
List<Summary> result = serProjMapper.selectDept(date);
if(result != null && result.size() > 0){
for(Summary summary : result){
summary.setProjTypeList(new ArrayList<>());
List<Map<String,Object>> enumList = ProjectType.all();
SummaryProjType projType = null;
List<ProjectInfo> projectInfo = null;
if(enumList != null && enumList.size() > 0){
for(Map<String,Object> enumInfo : enumList){
projType = new SummaryProjType();
projType.setProjTypeName(String.valueOf(enumInfo.get("description")));
List<SerProjValueResp> values = serProjValueMapper.selectValue((Integer)enumInfo.get("value"),null,
null,summary.getDeptCode(),date,1);
if(values != null)
projType.setProject(values);
summary.getProjTypeList().add(projType);
}
}else{
summary.setProjTypeList(null);
}
}
}
return result;
}
} }
...@@ -6,4 +6,6 @@ public interface SerProjValueService { ...@@ -6,4 +6,6 @@ public interface SerProjValueService {
Object getValue(Integer projectType,Integer date,String deptCode) throws Throwable; Object getValue(Integer projectType,Integer date,String deptCode) throws Throwable;
boolean save(AddBudgetValue request); boolean save(AddBudgetValue request);
Object getSummary(Integer date);
} }
...@@ -5,8 +5,8 @@ jdbc.password=123456 ...@@ -5,8 +5,8 @@ jdbc.password=123456
jdbc.driverClass=com.mysql.jdbc.Driver jdbc.driverClass=com.mysql.jdbc.Driver
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.username=ll spring.datasource.username=scml_hc
spring.datasource.password=123456 spring.datasource.password=123
spring.datasource.url=jdbc:oracle:thin:@192.168.18.171:1521:his spring.datasource.url=jdbc:oracle:thin:@192.168.18.171:1521:his
# Redis\u6570\u636E\u5E93\u7D22\u5F15\uFF08\u9ED8\u8BA40\uFF09 # Redis\u6570\u636E\u5E93\u7D22\u5F15\uFF08\u9ED8\u8BA40\uFF09
......
spring.application.name=bsoftapi spring.application.name=bsoftapi
spring.profiles.active=dev spring.profiles.active=test
#server.port=8080 #server.port=8080
#server.servlet.context-path=/api #server.servlet.context-path=/api
mybatis.mapper-locations=classpath:mapper/*.xml mybatis.mapper-locations=classpath:mapper/*.xml
...@@ -15,5 +15,5 @@ spring.aop.auto=true ...@@ -15,5 +15,5 @@ spring.aop.auto=true
# Whether subclass-based (CGLIB) proxies are to be created (true) # Whether subclass-based (CGLIB) proxies are to be created (true)
spring.aop.proxy-target-class=false spring.aop.proxy-target-class=false
spring.jmx.enabled=false spring.jmx.enabled=false
#控制字段为null不返回的问题 True表示返回 False表示不返回 #\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u05B6\uFFFD\u03AAnull\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u0635\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD True\uFFFD\uFFFD\u02BE\uFFFD\uFFFD\uFFFD\uFFFD False\uFFFD\uFFFD\u02BE\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD
mybatis.configuration.call-setters-on-nulls=true mybatis.configuration.call-setters-on-nulls=true
\ No newline at end of file
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
<result column="TYPE_STATE" jdbcType="DECIMAL" property="typeState" /> <result column="TYPE_STATE" jdbcType="DECIMAL" property="typeState" />
<result column="SORT" jdbcType="DECIMAL" property="sort" /> <result column="SORT" jdbcType="DECIMAL" property="sort" />
</resultMap> </resultMap>
<resultMap id="Summary" type="com.bsoft.api.model.respmodel.Summary">
<result column="DEPT_CODE" jdbcType="VARCHAR" property="deptCode" />
</resultMap>
<resultMap id="ProjectInfo" type="com.bsoft.api.model.respmodel.ProjectInfo"> <resultMap id="ProjectInfo" type="com.bsoft.api.model.respmodel.ProjectInfo">
<result column="EXPONENT_ID" jdbcType="DECIMAL" property="exponentId" /> <result column="EXPONENT_ID" jdbcType="DECIMAL" property="exponentId" />
<result column="EXPONENT_NAME" jdbcType="VARCHAR" property="exponentName" /> <result column="EXPONENT_NAME" jdbcType="VARCHAR" property="exponentName" />
...@@ -62,8 +65,21 @@ ...@@ -62,8 +65,21 @@
select DISTINCT p.TYPE as EXPONENT_ID,e.EXPONENT_NAME,e.SORT select DISTINCT p.TYPE as EXPONENT_ID,e.EXPONENT_NAME,e.SORT
from ser_proj p from ser_proj p
join DIC_EXPONENT e on e.EXPONENT_ID=p.TYPE and e.STATE = 1 join DIC_EXPONENT e on e.EXPONENT_ID=p.TYPE and e.STATE = 1
where p.STATE = 1 and p.PROJ_TYPE = #{projType,jdbcType=DECIMAL} where p.STATE = 1
and p.TYPE_STATE = #{typeState,jdbcType=DECIMAL} <if test="projType!=null">
and p.PROJ_TYPE = #{projType,jdbcType=DECIMAL}
</if>
<if test="typeState!=null">
and p.TYPE_STATE = #{typeState,jdbcType=DECIMAL}
</if>
order by e.SORT order by e.SORT
</select> </select>
<select id="selectDept" resultMap="Summary">
select DEPT_CODE from SER_PROJ_VALUE
where 1=1
<if test="date!=null">
and "DATE"=2020
</if>
GROUP BY DEPT_CODE
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
<result column="CREATE_USERID" jdbcType="DECIMAL" property="createUserid" /> <result column="CREATE_USERID" jdbcType="DECIMAL" property="createUserid" />
<result column="STATE" jdbcType="DECIMAL" property="state" /> <result column="STATE" jdbcType="DECIMAL" property="state" />
<result column="PROJ_ID" jdbcType="DECIMAL" property="projId" /> <result column="PROJ_ID" jdbcType="DECIMAL" property="projId" />
<result column="QNZ" jdbcType="VARCHAR" property="qnz" /> <result column="QNZ" jdbcType="DECIMAL" property="qnz" />
<result column="WQQS" jdbcType="DECIMAL" property="wqqs" /> <result column="WQQS" jdbcType="DECIMAL" property="wqqs" />
<result column="LS" jdbcType="VARCHAR" property="ls" /> <result column="LS" jdbcType="VARCHAR" property="ls" />
<result column="MB" jdbcType="VARCHAR" property="mb" /> <result column="MB" jdbcType="DECIMAL" property="mb" />
<result column="CSYSZ" jdbcType="VARCHAR" property="csysz" /> <result column="CSYSZ" jdbcType="VARCHAR" property="csysz" />
<result column="CSYSZ_TB" jdbcType="DECIMAL" property="csyszTb" /> <result column="CSYSZ_TB" jdbcType="DECIMAL" property="csyszTb" />
<result column="YSZ" jdbcType="VARCHAR" property="ysz" /> <result column="YSZ" jdbcType="VARCHAR" property="ysz" />
...@@ -20,6 +20,11 @@ ...@@ -20,6 +20,11 @@
<result column="DATE" jdbcType="DECIMAL" property="date" /> <result column="DATE" jdbcType="DECIMAL" property="date" />
<result column="DEPT_CODE" jdbcType="VARCHAR" property="deptCode" /> <result column="DEPT_CODE" jdbcType="VARCHAR" property="deptCode" />
<result column="SORT" jdbcType="DECIMAL" property="sort" /> <result column="SORT" jdbcType="DECIMAL" property="sort" />
<result column="VERSION" jdbcType="VARCHAR" property="version" />
<result column="QNZ_UNIT" jdbcType="VARCHAR" property="qnzUnit" />
<result column="CSYSZ_UNIT" jdbcType="VARCHAR" property="csyszUnit" />
<result column="YSZ_UNIT" jdbcType="VARCHAR" property="yszUnit" />
<result column="SZ_UNIT" jdbcType="VARCHAR" property="szUnit" />
</resultMap> </resultMap>
<resultMap id="SerProjValueResp" extends="BaseResultMap" type="com.bsoft.api.model.respmodel.SerProjValueResp"> <resultMap id="SerProjValueResp" extends="BaseResultMap" type="com.bsoft.api.model.respmodel.SerProjValueResp">
<result column="PROJ_NAME" jdbcType="VARCHAR" property="projName"/> <result column="PROJ_NAME" jdbcType="VARCHAR" property="projName"/>
...@@ -30,21 +35,23 @@ ...@@ -30,21 +35,23 @@
where ID = #{id,jdbcType=DECIMAL} where ID = #{id,jdbcType=DECIMAL}
</delete> </delete>
<insert id="insert" parameterType="com.bsoft.api.model.SerProjValue"> <insert id="insert" parameterType="com.bsoft.api.model.SerProjValue">
<selectKey keyProperty="id" order="AFTER" resultType="java.math.BigDecimal"> <selectKey keyProperty="id" order="BEFORE" resultType="java.math.BigDecimal">
select SEQ_SER_PROJ_VALUE_ID.nextval from dual select SEQ_SER_PROJ_VALUE_ID.nextval from dual
</selectKey> </selectKey>
insert into SER_PROJ_VALUE (CREATE_DATE, CREATE_USERID, "STATE", insert into SER_PROJ_VALUE (ID,CREATE_DATE, CREATE_USERID, "STATE",
PROJ_ID, QNZ, WQQS, PROJ_ID, QNZ, WQQS,
LS, MB, CSYSZ, CSYSZ_TB, LS, MB, CSYSZ, CSYSZ_TB,
YSZ, YSZ_TB, SZ, ZXPL, YSZ, YSZ_TB, SZ, ZXPL,
"DATE", DEPT_CODE, SORT "DATE", DEPT_CODE, SORT,
) VERSION, QNZ_UNIT, CSYSZ_UNIT,
values (#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL}, YSZ_UNIT, SZ_UNIT)
#{projId,jdbcType=DECIMAL}, #{qnz,jdbcType=VARCHAR}, #{wqqs,jdbcType=DECIMAL}, values (#{id,jdbcType=DECIMAL},#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL},
#{ls,jdbcType=VARCHAR}, #{mb,jdbcType=VARCHAR}, #{csysz,jdbcType=VARCHAR}, #{csyszTb,jdbcType=DECIMAL}, #{projId,jdbcType=DECIMAL}, #{qnz,jdbcType=DECIMAL}, #{wqqs,jdbcType=DECIMAL},
#{ysz,jdbcType=VARCHAR}, #{yszTb,jdbcType=DECIMAL}, #{sz,jdbcType=VARCHAR}, #{zxpl,jdbcType=DECIMAL}, #{ls,jdbcType=DECIMAL}, #{mb,jdbcType=DECIMAL}, #{csysz,jdbcType=DECIMAL}, #{csyszTb,jdbcType=DECIMAL},
#{date,jdbcType=DECIMAL}, #{deptCode,jdbcType=VARCHAR}, #{sort,jdbcType=DECIMAL} #{ysz,jdbcType=DECIMAL}, #{yszTb,jdbcType=DECIMAL}, #{sz,jdbcType=DECIMAL}, #{zxpl,jdbcType=DECIMAL},
) #{date,jdbcType=DECIMAL}, #{deptCode,jdbcType=VARCHAR}, #{sort,jdbcType=DECIMAL},
#{version,jdbcType=VARCHAR}, #{qnzUnit,jdbcType=VARCHAR}, #{csyszUnit,jdbcType=VARCHAR},
#{yszUnit,jdbcType=VARCHAR}, #{szUnit,jdbcType=VARCHAR})
</insert> </insert>
<update id="updateByPrimaryKey" parameterType="com.bsoft.api.model.SerProjValue"> <update id="updateByPrimaryKey" parameterType="com.bsoft.api.model.SerProjValue">
update SER_PROJ_VALUE update SER_PROJ_VALUE
...@@ -52,47 +59,74 @@ ...@@ -52,47 +59,74 @@
CREATE_USERID = #{createUserid,jdbcType=DECIMAL}, CREATE_USERID = #{createUserid,jdbcType=DECIMAL},
"STATE" = #{state,jdbcType=DECIMAL}, "STATE" = #{state,jdbcType=DECIMAL},
PROJ_ID = #{projId,jdbcType=DECIMAL}, PROJ_ID = #{projId,jdbcType=DECIMAL},
QNZ = #{qnz,jdbcType=VARCHAR}, QNZ = #{qnz,jdbcType=DECIMAL},
WQQS = #{wqqs,jdbcType=DECIMAL}, WQQS = #{wqqs,jdbcType=DECIMAL},
LS = #{ls,jdbcType=VARCHAR}, LS = #{ls,jdbcType=DECIMAL},
MB = #{mb,jdbcType=VARCHAR}, MB = #{mb,jdbcType=DECIMAL},
CSYSZ = #{csysz,jdbcType=VARCHAR}, CSYSZ = #{csysz,jdbcType=DECIMAL},
CSYSZ_TB = #{csyszTb,jdbcType=DECIMAL}, CSYSZ_TB = #{csyszTb,jdbcType=DECIMAL},
YSZ = #{ysz,jdbcType=VARCHAR}, YSZ = #{ysz,jdbcType=DECIMAL},
YSZ_TB = #{yszTb,jdbcType=DECIMAL}, YSZ_TB = #{yszTb,jdbcType=DECIMAL},
SZ = #{sz,jdbcType=VARCHAR}, SZ = #{sz,jdbcType=DECIMAL},
ZXPL = #{zxpl,jdbcType=DECIMAL}, ZXPL = #{zxpl,jdbcType=DECIMAL},
"DATE" = #{date,jdbcType=DECIMAL}, "DATE" = #{date,jdbcType=DECIMAL},
DEPT_CODE = #{deptCode,jdbcType=VARCHAR}, DEPT_CODE = #{deptCode,jdbcType=VARCHAR},
SORT = #{sort,jdbcType=DECIMAL} SORT = #{sort,jdbcType=DECIMAL},
VERSION = #{version,jdbcType=VARCHAR},
QNZ_UNIT = #{qnzUnit,jdbcType=VARCHAR},
CSYSZ_UNIT = #{csyszUnit,jdbcType=VARCHAR},
YSZ_UNIT = #{yszUnit,jdbcType=VARCHAR},
SZ_UNIT = #{szUnit,jdbcType=VARCHAR}
where ID = #{id,jdbcType=DECIMAL} where ID = #{id,jdbcType=DECIMAL}
</update> </update>
<select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, "STATE", PROJ_ID, QNZ, WQQS, LS, MB, CSYSZ, select ID, CREATE_DATE, CREATE_USERID, "STATE", PROJ_ID, QNZ, WQQS, LS, MB, CSYSZ,
CSYSZ_TB, YSZ, YSZ_TB, SZ, ZXPL, "DATE", DEPT_CODE, SORT CSYSZ_TB, YSZ, YSZ_TB, SZ, ZXPL, "DATE", DEPT_CODE, SORT, VERSION, QNZ_UNIT, CSYSZ_UNIT,
YSZ_UNIT, SZ_UNIT
from SER_PROJ_VALUE from SER_PROJ_VALUE
where ID = #{id,jdbcType=DECIMAL} where ID = #{id,jdbcType=DECIMAL}
</select> </select>
<select id="selectAll" resultMap="BaseResultMap"> <select id="selectAll" resultMap="BaseResultMap">
select ID, CREATE_DATE, CREATE_USERID, "STATE", PROJ_ID, QNZ, WQQS, LS, MB, CSYSZ, select ID, CREATE_DATE, CREATE_USERID, "STATE", PROJ_ID, QNZ, WQQS, LS, MB, CSYSZ,
CSYSZ_TB, YSZ, YSZ_TB, SZ, ZXPL, "DATE", DEPT_CODE, SORT CSYSZ_TB, YSZ, YSZ_TB, SZ, ZXPL, "DATE", DEPT_CODE, SORT, VERSION, QNZ_UNIT, CSYSZ_UNIT,
YSZ_UNIT, SZ_UNIT
from SER_PROJ_VALUE from SER_PROJ_VALUE
</select> </select>
<select id="selectValue" resultMap="SerProjValueResp"> <select id="selectValue" resultMap="SerProjValueResp">
select v.*,p.PROJ_NAME,p.IS_BUDGET SELECT v.*,p.PROJ_NAME,p.IS_BUDGET
from ( FROM (
select v.ID,v.PROJ_ID,MAX(v.CREATE_DATE) as CREATE_DATE SELECT v.PROJ_ID,MAX(v.VERSION) AS VERSION
from SER_PROJ_VALUE v FROM SER_PROJ_VALUE v
where v.STATE = 1 WHERE v.STATE = 1
GROUP BY v.PROJ_ID,v.ID <if test="dept!=null">
AND v.DEPT_CODE = #{dept,jdbcType=VARCHAR}
</if>
<if test="date!=null">
AND v."DATE" = #{date,jdbcType=DECIMAL}
</if>
GROUP BY v.PROJ_ID
)m )m
join SER_PROJ_VALUE v on v.ID = m.ID JOIN SER_PROJ_VALUE v ON v.PROJ_ID = m.PROJ_ID AND v.VERSION = m.VERSION
join SER_PROJ p on p.ID = m.PROJ_ID and p.STATE = 1 JOIN SER_PROJ p ON p.ID = m.PROJ_ID AND p.STATE = 1
where 1 = 1 WHERE 1 = 1
and p.PROJ_TYPE = #{projType,jdbcType=DECIMAL} <if test="projType!=null">
and p.TYPE_STATE = #{typeState,jdbcType=DECIMAL} AND p.PROJ_TYPE = #{projType,jdbcType=DECIMAL}
and p.TYPE = #{exponentId,jdbcType=DECIMAL} </if>
and v.DEPT_CODE = #{dept,jdbcType=VARCHAR} <if test="typeState!=null">
and v."DATE" = #{date,jdbcType=DECIMAL} AND p.TYPE_STATE = #{typeState,jdbcType=DECIMAL}
</if>
<if test="exponentId!=null">
AND p.TYPE = #{exponentId,jdbcType=DECIMAL}
</if>
<if test="dept!=null">
AND v.DEPT_CODE = #{dept,jdbcType=VARCHAR}
</if>
<if test="date!=null">
AND v."DATE" = #{date,jdbcType=DECIMAL}
</if>
<if test="isBudget!=null">
AND p.IS_BUDGET = #{isBudget,jdbcType=DECIMAL}
</if>
ORDER BY p.SORT
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -42,9 +42,6 @@ ...@@ -42,9 +42,6 @@
<!-- 生成映射接口配置 --> <!-- 生成映射接口配置 -->
<javaClientGenerator targetPackage="com.bsoft.api.mapper" targetProject="src/main/java" type="XMLMAPPER"/> <javaClientGenerator targetPackage="com.bsoft.api.mapper" targetProject="src/main/java" type="XMLMAPPER"/>
<table tableName="SER_PROJ">
<generatedKey column="id" sqlStatement="select SEQ_SER_PROJ_ID.nextval from dual" identity="true"/>
</table>
<table tableName="SER_PROJ_VALUE"> <table tableName="SER_PROJ_VALUE">
<generatedKey column="id" sqlStatement="select SEQ_SER_PROJ_VALUE_ID.nextval from dual" identity="true"/> <generatedKey column="id" sqlStatement="select SEQ_SER_PROJ_VALUE_ID.nextval from dual" identity="true"/>
</table> </table>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment