增加代码检测,和映射
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
<?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.bms.system.mapper.BmsProductCodeMappingMapper">
|
||||
|
||||
<resultMap type="BmsProductCodeMapping" id="BmsProductCodeMappingResult">
|
||||
<id property="mapId" column="map_id" />
|
||||
<result property="upstreamCode" column="upstream_code" />
|
||||
<result property="bmsProductCode" column="bms_product_code" />
|
||||
<result property="status" column="status" />
|
||||
<result property="remark" column="remark" />
|
||||
<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="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectVo">
|
||||
select map_id, upstream_code, bms_product_code, status, remark,
|
||||
create_by, create_time, update_by, update_time, del_flag
|
||||
from product_code_mapping
|
||||
</sql>
|
||||
|
||||
<select id="selectList" parameterType="BmsProductCodeMapping" resultMap="BmsProductCodeMappingResult">
|
||||
<include refid="selectVo"/>
|
||||
<where>
|
||||
del_flag = '0'
|
||||
<if test="upstreamCode != null and upstreamCode != ''">
|
||||
and upstream_code like concat('%', #{upstreamCode}, '%')
|
||||
</if>
|
||||
<if test="bmsProductCode != null and bmsProductCode != ''">
|
||||
and bms_product_code like concat('%', #{bmsProductCode}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
order by map_id desc
|
||||
</select>
|
||||
|
||||
<select id="selectById" parameterType="Long" resultMap="BmsProductCodeMappingResult">
|
||||
<include refid="selectVo"/>
|
||||
where map_id = #{mapId} and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectActiveByUpstreamCode" resultMap="BmsProductCodeMappingResult">
|
||||
<include refid="selectVo"/>
|
||||
where del_flag = '0' and status = '0' and upstream_code = #{upstreamCode}
|
||||
order by map_id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="countByUpstreamCode" resultType="int">
|
||||
select count(1) from product_code_mapping
|
||||
where del_flag = '0' and upstream_code = #{upstreamCode}
|
||||
<if test="excludeId != null">and map_id != #{excludeId}</if>
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="BmsProductCodeMapping" useGeneratedKeys="true" keyProperty="mapId">
|
||||
insert into product_code_mapping (
|
||||
upstream_code, bms_product_code, status, remark, create_by, create_time, del_flag
|
||||
) values (
|
||||
#{upstreamCode}, #{bmsProductCode}, #{status}, #{remark}, #{createBy}, sysdate(), '0'
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="BmsProductCodeMapping">
|
||||
update product_code_mapping
|
||||
<set>
|
||||
<if test="upstreamCode != null and upstreamCode != ''">upstream_code = #{upstreamCode},</if>
|
||||
<if test="bmsProductCode != null and bmsProductCode != ''">bms_product_code = #{bmsProductCode},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where map_id = #{mapId}
|
||||
</update>
|
||||
|
||||
<update id="deleteByIds" parameterType="Long">
|
||||
update product_code_mapping
|
||||
set del_flag = '1',
|
||||
upstream_code = concat(upstream_code, '#DEL#', map_id),
|
||||
update_time = sysdate()
|
||||
where map_id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user