Files
zhwl/zhwl-wcsc/target/classes/mapper/wcsc/ZdyWcscCategoryMapper.xml
2025-07-01 17:54:58 +08:00

216 lines
7.5 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.zhwl.wcsc.mapper.ZdyWcscCategoryMapper">
<resultMap type="ZdyWcscCategory" id="ZdyWcscCategoryResult">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="type" column="type"/>
<result property="image" column="image"/>
<result property="pid" column="pid"/>
<result property="weigh" column="weigh"/>
<result property="description" column="description"/>
<result property="status" column="status"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="createBy" column="create_by"/>
<result property="updateBy" column="update_by"/>
<result property="score" column="score"/>
<result property="storeId" column="store_id"/>
<result property="storeType" column="storeType"/>
<result property="storeName" column="storeName"/>
<result property="deptId" column="dept_id"/>
<result property="delFlag" column="del_flag"/>
</resultMap>
<sql id="selectZdyWcscCategoryVo">
SELECT a.id,
a.NAME,
a.type,
a.image,
a.pid,
a.weigh,
a.description,
a.STATUS,
a.create_time,
a.update_time,
a.score,
a.create_by,
a.update_by,
a.store_id,
a.dept_id,
sbi.name AS storeName,
st.store_type AS storeType
FROM zdy_wcsc_category a
LEFT JOIN zdy_wcsc_store st ON st.id = a.store_id
LEFT JOIN sys_dept d ON d.dept_id = a.dept_id
LEFT JOIN zdy_store_base_info sbi ON st.store_id = sbi.id
</sql>
<select id="selectZdyWcscCategoryList" parameterType="ZdyWcscCategory" resultMap="ZdyWcscCategoryResult">
<include refid="selectZdyWcscCategoryVo"/>
<where>
a.del_flag = 0
and sbi.register_audit_status = 'APPROVED'
and sbi.grounding_status = 'up'
<if test="name != null and name != ''">
and a.name like concat('%', #{name}, '%')
</if>
<if test="type != null and type != ''">
and a.type = #{type}
</if>
<if test="pid != null ">
and a.pid = #{pid}
</if>
<if test="status != null and status != ''">
and a.status = #{status}
</if>
<if test="storeId != null">
and a.store_id = #{storeId}
</if>
${params.dataScope}
</where>
order by a.weigh asc
</select>
<select id="selectZdyWcscCategoryById" parameterType="Integer"
resultMap="ZdyWcscCategoryResult">
<include refid="selectZdyWcscCategoryVo"/>
where a.id = #{id}
</select>
<insert id="insertZdyWcscCategory" parameterType="ZdyWcscCategory" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_wcsc_category
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,
</if>
<if test="type != null and type != ''">type,
</if>
<if test="image != null and image != ''">image,
</if>
<if test="pid != null">pid,
</if>
<if test="weigh != null">weigh,
</if>
<if test="description != null and description != ''">description,
</if>
<if test="status != null and status != ''">status,
</if>
create_time,
<if test="score != null">score,
</if>
<if test="createBy != null">create_by,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="storeId != null">store_id,
</if>
<if test="deptId != null">dept_id,
</if>
<if test="delFlag != null">del_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},
</if>
<if test="type != null and type != ''">#{type},
</if>
<if test="image != null and image != ''">#{image},
</if>
<if test="pid != null">#{pid},
</if>
<if test="weigh != null">#{weigh},
</if>
<if test="description != null and description != ''">#{description},
</if>
<if test="status != null and status != ''">#{status},
</if>
sysdate(),
<if test="score != null">#{score},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="storeId != null">#{storeId},
</if>
<if test="deptId != null">#{deptId},
</if>
<if test="delFlag != null">#{delFlag},
</if>
</trim>
</insert>
<update id="updateZdyWcscCategory" parameterType="ZdyWcscCategory">
update zdy_wcsc_category
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name =
#{name},
</if>
<if test="type != null and type != ''">type =
#{type},
</if>
<if test="image != null and image != ''">image =
#{image},
</if>
<if test="pid != null">pid =
#{pid},
</if>
<if test="weigh != null">weigh =
#{weigh},
</if>
<if test="description != null and description != ''">description =
#{description},
</if>
<if test="status != null and status != ''">status =
#{status},
</if>
update_time = sysdate(),
<if test="score != null">score =
#{score},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="storeId != null">store_id =
#{storeId},
</if>
<if test="deptId != null">dept_id =
#{deptId},
</if>
<if test="delFlag != null">del_flag =
#{delFlag},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyWcscCategoryById" parameterType="Integer">
update zdy_wcsc_category
set del_flag = 1
where id = #{id}
</delete>
<delete id="deleteZdyWcscCategoryByIds" parameterType="String">
update zdy_wcsc_category set del_flag = 1 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="deleteByStoreIds">
update zdy_wcsc_category set del_flag = 1 where store_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>