WorkMapper.xml 5.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
<?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.duowenlvshi.duowenlszp.model.work.dao.WorkMapper" >
  <resultMap id="BaseResultMap" type="com.duowenlvshi.duowenlszp.model.work.entity.Work" >
    <id column="id" property="workId" jdbcType="VARCHAR" />
    <result column="lawyer_id" property="lawyerId" jdbcType="VARCHAR" />
    <result column="startTime" property="startTime" jdbcType="DATE" />
    <result column="endingTime" property="endingTime" jdbcType="DATE" />
    <result column="company" property="company" jdbcType="VARCHAR" />
    <result column="position" property="position" jdbcType="VARCHAR" />
    <result column="createDate" property="createdate" jdbcType="TIMESTAMP" />
    <result column="updateDate" property="updatedate" jdbcType="TIMESTAMP" />
    <result column="year" property="year" jdbcType="DOUBLE" />
    <result column="isValid" property="isvalid" jdbcType="CHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id , lawyer_id, startTime, endingTime, company, position, createDate, updateDate,
    isValid
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    select
    <include refid="Base_Column_List" />
    from lszp_work
    where id = #{workId,jdbcType=VARCHAR}
  </select>


  <insert id="insertSelective" parameterType="com.duowenlvshi.duowenlszp.model.work.entity.Work" >
    insert into lszp_work
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="workId != null" >
        id,
      </if>
      <if test="lawyerId != null" >
        lawyer_id,
      </if>
      <if test="startTime != null" >
        startTime,
      </if>
      <if test="endingTime != null" >
        endingTime,
      </if>
      <if test="company != null" >
        company,
      </if>
      <if test="position != null" >
        position,
      </if>
      <if test="createdate != null" >
        createDate,
      </if>
      <if test="updatedate != null" >
        updateDate,
      </if>
      <if test="year != null" >
        year,
      </if>
      <if test="isvalid != null" >
        isValid,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="workId != null" >
        #{workId,jdbcType=VARCHAR},
      </if>
      <if test="lawyerId != null" >
        #{lawyerId,jdbcType=VARCHAR},
      </if>
      <if test="startTime != null" >
        #{startTime,jdbcType=DATE},
      </if>
      <if test="endingTime != null" >
        #{endingTime,jdbcType=DATE},
      </if>
      <if test="company != null" >
        #{company,jdbcType=VARCHAR},
      </if>
      <if test="position != null" >
        #{position,jdbcType=VARCHAR},
      </if>
      <if test="createdate != null" >
        #{createdate,jdbcType=TIMESTAMP},
      </if>
      <if test="updatedate != null" >
        #{updatedate,jdbcType=TIMESTAMP},
      </if>
      <if test="year != null" >
        #{year,jdbcType=DOUBLE},
      </if>
      <if test="isvalid != null" >
        #{isvalid,jdbcType=CHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.duowenlvshi.duowenlszp.model.work.entity.Work" >
    update lszp_work
    <set >
      <if test="lawyerId != null" >
        lawyer_id = #{lawyerId,jdbcType=VARCHAR},
      </if>
      <if test="startTime != null" >
        startTime = #{startTime,jdbcType=DATE},
      </if>
      <if test="endingTime != null" >
        endingTime = #{endingTime,jdbcType=DATE},
      </if>
      <if test="company != null" >
        company = #{company,jdbcType=VARCHAR},
      </if>
      <if test="position != null" >
        position = #{position,jdbcType=VARCHAR},
      </if>
      <if test="createdate != null" >
        createDate = #{createdate,jdbcType=TIMESTAMP},
      </if>
      <if test="updatedate != null" >
        updateDate = #{updatedate,jdbcType=TIMESTAMP},
      </if>
      <if test="year != null" >
        year = #{year,jdbcType=DOUBLE},
      </if>
      <if test="isvalid != null" >
        isValid = #{isvalid,jdbcType=CHAR},
      </if>
    </set>
    where id = #{workId,jdbcType=VARCHAR}
  </update>
  <!--通过律师id查询所有工作经历-->
  <select id="selectByLawyerId" resultType="java.util.Map" parameterType="java.lang.String">
    select id as workId,lawyer_id,startTime,endingTime,company,position from lszp_work where lawyer_id=#{lawyerId} and isValid ="1"
  </select>
  <!--删除律师教育经历-->
  <update id="delete" parameterType="String">
    update lszp_work set isValid="0"  where id = #{id}
  </update>
  <!--模糊查询学校code-->
  <select id="selectSchoolVague" parameterType="String" resultType="java.util.Map">
   select code,name from  adv_colleage where name like "%"#{name}"%"
  </select>
  <!--查询学校code-->
  <select id="selectSchool" parameterType="String" resultType="java.util.Map">
   select code,name from  adv_colleage where name =#{name}
  </select>
  <!--查询工作时间总和-->
  <select id="selectYear" parameterType="String" resultType="double">
    SELECT SUM(YEAR) FROM lszp_work WHERE lawyer_id=#{id} and isValid ="1"
  </select>
  <!--删除-->
  <update id="deleteAll" parameterType="java.util.Map" statementType="STATEMENT">
  update ${map.surface} set isValid="0" where id=${map.id}
  </update>
</mapper>