You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
5.2 KiB
XML
118 lines
5.2 KiB
XML
<?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.op.quality.mapper.QcMaterialGroupDetailMapper">
|
|
|
|
<resultMap type="QcMaterialGroupDetail" id="QcMaterialGroupDetailResult">
|
|
<result property="id" column="id" />
|
|
<result property="groupId" column="group_id" />
|
|
<result property="materialCode" column="material_code" />
|
|
<result property="materialName" column="material_name" />
|
|
<result property="attr1" column="attr1" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="factoryCode" column="factory_code" />
|
|
<result property="delFlag" column="del_flag" />
|
|
</resultMap>
|
|
|
|
<sql id="selectQcMaterialGroupDetailVo">
|
|
select id, group_id, material_code, material_name, attr1, create_by, create_time, update_by, update_time, factory_code, del_flag from qc_material_group_detail
|
|
</sql>
|
|
|
|
<select id="selectQcMaterialGroupDetailList" parameterType="QcMaterialGroupDetail" resultMap="QcMaterialGroupDetailResult">
|
|
<include refid="selectQcMaterialGroupDetailVo"/>
|
|
<where>
|
|
<if test="groupId != null and groupId != ''"> and group_id = #{groupId}</if>
|
|
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
|
|
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
|
|
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
|
|
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectQcMaterialGroupDetailById" parameterType="String" resultMap="QcMaterialGroupDetailResult">
|
|
<include refid="selectQcMaterialGroupDetailVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
<select id="getGroupByMaterial" resultType="com.op.quality.domain.QcMaterialGroupDetail">
|
|
select top 1 group_id groupId
|
|
from qc_material_group_detail
|
|
where material_code = #{materialCode}
|
|
and del_flag = '0'
|
|
order by create_time desc
|
|
</select>
|
|
|
|
<insert id="insertQcMaterialGroupDetail" parameterType="QcMaterialGroupDetail">
|
|
insert into qc_material_group_detail
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">id,</if>
|
|
<if test="groupId != null and groupId != ''">group_id,</if>
|
|
<if test="materialCode != null">material_code,</if>
|
|
<if test="materialName != null">material_name,</if>
|
|
<if test="attr1 != null">attr1,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="factoryCode != null and factoryCode != ''">factory_code,</if>
|
|
<if test="delFlag != null">del_flag,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">#{id},</if>
|
|
<if test="groupId != null and groupId != ''">#{groupId},</if>
|
|
<if test="materialCode != null">#{materialCode},</if>
|
|
<if test="materialName != null">#{materialName},</if>
|
|
<if test="attr1 != null">#{attr1},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="factoryCode != null and factoryCode != ''">#{factoryCode},</if>
|
|
<if test="delFlag != null">#{delFlag},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateQcMaterialGroupDetail" parameterType="QcMaterialGroupDetail">
|
|
update qc_material_group_detail
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="groupId != null and groupId != ''">group_id = #{groupId},</if>
|
|
<if test="materialCode != null">material_code = #{materialCode},</if>
|
|
<if test="materialName != null">material_name = #{materialName},</if>
|
|
<if test="attr1 != null">attr1 = #{attr1},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="factoryCode != null and factoryCode != ''">factory_code = #{factoryCode},</if>
|
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteQcMaterialGroupDetailById" parameterType="String">
|
|
delete from qc_material_group_detail where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteQcMaterialGroupDetailByIds" parameterType="String">
|
|
delete from qc_material_group_detail where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
<select id="validationData" parameterType="String" resultMap="QcMaterialGroupDetailResult">
|
|
select
|
|
id,
|
|
create_by,
|
|
create_time
|
|
from qc_check_type_project
|
|
where material_code = #{materialCode}
|
|
</select>
|
|
<select id="validationGroupDetailData" parameterType="String" resultMap="QcMaterialGroupDetailResult">
|
|
<include refid="selectQcMaterialGroupDetailVo"></include>
|
|
where material_code = #{materialCode}
|
|
</select>
|
|
</mapper>
|