<?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.thhy.secure.modules.biz.material.mapper.TMaterialMapper">
|
<resultMap id="BaseResultMap" type="com.thhy.secure.modules.biz.material.entity.TMaterial">
|
<!--
|
WARNING - @mbg.generated
|
This element is automatically generated by MyBatis Generator, do not modify.
|
This element was generated on Mon Jun 05 12:47:02 CST 2023.
|
-->
|
<id column="material_id" jdbcType="VARCHAR" property="materialId" />
|
<result column="material_name" jdbcType="VARCHAR" property="materialName" />
|
<result column="material_type" jdbcType="VARCHAR" property="materialType" />
|
<result column="material_number" jdbcType="VARCHAR" property="materialNumber" />
|
<result column="material_version" jdbcType="VARCHAR" property="materialVersion" />
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
|
<result column="is_use" jdbcType="INTEGER" property="isUse" />
|
<result column="company_id" jdbcType="VARCHAR" property="companyId" />
|
</resultMap>
|
|
|
<insert id="materialInsert">
|
insert into t_material
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="materialId != null">
|
material_id,
|
</if>
|
<if test="materialName != null">
|
material_name,
|
</if>
|
<if test="materialType != null">
|
material_type,
|
</if>
|
<if test="materialNumber != null">
|
material_number,
|
</if>
|
<if test="materialVersion != null">
|
material_version,
|
</if>
|
<if test="createTime != null">
|
create_time,
|
</if>
|
<if test="createUser != null">
|
create_user,
|
</if>
|
<if test="isUse != null">
|
is_use,
|
</if>
|
<if test="companyId != null">
|
company_id,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="materialId != null">
|
#{materialId,jdbcType=VARCHAR},
|
</if>
|
<if test="materialName != null">
|
#{materialName,jdbcType=VARCHAR},
|
</if>
|
<if test="materialType != null">
|
#{materialType,jdbcType=VARCHAR},
|
</if>
|
<if test="materialNumber != null">
|
#{materialNumber,jdbcType=VARCHAR},
|
</if>
|
<if test="materialVersion != null">
|
#{materialVersion,jdbcType=VARCHAR},
|
</if>
|
<if test="createTime != null">
|
#{createTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="createUser != null">
|
#{createUser,jdbcType=VARCHAR},
|
</if>
|
<if test="isUse != null">
|
#{isUse,jdbcType=INTEGER},
|
</if>
|
<if test="companyId != null">
|
#{companyId,jdbcType=VARCHAR},
|
</if>
|
</trim>
|
</insert>
|
|
<insert id="materialPathInsert">
|
insert into t_material_path
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="materialPathId != null">
|
material_path_id,
|
</if>
|
<if test="materialPath != null">
|
material_path,
|
</if>
|
<if test="materialId != null">
|
material_id,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="materialPathId != null">
|
#{materialPathId,jdbcType=VARCHAR},
|
</if>
|
<if test="materialPath != null">
|
#{materialPath,jdbcType=VARCHAR},
|
</if>
|
<if test="materialId != null">
|
#{materialId,jdbcType=VARCHAR},
|
</if>
|
</trim>
|
</insert>
|
|
<select id="materialList" resultType="com.thhy.secure.modules.biz.material.entity.TMaterial">
|
SELECT
|
tm.material_id as materialId,
|
tm.material_name as materialName,
|
tm.material_type as materialType,
|
tm.material_number as materialNumber,
|
tm.material_version as materialVersion,
|
sd.dict_name as dictName
|
FROM
|
t_material tm
|
LEFT JOIN sys_dict sd ON tm.material_type = sd.dict_id
|
where tm.is_use=1
|
<if test="companyId!=null and companyId!='' ">
|
and tm.company_id=#{companyId}
|
</if>
|
<if test="materialName!=null and materialName!='' ">
|
and tm.material_name like concat('%',#{materialName},'%')
|
</if>
|
<if test="materialType!=null and materialType!='' ">
|
and tm.material_type=#{materialType}
|
</if>
|
order by tm.create_time desc
|
</select>
|
<select id="materialInfo" resultType="com.thhy.secure.modules.biz.material.entity.TMaterial">
|
SELECT
|
tm.material_id as materialId,
|
tm.material_name as materialName,
|
tm.material_type as materialType,
|
tm.material_number as materialNumber,
|
tm.material_version as materialVersion,
|
sd.dict_name as dictName
|
FROM
|
t_material tm
|
LEFT JOIN sys_dict sd ON tm.material_type = sd.dict_id
|
where tm.is_use=1 and tm.material_id=#{materialId}
|
</select>
|
<select id="materialPathList" parameterType="java.lang.String" resultType="com.thhy.secure.modules.biz.material.entity.TMaterialPath">
|
select
|
material_path_id as materialPathId,
|
material_path as materialPath,
|
material_id as materialId
|
from t_material_path where
|
material_id=#{materialId}
|
</select>
|
|
<update id="materialUpdate">
|
update t_material
|
<set>
|
<if test="materialName != null">
|
material_name = #{materialName,jdbcType=VARCHAR},
|
</if>
|
<if test="materialType != null">
|
material_type = #{materialType,jdbcType=VARCHAR},
|
</if>
|
<if test="materialNumber != null">
|
material_number = #{materialNumber,jdbcType=VARCHAR},
|
</if>
|
<if test="materialVersion != null">
|
material_version = #{materialVersion,jdbcType=VARCHAR},
|
</if>
|
<if test="createTime != null">
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="createUser != null">
|
create_user = #{createUser,jdbcType=VARCHAR},
|
</if>
|
<if test="isUse != null">
|
is_use = #{isUse,jdbcType=INTEGER},
|
</if>
|
<if test="companyId != null">
|
company_id = #{companyId,jdbcType=VARCHAR},
|
</if>
|
</set>
|
where material_id = #{materialId,jdbcType=VARCHAR}
|
</update>
|
|
<delete id="materialPathDel" parameterType="java.lang.String">
|
delete from t_material_path
|
where material_id=#{materialId}
|
</delete>
|
|
</mapper>
|