Commit 445c569b by Suvalue

预算编制修改

parent a6c18b8b
package com.bsoft.api.service.Impl; package com.bsoft.api.service.Impl;
import com.bsoft.api.common.exceptions.DBConfigurationError;
import com.bsoft.api.mapper.DicOrgMapper;
import com.bsoft.api.mapper.SerDiseaseMapper; import com.bsoft.api.mapper.SerDiseaseMapper;
import com.bsoft.api.mapper.SysRoleMapper;
import com.bsoft.api.model.SerDepartment;
import com.bsoft.api.model.SerDisease; import com.bsoft.api.model.SerDisease;
import com.bsoft.api.model.SysRole;
import com.bsoft.api.model.respmodel.DiseaseLevel; import com.bsoft.api.model.respmodel.DiseaseLevel;
import com.bsoft.api.service.SerDiseaseService; import com.bsoft.api.service.SerDiseaseService;
import com.bsoft.common.utils.StringUtil; import com.bsoft.common.utils.StringUtil;
...@@ -15,12 +20,29 @@ import java.util.List; ...@@ -15,12 +20,29 @@ import java.util.List;
public class SerDiseaseServiceImpl implements SerDiseaseService { public class SerDiseaseServiceImpl implements SerDiseaseService {
@Resource @Resource
private SerDiseaseMapper serDiseaseMapper; private SerDiseaseMapper serDiseaseMapper;
@Resource
private SysRoleMapper sysRoleMapper;
@Resource
private DicOrgMapper dicOrgMapper;
@Override @Override
public List<DiseaseLevel> selectListByIdorLevel(String date, String diseaseCode, Integer level, String docCode, String deptCode, Long userId) { public List<DiseaseLevel> selectListByIdorLevel(String date, String diseaseCode, Integer level, String docCode, String deptCode, Long userId) {
List<DiseaseLevel> list = new ArrayList<>(); List<DiseaseLevel> list = new ArrayList<>();
docCode = StringUtil.isNullOrEmpty(docCode) ? null : docCode; docCode = StringUtil.isNullOrEmpty(docCode) ? null : docCode;
deptCode = StringUtil.isNullOrEmpty(deptCode) ? null : deptCode; deptCode = StringUtil.isNullOrEmpty(deptCode) ? null : deptCode;
//判断用户角色
SysRole role = sysRoleMapper.selectByUser(userId);
if (role != null) {
if (role.getRoleCode().equals(2) && StringUtil.isNullOrBlank(deptCode)) {
//科室账号科室入参为空时自动分配科室
List<SerDepartment> deptList = dicOrgMapper.selectDeptByUser(userId, null);
if (deptList != null && deptList.size() > 0)
deptCode = deptList.get(0).getKsbm();
}
} else {
throw new DBConfigurationError("用户未分配角色!");
}
if (diseaseCode != null && diseaseCode != "") { if (diseaseCode != null && diseaseCode != "") {
list = selectByCode(date, diseaseCode, docCode, deptCode, userId); list = selectByCode(date, diseaseCode, docCode, deptCode, userId);
} else { } else {
......
...@@ -130,19 +130,19 @@ public class SerProjValueServiceImpl implements SerProjValueService { ...@@ -130,19 +130,19 @@ public class SerProjValueServiceImpl implements SerProjValueService {
for (Map<String, Object> enumInfo : enumList) { for (Map<String, Object> enumInfo : enumList) {
projType = new SummaryProjType(); projType = new SummaryProjType();
projType.setProjTypeName(String.valueOf(enumInfo.get("description"))); projType.setProjTypeName(String.valueOf(enumInfo.get("description")));
values = serProjValueMapper.selectValue((Integer) enumInfo.get("value"), null, values = serProjValueMapper.selectValue((Integer) enumInfo.get("value"), null,
null, summary.getDeptCode(), date, budgetType, orgCode); null, summary.getDeptCode(), date, budgetType, orgCode);
if (values != null && values.size() > 0) { // if (values != null && values.size() > 0) {
for (SerProjValueResp value : values) { // for (SerProjValueResp value : values) {
valueSz = projValueSzMapper.selectByProj(value.getProjId(), date, summary.getDeptCode(), orgCode); // valueSz = projValueSzMapper.selectByProj(value.getProjId(), date, summary.getDeptCode(), orgCode);
if (valueSz != null) { // if (valueSz != null) {
value.setSz(valueSz.getSz()); // value.setSz(valueSz.getSz());
value.setZxpl(valueSz.getZxpl()); // value.setZxpl(valueSz.getZxpl());
valueSz = null; // valueSz = null;
} // }
} // }
projType.setProject(values); projType.setProject(values);
} // }
summary.getProjTypeList().add(projType); summary.getProjTypeList().add(projType);
} }
} else { } else {
......
...@@ -86,12 +86,18 @@ ...@@ -86,12 +86,18 @@
d.PARENT_ID, d.`LEVEL`, d.ORG_ID, d.ORG_NAME d.PARENT_ID, d.`LEVEL`, d.ORG_ID, d.ORG_NAME
from SER_DISEASE d from SER_DISEASE d
join SER_DISEASE_DOC_RS rs on rs.MDC_CODE=d.MDC_CODE join SER_DISEASE_DOC_RS rs on rs.MDC_CODE=d.MDC_CODE
join (select ZBZBM,KSBM,SUM(ZLS) as ZLS
from val_block_values_1_5_2
where TIME=#{date} and ZLS>0
group by ZBZBM,KSBM) val on val.ZBZBM = d.MDC_CODE and val.KSBM=rs.DEPT_CODE
<if test="deptCode!=null"> <if test="deptCode!=null">
and val.KSBM=#{deptCode,jdbcType=VARCHAR} join (select ZBZBM,KSBM,SUM(ZLS) as ZLS
from val_block_values_1_2_2
where TIME=#{date} and ZLS>0
and KSBM=#{deptCode,jdbcType=VARCHAR}
group by ZBZBM,KSBM) val on val.ZBZBM = d.MDC_CODE and val.KSBM=rs.DEPT_CODE
</if>
<if test="deptCode==null">
join (select ZBZBM,SUM(ZLS) as ZLS
from val_block_values_1_1_2
where TIME=#{date} and ZLS>0
group by ZBZBM) val on val.ZBZBM = d.MDC_CODE
</if> </if>
where 1 = 1 and STATE=1 where 1 = 1 and STATE=1
<if test="level!=null"> <if test="level!=null">
...@@ -100,15 +106,6 @@ ...@@ -100,15 +106,6 @@
<if test="deptCode!=null"> <if test="deptCode!=null">
and rs.DEPT_CODE = #{deptCode,jdbcType=VARCHAR} and rs.DEPT_CODE = #{deptCode,jdbcType=VARCHAR}
</if> </if>
<if test="deptCode==null">
and EXISTS(select o2.ORG_CODE as DEPT_CODE
from SYS_USER_ORG_RS rs2
join DIC_ORG o2 on o2.id = rs2.ORG_ID and rs2.STATE = 1
where o2.STATE = 1
and rs2.USER_ID = #{userId,jdbcType=DECIMAL}
and o2.ORG_CODE = rs.DEPT_CODE
)
</if>
order by val.ZLS desc order by val.ZLS desc
</select> </select>
<select id="selectByLevelNoZBZ" resultMap="DiseaseLevel"> <select id="selectByLevelNoZBZ" resultMap="DiseaseLevel">
...@@ -138,12 +135,18 @@ ...@@ -138,12 +135,18 @@
d.PARENT_ID, d.`LEVEL`, d.ORG_ID, d.ORG_NAME d.PARENT_ID, d.`LEVEL`, d.ORG_ID, d.ORG_NAME
from SER_DISEASE d from SER_DISEASE d
join SER_DISEASE_DOC_RS rs on rs.MDC_CODE=d.MDC_CODE join SER_DISEASE_DOC_RS rs on rs.MDC_CODE=d.MDC_CODE
join (select ZBZBM,KSBM,SUM(ZLS) as ZLS
from val_block_values_1_5_2
where TIME=#{date} and ZLS>0
group by ZBZBM,KSBM) val on val.ZBZBM = d.MDC_CODE and val.KSBM=rs.DEPT_CODE
<if test="deptCode!=null"> <if test="deptCode!=null">
and val.KSBM=#{deptCode,jdbcType=VARCHAR} join (select ZBZBM,KSBM,SUM(ZLS) as ZLS
from val_block_values_1_2_2
where TIME=#{date} and ZLS>0
and KSBM=#{deptCode,jdbcType=VARCHAR}
group by ZBZBM,KSBM) val on val.ZBZBM = d.MDC_CODE and val.KSBM=rs.DEPT_CODE
</if>
<if test="deptCode==null">
join (select ZBZBM,SUM(ZLS) as ZLS
from val_block_values_1_1_2
where TIME=#{date} and ZLS>0
group by ZBZBM) val on val.ZBZBM = d.MDC_CODE
</if> </if>
where 1 = 1 and STATE=1 and STATE=1 where 1 = 1 and STATE=1 and STATE=1
<if test="parentId!=null"> <if test="parentId!=null">
...@@ -152,26 +155,34 @@ ...@@ -152,26 +155,34 @@
<if test="deptCode!=null"> <if test="deptCode!=null">
and rs.DEPT_CODE=#{deptCode,jdbcType=VARCHAR} and rs.DEPT_CODE=#{deptCode,jdbcType=VARCHAR}
</if> </if>
<if test="deptCode==null">
and EXISTS(select o2.ORG_CODE as DEPT_CODE
from SYS_USER_ORG_RS rs2
join DIC_ORG o2 on o2.id = rs2.ORG_ID and rs2.STATE = 1
where o2.STATE = 1
and rs2.USER_ID = #{userId,jdbcType=DECIMAL}
and o2.ORG_CODE = rs.DEPT_CODE
)
</if>
order by val.ZLS desc order by val.ZLS desc
</select> </select>
<select id="selectByParentIdNoZbz" resultMap="DiseaseLevel"> <select id="selectByParentIdNoZbz" resultMap="DiseaseLevel">
select DISTINCT d.ID, d.CREATE_DATE, d.CREATE_USERID, d.`STATE`, d.MDC_CODE, d.MDC_NAME, d.`DATE`,d.MDC_NUM, select DISTINCT d.ID, d.CREATE_DATE, d.CREATE_USERID, d.`STATE`, d.MDC_CODE, d.MDC_NAME, d.`DATE`,d.MDC_NUM,
d.PARENT_ID, d.`LEVEL`, d.ORG_ID, d.ORG_NAME d.PARENT_ID, d.`LEVEL`, d.ORG_ID, d.ORG_NAME
from SER_DISEASE d from SER_DISEASE d
join SER_DISEASE_DOC_RS rs on rs.MDC_CODE=d.MDC_CODE
<if test="deptCode!=null">
join (select ZBZBM,KSBM,SUM(ZLS) as ZLS
from val_block_values_1_5_2
where TIME=#{date}
and KSBM=#{deptCode,jdbcType=VARCHAR}
group by ZBZBM,KSBM) val on val.ZBZBM = d.MDC_CODE and val.KSBM=rs.DEPT_CODE
</if>
<if test="deptCode==null">
join (select ZBZBM,SUM(ZLS) as ZLS
from val_block_values_1_3_2
where TIME=#{date}
group by ZBZBM) val on val.ZBZBM = d.MDC_CODE
</if>
where 1 = 1 and STATE=1 and STATE=1 where 1 = 1 and STATE=1 and STATE=1
<if test="parentId!=null"> <if test="parentId!=null">
and d.PARENT_ID = #{parentId,jdbcType=DECIMAL} and d.PARENT_ID = #{parentId,jdbcType=DECIMAL}
</if> </if>
order by d.MDC_NUM <if test="deptCode!=null">
and rs.DEPT_CODE=#{deptCode,jdbcType=VARCHAR}
</if>
order by val.ZLS desc
</select> </select>
<select id="selectParentById" resultMap="DiseaseLevel"> <select id="selectParentById" resultMap="DiseaseLevel">
select * select *
......
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bsoft.api.mapper.SerProjValueMapper"> <mapper namespace="com.bsoft.api.mapper.SerProjValueMapper">
<resultMap id="BaseResultMap" type="com.bsoft.api.model.SerProjValue"> <resultMap id="BaseResultMap" type="com.bsoft.api.model.SerProjValue">
<result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate" /> <result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate"/>
<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="DECIMAL" 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="DECIMAL" property="ls" /> <result column="LS" jdbcType="DECIMAL" property="ls"/>
<result column="MB" jdbcType="DECIMAL" property="mb" /> <result column="MB" jdbcType="DECIMAL" property="mb"/>
<result column="CSYSZ" jdbcType="DECIMAL" property="csysz" /> <result column="CSYSZ" jdbcType="DECIMAL" property="csysz"/>
<result column="CSYSZ_TB" jdbcType="DECIMAL" property="csyszTb" /> <result column="CSYSZ_TB" jdbcType="DECIMAL" property="csyszTb"/>
<result column="YSZ" jdbcType="DECIMAL" property="ysz" /> <result column="YSZ" jdbcType="DECIMAL" property="ysz"/>
<result column="YSZ_TB" jdbcType="DECIMAL" property="yszTb" /> <result column="YSZ_TB" jdbcType="DECIMAL" property="yszTb"/>
<result column="SZ" jdbcType="DECIMAL" property="sz" /> <result column="SZ2" jdbcType="DECIMAL" property="sz"/>
<result column="ZXPL" jdbcType="DECIMAL" property="zxpl" /> <result column="ZXPL2" jdbcType="DECIMAL" property="zxpl"/>
<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="VERSION" jdbcType="VARCHAR" property="version"/>
<result column="QNZ_UNIT" jdbcType="VARCHAR" property="qnzUnit" /> <result column="QNZ_UNIT" jdbcType="VARCHAR" property="qnzUnit"/>
<result column="CSYSZ_UNIT" jdbcType="VARCHAR" property="csyszUnit" /> <result column="CSYSZ_UNIT" jdbcType="VARCHAR" property="csyszUnit"/>
<result column="YSZ_UNIT" jdbcType="VARCHAR" property="yszUnit" /> <result column="YSZ_UNIT" jdbcType="VARCHAR" property="yszUnit"/>
<result column="SZ_UNIT" jdbcType="VARCHAR" property="szUnit" /> <result column="SZ_UNIT" jdbcType="VARCHAR" property="szUnit"/>
<result column="WQQS_ZYPZ_JS" jdbcType="DECIMAL" property="wqqsZypzJs" /> <result column="WQQS_ZYPZ_JS" jdbcType="DECIMAL" property="wqqsZypzJs"/>
<result column="DEPT_NAME" jdbcType="VARCHAR" property="deptName" /> <result column="DEPT_NAME" jdbcType="VARCHAR" property="deptName"/>
<result column="HOSCODE" jdbcType="VARCHAR" property="hoscode" /> <result column="HOSCODE" jdbcType="VARCHAR" property="hoscode"/>
</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"/>
<result column="IS_BUDGET" jdbcType="DECIMAL" property="isBudget"/> <result column="IS_BUDGET" jdbcType="DECIMAL" property="isBudget"/>
<result column="PARENT" jdbcType="DECIMAL" property="parent"/> <result column="PARENT" jdbcType="DECIMAL" property="parent"/>
</resultMap> </resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal"> <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
delete from SER_PROJ_VALUE delete
where ID = #{id,jdbcType=DECIMAL} from SER_PROJ_VALUE
</delete> where ID = #{id,jdbcType=DECIMAL}
<insert id="insert" parameterType="com.bsoft.api.model.SerProjValue"> </delete>
insert into SER_PROJ_VALUE (CREATE_DATE, CREATE_USERID, `STATE`, <insert id="insert" parameterType="com.bsoft.api.model.SerProjValue">
PROJ_ID, QNZ, WQQS, insert into SER_PROJ_VALUE (CREATE_DATE, CREATE_USERID, `STATE`,
LS, MB, CSYSZ, CSYSZ_TB, PROJ_ID, QNZ, WQQS,
YSZ, YSZ_TB, SZ, ZXPL, LS, MB, CSYSZ, CSYSZ_TB,
`DATE`, DEPT_CODE, SORT, YSZ, YSZ_TB, SZ, ZXPL,
VERSION, QNZ_UNIT, CSYSZ_UNIT, `DATE`, DEPT_CODE, SORT,
YSZ_UNIT, SZ_UNIT, WQQS_ZYPZ_JS, VERSION, QNZ_UNIT, CSYSZ_UNIT,
DEPT_NAME, HOSCODE) YSZ_UNIT, SZ_UNIT, WQQS_ZYPZ_JS,
values (#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL}, DEPT_NAME, HOSCODE)
#{projId,jdbcType=DECIMAL}, #{qnz,jdbcType=DECIMAL}, #{wqqs,jdbcType=DECIMAL}, values (#{createDate,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL},
#{ls,jdbcType=DECIMAL}, #{mb,jdbcType=DECIMAL}, #{csysz,jdbcType=DECIMAL}, #{csyszTb,jdbcType=DECIMAL}, #{projId,jdbcType=DECIMAL}, #{qnz,jdbcType=DECIMAL}, #{wqqs,jdbcType=DECIMAL},
#{ysz,jdbcType=DECIMAL}, #{yszTb,jdbcType=DECIMAL}, #{sz,jdbcType=DECIMAL}, #{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},
#{version,jdbcType=VARCHAR}, #{qnzUnit,jdbcType=VARCHAR}, #{csyszUnit,jdbcType=VARCHAR}, #{date,jdbcType=DECIMAL}, #{deptCode,jdbcType=VARCHAR}, #{sort,jdbcType=DECIMAL},
#{yszUnit,jdbcType=VARCHAR}, #{szUnit,jdbcType=VARCHAR}, #{wqqsZypzJs,jdbcType=DECIMAL}, #{version,jdbcType=VARCHAR}, #{qnzUnit,jdbcType=VARCHAR}, #{csyszUnit,jdbcType=VARCHAR},
#{deptName,jdbcType=VARCHAR}, #{hoscode,jdbcType=VARCHAR}) #{yszUnit,jdbcType=VARCHAR}, #{szUnit,jdbcType=VARCHAR}, #{wqqsZypzJs,jdbcType=DECIMAL},
</insert> #{deptName,jdbcType=VARCHAR}, #{hoscode,jdbcType=VARCHAR})
<update id="updateByPrimaryKey" parameterType="com.bsoft.api.model.SerProjValue"> </insert>
update SER_PROJ_VALUE <update id="updateByPrimaryKey" parameterType="com.bsoft.api.model.SerProjValue">
set CREATE_DATE = #{createDate,jdbcType=TIMESTAMP}, update SER_PROJ_VALUE
CREATE_USERID = #{createUserid,jdbcType=DECIMAL}, set CREATE_DATE = #{createDate,jdbcType=TIMESTAMP},
`STATE` = #{state,jdbcType=DECIMAL}, CREATE_USERID = #{createUserid,jdbcType=DECIMAL},
PROJ_ID = #{projId,jdbcType=DECIMAL}, `STATE` = #{state,jdbcType=DECIMAL},
QNZ = #{qnz,jdbcType=DECIMAL}, PROJ_ID = #{projId,jdbcType=DECIMAL},
WQQS = #{wqqs,jdbcType=DECIMAL}, QNZ = #{qnz,jdbcType=DECIMAL},
LS = #{ls,jdbcType=DECIMAL}, WQQS = #{wqqs,jdbcType=DECIMAL},
MB = #{mb,jdbcType=DECIMAL}, LS = #{ls,jdbcType=DECIMAL},
CSYSZ = #{csysz,jdbcType=DECIMAL}, MB = #{mb,jdbcType=DECIMAL},
CSYSZ_TB = #{csyszTb,jdbcType=DECIMAL}, CSYSZ = #{csysz,jdbcType=DECIMAL},
YSZ = #{ysz,jdbcType=DECIMAL}, CSYSZ_TB = #{csyszTb,jdbcType=DECIMAL},
YSZ_TB = #{yszTb,jdbcType=DECIMAL}, YSZ = #{ysz,jdbcType=DECIMAL},
SZ = #{sz,jdbcType=DECIMAL}, YSZ_TB = #{yszTb,jdbcType=DECIMAL},
ZXPL = #{zxpl,jdbcType=DECIMAL}, SZ = #{sz,jdbcType=DECIMAL},
`DATE` = #{date,jdbcType=DECIMAL}, ZXPL = #{zxpl,jdbcType=DECIMAL},
DEPT_CODE = #{deptCode,jdbcType=VARCHAR}, `DATE` = #{date,jdbcType=DECIMAL},
SORT = #{sort,jdbcType=DECIMAL}, DEPT_CODE = #{deptCode,jdbcType=VARCHAR},
VERSION = #{version,jdbcType=VARCHAR}, SORT = #{sort,jdbcType=DECIMAL},
QNZ_UNIT = #{qnzUnit,jdbcType=VARCHAR}, VERSION = #{version,jdbcType=VARCHAR},
CSYSZ_UNIT = #{csyszUnit,jdbcType=VARCHAR}, QNZ_UNIT = #{qnzUnit,jdbcType=VARCHAR},
YSZ_UNIT = #{yszUnit,jdbcType=VARCHAR}, CSYSZ_UNIT = #{csyszUnit,jdbcType=VARCHAR},
SZ_UNIT = #{szUnit,jdbcType=VARCHAR}, YSZ_UNIT = #{yszUnit,jdbcType=VARCHAR},
HOSCODE = #{hosCode,jdbcType=VARCHAR} SZ_UNIT = #{szUnit,jdbcType=VARCHAR},
where ID = #{id,jdbcType=DECIMAL} HOSCODE = #{hosCode,jdbcType=VARCHAR}
</update> where ID = #{id,jdbcType=DECIMAL}
</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,
CSYSZ_TB, YSZ, YSZ_TB, SZ, ZXPL, `DATE`, DEPT_CODE, SORT, VERSION, QNZ_UNIT, CSYSZ_UNIT, CREATE_DATE,
YSZ_UNIT, SZ_UNIT, HOSCODE CREATE_USERID,
from SER_PROJ_VALUE `STATE`,
where ID = #{id,jdbcType=DECIMAL} PROJ_ID,
</select> QNZ,
<select id="selectAll" resultMap="BaseResultMap"> WQQS,
select ID, CREATE_DATE, CREATE_USERID, `STATE`, PROJ_ID, QNZ, WQQS, LS, MB, CSYSZ, LS,
CSYSZ_TB, YSZ, YSZ_TB, SZ, ZXPL, `DATE`, DEPT_CODE, SORT, VERSION, QNZ_UNIT, CSYSZ_UNIT, MB,
YSZ_UNIT, SZ_UNIT, WQQS_ZYPZ_JS, DEPT_NAME, HOSCODE CSYSZ,
from SER_PROJ_VALUE CSYSZ_TB,
</select> YSZ,
<select id="selectValue" resultMap="SerProjValueResp"> YSZ_TB,
SELECT v.*,p.PROJ_NAME,p.IS_BUDGET,p.PARENT SZ,
FROM SER_PROJ p ZXPL,
LEFT JOIN `DATE`,
( DEPT_CODE,
SELECT v.PROJ_ID,MAX(v.VERSION) AS VERSION SORT,
FROM SER_PROJ_VALUE v VERSION,
WHERE v.`STATE` = 1 QNZ_UNIT,
<if test="dept!=null"> CSYSZ_UNIT,
AND v.DEPT_CODE = #{dept,jdbcType=VARCHAR} YSZ_UNIT,
</if> SZ_UNIT,
<if test="date!=null"> HOSCODE
AND v.`DATE` = LEFT(#{date,jdbcType=DECIMAL},4) from SER_PROJ_VALUE
</if> where ID = #{id,jdbcType=DECIMAL}
<if test="hosCode!=null"> </select>
AND v.HOSCODE = #{hosCode,jdbcType=VARCHAR} <select id="selectAll" resultMap="BaseResultMap">
</if> select ID,
GROUP BY v.PROJ_ID CREATE_DATE,
)m on m.PROJ_ID = p.ID CREATE_USERID,
left JOIN SER_PROJ_VALUE v ON v.PROJ_ID = m.PROJ_ID AND v.VERSION = m.VERSION `STATE`,
<if test="dept!=null"> PROJ_ID,
AND v.DEPT_CODE = #{dept,jdbcType=VARCHAR} QNZ,
</if> WQQS,
<if test="date!=null"> LS,
AND v.`DATE` = LEFT(#{date,jdbcType=DECIMAL},4) MB,
</if> CSYSZ,
<if test="hosCode!=null"> CSYSZ_TB,
AND v.HOSCODE = #{hosCode,jdbcType=VARCHAR} YSZ,
</if> YSZ_TB,
WHERE 1 = 1 and p.`STATE` = 1 SZ,
<if test="projType!=null"> ZXPL,
AND p.PROJ_TYPE = #{projType,jdbcType=DECIMAL} `DATE`,
</if> DEPT_CODE,
<if test="typeState!=null"> SORT,
AND p.TYPE_STATE = #{typeState,jdbcType=DECIMAL} VERSION,
</if> QNZ_UNIT,
<if test="exponentId!=null"> CSYSZ_UNIT,
AND p.`TYPE` = #{exponentId,jdbcType=DECIMAL} YSZ_UNIT,
</if> SZ_UNIT,
<if test="budgetType!=null"> WQQS_ZYPZ_JS,
AND p.IS_BUDGET&amp;#{budgetType,jdbcType=DECIMAL}>0 DEPT_NAME,
</if> HOSCODE
ORDER BY p.SORT from SER_PROJ_VALUE
</select> </select>
<delete id="deleteByDeptWithDate"> <select id="selectValue" resultMap="SerProjValueResp">
delete v from SER_PROJ_VALUE v SELECT v.*,p.PROJ_NAME,p.IS_BUDGET,p.PARENT,sz.SZ as SZ2,sz.ZXPL as ZXPL2
JOIN SER_PROJ p ON p.ID = v.PROJ_ID FROM SER_PROJ p
WHERE p.PROJ_TYPE = #{projType,jdbcType=DECIMAL} LEFT JOIN
AND p.IS_BUDGET&amp;1>0 (
AND v.`DATE` = LEFT(#{date,jdbcType=DECIMAL},4) SELECT v.PROJ_ID,MAX(v.VERSION) AS VERSION
AND v.DEPT_CODE = #{dept,jdbcType=VARCHAR} FROM SER_PROJ_VALUE v
AND v.HOSCODE = #{orgCode,jdbcType=VARCHAR} WHERE v.`STATE` = 1
</delete> <if test="dept!=null">
<insert id="insertToHistory"> AND v.DEPT_CODE = #{dept,jdbcType=VARCHAR}
INSERT into ser_proj_value_history </if>
select v.* from SER_PROJ_VALUE v <if test="date!=null">
JOIN SER_PROJ p ON p.ID = v.PROJ_ID AND v.`DATE` = LEFT(#{date,jdbcType=DECIMAL},4)
WHERE p.PROJ_TYPE = #{projType,jdbcType=DECIMAL} </if>
AND p.IS_BUDGET&amp;1>0 <if test="hosCode!=null">
AND v.`DATE` = LEFT(#{date,jdbcType=DECIMAL},4) AND v.HOSCODE = #{hosCode,jdbcType=VARCHAR}
AND v.DEPT_CODE = #{dept,jdbcType=VARCHAR} </if>
AND v.HOSCODE = #{orgCode,jdbcType=VARCHAR} GROUP BY v.PROJ_ID
</insert> )m on m.PROJ_ID = p.ID
<update id="updateValue" statementType="CALLABLE"> left JOIN SER_PROJ_VALUE v ON v.PROJ_ID = m.PROJ_ID AND v.VERSION = m.VERSION
{call ESTIMATE_UPDATE_GZD_BL( <if test="dept!=null">
#{date,jdbcType=DECIMAL}, AND v.DEPT_CODE = #{dept,jdbcType=VARCHAR}
#{hosCode,jdbcType=VARCHAR} </if>
)} <if test="date!=null">
</update> AND v.`DATE` = LEFT(#{date,jdbcType=DECIMAL},4)
</if>
<if test="hosCode!=null">
AND v.HOSCODE = #{hosCode,jdbcType=VARCHAR}
</if>
left join ser_proj_value_sz sz on sz.PROJ_ID = m.PROJ_ID
AND sz.DEPT_CODE = v.DEPT_CODE
AND sz.`DATE` = #{date,jdbcType=DECIMAL}
AND sz.HOSCODE = v.HOSCODE
WHERE 1 = 1 and p.`STATE` = 1
<if test="projType!=null">
AND p.PROJ_TYPE = #{projType,jdbcType=DECIMAL}
</if>
<if test="typeState!=null">
AND p.TYPE_STATE = #{typeState,jdbcType=DECIMAL}
</if>
<if test="exponentId!=null">
AND p.`TYPE` = #{exponentId,jdbcType=DECIMAL}
</if>
<if test="budgetType!=null">
AND p.IS_BUDGET&amp;#{budgetType,jdbcType=DECIMAL}>0
</if>
ORDER BY p.SORT
</select>
<delete id="deleteByDeptWithDate">
delete v
from SER_PROJ_VALUE v
JOIN SER_PROJ p ON p.ID = v.PROJ_ID
WHERE p.PROJ_TYPE = #{projType,jdbcType=DECIMAL}
AND p.IS_BUDGET &amp; 1 > 0
AND v.`DATE` = LEFT(#{date,jdbcType=DECIMAL}, 4)
AND v.DEPT_CODE = #{dept,jdbcType=VARCHAR}
AND v.HOSCODE = #{orgCode,jdbcType=VARCHAR}
</delete>
<insert id="insertToHistory">
INSERT into ser_proj_value_history
select v.*
from SER_PROJ_VALUE v
JOIN SER_PROJ p ON p.ID = v.PROJ_ID
WHERE p.PROJ_TYPE = #{projType,jdbcType=DECIMAL}
AND p.IS_BUDGET &amp; 1 > 0
AND v.`DATE` = LEFT(#{date,jdbcType=DECIMAL}, 4)
AND v.DEPT_CODE = #{dept,jdbcType=VARCHAR}
AND v.HOSCODE = #{orgCode,jdbcType=VARCHAR}
</insert>
<update id="updateValue" statementType="CALLABLE">
{call ESTIMATE_UPDATE_GZD_BL(
#{date,jdbcType=DECIMAL},
#{hosCode,jdbcType=VARCHAR}
)}
</update>
</mapper> </mapper>
\ No newline at end of file
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