<?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>