|
|
|
@ -5,178 +5,193 @@
|
|
|
|
|
<mapper namespace="com.op.quality.mapper.QcGoalDistributeMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="QcGoalDistribute" id="QcGoalDistributeResult">
|
|
|
|
|
<result property="id" column="id"/>
|
|
|
|
|
<result property="belongGoalId" column="belong_goal_id"/>
|
|
|
|
|
<result property="supplierCode" column="supplier_code"/>
|
|
|
|
|
<result property="supplierName" column="supplier_name"/>
|
|
|
|
|
<result property="attr1" column="attr1"/>
|
|
|
|
|
<result property="attr2" column="attr2"/>
|
|
|
|
|
<result property="attr3" column="attr3"/>
|
|
|
|
|
<result property="attr4" column="attr4"/>
|
|
|
|
|
<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"/>
|
|
|
|
|
<result property="id" column="id"/>
|
|
|
|
|
<result property="belongGoalId" column="belong_goal_id"/>
|
|
|
|
|
<result property="supplierCode" column="supplier_code"/>
|
|
|
|
|
<result property="supplierName" column="supplier_name"/>
|
|
|
|
|
<result property="attr1" column="attr1"/>
|
|
|
|
|
<result property="attr2" column="attr2"/>
|
|
|
|
|
<result property="attr3" column="attr3"/>
|
|
|
|
|
<result property="attr4" column="attr4"/>
|
|
|
|
|
<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="selectQcGoalDistributeVo">
|
|
|
|
|
select id, belong_goal_id, supplier_code, supplier_name, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, factory_code, del_flag from qc_goal_distribute
|
|
|
|
|
</sql>
|
|
|
|
|
select id,
|
|
|
|
|
belong_goal_id,
|
|
|
|
|
supplier_code,
|
|
|
|
|
supplier_name,
|
|
|
|
|
attr1,
|
|
|
|
|
attr2,
|
|
|
|
|
attr3,
|
|
|
|
|
attr4,
|
|
|
|
|
create_by,
|
|
|
|
|
create_time,
|
|
|
|
|
update_by,
|
|
|
|
|
update_time,
|
|
|
|
|
factory_code,
|
|
|
|
|
del_flag
|
|
|
|
|
from qc_goal_distribute
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectQcGoalDistributeList" parameterType="QcGoalDistribute" resultMap="QcGoalDistributeResult">
|
|
|
|
|
<include refid="selectQcGoalDistributeVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="belongGoalId != null and belongGoalId != ''">
|
|
|
|
|
and belong_goal_id = #{belongGoalId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplierCode != null and supplierCode != ''">
|
|
|
|
|
and supplier_code = #{supplierCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplierName != null and supplierName != ''">
|
|
|
|
|
and supplier_name like concat('%', #{supplierName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr1 != null and attr1 != ''">
|
|
|
|
|
and attr1 = #{attr1}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr2 != null and attr2 != ''">
|
|
|
|
|
and attr2 = #{attr2}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr3 != null and attr3 != ''">
|
|
|
|
|
and attr3 = #{attr3}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr4 != null and attr4 != ''">
|
|
|
|
|
and attr4 = #{attr4}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="factoryCode != null and factoryCode != ''">
|
|
|
|
|
and factory_code = #{factoryCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="belongGoalId != null and belongGoalId != ''">
|
|
|
|
|
and belong_goal_id = #{belongGoalId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplierCode != null and supplierCode != ''">
|
|
|
|
|
and supplier_code = #{supplierCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplierName != null and supplierName != ''">
|
|
|
|
|
and supplier_name like concat('%', #{supplierName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr1 != null and attr1 != ''">
|
|
|
|
|
and attr1 = #{attr1}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr2 != null and attr2 != ''">
|
|
|
|
|
and attr2 = #{attr2}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr3 != null and attr3 != ''">
|
|
|
|
|
and attr3 = #{attr3}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr4 != null and attr4 != ''">
|
|
|
|
|
and attr4 = #{attr4}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="factoryCode != null and factoryCode != ''">
|
|
|
|
|
and factory_code = #{factoryCode}
|
|
|
|
|
</if>
|
|
|
|
|
and del_flag = '0'
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectQcGoalDistributeById" parameterType="String"
|
|
|
|
|
resultMap="QcGoalDistributeResult">
|
|
|
|
|
<include refid="selectQcGoalDistributeVo"/>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
<include refid="selectQcGoalDistributeVo"/>
|
|
|
|
|
where del_flag = '0' and id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertQcGoalDistribute" parameterType="QcGoalDistribute">
|
|
|
|
|
insert into qc_goal_distribute
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="id != null">id,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="belongGoalId != null">belong_goal_id,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplierCode != null">supplier_code,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplierName != null">supplier_name,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr1 != null">attr1,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr2 != null">attr2,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr3 != null">attr3,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr4 != null">attr4,
|
|
|
|
|
</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>
|
|
|
|
|
<if test="id != null">id,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="belongGoalId != null">belong_goal_id,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplierCode != null">supplier_code,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplierName != null">supplier_name,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr1 != null">attr1,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr2 != null">attr2,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr3 != null">attr3,
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr4 != null">attr4,
|
|
|
|
|
</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="belongGoalId != null">#{belongGoalId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplierCode != null">#{supplierCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplierName != null">#{supplierName},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr1 != null">#{attr1},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr2 != null">#{attr2},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr3 != null">#{attr3},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr4 != null">#{attr4},
|
|
|
|
|
</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>
|
|
|
|
|
<if test="id != null">#{id},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="belongGoalId != null">#{belongGoalId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplierCode != null">#{supplierCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplierName != null">#{supplierName},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr1 != null">#{attr1},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr2 != null">#{attr2},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr3 != null">#{attr3},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr4 != null">#{attr4},
|
|
|
|
|
</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="updateQcGoalDistribute" parameterType="QcGoalDistribute">
|
|
|
|
|
update qc_goal_distribute
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="belongGoalId != null">belong_goal_id =
|
|
|
|
|
#{belongGoalId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplierCode != null">supplier_code =
|
|
|
|
|
#{supplierCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplierName != null">supplier_name =
|
|
|
|
|
#{supplierName},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr1 != null">attr1 =
|
|
|
|
|
#{attr1},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr2 != null">attr2 =
|
|
|
|
|
#{attr2},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr3 != null">attr3 =
|
|
|
|
|
#{attr3},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr4 != null">attr4 =
|
|
|
|
|
#{attr4},
|
|
|
|
|
</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>
|
|
|
|
|
<if test="belongGoalId != null">belong_goal_id =
|
|
|
|
|
#{belongGoalId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplierCode != null">supplier_code =
|
|
|
|
|
#{supplierCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplierName != null">supplier_name =
|
|
|
|
|
#{supplierName},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr1 != null">attr1 =
|
|
|
|
|
#{attr1},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr2 != null">attr2 =
|
|
|
|
|
#{attr2},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr3 != null">attr3 =
|
|
|
|
|
#{attr3},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="attr4 != null">attr4 =
|
|
|
|
|
#{attr4},
|
|
|
|
|
</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="deleteQcGoalDistributeById" parameterType="String">
|
|
|
|
|
delete from qc_goal_distribute where id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
update qc_goal_distribute set del_flag = '1' where id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteQcGoalDistributeByIds" parameterType="String">
|
|
|
|
|
delete from qc_goal_distribute where id in
|
|
|
|
|
update qc_goal_distribute set del_flag = '1' where id in
|
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
@ -193,9 +208,9 @@
|
|
|
|
|
from base_supplier bs
|
|
|
|
|
where bs.active_flag = '1' and bs.del_flag = '0'
|
|
|
|
|
and bs.supplier_code not in (
|
|
|
|
|
select gd.supplier_code
|
|
|
|
|
from qc_goal_distribute gd
|
|
|
|
|
where gd.belong_goal_id =#{belongGoalId}
|
|
|
|
|
select gd.supplier_code
|
|
|
|
|
from qc_goal_distribute gd
|
|
|
|
|
where gd.belong_goal_id =#{belongGoalId}
|
|
|
|
|
)
|
|
|
|
|
<if test="supplierName != null and supplierName != ''">and bs.zh_desc like concat('%', #{supplierName},
|
|
|
|
|
'%')
|
|
|
|
@ -204,8 +219,8 @@
|
|
|
|
|
|
|
|
|
|
<select id="getGoalDistributeDo" parameterType="QcGoalDistribute" resultMap="QcGoalDistributeResult">
|
|
|
|
|
select distinct
|
|
|
|
|
gd.supplier_code,
|
|
|
|
|
concat(bs.zh_desc,'(',bs.supplier_code,')') label
|
|
|
|
|
gd.supplier_code,
|
|
|
|
|
concat(bs.zh_desc,'(',bs.supplier_code,')') label
|
|
|
|
|
from qc_goal_distribute gd
|
|
|
|
|
left join base_supplier bs on gd.supplier_code = bs.supplier_code
|
|
|
|
|
where gd.belong_goal_id =#{belongGoalId}
|
|
|
|
@ -224,11 +239,12 @@
|
|
|
|
|
bp.active_flag = '1'
|
|
|
|
|
AND bp.del_flag = '0'
|
|
|
|
|
AND bp.product_code NOT IN (
|
|
|
|
|
SELECT gd.supplier_code
|
|
|
|
|
FROM qc_goal_distribute gd
|
|
|
|
|
WHERE gd.belong_goal_id =#{ belongGoalId }
|
|
|
|
|
SELECT gd.supplier_code
|
|
|
|
|
FROM qc_goal_distribute gd
|
|
|
|
|
WHERE gd.belong_goal_id =#{ belongGoalId }
|
|
|
|
|
)
|
|
|
|
|
<if test="supplierName != null and supplierName != ''">and bp.product_desc_zh like concat('%', #{supplierName},'%')
|
|
|
|
|
<if test="supplierName != null and supplierName != ''">and bp.product_desc_zh like concat('%',
|
|
|
|
|
#{supplierName},'%')
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|