<?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.gkhy.safePlatform.specialWork.repository.MaterialDetialInfoRepository">
|
|
<resultMap type="com.gkhy.safePlatform.specialWork.entity.MaterialDetailInfo" id="MaterialDetialMap">
|
<result property="id" column="id" jdbcType="BIGINT"/>
|
<result property="materialName" column="material_name" jdbcType="VARCHAR"/>
|
<result property="consumable" column="consumable" jdbcType="TINYINT"/>
|
<result property="standVal" column="stand_val" jdbcType="INTEGER"/>
|
<result property="configurationLevel" column="configuration_level" jdbcType="INTEGER"/>
|
<result property="maBaseId" column="ma_base_id" jdbcType="BIGINT"/>
|
<result property="bigClassifyId" column="big_classify_id" jdbcType="BIGINT"/>
|
<result property="bigClassifyName" column="big_classify_name" jdbcType="VARCHAR"/>
|
<result property="smallClassifyId" column="small_classify_id" jdbcType="BIGINT"/>
|
<result property="status" column="status" jdbcType="INTEGER"/>
|
<result property="gmtCreate" column="gmt_create" jdbcType="TIMESTAMP"/>
|
<result property="createUid" column="create_uid" jdbcType="INTEGER"/>
|
<result property="createUname" column="create_uname" jdbcType="VARCHAR"/>
|
<result property="gmtModified" column="gmt_modified" jdbcType="TIMESTAMP"/>
|
<result property="modifiedUid" column="modified_uid" jdbcType="BIGINT"/>
|
<result property="modifiedUname" column="modified_uname" jdbcType="VARCHAR"/>
|
</resultMap>
|
|
<!--查询单个-->
|
<select id="queryById" resultMap="MaterialDetialMap">
|
select
|
id, material_name, consumable, stand_val, configuration_level, ma_base_id, big_classify_id, big_classify_name, small_classify_id, status, gmt_create, create_uid, create_uname, gmt_modified, modified_uid, modified_uname
|
from material_detail
|
where id = #{id}
|
</select>
|
|
<!--查询数据-->
|
<select id="listAll" resultMap="MaterialDetialMap">
|
select
|
id, material_name, consumable, stand_val, configuration_level, ma_base_id, big_classify_id, big_classify_name, small_classify_id
|
from material_detail
|
where status = #{status}
|
</select>
|
|
<!--新增所有列-->
|
<insert id="insertOne" >
|
insert into material_detail(id,material_name, consumable, stand_val, configuration_level, ma_base_id, big_classify_id, big_classify_name, small_classify_id, status, gmt_create, create_uid, create_uname, gmt_modified, modified_uid, modified_uname)
|
values (#{id},#{materialName}, #{consumable}, #{standVal}, #{configurationLevel}, #{maBaseId}, #{bigClassifyId}, #{bigClassifyName}, #{smallClassifyId}, #{status}, #{gmtCreate}, #{createUid}, #{createUname}, #{gmtModified}, #{modifiedUid}, #{modifiedUname})
|
</insert>
|
|
<!--通过主键修改数据-->
|
<update id="updateOne">
|
update material_detail
|
<set>
|
<if test="materialName != null and materialName != ''">
|
material_name = #{materialName},
|
</if>
|
<if test="consumable != null">
|
consumable = #{consumable},
|
</if>
|
<if test="standVal != null">
|
stand_val = #{standVal},
|
</if>
|
<if test="configurationLevel != null">
|
configuration_level = #{configurationLevel},
|
</if>
|
<if test="maBaseId != null">
|
ma_base_id = #{maBaseId},
|
</if>
|
<if test="bigClassifyId != null">
|
big_classify_id = #{bigClassifyId},
|
</if>
|
<if test="bigClassifyName != null and bigClassifyName != ''">
|
big_classify_name = #{bigClassifyName},
|
</if>
|
<if test="smallClassifyId != null">
|
small_classify_id = #{smallClassifyId},
|
</if>
|
<if test="status != null">
|
status = #{status},
|
</if>
|
<if test="gmtCreate != null">
|
gmt_create = #{gmtCreate},
|
</if>
|
<if test="createUid != null">
|
create_uid = #{createUid},
|
</if>
|
<if test="createUname != null and createUname != ''">
|
create_uname = #{createUname},
|
</if>
|
<if test="gmtModified != null">
|
gmt_modified = #{gmtModified},
|
</if>
|
<if test="modifiedUid != null">
|
modified_uid = #{modifiedUid},
|
</if>
|
<if test="modifiedUname != null and modifiedUname != ''">
|
modified_uname = #{modifiedUname},
|
</if>
|
</set>
|
where id = #{id}
|
</update>
|
|
<!--逻辑删除-->
|
<update id="updateStatus">
|
update material_detail set status = #{status} where id = #{id}
|
</update>
|
|
<!--批量删除-->
|
<update id="batchUpdateStatus">
|
update material_detail set status = #{status}
|
where id in
|
<foreach collection="ids" item="id" open="(" close=")" separator=",">
|
#{id}
|
</foreach>
|
</update>
|
<select id="listByMaBaseId" resultMap="MaterialDetialMap">
|
select
|
id, material_name, consumable, stand_val, configuration_level, ma_base_id, big_classify_id, big_classify_name, small_classify_id
|
from material_detail
|
where ma_base_id = #{maBaseId}
|
and status = #{status}
|
|
</select>
|
<!--批量插入-->
|
<insert id="saveBatch" >
|
insert into material_detail(id,material_name, consumable, stand_val, configuration_level, ma_base_id, big_classify_id, big_classify_name, small_classify_id, status, gmt_create, create_uid, create_uname, gmt_modified, modified_uid, modified_uname)
|
values
|
<foreach collection="entities" item="entity" separator=",">
|
(#{entity.id},#{entity.materialName}, #{entity.consumable}, #{entity.standVal}, #{entity.configurationLevel}, #{entity.maBaseId}, #{entity.bigClassifyId}, #{entity.bigClassifyName}, #{entity.smallClassifyId}, #{entity.status}, #{entity.gmtCreate}, #{entity.createUid}, #{entity.createUname}, #{entity.gmtModified}, #{entity.modifiedUid}, #{entity.modifiedUname})
|
</foreach>
|
</insert>
|
<!--批量更新-->
|
<update id="updateBatch">
|
<foreach collection="list" item="md" index="index" open="" close="" separator=";">
|
update material_detail
|
<set>
|
<if test="md.materialName != null and md.materialName != ''">
|
material_name = #{md.materialName},
|
</if>
|
<if test="md.consumable != null">
|
consumable = #{md.consumable},
|
</if>
|
<if test="md.standVal != null">
|
stand_val = #{md.standVal},
|
</if>
|
<if test="md.configurationLevel != null">
|
configuration_level = #{md.configurationLevel},
|
</if>
|
<if test="md.maBaseId != null">
|
ma_base_id = #{md.maBaseId},
|
</if>
|
<if test="md.bigClassifyId != null">
|
big_classify_id = #{md.bigClassifyId},
|
</if>
|
<if test="md.bigClassifyName != null and md.bigClassifyName != ''">
|
big_classify_name = #{md.bigClassifyName},
|
</if>
|
<if test="md.smallClassifyId != null">
|
small_classify_id = #{md.smallClassifyId},
|
</if>
|
<if test="md.status != null">
|
status = #{md.status},
|
</if>
|
<if test="md.gmtCreate != null">
|
gmt_create = #{md.gmtCreate},
|
</if>
|
<if test="md.createUid != null">
|
create_uid = #{md.createUid},
|
</if>
|
<if test="md.createUname != null and md.createUname != ''">
|
create_uname = #{md.createUname},
|
</if>
|
<if test="md.gmtModified != null">
|
gmt_modified = #{md.gmtModified},
|
</if>
|
<if test="md.modifiedUid != null">
|
modified_uid = #{md.modifiedUid},
|
</if>
|
<if test="md.modifiedUname != null and md.modifiedUname != ''">
|
modified_uname = #{md.modifiedUname},
|
</if>
|
</set>
|
where id = #{md.id}
|
</foreach>
|
</update>
|
<update id="updateStatusByMaBaseId">
|
update material_detail set status = #{status} where ma_base_id = #{maBaseId}
|
</update>
|
<update id="batchUpdateStatusByMaBaseIds">
|
update material_detail
|
set status = #{status}
|
where ma_base_id in
|
<foreach collection="maBaseIds" item="maBaseId" open="(" close=")" separator=",">
|
#{maBaseId}
|
</foreach>
|
</update>
|
<select id="listByMaBaseIds" resultMap="MaterialDetialMap">
|
select
|
id, material_name, consumable, stand_val, configuration_level, ma_base_id, big_classify_id, big_classify_name, small_classify_id
|
from material_detail
|
where status = #{status} and ma_base_id in
|
<foreach collection="maBaseIds" item="maBaseId" open="(" close=")" separator=",">
|
#{maBaseId}
|
</foreach>
|
</select>
|
|
<select id="listByIds" resultMap="MaterialDetialMap">
|
select
|
id, material_name, consumable, stand_val, configuration_level, ma_base_id, big_classify_id, big_classify_name, small_classify_id
|
from material_detail
|
where status = #{status} and id in
|
<foreach collection="ids" item="id" open="(" close=")" separator=",">
|
#{id}
|
</foreach>
|
</select>
|
|
</mapper>
|