仓库信息模块优化
This commit is contained in:
@@ -1,61 +1,103 @@
|
||||
<?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">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zg.project.information.mapper.SceneMappingMapper">
|
||||
|
||||
<resultMap type="SceneMapping" id="SceneMappingResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="sceneCode" column="scene_code" />
|
||||
<result property="sceneName" column="scene_name" />
|
||||
|
||||
<!-- ====== 实体映射 ====== -->
|
||||
<resultMap id="SceneMappingResult" type="SceneMapping">
|
||||
<result property="id" column="id"/>
|
||||
<result property="sceneCode" column="scene_code"/>
|
||||
<result property="sceneName" column="scene_name"/>
|
||||
<result property="warehouseCode" column="warehouse_code"/>
|
||||
<result property="warehouseName" column="warehouse_name"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- ====== 通用查询列(含连表字段) ====== -->
|
||||
<sql id="selectSceneMappingVo">
|
||||
select id, scene_code, scene_name from scene_mapping
|
||||
SELECT
|
||||
sm.id,
|
||||
sm.scene_code,
|
||||
sm.scene_name,
|
||||
sm.warehouse_code,
|
||||
wi.warehouse_name AS warehouse_name
|
||||
FROM scene_mapping sm
|
||||
LEFT JOIN warehouse_info wi
|
||||
ON wi.warehouse_code = sm.warehouse_code
|
||||
</sql>
|
||||
|
||||
<!-- ====== 列表查询 ====== -->
|
||||
<select id="selectSceneMappingList" parameterType="SceneMapping" resultMap="SceneMappingResult">
|
||||
<include refid="selectSceneMappingVo"/>
|
||||
<where>
|
||||
<if test="sceneCode != null and sceneCode != ''"> and scene_code = #{sceneCode}</if>
|
||||
<if test="sceneName != null and sceneName != ''"> and scene_name like concat('%', #{sceneName}, '%')</if>
|
||||
<where>
|
||||
<if test="sceneCode != null and sceneCode != ''">
|
||||
AND sm.scene_code = #{sceneCode}
|
||||
</if>
|
||||
<if test="sceneName != null and sceneName != ''">
|
||||
AND sm.scene_name LIKE CONCAT('%', #{sceneName}, '%')
|
||||
</if>
|
||||
<if test="warehouseCode != null and warehouseCode != ''">
|
||||
AND sm.warehouse_code = #{warehouseCode}
|
||||
</if>
|
||||
<if test="warehouseName != null and warehouseName != ''">
|
||||
AND wi.warehouse_name LIKE CONCAT('%', #{warehouseName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<!-- ====== 主键查询 ====== -->
|
||||
<select id="selectSceneMappingById" parameterType="Long" resultMap="SceneMappingResult">
|
||||
<include refid="selectSceneMappingVo"/>
|
||||
where id = #{id}
|
||||
WHERE sm.id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- ====== 新增 ====== -->
|
||||
<insert id="insertSceneMapping" parameterType="SceneMapping" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into scene_mapping
|
||||
INSERT INTO scene_mapping
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="sceneCode != null and sceneCode != ''">scene_code,</if>
|
||||
<if test="sceneName != null and sceneName != ''">scene_name,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="warehouseCode != null and warehouseCode != ''">warehouse_code,</if>
|
||||
<if test="warehouseName != null and warehouseName != ''">warehouse_name,</if>
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="sceneCode != null and sceneCode != ''">#{sceneCode},</if>
|
||||
<if test="sceneName != null and sceneName != ''">#{sceneName},</if>
|
||||
</trim>
|
||||
<if test="warehouseCode != null and warehouseCode != ''">#{warehouseCode},</if>
|
||||
<if test="warehouseName != null and warehouseName != ''">#{warehouseName},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- ====== 更新(可修改所属仓库编码 + 名称) ====== -->
|
||||
<update id="updateSceneMapping" parameterType="SceneMapping">
|
||||
update scene_mapping
|
||||
UPDATE scene_mapping
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="sceneCode != null and sceneCode != ''">scene_code = #{sceneCode},</if>
|
||||
<if test="sceneName != null and sceneName != ''">scene_name = #{sceneName},</if>
|
||||
<if test="sceneCode != null and sceneCode != ''">
|
||||
scene_code = #{sceneCode},
|
||||
</if>
|
||||
<if test="sceneName != null and sceneName != ''">
|
||||
scene_name = #{sceneName},
|
||||
</if>
|
||||
<if test="warehouseCode != null and warehouseCode != ''">
|
||||
warehouse_code = #{warehouseCode},
|
||||
</if>
|
||||
<if test="warehouseName != null and warehouseName != ''">
|
||||
warehouse_name = #{warehouseName},
|
||||
</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- ====== 删除 ====== -->
|
||||
<delete id="deleteSceneMappingById" parameterType="Long">
|
||||
delete from scene_mapping where id = #{id}
|
||||
DELETE FROM scene_mapping WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSceneMappingByIds" parameterType="String">
|
||||
delete from scene_mapping where id in
|
||||
DELETE FROM scene_mapping WHERE id IN
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user