| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- <?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.usoftchina.saas.document.mapper.EmployeeMapper">
- <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.Employee">
- <id column="em_id" jdbcType="INTEGER" property="id" />
- <result column="em_code" jdbcType="VARCHAR" property="em_code" />
- <result column="em_name" jdbcType="VARCHAR" property="em_name" />
- <result column="em_password" jdbcType="VARCHAR" property="em_password" />
- <result column="em_class" jdbcType="VARCHAR" property="em_class" />
- <result column="em_mobile" jdbcType="VARCHAR" property="em_mobile" />
- <result column="em_email" jdbcType="VARCHAR" property="em_email" />
- <result column="companyId" jdbcType="INTEGER" property="companyId" />
- <result column="updaterId" jdbcType="INTEGER" property="updaterId" />
- <result column="updateTime" jdbcType="TIMESTAMP" property="updateTime" />
- <result column="em_text1" jdbcType="VARCHAR" property="em_text1" />
- <result column="em_text2" jdbcType="VARCHAR" property="em_text2" />
- <result column="em_text3" jdbcType="VARCHAR" property="em_text3" />
- <result column="em_text4" jdbcType="VARCHAR" property="em_text4" />
- <result column="em_text5" jdbcType="VARCHAR" property="em_text5" />
- </resultMap>
- <sql id="Base_Column_List">
- em_id, em_code, em_name, em_password, em_class, em_mobile, em_email, companyId, updaterId,
- updateTime, em_text1, em_text2, em_text3, em_text4, em_text5
- </sql>
- <select id="selectByPrimaryKey" parameterType="long" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from employee
- where em_id = #{em_id,jdbcType=INTEGER}
- </select>
- <select id="selectByMobile" parameterType="string" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from employee
- where em_mobile = #{mobile,jdbcType=INTEGER}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="long">
- delete from employee
- where em_id = #{em_id,jdbcType=INTEGER}
- </delete>
- <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Employee">
- <selectKey resultType="java.lang.Long" keyProperty="id">
- SELECT LAST_INSERT_ID() AS ID
- </selectKey>
- insert into employee
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="em_code != null">
- em_code,
- </if>
- <if test="em_name != null">
- em_name,
- </if>
- <if test="em_password != null">
- em_password,
- </if>
- <if test="em_class != null">
- em_class,
- </if>
- <if test="em_mobile != null">
- em_mobile,
- </if>
- <if test="em_email != null">
- em_email,
- </if>
- <if test="companyId != null">
- companyId,
- </if>
- <if test="updaterId != null">
- updaterId,
- </if>
- <if test="updateTime != null">
- updateTime,
- </if>
- <if test="em_text1 != null">
- em_text1,
- </if>
- <if test="em_text2 != null">
- em_text2,
- </if>
- <if test="em_text3 != null">
- em_text3,
- </if>
- <if test="em_text4 != null">
- em_text4,
- </if>
- <if test="em_text5 != null">
- em_text5,
- </if>
- <if test="creatorId != null" >
- creatorId,
- </if>
- <if test="createTime != null" >
- createTime,
- </if>
- <if test="creatorName != null" >
- creatorName,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="em_code != null">
- #{em_code,jdbcType=VARCHAR},
- </if>
- <if test="em_name != null">
- #{em_name,jdbcType=VARCHAR},
- </if>
- <if test="em_password != null">
- #{em_password,jdbcType=VARCHAR},
- </if>
- <if test="em_class != null">
- #{em_class,jdbcType=VARCHAR},
- </if>
- <if test="em_mobile != null">
- #{em_mobile,jdbcType=VARCHAR},
- </if>
- <if test="em_email != null">
- #{em_email,jdbcType=VARCHAR},
- </if>
- <if test="companyId != null">
- #{companyId,jdbcType=INTEGER},
- </if>
- <if test="updaterId != null">
- #{updaterId,jdbcType=INTEGER},
- </if>
- <if test="updateTime != null">
- #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="em_text1 != null">
- #{em_text1,jdbcType=VARCHAR},
- </if>
- <if test="em_text2 != null">
- #{em_text2,jdbcType=VARCHAR},
- </if>
- <if test="em_text3 != null">
- #{em_text3,jdbcType=VARCHAR},
- </if>
- <if test="em_text4 != null">
- #{em_text4,jdbcType=VARCHAR},
- </if>
- <if test="em_text5 != null">
- #{em_text5,jdbcType=VARCHAR},
- </if>
- <if test="creatorId != null" >
- #{creatorId,jdbcType=INTEGER},
- </if>
- <if test="createTime != null" >
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="creatorName != null" >
- #{creatorName,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Employee">
- update employee
- <set>
- <if test="em_code != null">
- em_code = #{em_code,jdbcType=VARCHAR},
- </if>
- <if test="em_name != null">
- em_name = #{em_name,jdbcType=VARCHAR},
- </if>
- <if test="em_password != null">
- em_password = #{em_password,jdbcType=VARCHAR},
- </if>
- <if test="em_class != null">
- em_class = #{em_class,jdbcType=VARCHAR},
- </if>
- <if test="em_mobile != null">
- em_mobile = #{em_mobile,jdbcType=VARCHAR},
- </if>
- <if test="em_email != null">
- em_email = #{em_email,jdbcType=VARCHAR},
- </if>
- <if test="companyId != null">
- companyId = #{companyId,jdbcType=INTEGER},
- </if>
- <if test="updaterId != null">
- updaterId = #{updaterId,jdbcType=INTEGER},
- </if>
- <if test="updateTime != null">
- updateTime = #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="em_text1 != null">
- em_text1 = #{em_text1,jdbcType=VARCHAR},
- </if>
- <if test="em_text2 != null">
- em_text2 = #{em_text2,jdbcType=VARCHAR},
- </if>
- <if test="em_text3 != null">
- em_text3 = #{em_text3,jdbcType=VARCHAR},
- </if>
- <if test="em_text4 != null">
- em_text4 = #{em_text4,jdbcType=VARCHAR},
- </if>
- <if test="em_text5 != null">
- em_text5 = #{em_text5,jdbcType=VARCHAR},
- </if>
- </set>
- where em_id = #{id,jdbcType=INTEGER}
- </update>
- <!--查询所有物料信息-->
- <select id="selectEmployeeListByCondition" resultMap="BaseResultMap" parameterType="com.usoftchina.saas.commons.dto.DocReqDTO">
- SELECT * FROM Employee
- <where>
- <if test="con != null">
- ${con}
- </if>
- <if test="companyId != null">
- and companyid = #{companyId}
- </if>
- </where>
- ORDER BY em_ID DESC
- </select>
- <select id="validateCodeWhenInsert" resultType="int">
- select count(*) from Employee where em_code = #{code} and companyId =#{companyId}
- </select>
- <select id="validateCodeWhenUpdate" resultType="int" >
- select count(*) from Employee where em_code = #{code} and em_id != #{id} and companyId =#{companyId}
- </select>
- <select id="validatePhoneWhenInsert" resultType="int">
- select count(*) from Employee where em_mobile = #{phone} and companyId =#{companyId}
- </select>
- <select id="validatePhoneWhenUpdate" resultType="int" >
- select count(*) from Employee where em_mobile = #{phone} and em_id != #{id} and companyId =#{companyId}
- </select>
- <select id="validateNameAndCodeWhenInsert" resultType="int">
- select count(*) from Employee where (em_code = #{code} or em_name = #{name}) and companyId =#{companyId}
- </select>
-
- <select id="validateNameAndCodeWhenUpdate" resultType="int">
- select count(*) from Employee where (em_code = #{code} or em_name = #{name}) and em_id !=#{id} and companyId =#{companyId}
- </select>
- </mapper>
|