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

72 lines
4.3 KiB
XML
Raw Normal View History

<?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.UserMapper">
<resultMap id="UserResultMap" type="com.electromagnetic.industry.software.data.manage.domain.boardservice.user.model.User">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="user_name" jdbcType="VARCHAR" property="userName" />
<result column="work_number" jdbcType="VARCHAR" property="workNumber" />
<result column="mobile" jdbcType="VARCHAR" property="mobile" />
<result column="user_dept" jdbcType="VARCHAR" property="userDept" />
<result column="user_title" jdbcType="VARCHAR" property="userTitle" />
<result column="user_pwd" jdbcType="VARCHAR" property="userPwd" />
<result column="join_time" jdbcType="TIMESTAMP" property="joinTime" />
<result column="is_published" jdbcType="TINYINT" property="isPublished" />
<result column="salt" jdbcType="VARCHAR" property="salt" />
<result column="user_status" jdbcType="VARCHAR" property="userStatus" />
<result column="internship_end_date" jdbcType="DATE" property="internshipEndDate"/>
<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>
<insert id="insert" parameterType="com.electromagnetic.industry.software.data.manage.domain.boardservice.user.model.User">
insert into ed_users(
<if test="userId != null and userId !='' ">user_id,</if>
<if test="userName != null and userName !='' ">user_name,</if>
<if test="workNumber != null and workNumber !='' ">work_number,</if>
<if test="mobile != null and mobile !='' ">mobile,</if>
<if test="userDept != null and userDept !='' ">user_dept,</if>
<if test="userTitle != null and userTitle !='' ">user_title,</if>
<if test="userPwd != null and userPwd !='' ">user_pwd,</if>
<if test="joinTime != null">join_time,</if>
<if test="isPublished != null">is_published,</if>
<if test="salt != null and salt !='' ">salt,</if>
<if test="userStatus != null and userStatus !='' ">user_status,</if>
<if test="internshipEndDate != null">internship_end_date,</if>
<if test="creator != null and creator !='' ">creator,</if>
<if test="creatorName != null and creatorName !='' ">creator_name,</if>
gmt_create,
effect_flag)
values (
<if test="userId != null and userId !='' ">#{userId},</if>
<if test="userName != null and userName !='' ">#{userName},</if>
<if test="workNumber != null and workNumber !='' ">#{workNumber},</if>
<if test="mobile != null and mobile !='' ">#{mobile},</if>
<if test="userDept != null and userDept !='' ">#{userDept},</if>
<if test="userTitle != null and userTitle !='' ">#{userTitle},</if>
<if test="userPwd != null and userPwd !='' ">#{userPwd},</if>
<if test="joinTime != null">#{joinTime},</if>
<if test="isPublished != null">#{isPublished},</if>
<if test="salt != null and salt !='' ">#{salt},</if>
<if test="userStatus != null and userStatus !='' ">#{userStatus},</if>
<if test="internshipEndDate != null">#{internshipEndDate},</if>
<if test="creator != null and creator !='' ">#{creator},</if>
<if test="creatorName != null and creatorName !='' ">#{creatorName},</if>
now(),
1
)
</insert>
2024-11-15 09:19:06 +08:00
<update id="publish" parameterType="com.electromagnetic.industry.software.data.manage.domain.boardservice.user.model.User">
update ed_users
<trim prefix="SET" suffixOverrides=",">
<if test="isPublished != null">is_published = #{isPublished}</if>
</trim>
where user_id = #{userId}
</update>
</mapper>