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

130 lines
5.7 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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="file_type" jdbcType="VARCHAR" property="fileType" />
<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="note" jdbcType="VARCHAR" property="note" />
<result column="editor" jdbcType="VARCHAR" property="editor" />
<result column="gmt_batch_upload" jdbcType="TIMESTAMP" property="gmtBatchUpload" />
<result column="save_status" jdbcType="VARCHAR" property="saveStatus" />
<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,note,editor,gmt_batch_upload,save_status,creator,creator_name,gmt_create,modifier,modifier_name,
gmt_modified,effect_flag
</sql>
<insert id="createDataInfo" 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 (category_id,
data_id, data_no, data_name,
data_type, file_type, version,
content, implant_json, data_status,
note, editor, gmt_batch_upload, save_status,
creator, creator_name, gmt_create,
modifier, modifier_name, gmt_modified,
effect_flag
)
values (#{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},
#{note,jdbcType=VARCHAR}, #{editor,jdbcType=VARCHAR}, #{gmtBatchUpload,jdbcType=TIMESTAMP}, #{saveStatus,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
where
effect_flag = 1
<if test="parentId!=null and parentId!=''">
and category_id='${parentId}'
</if>
<if test="dataId!=null and dataId!=''">
and data_id='${dataId}'
</if>
<if test="keyWord!=null and keyWord!=''">
and data_name LIKE '%${keyWord}%'
</if>
<if test="dataType != null and dataType!=''">
and data_type = '${dataType}'
</if>
<if test="saveStatus!=null and saveStatus!=''">
and save_status='${saveStatus}'
</if>
GROUP BY id
<if test="gmtCreate == 'asc' or gmtCreate =='desc'">
order by gmt_create ${gmtCreate}
</if>
</select>
<update id="updateFileInfo" parameterType="com.electromagnetic.industry.software.data.manage.domain.boardservice.indicator.parames.EDDataParams">
update ed_data_info
<set>
<if test="name != null and name!=''">
data_name = #{name,jdbcType=VARCHAR},
</if>
<if test="dataStatus != null and dataStatus!=''">
data_status = #{dataStatus,jdbcType=VARCHAR},
</if>
<if test="note != null and note!=''">
note = #{note,jdbcType=VARCHAR},
</if>
<if test="saveStatus != null and note!=''">
save_status = #{saveStatus,jdbcType=VARCHAR},
</if>
<if test="effectFlag != null and effectFlag!=''">
effect_flag = #{effectFlag,jdbcType=VARCHAR},
</if>
<if test="userId != null and userId!=''">
modifier = #{userId,jdbcType=VARCHAR},
</if>
<if test="userName != null and userName!=''">
modifier_name = #{userName,jdbcType=VARCHAR},
</if>
gmt_modified = now()
</set>
<where>
<!-- 条件 1按数据编码修改 -->
<if test="dataId != null and dataId != ''">
data_id = #{dataId,jdbcType=VARCHAR}
</if>
<!-- 条件 2按目录编码修改 -->
<if test="parentId != null and parentId != ''">
category_id = #{parentId,jdbcType=VARCHAR}
</if>
</where>
</update>
</mapper>