药品信息 lombok依赖 使用@Data注解省略getset方法书写
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
<?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.zhyc.module.biosafety.mapper.SwMedicineMapper">
|
||||
|
||||
<resultMap type="SwMedicine" id="SwMedicineResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="medica" column="medica" />
|
||||
<result property="name" column="name" />
|
||||
<result property="medicType" column="medic_type" />
|
||||
<result property="usageId" column="usage_id" />
|
||||
<result property="comment" column="comment" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSwMedicineVo">
|
||||
select id, medica, name, medic_type, usage_id, comment from sw_medicine
|
||||
</sql>
|
||||
|
||||
<select id="selectSwMedicineList" parameterType="SwMedicine" resultMap="SwMedicineResult">
|
||||
<include refid="selectSwMedicineVo"/>
|
||||
<where>
|
||||
<if test="medica != null and medica != ''"> and medica = #{medica}</if>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="medicType != null "> and medic_type = #{medicType}</if>
|
||||
<if test="usageId != null "> and usage_id = #{usageId}</if>
|
||||
<if test="comment != null and comment != ''"> and comment = #{comment}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSwMedicineById" parameterType="Long" resultMap="SwMedicineResult">
|
||||
<include refid="selectSwMedicineVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSwMedicine" parameterType="SwMedicine" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sw_medicine
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="medica != null">medica,</if>
|
||||
<if test="name != null">name,</if>
|
||||
<if test="medicType != null">medic_type,</if>
|
||||
<if test="usageId != null">usage_id,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="medica != null">#{medica},</if>
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="medicType != null">#{medicType},</if>
|
||||
<if test="usageId != null">#{usageId},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSwMedicine" parameterType="SwMedicine">
|
||||
update sw_medicine
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="medica != null">medica = #{medica},</if>
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="medicType != null">medic_type = #{medicType},</if>
|
||||
<if test="usageId != null">usage_id = #{usageId},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSwMedicineById" parameterType="Long">
|
||||
delete from sw_medicine where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSwMedicineByIds" parameterType="String">
|
||||
delete from sw_medicine where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user