DepotMapper.xml 8.83 KB
<?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.DepotMapper">

	<select id="selectGeneralAll" resultType="com.ruoyi.service.domain.General">
		select * from general
	</select>

	<select id="selectDepot" parameterType="com.ruoyi.service.domain.Depot" resultType="com.ruoyi.service.domain.Depot">
		select * from depot
		<where>
			<if test="id != null and id != ''">
				AND id =#{id}
			</if>
			<if test="parentId != null and parentId != ''">
				AND parentId =#{parentId}
			</if>
		</where>
	</select>

	<select id="selectRegion" parameterType="com.ruoyi.service.domain.Region" resultType="com.ruoyi.service.domain.Region">
		select * from depot_region
		<where>
			<if test="id != null and id != ''">
				AND id =#{id}
			</if>
			<if test="parentId != null and parentId != ''">
				AND parentId =#{parentId}
			</if>
		</where>
	</select>

    <select id="selectColumn" resultType="com.ruoyi.service.domain.Column" parameterType="com.ruoyi.service.domain.Column">
		select a.*,b.regionName from depot_column a,depot_region b
		where a.parentId=b.id
		<if test="id != null and id != ''">
			AND a.id =#{id}
		</if>
		<if test="parentId != null and parentId != ''">
			AND a.parentId =#{parentId}
		</if>
	</select>

	<select id="selectNode" resultType="com.ruoyi.service.domain.Node" parameterType="com.ruoyi.service.domain.Node">
		select * from depot_node
		<where>
			<if test="id != null and id != ''">
				AND id =#{id}
			</if>
			<if test="parentId != null and parentId != ''">
				AND parentId =#{parentId}
			</if>
			<if test="surface != null and surface != ''">
				AND surface =#{surface}
			</if>
			<if test="nodeNo != null and nodeNo != ''">
				AND nodeNo =#{nodeNo}
			</if>
			<if test="layerNo != null and layerNo != ''">
				AND layerNo =#{layerNo}
			</if>
		</where>
	</select>

	<select id="checkDepotNameUnique" parameterType="com.ruoyi.service.domain.Depot" resultType="int">
		select count(1) from depot where depotName = #{depotName}
		<if test="id != null and id != ''"> and id != #{id}</if>
		limit 1
	</select>

	<select id="checkDepotNoUnique" parameterType="com.ruoyi.service.domain.Depot" resultType="int">
		select count(1) from depot where depotNo = #{depotNo}
		<if test="id != null and id != ''"> and id != #{id}</if>
		limit 1
	</select>

	<insert id="insertDepot" parameterType="com.ruoyi.service.domain.Depot">
		insert into depot(
		<if test="parentId != null and parentId != ''">parentId,</if>
		<if test="depotNo != null and depotNo != ''">depotNo,</if>
		<if test="depotName != null and depotName != ''">depotName,</if>
		<if test="mark != null and mark != ''">mark,</if>
		createTime
		)values(
		<if test="parentId != null and parentId != ''">#{parentId},</if>
		<if test="depotNo != null and depotNo != ''">#{depotNo},</if>
		<if test="depotName != null and depotName != ''">#{depotName},</if>
		<if test="mark != null and mark != ''">#{mark},</if>
		sysdate()
		)
	</insert>

	<insert id="insertRegion" parameterType="com.ruoyi.service.domain.Region">
		insert into depot_region(
		<if test="parentId != null and parentId != ''">parentId,</if>
		<if test="regionNo != null and regionNo != ''">regionNo,</if>
		<if test="regionName != null and regionName != ''">regionName,</if>
		<if test="columnSize != null and columnSize != ''">columnSize,</if>
		<if test="mark != null and mark != ''">mark,</if>
		createTime
		)values(
		<if test="parentId != null and parentId != ''">#{parentId},</if>
		<if test="regionNo != null and regionNo != ''">#{regionNo},</if>
		<if test="regionName != null and regionName != ''">#{regionName},</if>
		<if test="columnSize != null and columnSize != ''">#{columnSize},</if>
		<if test="mark != null and mark != ''">#{mark},</if>
		sysdate()
		)
	</insert>

	<insert id="insertColumn" parameterType="com.ruoyi.service.domain.Column">
		insert into depot_column(
		<if test="parentId != null and parentId != ''">parentId,</if>
		<if test="type != null and type != ''">type,</if>
		<if test="surfaceType != null and surfaceType != ''">surfaceType,</if>
		<if test="columnNo != null and columnNo != ''">columnNo,</if>
		<if test="columnName != null and columnName != ''">columnName,</if>
		<if test="columnType != null and columnType != ''">columnType,</if>
		<if test="nodeSize != null and nodeSize != ''">nodeSize,</if>
		<if test="nodeLength != null and nodeLength != ''">nodeLength,</if>
		<if test="layerSize != null and layerSize != ''">layerSize,</if>
		<if test="layerHeight != null and layerHeight != ''">layerHeight,</if>
		<if test="mark != null and mark != ''">mark,</if>
		createTime
		)values(
		<if test="parentId != null and parentId != ''">#{parentId},</if>
		<if test="type != null and type != ''">#{type},</if>
		<if test="surfaceType != null and surfaceType != ''">#{surfaceType},</if>
		<if test="columnNo != null and columnNo != ''">#{columnNo},</if>
		<if test="columnName != null and columnName != ''">#{columnName},</if>
		<if test="columnType != null and columnType != ''">#{columnType},</if>
		<if test="nodeSize != null and nodeSize != ''">#{nodeSize},</if>
		<if test="nodeLength != null and nodeLength != ''">#{nodeLength},</if>
		<if test="layerSize != null and layerSize != ''">#{layerSize},</if>
		<if test="layerHeight != null and layerHeight != ''">#{layerHeight},</if>
		<if test="mark != null and mark != ''">#{mark},</if>
		sysdate()
		)
	</insert>

	<insert id="insertNode" parameterType="com.ruoyi.service.domain.Node">
		insert into depot_node(
		<if test="parentId != null and parentId != ''">parentId,</if>
		<if test="surface != null and surface != ''">surface,</if>
		<if test="nodeNo != null and nodeNo != ''">nodeNo,</if>
		<if test="layerNo != null and layerNo != ''">layerNo,</if>
		<if test="layerCode != null and layerCode != ''">layerCode,</if>
		<if test="depotCode != null and depotCode != ''">depotCode,</if>
		<if test="mark != null and mark != ''">mark,</if>
		createTime
		)values(
		<if test="parentId != null and parentId != ''">#{parentId},</if>
		<if test="surface != null and surface != ''">#{surface},</if>
		<if test="nodeNo != null and nodeNo != ''">#{nodeNo},</if>
		<if test="layerNo != null and layerNo != ''">#{layerNo},</if>
		<if test="layerCode != null and layerCode != ''">#{layerCode},</if>
		<if test="depotCode != null and depotCode != ''">#{depotCode},</if>
		<if test="mark != null and mark != ''">#{mark},</if>
		sysdate()
		)
	</insert>



	<update id="updateDepot" parameterType="com.ruoyi.service.domain.Depot">
		update depot
		<set>
			<if test="depotName != null and depotName != ''">depotName = #{depotName},</if>
			<if test="mark != null">mark = #{mark},</if>
			updateTime = sysdate()
		</set>
		where id = #{id}
	</update>

	<update id="updateRegion" parameterType="com.ruoyi.service.domain.Region">
		update depot_region
		<set>
			<if test="columnSize != null and columnSize != ''">columnSize = #{columnSize},</if>
			<if test="mark != null">mark = #{mark},</if>
			updateTime = sysdate()
		</set>
		where id = #{id}
	</update>

	<update id="updateColumn" parameterType="com.ruoyi.service.domain.Column">
		update depot_column
		<set>
			<if test="type != null and type != ''">type = #{type},</if>
			<if test="surfaceType != null and surfaceType != ''">surfaceType = #{surfaceType},</if>
			<if test="columnName != null and columnName != ''">columnName = #{columnName},</if>
			<if test="columnType != null and columnType != ''">columnType = #{columnType},</if>
			<if test="nodeSize != null and nodeSize != ''">nodeSize = #{nodeSize},</if>
			<if test="nodeLength != null and nodeLength != ''">nodeLength = #{nodeLength},</if>
			<if test="layerSize != null and layerSize != ''">layerSize = #{layerSize},</if>
			<if test="layerHeight != null and layerHeight != ''">layerHeight = #{layerHeight},</if>
			<if test="mark != null">mark = #{mark},</if>
			updateTime = sysdate()
		</set>
		where id = #{id}
	</update>


	<select id="getDepot" resultType="com.ruoyi.service.domain.Depot" parameterType="com.ruoyi.service.domain.Depot">
		select * from depot
		<where>
			<if test="id != null and id != ''">
				AND id = #{id}
			</if>
		</where>
	</select>

	<delete id="delDepot" parameterType="Long">
		delete from depot where id id in
		<foreach collection="array" item="id" open="(" separator="," close=")">
			#{id}
		</foreach>
	</delete>

	<delete id="delRegion" parameterType="Long">
		delete from depot_region where id in
		<foreach collection="array" item="id" open="(" separator="," close=")">
			#{id}
		</foreach>
	</delete>

	<delete id="delColumn" parameterType="Long">
		delete from depot_column where id in
		<foreach collection="array" item="id" open="(" separator="," close=")">
			#{id}
		</foreach>
	</delete>

	<delete id="delNode" parameterType="Long">
		delete from depot_node where id in
		<foreach collection="array" item="id" open="(" separator="," close=")">
			#{id}
		</foreach>
	</delete>


</mapper>