预算指标增删改接口

This commit is contained in:
hecan 2024-08-19 16:12:10 +08:00
parent 86d4bf5d53
commit 776b5804dc
5 changed files with 237 additions and 4 deletions

View File

@ -11,4 +11,12 @@ import com.hzya.frame.grpU8.nxproof.oeryszb.entity.OerYszbEntity;
* @Date: 2023/6/19 14:59
*/
public interface IOerYszbDao extends IBaseDao<OerYszbEntity,String> {
//保存预算指标
OerYszbEntity saveOerYszbEntity(OerYszbEntity oerYszbEntity);
//更新预算指标
Integer updateOerYszbEntity(OerYszbEntity oerYszbEntity);
//删除预算指标
Integer deleteOerYszbEntity(OerYszbEntity oerYszbEntity);
}

View File

@ -1,11 +1,14 @@
package com.hzya.frame.grpU8.nxproof.oeryszb.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.grpU8.nxproof.oeryszb.dao.IOerYszbDao;
import com.hzya.frame.grpU8.nxproof.oeryszb.entity.OerYszbEntity;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @Author:hecan
* @Description:
@ -15,4 +18,23 @@ import org.springframework.stereotype.Repository;
*/
@Repository(value = "oerYszbDao")
public class OerYszbDaoImpl extends MybatisGenericDao<OerYszbEntity,String> implements IOerYszbDao {
@Override
@DS("#oerYszbEntity.dataSourceCode")
public OerYszbEntity saveOerYszbEntity(OerYszbEntity oerYszbEntity) {
return super.save(oerYszbEntity);
}
@Override
@DS("#oerYszbEntity.dataSourceCode")
public Integer updateOerYszbEntity(OerYszbEntity oerYszbEntity) {
int update = super.update("OerYszbEntity_update_yszb", oerYszbEntity);
return update;
}
@Override
@DS("#oerYszbEntity.dataSourceCode")
public Integer deleteOerYszbEntity(OerYszbEntity oerYszbEntity) {
return super.delete("OerYszbEntity_delete_yszb",oerYszbEntity);
}
}

View File

@ -22,7 +22,7 @@
<sql id="OerYszbEntity_Base_Column_List">
MLID,DJLXID,GSDM,KJND,BNXID
</sql>
<insert id="OerYszbEntity_insert" parameterType="com.hzya.frame.grpU8.nxproof.oeryszb.entity.OerYszbEntity">
<insert id="entity_insert" parameterType="com.hzya.frame.grpU8.nxproof.oeryszb.entity.OerYszbEntity">
insert into OER_YSZB(
<if test="mlId != null and mlId !='' "> MLID, </if>
<if test="djlxId != null and djlxId !='' "> DJLXID, </if>
@ -59,7 +59,48 @@
)
</insert>
<delete id="OerYszbEntity_delete" parameterType="com.hzya.frame.grpU8.nxproof.oeryszb.entity.OerYszbEntity">
<update id="entity_update" parameterType="com.hzya.frame.grpU8.nxproof.oeryszb.entity.OerYszbEntity">
update OER_YSZB set
<trim suffix="" suffixOverrides=",">
<if test="mlId != null and mlId !='' "> MLID=#{mlId}, </if>
<if test="djlxId != null and djlxId !='' "> DJLXID=#{djlxId}, </if>
<if test="kjnd != null and kjnd !='' "> KJND=#{kjnd}, </if>
<if test="bnxId != null and bnxId !='' "> BNXID=#{bnxId}, </if>
<if test="dataId != null and dataId !='' "> DataID=#{dataId}, </if>
<if test="xh != null and xh !=''">XH= #{xh}, </if>
<if test="zbdm != null and zbdm !='' ">ZBDM= #{zbdm}, </if>
<if test="zbId != null and zbId !='' "> ZBID=#{zbId}, </if>
<if test="jhId != null and jhId !='' ">JHID= #{jhId}, </if>
<if test="kzzbId != null and kzzbId !='' "> KZZBID=#{kzzbId}, </if>
<if test="kmdm != null and kmdm !='' ">KMDM= #{kmdm}, </if>
<if test="kmmc != null and kmmc !='' "> KMMC=#{kmmc},</if>
<if test="je != null and je !='' "> JE=#{je}, </if>
<if test="zy != null and zy !='' "> ZY=#{zy},</if>
<if test="gsdm != null and gsdm !='' ">GSDM #{gsdm} </if>
</trim>
where mlId= #{mlId}
</update>
<update id="OerYszbEntity_update_yszb" parameterType="com.hzya.frame.grpU8.nxproof.oeryszb.entity.OerYszbEntity">
update OER_YSZB set
<trim suffix="" suffixOverrides=",">
<if test="djlxId != null and djlxId !='' "> DJLXID=#{djlxId}, </if>
<if test="bnxId != null and bnxId !='' "> BNXID=#{bnxId}, </if>
<if test="dataId != null and dataId !='' "> DataID=#{dataId}, </if>
<if test="xh != null and xh !=''">XH= #{xh}, </if>
<if test="zbdm != null and zbdm !='' ">ZBDM= #{zbdm}, </if>
<if test="jhId != null and jhId !='' ">JHID= #{jhId}, </if>
<if test="kzzbId != null and kzzbId !='' "> KZZBID=#{kzzbId}, </if>
<if test="kmdm != null and kmdm !='' ">KMDM= #{kmdm}, </if>
<if test="kmmc != null and kmmc !='' "> KMMC=#{kmmc},</if>
<if test="je != null and je !='' "> JE=#{je}, </if>
<if test="zy != null and zy !='' "> ZY=#{zy},</if>
</trim>
where mlId= #{mlId} and kjnd=#{kjnd} and gsdm=#{gsdm} and ZBID=#{zbId}
<if test="xh != null and xh !='' "> and XH= #{xh} </if>
</update>
<delete id="entity_delete" parameterType="com.hzya.frame.grpU8.nxproof.oeryszb.entity.OerYszbEntity">
DELETE
FROM
oer_yszb
@ -69,4 +110,16 @@
AND MLID = #{mlId}
</delete>
<delete id="OerYszbEntity_delete_yszb" parameterType="com.hzya.frame.grpU8.nxproof.oeryszb.entity.OerYszbEntity">
DELETE
FROM
oer_yszb
WHERE
GSDM = #{gsdm}
AND KJND = #{kjnd}
AND MLID = #{mlId}
and ZBID=#{zbId}
<if test="xh != null and xh !='' "> and XH= #{xh} </if>
</delete>
</mapper>

