dianci/ruoyi-system/src/main/resources/mapper/system/SysIdentifierMapper.xml

144 lines
7.1 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.ruoyi.system.mapper.SysIdentifierMapper">
<resultMap type="com.ruoyi.common.core.domain.entity.SysIdentifier" id="SysIdentifierResult">
<id property="id" column="id" />
<result property="identifierId" column="identifier_id" />
<result property="identifierTwo" column="identifier_two" />
<result property="identifierThree" column="identifier_three" />
<result property="identifierFour" column="identifier_four" />
<result property="type" column="type" />
<result property="ladleNumber" column="ladle_number" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="delFlag" column="del_flag" />
</resultMap>
<select id="selectIdentifierList" resultMap="SysIdentifierResult">
select i.id,i.identifier_id,i.identifier_two,i.ladle_number,i.create_by,i.create_time,i.update_by,i.update_time,i.remark,i.del_flag from sys_identifier i
where i.del_flag = '0' and i.type = 0
<if test="ladleNumber != null and ladleNumber != ''">
AND i.ladle_number like concat('%',#{ladleNumber}, '%')
</if>
<if test="identifierId != null and identifierId != ''">
AND i.identifier_id like concat('%',#{identifierId}, '%') or
i.identifier_two like concat('%',#{identifierId}, '%')
</if>
order by i.id asc
</select>
<insert id="insertIdentifier">
insert into sys_identifier(
<if test="id != null and id != 0">id,</if>
<if test="identifierId != null and identifierId != ''">identifier_id,</if>
<if test="identifierTwo != null and identifierTwo != ''">identifier_two,</if>
<if test="ladleNumber != null and ladleNumber != ''">ladle_number,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
type,
create_time
)values(
<if test="id != null and id != 0">#{id},</if>
<if test="identifierId != null and identifierId != ''">#{identifierId},</if>
<if test="identifierTwo != null and identifierTwo != ''">#{identifierTwo},</if>
<if test="ladleNumber != null and ladleNumber != ''">#{ladleNumber},</if>
<if test="createBy != null and createBy != ''">#{createBy},#,</if>
<if test="remark != null and remark != ''">#{remark},</if>
0,
sysdate()
)
</insert>
<select id="selectIdentifierById" resultMap="SysIdentifierResult">
select i.id,i.identifier_id,i.identifier_two,i.ladle_number,i.create_by,i.create_time,i.update_by,i.update_time,i.remark,i.del_flag from sys_identifier i where i.id = #{id}
</select>
<update id="updateIdentifier">
update sys_identifier
<set>
<if test="identifierId != null and identifierId != ''">identifier_id = #{identifierId},</if>
<if test="identifierTwo != null and identifierTwo != ''">identifier_two = #{identifierTwo},</if>
<if test="ladleNumber != null and ladleNumber != ''">ladle_number = #{ladleNumber},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
update_time = sysdate()
</set>
where id = #{id}
</update>
<select id="selectNormalIdentifierList" resultMap="SysIdentifierResult">
select i.id,i.identifier_id,i.identifier_two,i.identifier_three,i.identifier_four,i.ladle_number,i.type,i.create_by,i.create_time,i.update_by,i.update_time,i.remark,i.del_flag from sys_identifier i
where i.del_flag = '0' and i.type = 1
<if test="ladleNumber != null and ladleNumber != ''">
AND i.ladle_number like concat('%',#{ladleNumber}, '%')
</if>
<if test="identifierId != null and identifierId != ''">
AND i.identifier_id like concat('%',#{identifierId}, '%') or
i.identifier_two like concat('%',#{identifierId}, '%')
</if>
</select>
<insert id="insertNormalIdentifier">
insert into sys_identifier(
<if test="id != null and id != 0">id,</if>
<if test="identifierId != null and identifierId != ''">identifier_id,</if>
<if test="identifierTwo != null and identifierTwo != ''">identifier_two,</if>
<if test="identifierThree != null and identifierThree != ''">identifier_three,</if>
<if test="identifierFour != null and identifierFour != ''">identifier_four,</if>
<if test="ladleNumber != null and ladleNumber != ''">ladle_number,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
type,
create_time
)values(
<if test="id != null and id != 0">#{id},</if>
<if test="identifierId != null and identifierId != ''">#{identifierId},</if>
<if test="identifierTwo != null and identifierTwo != ''">#{identifierTwo},</if>
<if test="identifierThree != null and identifierThree != ''">#{identifierThree},</if>
<if test="identifierFour != null and identifierFour != ''">#{identifierFour},</if>
<if test="ladleNumber != null and ladleNumber != ''">#{ladleNumber},</if>
<if test="createBy != null and createBy != ''">#{createBy},#,</if>
<if test="remark != null and remark != ''">#{remark},</if>
1,
sysdate()
)
</insert>
<select id="selectNormalIdentifierById" resultMap="SysIdentifierResult">
select i.id,i.identifier_id,i.identifier_two,i.identifier_three,i.identifier_four,i.type,i.ladle_number,i.create_by,i.create_time,i.update_by,i.update_time,i.remark,i.del_flag from sys_identifier i where i.id = #{id}
</select>
<update id="updateNormalIdentifier">
update sys_identifier
<set>
<if test="identifierId != null and identifierId != ''">identifier_id = #{identifierId},</if>
<if test="identifierTwo != null and identifierTwo != ''">identifier_two = #{identifierTwo},</if>
<if test="identifierThree != null and identifierThree != ''">identifier_three = #{identifierThree},</if>
<if test="identifierFour != null and identifierFour != ''">identifier_four = #{identifierFour},</if>
<if test="ladleNumber != null and ladleNumber != ''">ladle_number = #{ladleNumber},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
update_time = sysdate()
</set>
where id = #{id}
</update>
<select id="selectAllIdentifierList" resultMap="SysIdentifierResult">
select i.id,i.identifier_id,i.identifier_two,i.ladle_number,i.create_by,i.create_time,i.update_by,i.update_time,i.remark,i.del_flag from sys_identifier i
where i.del_flag = '0' and i.type = 0
</select>
<select id="selectIdentifierByTag" resultMap="SysIdentifierResult">
select i.id,i.identifier_id,i.identifier_two,i.identifier_three,i.identifier_four,i.type,i.ladle_number,i.create_by,i.create_time,i.update_by,i.update_time,i.remark,i.del_flag
from sys_identifier i where i.identifier_id = #{tag} or identifier_two = #{tag} or identifier_three = #{tag} or identifier_four = #{tag}
</select>
</mapper>