|
|
@@ -3,7 +3,7 @@
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.ruoyi.system.mapper.PosTypeMapper">
|
|
|
-
|
|
|
+
|
|
|
<resultMap type="PosType" id="PosTypeResult">
|
|
|
<result property="id" column="id" />
|
|
|
<result property="name" column="name" />
|
|
|
@@ -12,29 +12,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="nameTw" column="name_tw" />
|
|
|
<result property="image" column="image" />
|
|
|
<result property="sort" column="sort" />
|
|
|
+ <result property="parentId" column="parent_id" />
|
|
|
+ <result property="tag" column="tag" />
|
|
|
+ <result property="ancestors" column="ancestors" />
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectPosTypeVo">
|
|
|
- select id, name,name_vi,name_en,name_tw, image,sort from pos_type
|
|
|
+ select id, name,name_vi,name_en,name_tw, image,sort,parent_id,tag,ancestors from pos_type
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectPosTypeList" parameterType="PosType" resultMap="PosTypeResult">
|
|
|
<include refid="selectPosTypeVo"/>
|
|
|
- <where>
|
|
|
+ <where>
|
|
|
<if test="name != null and name != ''"> and name = #{name}</if>
|
|
|
<if test="nameVi != null and nameVi != ''"> and name_vi = #{nameVi}</if>
|
|
|
<if test="nameEn != null and nameEn != ''"> and name_en = #{nameEn}</if>
|
|
|
<if test="nameTw != null and nameTw != ''"> and name_tw = #{nameTw}</if>
|
|
|
<if test="sort != null and sort != ''"> and sort = #{sort}</if>
|
|
|
+ <if test="parentId != null"> and parent_id = #{parentId}</if>
|
|
|
+ <if test="tag != null and tag != ''"> and tag = #{tag}</if>
|
|
|
+ <if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
|
|
|
</where>
|
|
|
- order by sort desc
|
|
|
+ order by parent_id, sort desc
|
|
|
</select>
|
|
|
-
|
|
|
+
|
|
|
<select id="selectPosTypeById" parameterType="Long" resultMap="PosTypeResult">
|
|
|
<include refid="selectPosTypeVo"/>
|
|
|
where id = #{id}
|
|
|
</select>
|
|
|
-
|
|
|
+
|
|
|
<insert id="insertPosType" parameterType="PosType" useGeneratedKeys="true" keyProperty="id">
|
|
|
insert into pos_type
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
@@ -44,6 +50,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="nameTw != null and nameTw != ''">name_tw,</if>
|
|
|
<if test="image != null and image != ''">image,</if>
|
|
|
<if test="sort != null and sort != ''">sort,</if>
|
|
|
+ <if test="parentId != null">parent_id,</if>
|
|
|
+ <if test="tag != null and tag != ''">tag,</if>
|
|
|
+ <if test="ancestors != null and ancestors != ''">ancestors,</if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="name != null and name != ''">#{name},</if>
|
|
|
@@ -52,6 +61,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="nameTw != null and nameTw != ''">#{nameTw},</if>
|
|
|
<if test="image != null and image != ''">#{image},</if>
|
|
|
<if test="sort != null and sort != ''">#{sort},</if>
|
|
|
+ <if test="parentId != null">#{parentId},</if>
|
|
|
+ <if test="tag != null and tag != ''">#{tag},</if>
|
|
|
+ <if test="ancestors != null and ancestors != ''">#{ancestors},</if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
|
|
|
@@ -64,6 +76,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="nameTw != null and nameTw != ''">name_tw = #{nameTw},</if>
|
|
|
<if test="image != null and image != ''">image = #{image},</if>
|
|
|
<if test="sort != null and sort != ''">sort = #{sort},</if>
|
|
|
+ <if test="parentId != null">parent_id = #{parentId},</if>
|
|
|
+ <if test="tag != null and tag != ''">tag = #{tag},</if>
|
|
|
+ <if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
|
|
|
</trim>
|
|
|
where id = #{id}
|
|
|
</update>
|
|
|
@@ -73,9 +88,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</delete>
|
|
|
|
|
|
<delete id="deletePosTypeByIds" parameterType="String">
|
|
|
- delete from pos_type where id in
|
|
|
+ delete from pos_type where id in
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
#{id}
|
|
|
</foreach>
|
|
|
</delete>
|
|
|
-</mapper>
|
|
|
+
|
|
|
+ <select id="selectPosTypeTreeList" parameterType="PosType" resultMap="PosTypeResult">
|
|
|
+ <include refid="selectPosTypeVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
|
|
+ <if test="nameVi != null and nameVi != ''"> and name_vi like concat('%', #{nameVi}, '%')</if>
|
|
|
+ <if test="nameEn != null and nameEn != ''"> and name_en like concat('%', #{nameEn}, '%')</if>
|
|
|
+ <if test="nameTw != null and nameTw != ''"> and name_tw like concat('%', #{nameTw}, '%')</if>
|
|
|
+ <if test="parentId != null"> and parent_id = #{parentId}</if>
|
|
|
+ <if test="tag != null and tag != ''"> and tag = #{tag}</if>
|
|
|
+ </where>
|
|
|
+ order by parent_id, sort desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectPosTypeCountByParentId" parameterType="Long" resultType="Integer">
|
|
|
+ select count(1) from pos_type where parent_id = #{parentId}
|
|
|
+ </select>
|
|
|
+</mapper>
|