2023-12-10 17:30:51 +08:00
|
|
|
<?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.bonus.sgzb.material.mapper.PurchaseMacodeInfoMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.bonus.sgzb.material.domain.PurchaseMacodeInfo" id="PurchaseMacodeInfoResult">
|
|
|
|
|
<result property="taskId" column="task_id" />
|
|
|
|
|
<result property="typeId" column="type_id" />
|
|
|
|
|
<result property="maCode" column="ma_code" />
|
|
|
|
|
<result property="fixCode" column="fix_code" />
|
|
|
|
|
<result property="codeType" column="code_type" />
|
|
|
|
|
<result property="status" column="status" />
|
|
|
|
|
<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="remark" column="remark" />
|
|
|
|
|
<result property="companyId" column="company_id" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectPurchaseMacodeInfoVo">
|
|
|
|
|
select task_id, type_id, ma_code, fix_code, code_type, status, create_by, create_time, update_by, update_time, remark, company_id from purchase_macode_info
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectPurchaseMacodeInfoList" parameterType="com.bonus.sgzb.material.domain.PurchaseMacodeInfo" resultMap="PurchaseMacodeInfoResult">
|
|
|
|
|
<include refid="selectPurchaseMacodeInfoVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="typeId != null "> and type_id = #{typeId}</if>
|
|
|
|
|
<if test="maCode != null and maCode != ''"> and ma_code = #{maCode}</if>
|
|
|
|
|
<if test="fixCode != null and fixCode != ''"> and fix_code = #{fixCode}</if>
|
|
|
|
|
<if test="codeType != null and codeType != ''"> and code_type = #{codeType}</if>
|
|
|
|
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
|
|
|
|
<if test="companyId != null "> and company_id = #{companyId}</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectPurchaseMacodeInfoByTaskId" parameterType="Long" resultMap="PurchaseMacodeInfoResult">
|
|
|
|
|
<include refid="selectPurchaseMacodeInfoVo"/>
|
|
|
|
|
where task_id = #{taskId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertPurchaseMacodeInfo" parameterType="com.bonus.sgzb.material.domain.PurchaseMacodeInfo" useGeneratedKeys="true" keyProperty="taskId">
|
|
|
|
|
insert into purchase_macode_info
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="typeId != null">type_id,</if>
|
|
|
|
|
<if test="maCode != null">ma_code,</if>
|
|
|
|
|
<if test="fixCode != null">fix_code,</if>
|
|
|
|
|
<if test="codeType != null">code_type,</if>
|
|
|
|
|
<if test="status != null">status,</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="remark != null">remark,</if>
|
|
|
|
|
<if test="companyId != null">company_id,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="typeId != null">#{typeId},</if>
|
|
|
|
|
<if test="maCode != null">#{maCode},</if>
|
|
|
|
|
<if test="fixCode != null">#{fixCode},</if>
|
|
|
|
|
<if test="codeType != null">#{codeType},</if>
|
|
|
|
|
<if test="status != null">#{status},</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="remark != null">#{remark},</if>
|
|
|
|
|
<if test="companyId != null">#{companyId},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updatePurchaseMacodeInfo" parameterType="com.bonus.sgzb.material.domain.PurchaseMacodeInfo">
|
|
|
|
|
update purchase_macode_info
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="typeId != null">type_id = #{typeId},</if>
|
|
|
|
|
<if test="maCode != null">ma_code = #{maCode},</if>
|
|
|
|
|
<if test="fixCode != null">fix_code = #{fixCode},</if>
|
|
|
|
|
<if test="codeType != null">code_type = #{codeType},</if>
|
|
|
|
|
<if test="status != null">status = #{status},</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="remark != null">remark = #{remark},</if>
|
|
|
|
|
<if test="companyId != null">company_id = #{companyId},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where task_id = #{taskId}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deletePurchaseMacodeInfoByTaskId" parameterType="Long">
|
|
|
|
|
delete from purchase_macode_info where task_id = #{taskId}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deletePurchaseMacodeInfoByTaskIds" parameterType="String">
|
|
|
|
|
delete from purchase_macode_info where task_id in
|
|
|
|
|
<foreach item="taskId" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{taskId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
2023-12-15 09:16:47 +08:00
|
|
|
|
|
|
|
|
<select id="getTypeByTypeId" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
select mt.code typeCode,mt1.code specsCode from ma_type mt
|
|
|
|
|
left join (select type_id,code from ma_type
|
|
|
|
|
where type_id in (select parent_id from ma_type where type_id = #{typeId})) mt1 on mt.parent_id = mt1.type_id
|
|
|
|
|
where mt.type_id = #{typeId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getSerialNumber" resultType="int">
|
|
|
|
|
select count(*) from ma_machine where type_id = #{typeId} and DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{nowDate},'%y%m')
|
|
|
|
|
</select>
|
2023-12-10 17:30:51 +08:00
|
|
|
</mapper>
|