electromagnetic-data/infrastructure/repository/src/main/resources/sqlmapper/EdDataInfoMapper.xml

73 lines
3.4 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.data.manage.repository.dao.EDDataMapper">
<resultMap id="BaseResultMap" type="com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.model.EDDataInfo">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="category_id" jdbcType="VARCHAR" property="categoryId" />
<result column="data_id" jdbcType="VARCHAR" property="dataId" />
<result column="data_no" jdbcType="VARCHAR" property="dataNo" />
<result column="data_name" jdbcType="VARCHAR" property="dataName" />
<result column="data_type" jdbcType="VARCHAR" property="dataType" />
<result column="version" jdbcType="VARCHAR" property="version" />
<result column="content" jdbcType="VARCHAR" property="content" />
<result column="implant_json" jdbcType="VARCHAR" property="implantJson" />
<result column="data_status" jdbcType="VARCHAR" property="dataStatus" />
<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="Base_Column_list">
id,category_id,data_id,data_no,data_name,data_type,file_type,version,content,
implant_json,data_status,creator,creator_name,gmt_create,modifier,modifier_name,
gmt_modified,effect_flag
</sql>
<insert id="createFolder" parameterType="com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.model.EDDataInfo">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ed_data_info (id, category_id,
data_id, data_no, data_name,
data_type, file_type,
version,content, implant_json, data_status,
creator, creator_name, gmt_create,
modifier, modifier_name, gmt_modified,
effect_flag
)
values (#{id,jdbcType=VARCHAR}, #{categoryId,jdbcType=VARCHAR},
#{dataId,jdbcType=VARCHAR}, #{dataNo,jdbcType=VARCHAR}, #{dataName,jdbcType=VARCHAR},
#{dataType,jdbcType=VARCHAR}, #{fileType,jdbcType=VARCHAR},
#{version,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR}, #{implantJson,jdbcType=VARCHAR}, #{dataStatus,jdbcType=VARCHAR},
#{creator,jdbcType=VARCHAR}, #{creatorName,jdbcType=VARCHAR}, now(), #{modifier,jdbcType=VARCHAR},
#{modifierName,jdbcType=VARCHAR},now(),1
)
</insert>
<select id="getDataInfoList" resultMap="BaseResultMap"
parameterType="com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.parames.EDDataParams">
SELECT
<include refid="Base_Column_list"/>
FROM
ed_data_info data
where
effect_flag = 1
<if test="parentId!=null and parentId!=''">
and category_id='${parentId}'
</if>
<if test="keyWord!=null and keyWord!=''">
and data_name LIKE '%${keyWord}%'
</if>
GROUP BY id
order by gmt_modified asc
</select>
</mapper>