feat: 多码融合

v3
chenhc 6 months ago
parent ea28c3f986
commit 021bd57147

@ -0,0 +1,62 @@
package com.glxp.udidl.admin.controller.udchs;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.glxp.udidl.admin.dto.udchs.BaseParam;
import com.glxp.udidl.admin.entity.chs.CodeRel;
import com.glxp.udidl.admin.entity.chs.YbDrug;
import com.glxp.udidl.admin.enums.ResultEnum;
import com.glxp.udidl.admin.res.BaseResponse;
import com.glxp.udidl.admin.service.udchs.impl.CodeRelServiceImpl;
import com.glxp.udidl.admin.util.ResultVOUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
*/
@Api(tags = "多码融合库信息接口")
@RestController
@RequestMapping("/udchs/codeRel")
public class CodeRelController {
@Autowired
private CodeRelServiceImpl codeRelService;
@ApiOperation(value = "获取指定信息", response = CodeRel.class)
@GetMapping("/list")
public BaseResponse getList(CodeRel param) {
if ( param == null ||
(StrUtil.isBlank(param.getDinamecode()) && StrUtil.isBlank(param.getDrugcode()))
){
return ResultVOUtils.error(ResultEnum.DATA_ERROR,"参数错误");
}
List<CodeRel> list = codeRelService.list(new LambdaQueryWrapper<CodeRel>()
.eq(CodeRel::getDinamecode,param.getDinamecode()).or().eq(CodeRel::getDrugcode,param.getDrugcode()));
return ResultVOUtils.success(list);
}
@ApiOperation(value = "更新指定信息", response = CodeRel.class)
@PostMapping("/update")
public BaseResponse updateByCodeRel(@RequestBody CodeRel param) {
if ( param == null ||
(StrUtil.isBlank(param.getDinamecode()) && StrUtil.isBlank(param.getDrugcode()))
){
return ResultVOUtils.error(ResultEnum.DATA_ERROR,"参数错误");
}
boolean b = codeRelService.updateByCodeRel(param);
if (!b){
return ResultVOUtils.error(500,"更新失败");
}
return ResultVOUtils.success("更新成功");
}
}

@ -0,0 +1,23 @@
package com.glxp.udidl.admin.dao.chs;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.udidl.admin.entity.chs.CodeRel;
import com.glxp.udidl.admin.entity.udid.Contactlist;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CodeRelMapper extends BaseMapper<CodeRel> {
int deleteByPrimaryKey(Integer id);
int insert(CodeRel record);
int insertSelective(CodeRel record);
CodeRel selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(CodeRel record);
int updateByPrimaryKey(CodeRel record);
boolean updateByCodeRel(CodeRel param);
}

@ -0,0 +1,63 @@
package com.glxp.udidl.admin.entity.chs;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
@Data
@TableName(value = "code_rel")
public class CodeRel {
public Integer id;
/**
*
*/
public String dinamecode;
/**
*
*/
public String drugcode;
/**
*
*/
public String ybbm;
/**
*
*/
public String yccode;
/**
*
*/
public String sptm;
/**
*
*/
public String ypbwm;
/**
*
*/
public String tyshxyh;
/**
* 9
*/
public String gjbm;
public String status;
public Date updatetime;
public Date createtime;
public Byte fromtype;
}

@ -0,0 +1,22 @@
package com.glxp.udidl.admin.service.udchs.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.udidl.admin.dao.chs.CodeRelMapper;
import com.glxp.udidl.admin.entity.chs.CodeRel;
import org.springframework.stereotype.Service;
@Service
public class CodeRelServiceImpl extends ServiceImpl<CodeRelMapper, CodeRel> {
//存在就更新 不存在就新增
public boolean updateByCodeRel(CodeRel param) {
boolean b = this.baseMapper.updateByCodeRel(param);
if (!b){
int i = this.baseMapper.insertSelective(param);
return i>0;
}
return b;
}
}

