<?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.gkhy.exam.system.mapper.ExStudentMapper">
|
<resultMap type="com.gkhy.exam.system.domain.ExStudent" id="ExStudentResult">
|
<result property="id" column="id" />
|
<result property="name" column="name" />
|
<result property="companyId" column="company_id" />
|
<result property="empno" column="empno" />
|
<result property="phone" column="phone" />
|
<result property="password" column="password" />
|
<result property="status" column="status" />
|
<result property="sex" column="sex" />
|
<result property="idNo" column="id_no" />
|
<result property="post" column="post" />
|
<result property="duty" column="duty" />
|
<result property="createId" column="create_id" />
|
|
<result property="delFlag" column="del_flag" />
|
<result property="loginIp" column="login_ip" />
|
<result property="loginDate" column="login_date" />
|
<result property="pwdUpdateDate" column="pwd_update_date" />
|
<result property="version" column="version" />
|
<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" />
|
|
<association property="company" javaType="com.gkhy.exam.system.domain.SysCompany" resultMap="companyResult" />
|
<association property="createUser" javaType="com.gkhy.exam.common.domain.entity.SysUser" resultMap="userResult" />
|
</resultMap>
|
<resultMap id="companyResult" type="com.gkhy.exam.system.domain.SysCompany">
|
<id property="id" column="company_id" />
|
<result property="name" column="company_name" />
|
</resultMap>
|
|
<resultMap id="userResult" type="com.gkhy.exam.common.domain.entity.SysUser">
|
<id property="id" column="create_id" />
|
<result property="name" column="create_name" />
|
</resultMap>
|
|
<sql id="selectStudentVo">
|
select s.id, s.name, s.company_id, s.empno, s.phone,s.status,s.sex,s.id_no,s.post,s.duty,
|
s.create_id,s.del_flag,s.version, s.create_by, s.create_time, s.update_by, s.update_time, s.remark,
|
c.id as company_id,c.name as company_name,d.name as create_name
|
from ex_student s
|
left join sys_company c on c.id=s.company_id
|
left join sys_user d on d.id=s.create_id
|
</sql>
|
|
<update id="deleteByStudentId">
|
update ex_student set del_flag=1 where id=#{studentId}
|
</update>
|
|
|
<select id="selectStudentList" resultMap="ExStudentResult">
|
<include refid="selectStudentVo"/>
|
<where>
|
and s.del_flag=0
|
<if test="name != null and name != ''">
|
AND s.name like concat('%', #{name}, '%')
|
</if>
|
<if test="phone != null and phone != ''">
|
AND s.phone like concat('%', #{phone}, '%')
|
</if>
|
<if test="companyId != null">
|
AND s.company_id =#{companyId}
|
</if>
|
<if test="idNo != null and idNo != ''">
|
AND s.id_no like concat('%', #{idNo}, '%')
|
</if>
|
<if test="createId != null">
|
AND s.create_id =#{createId}
|
</if>
|
<if test="params.createIds != null and params.createIds != ''">
|
AND s.create_id in
|
<foreach collection="params.createIds" item="createId" open="(" separator="," close=")">
|
#{createId}
|
</foreach>
|
</if>
|
</where>
|
order by s.id desc
|
</select>
|
|
<select id="selectStudentById" resultMap="ExStudentResult">
|
<include refid="selectStudentVo"/>
|
where s.id=#{studentId}
|
</select>
|
<select id="checkPhoneUnique" resultType="com.gkhy.exam.system.domain.ExStudent">
|
select id,phone from ex_student where phone=#{phone} and del_flag=0 limit 1
|
</select>
|
|
<select id="checkIdNoUnique" resultType="com.gkhy.exam.system.domain.ExStudent">
|
select id,id_no,company_id from ex_student where id_no=#{idNo} and del_flag=0 limit 1
|
</select>
|
|
<select id="selectStudentByPhone" resultType="com.gkhy.exam.system.domain.ExStudent">
|
select * from ex_student where phone=#{phone} and del_flag=0 limit 1
|
</select>
|
|
</mapper>
|