emis-service/emis-wms/src/main/resources/mapper/WmsGoodsCategoryMapper.xml
2024-01-11 16:46:48 +08:00

111 lines
6.3 KiB
XML

<?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.xdadan.erp.wms.mapper.WmsGoodsCategoryMapper">
<resultMap type="WmsGoodsCategory" id="WmsGoodsCategoryResult">
<result property="catId" column="cat_id" />
<result property="catName" column="cat_name" />
<result property="catDesc" column="cat_desc" />
<result property="merId" column="mer_id" />
<result property="parentId" column="parent_id" />
<result property="sortOrder" column="sort_order" />
<result property="delFlag" column="del_flag" />
<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" />
</resultMap>
<sql id="selectWmsGoodsCategoryVo">
select cat_id, cat_name, cat_desc, mer_id, parent_id, sort_order, del_flag, create_by, create_time, update_by, update_time, remark from wms_goods_category
</sql>
<select id="selectWmsGoodsCategoryList" parameterType="WmsGoodsCategory" resultMap="WmsGoodsCategoryResult">
<include refid="selectWmsGoodsCategoryVo"/>
<where>
<if test="catId != null "> and cat_id = #{catId}</if>
<if test="catName != null and catName != ''"> and cat_name like concat('%', #{catName}, '%')</if>
<if test="catDesc != null and catDesc != ''"> and cat_desc like concat('%', #{catDesc}, '%')</if>
<if test="merId != null and merId != ''"> and mer_id like concat('%', #{merId}, '%')</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="sortOrder != null "> and sort_order = #{sortOrder}</if>
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
</where>
order by create_time desc
</select>
<select id="selectWmsGoodsCategoryByCatId" parameterType="Integer" resultMap="WmsGoodsCategoryResult">
select cat_id, cat_name, cat_desc, mer_id, parent_id, sort_order, del_flag, create_by, create_time, update_by, update_time, remark
from wms_goods_category a
where a.cat_id = #{catId}
</select>
<insert id="insertWmsGoodsCategory" parameterType="WmsGoodsCategory">
insert into wms_goods_category
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="catId != null">cat_id,</if>
<if test="catName != null and catName != ''">cat_name,</if>
<if test="catDesc != null and catDesc != ''">cat_desc,</if>
<if test="merId != null and merId != ''">mer_id,</if>
<if test="parentId != null">parent_id,</if>
<if test="sortOrder != null">sort_order,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null and remark != ''">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="catId != null">#{catId},</if>
<if test="catName != null and catName != ''">#{catName},</if>
<if test="catDesc != null and catDesc != ''">#{catDesc},</if>
<if test="merId != null and merId != ''">#{merId},</if>
<if test="parentId != null">#{parentId},</if>
<if test="sortOrder != null">#{sortOrder},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null and remark != ''">#{remark},</if>
</trim>
</insert>
<update id="updateWmsGoodsCategory" parameterType="WmsGoodsCategory">
update wms_goods_category
<trim prefix="SET" suffixOverrides=",">
<if test="catName != null and catName != ''">cat_name = #{catName},</if>
<if test="catDesc != null and catDesc != ''">cat_desc = #{catDesc},</if>
<if test="merId != null and merId != ''">mer_id = #{merId},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="sortOrder != null">sort_order = #{sortOrder},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
</trim>
where cat_id = #{catId}
</update>
<delete id="deleteWmsGoodsCategoryByCatId" parameterType="Integer">
delete from wms_goods_category where cat_id = #{catId}
</delete>
<delete id="deleteWmsGoodsCategoryByCatIds" parameterType="String">
delete from wms_goods_category where cat_id in
<foreach item="catId" collection="array" open="(" separator="," close=")">
#{catId}
</foreach>
</delete>
</mapper>