@ -0,0 +1,239 @@
<?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="com.glxp.udidl.admin.dao.chs.CodeRelMapper">
<resultMap id="BaseResultMap" type="com.glxp.udidl.admin.entity.chs.CodeRel">
<!--@mbg.generated-->
<!--@Table code_rel-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="diNameCode" jdbcType="VARCHAR" property="dinamecode" />
<result column="drugCode" jdbcType="VARCHAR" property="drugcode" />
<result column="ybbm" jdbcType="VARCHAR" property="ybbm" />
<result column="ycCode" jdbcType="VARCHAR" property="yccode" />
<result column="sptm" jdbcType="VARCHAR" property="sptm" />
<result column="ypbwm" jdbcType="VARCHAR" property="ypbwm" />
<result column="tyshxyh" jdbcType="VARCHAR" property="tyshxyh" />
<result column="gjbm" jdbcType="VARCHAR" property="gjbm" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="updateTime" jdbcType="TIMESTAMP" property="updatetime" />
<result column="createTime" jdbcType="TIMESTAMP" property="createtime" />
<result column="fromType" jdbcType="TINYINT" property="fromtype" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, diNameCode, drugCode, ybbm, ycCode, sptm, ypbwm, tyshxyh, gjbm, `status`, updateTime,
createTime, fromType
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List" />
from code_rel
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--@mbg.generated-->
delete from code_rel
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.glxp.udidl.admin.entity.chs.CodeRel" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into code_rel (diNameCode, drugCode, ybbm,
ycCode, sptm, ypbwm,
tyshxyh, gjbm, `status`,
updateTime, createTime, fromType
)
values (#{dinamecode,jdbcType=VARCHAR}, #{drugcode,jdbcType=VARCHAR}, #{ybbm,jdbcType=VARCHAR},
#{yccode,jdbcType=VARCHAR}, #{sptm,jdbcType=VARCHAR}, #{ypbwm,jdbcType=VARCHAR},
#{tyshxyh,jdbcType=VARCHAR}, #{gjbm,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{updatetime,jdbcType=TIMESTAMP}, #{createtime,jdbcType=TIMESTAMP}, #{fromtype,jdbcType=TINYINT}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.glxp.udidl.admin.entity.chs.CodeRel" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into code_rel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dinamecode != null">
diNameCode,
</if>
<if test="drugcode != null">
drugCode,
</if>
<if test="ybbm != null">
ybbm,
</if>
<if test="yccode != null">
ycCode,
</if>
<if test="sptm != null">
sptm,
</if>
<if test="ypbwm != null">
ypbwm,
</if>
<if test="tyshxyh != null">
tyshxyh,
</if>
<if test="gjbm != null">
gjbm,
</if>
<if test="status != null">
`status`,
</if>
<if test="updatetime != null">
updateTime,
</if>
<if test="createtime != null">
createTime,
</if>
<if test="fromtype != null">
fromType,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dinamecode != null">
#{dinamecode,jdbcType=VARCHAR},
</if>
<if test="drugcode != null">
#{drugcode,jdbcType=VARCHAR},
</if>
<if test="ybbm != null">
#{ybbm,jdbcType=VARCHAR},
</if>
<if test="yccode != null">
#{yccode,jdbcType=VARCHAR},
</if>
<if test="sptm != null">
#{sptm,jdbcType=VARCHAR},
</if>
<if test="ypbwm != null">
#{ypbwm,jdbcType=VARCHAR},
</if>
<if test="tyshxyh != null">
#{tyshxyh,jdbcType=VARCHAR},
</if>
<if test="gjbm != null">
#{gjbm,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="updatetime != null">
#{updatetime,jdbcType=TIMESTAMP},
</if>
<if test="createtime != null">
#{createtime,jdbcType=TIMESTAMP},
</if>
<if test="fromtype != null">
#{fromtype,jdbcType=TINYINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.glxp.udidl.admin.entity.chs.CodeRel">
<!--@mbg.generated-->
update code_rel
<set>
<if test="dinamecode != null">
diNameCode = #{dinamecode,jdbcType=VARCHAR},
</if>
<if test="drugcode != null">
drugCode = #{drugcode,jdbcType=VARCHAR},
</if>
<if test="ybbm != null">
ybbm = #{ybbm,jdbcType=VARCHAR},
</if>
<if test="yccode != null">
ycCode = #{yccode,jdbcType=VARCHAR},
</if>
<if test="sptm != null">
sptm = #{sptm,jdbcType=VARCHAR},
</if>
<if test="ypbwm != null">
ypbwm = #{ypbwm,jdbcType=VARCHAR},
</if>
<if test="tyshxyh != null">
tyshxyh = #{tyshxyh,jdbcType=VARCHAR},
</if>
<if test="gjbm != null">
gjbm = #{gjbm,jdbcType=VARCHAR},
</if>
<if test="status != null">
`status` = #{status,jdbcType=VARCHAR},
</if>
<if test="updatetime != null">
updateTime = #{updatetime,jdbcType=TIMESTAMP},
</if>
<if test="createtime != null">
createTime = #{createtime,jdbcType=TIMESTAMP},
</if>
<if test="fromtype != null">
fromType = #{fromtype,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.glxp.udidl.admin.entity.chs.CodeRel">
<!--@mbg.generated-->
update code_rel
set diNameCode = #{dinamecode,jdbcType=VARCHAR},
drugCode = #{drugcode,jdbcType=VARCHAR},
ybbm = #{ybbm,jdbcType=VARCHAR},
ycCode = #{yccode,jdbcType=VARCHAR},
sptm = #{sptm,jdbcType=VARCHAR},
ypbwm = #{ypbwm,jdbcType=VARCHAR},
tyshxyh = #{tyshxyh,jdbcType=VARCHAR},
gjbm = #{gjbm,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
updateTime = #{updatetime,jdbcType=TIMESTAMP},
createTime = #{createtime,jdbcType=TIMESTAMP},
fromType = #{fromtype,jdbcType=TINYINT}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByCodeRel" parameterType="com.glxp.udidl.admin.entity.chs.CodeRel">
<!--@mbg.generated-->
update code_rel
<set>
<if test="ybbm != null">
ybbm = #{ybbm,jdbcType=VARCHAR},
</if>
<if test="yccode != null">
ycCode = #{yccode,jdbcType=VARCHAR},
</if>
<if test="sptm != null">
sptm = #{sptm,jdbcType=VARCHAR},
</if>
<if test="ypbwm != null">
ypbwm = #{ypbwm,jdbcType=VARCHAR},
</if>
<if test="tyshxyh != null">
tyshxyh = #{tyshxyh,jdbcType=VARCHAR},
</if>
<if test="gjbm != null">
gjbm = #{gjbm,jdbcType=VARCHAR},
</if>
<if test="status != null">
`status` = #{status,jdbcType=VARCHAR},
</if>
<if test="updatetime != null">
updateTime = #{updatetime,jdbcType=TIMESTAMP},
</if>
<if test="createtime != null">
createTime = #{createtime,jdbcType=TIMESTAMP},
</if>
<if test="fromtype != null">
fromType = #{fromtype,jdbcType=TINYINT},
</if>
</set>
<where>
<if test="dinamecode != null">
diNameCode = #{dinamecode,jdbcType=VARCHAR}
</if>
<if test="dinamecode == null and drugcode != null">
drugcode = #{drugcode,jdbcType=VARCHAR}
</if>
</where>
</update>
</mapper>
Loading…
Cancel
Save