<?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.MaterialAllocationBaseInfoRepository">
|
|
<resultMap type="com.gkhy.safePlatform.specialWork.entity.MaterialAllocationBaseInfo" id="MaterialAllocationBaseMap">
|
<result property="id" column="id" jdbcType="INTEGER"/>
|
<result property="name" column="name" jdbcType="VARCHAR"/>
|
<result property="workType" column="work_type" jdbcType="INTEGER"/>
|
<result property="workLevel" column="work_level" jdbcType="INTEGER"/>
|
<result property="status" column="status" jdbcType="INTEGER"/>
|
<result property="info" column="info" jdbcType="VARCHAR"/>
|
<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="INTEGER"/>
|
<result property="modifiedUname" column="modified_uname" jdbcType="VARCHAR"/>
|
</resultMap>
|
|
<!--查询单个-->
|
<select id="queryById" resultMap="MaterialAllocationBaseMap">
|
select
|
id, name, work_type, work_level,info
|
from material_allocation_base
|
where id = #{id} and status = #{status}
|
</select>
|
|
<!--查询指定行数据-->
|
<select id="listByCondition" resultMap="MaterialAllocationBaseMap">
|
select
|
id, name, work_type, work_level, status,info, gmt_create, create_uid, create_uname, gmt_modified, modified_uid, modified_uname
|
from material_allocation_base
|
<where>
|
<if test="query.name != null and query.name != ''">
|
and name like concat("%",#{query.name},"%")
|
</if>
|
<if test="query.workType != null">
|
and work_type = #{query.workType}
|
</if>
|
<if test="query.workLevel != null">
|
and work_level = #{query.workLevel}
|
</if>
|
<if test="query.status != null">
|
and status = #{query.status}
|
</if>
|
|
</where>
|
ORDER BY gmt_create desc
|
</select>
|
|
<!--新增所有列-->
|
<insert id="saveOne" >
|
insert into material_allocation_base(id,name, work_type, work_level, status, info, gmt_create, create_uid, create_uname, gmt_modified, modified_uid, modified_uname)
|
values (#{id},#{name}, #{workType}, #{workLevel}, #{status}, #{info}, #{gmtCreate}, #{createUid}, #{createUname}, #{gmtModified}, #{modifiedUid}, #{modifiedUname})
|
</insert>
|
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
insert into material_allocation_base(id,name, work_type, work_level, status, info, gmt_create, create_uid, create_uname, gmt_modified, modified_uid, modified_uname)
|
values
|
<foreach collection="entities" item="entity" separator=",">
|
(#{entity.id},#{entity.name}, #{entity.workType}, #{entity.workLevel}, #{entity.status}, #{entity.info}, #{entity.gmtCreate}, #{entity.createUid}, #{entity.createUname}, #{entity.gmtModified}, #{entity.modifiedUid}, #{entity.modifiedUname})
|
</foreach>
|
</insert>
|
|
<!--通过主键修改数据-->
|
<update id="updateOne">
|
update material_allocation_base
|
<set>
|
<if test="name != null and name != ''">
|
name = #{name},
|
</if>
|
<if test="workType != null">
|
work_type = #{workType},
|
</if>
|
<if test="workLevel != null">
|
work_level = #{workLevel},
|
</if>
|
<if test="status != null">
|
status = #{status},
|
</if>
|
<if test="info != null and info != ''">
|
info = #{info},
|
</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_allocation_base set status = #{status} where id = #{id}
|
</update>
|
|
<!--批量删除-->
|
<update id="batchUpdateStatus">
|
update material_allocation_base set status = #{status}
|
where id in
|
<foreach collection="ids" item="id" open="(" close=")" separator=",">
|
#{id}
|
</foreach>
|
</update>
|
<select id="getCountByWorkTypeOrLevel" resultType="java.lang.Integer">
|
select
|
count(1)
|
from material_allocation_base
|
<where>
|
<if test="query.id != null">
|
and id != #{query.id}
|
</if>
|
<if test="query.workType != null">
|
and work_type = #{query.workType}
|
</if>
|
<if test="query.workLevel != null">
|
and work_level = #{query.workLevel}
|
</if>
|
<if test="query.status != null">
|
and status = #{query.status}
|
</if>
|
|
</where>
|
</select>
|
</mapper>
|