DepotNodeMapper.xml
3.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?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.ruoyi.service.mapper.DepotNodeMapper">
<select id="selectDepotNodeList" parameterType="com.ruoyi.service.domain.DepotNode" resultType="com.ruoyi.service.domain.DepotNode">
select * from depot_node
<where>
<if test="parentId != null "> and parentId = #{parentId}</if>
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
<if test="nodeName != null and nodeName != ''"> and nodeName like concat('%', #{nodeName}, '%')</if>
<if test="orderNum != null "> and orderNum = #{orderNum}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectDepotNodeById" parameterType="Long" resultType="com.ruoyi.service.domain.DepotNode">
select * from depot_node
where id = #{id}
</select>
<insert id="insertDepotNode" parameterType="com.ruoyi.service.domain.DepotNode" useGeneratedKeys="true" keyProperty="id">
insert into depot_node
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId != null">parentId,</if>
<if test="ancestors != null">ancestors,</if>
<if test="nodeName != null">nodeName,</if>
<if test="orderNum != null">orderNum,</if>
<if test="status != null">status,</if>
<if test="delFlag != null">delFlag,</if>
<if test="nodeFlag != null">nodeFlag,</if>
<if test="depotCode != null">depotCode,</if>
<if test="createUser != null">createUser,</if>
createTime
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">#{parentId},</if>
<if test="ancestors != null">#{ancestors},</if>
<if test="nodeName != null">#{nodeName},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="status != null">#{status},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="nodeFlag != null">#{nodeFlag},</if>
<if test="depotCode != null">#{depotCode},</if>
<if test="createUser != null">#{createUser},</if>
sysdate()
</trim>
</insert>
<update id="updateDepotNode" parameterType="com.ruoyi.service.domain.DepotNode">
update depot_node
<trim prefix="SET" suffixOverrides=",">
<if test="parentId != null">parentId = #{parentId},</if>
<if test="ancestors != null">ancestors = #{ancestors},</if>
<if test="nodeName != null">nodeName = #{nodeName},</if>
<if test="orderNum != null">orderNum = #{orderNum},</if>
<if test="depotCode != null">depotCode = #{depotCode},</if>
<if test="status != null">status = #{status},</if>
<if test="delFlag != null">delFlag = #{delFlag},</if>
<if test="nodeFlag != null">nodeFlag = #{nodeFlag},</if>
<if test="updateUser != null">updateUser = #{updateUser},</if>
updateTime = sysdate()
</trim>
where id = #{id}
</update>
<delete id="deleteDepotNodeById" parameterType="Long">
delete from depot_node where id = #{id}
</delete>
<delete id="deleteDepotNodeByIds" parameterType="String">
delete from depot_node where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectCountBox" resultType="int" parameterType="Long">
SELECT count(*) from archives_box WHERE deport_node_id in (
SELECT depotCode FROM `depot_node` where (id=#{id} or FIND_IN_SET(#{id},ancestors)) and nodeFlag='1'
)
</select>
</mapper>