View File

@ -1,5 +1,9 @@
package com.hzya.frame.grpU8.nxproof.oeryszb.service;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.grpU8.nxproof.oeryszb.entity.OerYszbEntity;
/**
* @Author:hecan
* @Description:
@ -7,5 +11,35 @@ package com.hzya.frame.grpU8.nxproof.oeryszb.service;
* @return:
* @Date: 2023/6/19 14:28
*/
public interface IOerYszbService {
public interface IOerYszbService extends IBaseService<OerYszbEntity, String> {
/**
*
* @content 预算指标新增
* @Param
* @Return
* @Author hecan
* @Date 2024/8/16 10:42
* **/
Object saveOerYszb(JSONObject jsonObject);
/**
*
* @content 预算指标修改
* @Param
* @Return
* @Author hecan
* @Date 2024/8/16 10:42
* **/
Object updateOerYszb(JSONObject jsonObject);
/**
*
* @content 预算指标删除
* @Param
* @Return
* @Author hecan
* @Date 2024/8/16 10:43
* **/
Object deleteOerYszb(JSONObject jsonObject);
}

View File

@ -1,8 +1,17 @@
package com.hzya.frame.grpU8.nxproof.oeryszb.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.grpU8.nxproof.glPzml.dao.ISenderGlPzmlDao;
import com.hzya.frame.grpU8.nxproof.oeryszb.dao.IOerYszbDao;
import com.hzya.frame.grpU8.nxproof.oeryszb.entity.OerYszbEntity;
import com.hzya.frame.grpU8.nxproof.oeryszb.service.IOerYszbService;
import com.hzya.frame.web.entity.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.awt.*;
/**
* @Author:hecan
* @Description:
@ -11,5 +20,112 @@ import org.springframework.stereotype.Service;
* @Date: 2023/6/19 14:32
*/
@Service(value = "oerYszbService")
public class OerYszbServiceImpl implements IOerYszbService {
public class OerYszbServiceImpl extends BaseService<OerYszbEntity, String> implements IOerYszbService {
private IOerYszbDao oerYszbDao;
@Autowired
public void setOerYszbDao(IOerYszbDao dao) {
this.oerYszbDao = dao;
this.dao = dao;
}
//预算指标新增
@Override
public Object saveOerYszb(JSONObject json) {
JSONObject jsonObject = json.getJSONObject("jsonStr");
if(!checkStr(jsonObject.getString("mlId"))){
return BaseResult.getFailureMessageEntity("请传递mlid");
}
if(!checkStr(jsonObject.getString("gsdm"))){
return BaseResult.getFailureMessageEntity("请传递公司代码");
}
if(!checkStr(jsonObject.getString("kjnd"))){
return BaseResult.getFailureMessageEntity("请传递会计年度");
}
if(!checkStr(jsonObject.getString("zbId"))){
return BaseResult.getFailureMessageEntity("请传递指标id");
}
if(!checkStr(jsonObject.getString("zbdm"))){
return BaseResult.getFailureMessageEntity("请传递指标代码");
}
OerYszbEntity oerYszbEntity = jsonObject.toJavaObject(OerYszbEntity.class);
try {
logger.info("======开始保存预算指标=======");
oerYszbEntity.setDataId("0");
oerYszbEntity.setBnxId("0");
OerYszbEntity save = oerYszbDao.saveOerYszbEntity(oerYszbEntity);
JSONObject jsonObjectYszb=new JSONObject();
jsonObjectYszb.put("status","200");
jsonObjectYszb.put("yszb",save);
logger.info("======预算指标保存完毕,返回值:{}=======",jsonObjectYszb.toJSONString());
return jsonObjectYszb;
}catch (Exception e){
logger.info("根据mlid:{},会计年度:{},公司代码:{}指标id{}保存预算指标失败:{}",oerYszbEntity.getMlId(),oerYszbEntity.getKjnd(),oerYszbEntity.getGsdm(),oerYszbEntity.getZbId(),e.getMessage());
return BaseResult.getFailureMessageEntity("预算指标保存失败");
}
}
//预算指标修改
@Override
public Object updateOerYszb(JSONObject json) {
JSONObject jsonObject = json.getJSONObject("jsonStr");
if(!checkStr(jsonObject.getString("mlId"))){
return BaseResult.getFailureMessageEntity("请传递mlid");
}
if(!checkStr(jsonObject.getString("gsdm"))){
return BaseResult.getFailureMessageEntity("请传递公司代码");
}
if(!checkStr(jsonObject.getString("kjnd"))){
return BaseResult.getFailureMessageEntity("请传递会计年度");
}
if(!checkStr(jsonObject.getString("zbId"))){
return BaseResult.getFailureMessageEntity("请传递指标id");
}
OerYszbEntity oerYszbEntity = jsonObject.toJavaObject(OerYszbEntity.class);
try {
logger.info("======开始保存预算指标=======");
Integer integer = oerYszbDao.updateOerYszbEntity(oerYszbEntity);
JSONObject jsonObjectYszb=new JSONObject();
jsonObjectYszb.put("status","200");
jsonObjectYszb.put("yszb",integer);
return jsonObjectYszb;
}catch (Exception e){
logger.info("根据mlid:{},会计年度:{},公司代码:{}指标id{},序号:{}更新预算指标失败:{}",oerYszbEntity.getMlId(),oerYszbEntity.getKjnd(),oerYszbEntity.getGsdm(),oerYszbEntity.getZbId(),oerYszbEntity.getXh(),e.getMessage());
return BaseResult.getFailureMessageEntity("预算指标更新失败");
}
}
//预算指标删除
@Override
public Object deleteOerYszb(JSONObject json) {
JSONObject jsonObject = json.getJSONObject("jsonStr");
if(!checkStr(jsonObject.getString("mlId"))){
return BaseResult.getFailureMessageEntity("请传递mlid");
}
if(!checkStr(jsonObject.getString("gsdm"))){
return BaseResult.getFailureMessageEntity("请传递公司代码");
}
if(!checkStr(jsonObject.getString("kjnd"))){
return BaseResult.getFailureMessageEntity("请传递会计年度");
}
if(!checkStr(jsonObject.getString("zbId"))){
return BaseResult.getFailureMessageEntity("请传递指标id");
}
OerYszbEntity oerYszbEntity = jsonObject.toJavaObject(OerYszbEntity.class);
try {
logger.info("======开始保存预算指标=======");
Integer integer = oerYszbDao.deleteOerYszbEntity(oerYszbEntity);
JSONObject jsonObjectYszb=new JSONObject();
jsonObjectYszb.put("status","200");
jsonObjectYszb.put("yszb",integer);
return jsonObjectYszb;
}catch (Exception e){
logger.info("根据mlid:{},会计年度:{},公司代码:{}指标id{},序号:{}删除预算指标失败:{}",oerYszbEntity.getMlId(),oerYszbEntity.getKjnd(),oerYszbEntity.getGsdm(),oerYszbEntity.getZbId(),oerYszbEntity.getXh(),e.getMessage());
return BaseResult.getFailureMessageEntity("预算指标删除失败");
}
}
}