| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.aps.core.mapper.ApsBomMapper"> |
| | | |
| | | <resultMap type="ApsBom" id="ApsBomResult"> |
| | | <resultMap type="com.aps.core.domain.ApsBom" id="ApsBomResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="bomId" column="bom_id" /> |
| | | <result property="parentBomId" column="parent_bom_id" /> |
| | | <result property="bomLineId" column="bom_line_id" /> |
| | | <result property="bomHeaderId" column="bom_header_id" /> |
| | | <result property="itemCode" column="item_code" /> |
| | | <result property="itemName" column="item_name" /> |
| | | <result property="startDate" column="start_date" /> |
| | |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="drawingNo" column="drawing_no" /> |
| | | <result property="processNo" column="process_no" /> |
| | | <result property="unit" column="unit" /> |
| | | <result property="num" column="num" /> |
| | | <result property="totalNum" column="total_num" /> |
| | | <result property="preparationTime" column="preparation_time" /> |
| | | <result property="processingTime" column="processing_time" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectApsBomVo"> |
| | | select id, bom_id, parent_bom_id, item_code, item_name, start_date, end_date, org_code, del_flag, create_by, create_time, update_by, update_time from aps_bom |
| | | select id, bom_line_id, bom_header_id, item_code, item_name, start_date, end_date, org_code, |
| | | del_flag, create_by, create_time, update_by, update_time, drawing_no, process_no, unit, num, |
| | | total_num, preparation_time, processing_time |
| | | from aps_bom_line |
| | | </sql> |
| | | |
| | | <select id="selectApsBomList" parameterType="ApsBom" resultMap="ApsBomResult"> |
| | | <select id="selectApsBomList" parameterType="com.aps.core.domain.ApsBom" resultMap="ApsBomResult"> |
| | | <include refid="selectApsBomVo"/> |
| | | <where> |
| | | <if test="bomId != null and bomId != ''"> and bom_id = #{bomId}</if> |
| | | <if test="parentBomId != null and parentBomId != ''"> and parent_bom_id = #{parentBomId}</if> |
| | | <if test="itemCode != null and itemCode != ''"> and item_code like '%'||#{itemCode}||'%'</if> |
| | | <if test="itemName != null and itemName != ''"> and item_name like '%'|| #{itemName}||'%'</if> |
| | | <if test="bomLineId != null and bomLineId != ''"> and bom_line_id = #{bomLineId}</if> |
| | | <if test="bomHeaderId != null and bomHeaderId != ''"> and bom_header_id = #{bomHeaderId}</if> |
| | | <if test="itemCode != null and itemCode != ''"> and item_code like '%' || #{itemCode} || '%'</if> |
| | | <if test="itemName != null and itemName != ''"> and item_name like '%' || #{itemName} || '%'</if> |
| | | <if test="params.beginStartDate != null and params.beginStartDate != '' and params.endStartDate != null and params.endStartDate != ''"> and start_date between #{params.beginStartDate} and #{params.endStartDate}</if> |
| | | <if test="params.beginEndDate != null and params.beginEndDate != '' and params.endEndDate != null and params.endEndDate != ''"> and end_date between #{params.beginEndDate} and #{params.endEndDate}</if> |
| | | <if test="orgCode != null and orgCode != ''"> and org_code = #{orgCode}</if> |
| | | <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if> |
| | | and del_flag='0' |
| | | </where> |
| | | order by parent_bom_id,bom_id |
| | | order by bom_header_id,bom_line_id |
| | | </select> |
| | | |
| | | <select id="selectApsBomById" parameterType="Long" resultMap="ApsBomResult"> |
| | |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertApsBom" parameterType="ApsBom" useGeneratedKeys="true" keyProperty="id"> |
| | | insert into aps_bom |
| | | <insert id="insertApsBom" parameterType="com.aps.core.domain.ApsBom" useGeneratedKeys="true" keyProperty="id"> |
| | | insert into aps_bom_line |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="bomId != null">bom_id,</if> |
| | | <if test="parentBomId != null">parent_bom_id,</if> |
| | | <if test="bomLineId != null">bom_line_id,</if> |
| | | <if test="bomHeaderId != null">bom_header_id,</if> |
| | | <if test="itemCode != null">item_code,</if> |
| | | <if test="itemName != null">item_name,</if> |
| | | <if test="startDate != null">start_date,</if> |
| | |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="updateBy != null">update_by,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="drawingNo != null">drawing_no,</if> |
| | | <if test="processNo != null">process_no,</if> |
| | | <if test="unit != null">unit,</if> |
| | | <if test="num != null">num,</if> |
| | | <if test="totalNum != null">total_num,</if> |
| | | <if test="preparationTime != null">preparation_time,</if> |
| | | <if test="processingTime != null">processing_time,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="bomId != null">#{bomId},</if> |
| | | <if test="parentBomId != null">#{parentBomId},</if> |
| | | <if test="bomLineId != null">#{bomLineId},</if> |
| | | <if test="bomHeaderId != null">#{bomHeaderId},</if> |
| | | <if test="itemCode != null">#{itemCode},</if> |
| | | <if test="itemName != null">#{itemName},</if> |
| | | <if test="startDate != null">#{startDate},</if> |
| | |
| | | <if test="createTime != null">#{createTime},</if> |
| | | <if test="updateBy != null">#{updateBy},</if> |
| | | <if test="updateTime != null">#{updateTime},</if> |
| | | <if test="drawingNo != null">#{drawingNo},</if> |
| | | <if test="processNo != null">#{processNo},</if> |
| | | <if test="unit != null">#{unit},</if> |
| | | <if test="num != null">#{num},</if> |
| | | <if test="totalNum != null">#{totalNum},</if> |
| | | <if test="preparationTime != null">#{preparationTime},</if> |
| | | <if test="processingTime != null">#{processingTime},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateApsBom" parameterType="ApsBom"> |
| | | update aps_bom |
| | | <update id="updateApsBom" parameterType="com.aps.core.domain.ApsBom"> |
| | | update aps_bom_line |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="bomId != null">bom_id = #{bomId},</if> |
| | | <if test="parentBomId != null">parent_bom_id = #{parentBomId},</if> |
| | | <if test="bomLineId != null">bom_line_id = #{bomLineId},</if> |
| | | <if test="bomHeaderId != null">bom_header_id = #{bomHeaderId},</if> |
| | | <if test="itemCode != null">item_code = #{itemCode},</if> |
| | | <if test="itemName != null">item_name = #{itemName},</if> |
| | | <if test="startDate != null">start_date = #{startDate},</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="drawingNo != null">drawing_no = #{drawingNo},</if> |
| | | <if test="processNo != null">process_no = #{processNo},</if> |
| | | <if test="unit != null">unit = #{unit},</if> |
| | | <if test="num != null">num = #{num},</if> |
| | | <if test="totalNum != null">total_num = #{totalNum}</if> |
| | | <if test="preparationTime != null">preparation_time = #{preparationTime},</if> |
| | | <if test="processingTime != null">processing_time = #{processingTime},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteApsBomById" parameterType="Long"> |
| | | delete from aps_bom where id = #{id} |
| | | delete from aps_bom_line where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteApsBomByIds" parameterType="String"> |
| | | delete from aps_bom where id in |
| | | delete from aps_bom_line where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <resultMap type="com.aps.core.domain.ApsBom" id="ApsBomLineResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="bomLineId" column="bom_line_id" /> |
| | | <result property="itemCode" column="item_code" /> |
| | | <result property="itemName" column="item_name" /> |
| | | <result property="num" column="num" /> |
| | | </resultMap> |
| | | <sql id="selectApsBomLineVo"> |
| | | select id, bom_line_id, item_code, item_name, num |
| | | from aps_bom_line |
| | | </sql> |
| | | |
| | | <select id="selectApsBomLineList" parameterType="String" resultMap="ApsBomLineResult"> |
| | | select id, bom_line_id, item_code, num |
| | | from aps_bom_line where del_flag='0' |
| | | and org_code = #{orgCode} |
| | | and bom_header_id = #{bomHeaderId} |
| | | order by bom_line_id |
| | | </select> |
| | | </mapper> |