67 lines
3.5 KiB
XML
67 lines
3.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.electromagnetic.industry.software.manage.mapper.CategoryMapper">
|
||
|
|
<resultMap id="CategoryResultMap" type="com.electromagnetic.industry.software.manage.pojo.models.Category">
|
||
|
|
<id column="id" jdbcType="BIGINT" property="id" />
|
||
|
|
<result column="category_type_id" jdbcType="VARCHAR" property="categoryTypeId" />
|
||
|
|
<result column="parent_id" jdbcType="VARCHAR" property="parentId" />
|
||
|
|
<result column="category_id" jdbcType="VARCHAR" property="categoryId" />
|
||
|
|
<result column="category_name" jdbcType="VARCHAR" property="categoryName" />
|
||
|
|
<result column="category_status" jdbcType="VARCHAR" property="categoryStatus" />
|
||
|
|
<result column="creator" jdbcType="VARCHAR" property="creator" />
|
||
|
|
<result column="creator_name" jdbcType="VARCHAR" property="creatorName" />
|
||
|
|
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
|
||
|
|
<result column="modifier" jdbcType="VARCHAR" property="modifier" />
|
||
|
|
<result column="modifier_name" jdbcType="VARCHAR" property="modifierName" />
|
||
|
|
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
|
||
|
|
<result column="effect_flag" jdbcType="TINYINT" property="effectFlag" />
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<sql id="selectUserVo">
|
||
|
|
select category_type_id, parent_id, category_id, category_name, category_status,
|
||
|
|
creator, creator_name, gmt_create, modifier, modifier_name, gmt_modified, effect_flag
|
||
|
|
from ed_category
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<select id="selectTopCategories" resultMap="CategoryResultMap">
|
||
|
|
<include refid="selectUserVo" />
|
||
|
|
where parent_id = 0 and category_status="available"
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectAllCategories" resultMap="CategoryResultMap">
|
||
|
|
<include refid="selectUserVo" />
|
||
|
|
where category_status="available"
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectCategories" resultMap="CategoryResultMap"
|
||
|
|
parameterType="com.electromagnetic.industry.software.manage.pojo.models.Category">
|
||
|
|
<include refid="selectUserVo" />
|
||
|
|
where category_id = #{categoryId,jdbcType=VARCHAR} and category_status="available"
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectChildCategories" resultMap="CategoryResultMap"
|
||
|
|
parameterType="com.electromagnetic.industry.software.manage.pojo.models.Category">
|
||
|
|
<include refid="selectUserVo" />
|
||
|
|
where parent_id = #{parentId,jdbcType=VARCHAR} and category_status="available"
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id="createCategory" parameterType="com.electromagnetic.industry.software.manage.pojo.models.Category">
|
||
|
|
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
|
||
|
|
SELECT LAST_INSERT_ID()
|
||
|
|
</selectKey>
|
||
|
|
replace into ed_data_info (id,
|
||
|
|
category_type_id, parent_id, category_id,
|
||
|
|
category_name, category_status,
|
||
|
|
creator, creator_name, gmt_create,
|
||
|
|
modifier, modifier_name, gmt_modified,
|
||
|
|
effect_flag
|
||
|
|
)
|
||
|
|
values (#{id,jdbcType=VARCHAR}, #{categoryTypeId,jdbcType=VARCHAR},
|
||
|
|
#{parentId,jdbcType=VARCHAR}, #{categoryId,jdbcType=VARCHAR},
|
||
|
|
#{categoryName,jdbcType=VARCHAR}, #{categoryStatus,jdbcType=VARCHAR},
|
||
|
|
#{creator,jdbcType=VARCHAR}, #{creatorName,jdbcType=VARCHAR}, now(), #{modifier,jdbcType=VARCHAR},
|
||
|
|
#{modifierName,jdbcType=VARCHAR},now(),1
|
||
|
|
)
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
</mapper>
|