<?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="cn.timer.api.dao.kqgl.PunchRecordMapper" > <resultMap id="BaseResultMap" type="cn.timer.api.bean.kqgl.PunchRecord" > <id column="id" property="id" jdbcType="INTEGER" /> <result column="dktime" property="dktime" jdbcType="BIGINT" /> <result column="lon" property="lon" jdbcType="DOUBLE" /> <result column="lat" property="lat" jdbcType="DOUBLE" /> <result column="address" property="address" jdbcType="VARCHAR" /> <result column="results" property="results" jdbcType="INTEGER" /> <result column="user_id" property="userId" jdbcType="INTEGER" /> <result column="type" property="type" jdbcType="INTEGER" /> <result column="status" property="status" jdbcType="INTEGER" /> <result column="sort" property="sort" jdbcType="INTEGER" /> <result column="card_type" property="cardType" jdbcType="INTEGER" /> <result column="macname" property="macname" jdbcType="VARCHAR" /> <result column="mac" property="mac" jdbcType="VARCHAR" /> <result column="qyid" property="qyid" jdbcType="INTEGER" /> <result column="attdate" property="attdate" jdbcType="VARCHAR" /> <result column="attime" property="attime" jdbcType="BIGINT" /> <result column="dkmxid" property="dkmxid" jdbcType="INTEGER" /> <result column="bcid" property="bcid" jdbcType="INTEGER" /> <result column="remarks" property="remarks" jdbcType="VARCHAR" /> <result column="punchmode" property="punchmode" jdbcType="INTEGER" /> <result column="punchequipment" property="punchequipment" jdbcType="VARCHAR" /> <result column="commentary" property="commentary" /> <result column="username" property="username" jdbcType="VARCHAR" /> <result column="dept" property="dept" jdbcType="VARCHAR" /> <result column="post" property="post" jdbcType="VARCHAR" /> </resultMap> <sql id="Base_Column_List" > id, dktime, lon, lat, address, results, user_id, type, status, sort, card_type, macname, mac, qyid, attdate, attime, dkmxid,bcid,remarks,punchmode,punchequipment </sql> <select id="organizationalStructure" resultMap="BaseResultMap"> select m.name as post,um.name as dept,m.id as mid from zzgl_bmgw_m m left join zzgl_bmgw_m um on um.id = m.up_id where m.id = #{id} </select> <select id="QueryOriginalRecord" resultMap="BaseResultMap"> select dkjl.*, bmgw.dept, bmgw.post, info.`name` username from kqgl_asso_dkjl dkjl LEFT JOIN yggl_main_emp as info on info.emp_num = dkjl.user_id and info.org_code = #{param.qyid} LEFT JOIN (select m.name as post,um.name as dept,m.id as mid from zzgl_bmgw_m m left join zzgl_bmgw_m um on um.id = m.up_id ) as bmgw on bmgw.mid = info.bmgw_id where dkjl.qyid = #{param.qyid} <if test="param.start != ''" > and dkjl.attime >= #{param.start} </if> <if test="param.end != ''" > and dkjl.attime <= #{param.end} </if> <if test="param.text != null and param.text != ''" > and (info.`name` like CONCAT('%',#{param.text},'%') or info.emp_num = #{param.text}) </if> ORDER BY dkjl.id DESC </select> <select id="exportQueryOriginalRecord" resultMap="BaseResultMap"> select dkjl.*, bmgw.dept, bmgw.post, info.`name` username from kqgl_asso_dkjl dkjl LEFT JOIN yggl_main_emp as info on info.emp_num = dkjl.user_id and info.org_code = #{param.qyid} LEFT JOIN (select m.name as post,um.name as dept,m.id as mid from zzgl_bmgw_m m left join zzgl_bmgw_m um on um.id = m.up_id ) as bmgw on bmgw.mid = info.bmgw_id where dkjl.qyid = #{param.qyid} <if test="param.start != ''" > and dkjl.attime >= #{param.start} </if> <if test="param.end != ''" > and dkjl.attime <= #{param.end} </if> <if test="param.text != null and param.text != ''" > and (info.`name` like CONCAT('%',#{param.text},'%') or info.emp_num = #{param.text}) </if> ORDER BY dkjl.id DESC </select> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > select <include refid="Base_Column_List" /> from kqgl_asso_dkjl where id = #{id,jdbcType=INTEGER} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > delete from kqgl_asso_dkjl where id = #{id,jdbcType=INTEGER} </delete> <insert id="insert" parameterType="cn.timer.api.bean.kqgl.PunchRecord" useGeneratedKeys="true" keyProperty="id"> insert into kqgl_asso_dkjl (dktime, lon, lat, address, results, user_id, type, status, sort, card_type, macname, mac, qyid, attdate, attime, dkmxid,bcid,remarks,punchmode,punchequipment) values ( #{dktime,jdbcType=BIGINT}, #{lon,jdbcType=DOUBLE}, #{lat,jdbcType=DOUBLE}, #{address,jdbcType=VARCHAR}, #{results,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER}, #{cardType,jdbcType=INTEGER}, #{macname,jdbcType=VARCHAR}, #{mac,jdbcType=VARCHAR}, #{qyid,jdbcType=INTEGER}, #{attdate,jdbcType=VARCHAR}, #{attime,jdbcType=BIGINT}, #{dkmxid,jdbcType=INTEGER},#{bcid,jdbcType=INTEGER},#{remarks,jdbcType=VARCHAR},#{punchmode,jdbcType=INTEGER},#{punchequipment,jdbcType=VARCHAR}) </insert> <insert id="insertSelective" parameterType="cn.timer.api.bean.kqgl.PunchRecord" useGeneratedKeys="true" keyProperty="id"> insert into kqgl_asso_dkjl <trim prefix="(" suffix=")" suffixOverrides="," > <if test="dktime != null" > dktime, </if> <if test="lon != null" > lon, </if> <if test="lat != null" > lat, </if> <if test="address != null" > address, </if> <if test="results != null" > results, </if> <if test="userId != null" > user_id, </if> <if test="type != null" > type, </if> <if test="status != null" > status, </if> <if test="sort != null" > sort, </if> <if test="cardType != null" > card_type, </if> <if test="macname != null" > macname, </if> <if test="mac != null" > mac, </if> <if test="qyid != null" > qyid, </if> <if test="attdate != null" > attdate, </if> <if test="attime != null" > attime, </if> <if test="dkmxid != null" > dkmxid, </if> <if test="bcid != null" > bcid, </if> <if test="remarks != null" > remarks, </if> <if test="punchmode != null" > punchmode, </if> <if test="punchequipment != null" > punchequipment, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides="," > <if test="dktime != null" > #{dktime,jdbcType=BIGINT}, </if> <if test="lon != null" > #{lon,jdbcType=DOUBLE}, </if> <if test="lat != null" > #{lat,jdbcType=DOUBLE}, </if> <if test="address != null" > #{address,jdbcType=VARCHAR}, </if> <if test="results != null" > #{results,jdbcType=INTEGER}, </if> <if test="userId != null" > #{userId,jdbcType=INTEGER}, </if> <if test="type != null" > #{type,jdbcType=INTEGER}, </if> <if test="status != null" > #{status,jdbcType=INTEGER}, </if> <if test="sort != null" > #{sort,jdbcType=INTEGER}, </if> <if test="cardType != null" > #{cardType,jdbcType=INTEGER}, </if> <if test="macname != null" > #{macname,jdbcType=VARCHAR}, </if> <if test="mac != null" > #{mac,jdbcType=VARCHAR}, </if> <if test="qyid != null" > #{qyid,jdbcType=INTEGER}, </if> <if test="attdate != null" > #{attdate,jdbcType=VARCHAR}, </if> <if test="attime != null" > #{attime,jdbcType=BIGINT}, </if> <if test="dkmxid != null" > #{dkmxid,jdbcType=INTEGER}, </if> <if test="bcid != null" > #{bcid,jdbcType=INTEGER}, </if> <if test="remarks != null" > #{remarks,jdbcType=VARCHAR}, </if> <if test="punchmode != null" > #{punchmode,jdbcType=INTEGER}, </if> <if test="punchequipment != null" > #{punchequipment,jdbcType=VARCHAR}, </if> </trim> </insert> <update id="updateByPrimaryKeySelective" parameterType="cn.timer.api.bean.kqgl.PunchRecord" > update kqgl_asso_dkjl <set > <if test="dktime != null" > dktime = #{dktime,jdbcType=BIGINT}, </if> <if test="lon != null" > lon = #{lon,jdbcType=DOUBLE}, </if> <if test="lat != null" > lat = #{lat,jdbcType=DOUBLE}, </if> <if test="address != null" > address = #{address,jdbcType=VARCHAR}, </if> <if test="results != null" > results = #{results,jdbcType=INTEGER}, </if> <if test="userId != null" > user_id = #{userId,jdbcType=INTEGER}, </if> <if test="type != null" > type = #{type,jdbcType=INTEGER}, </if> <if test="status != null" > status = #{status,jdbcType=INTEGER}, </if> <if test="sort != null" > sort = #{sort,jdbcType=INTEGER}, </if> <if test="cardType != null" > card_type = #{cardType,jdbcType=INTEGER}, </if> <if test="macname != null" > macname = #{macname,jdbcType=VARCHAR}, </if> <if test="mac != null" > mac = #{mac,jdbcType=VARCHAR}, </if> <if test="qyid != null" > qyid = #{qyid,jdbcType=INTEGER}, </if> <if test="attdate != null" > attdate = #{attdate,jdbcType=VARCHAR}, </if> <if test="attime != null" > attime = #{attime,jdbcType=BIGINT}, </if> <if test="dkmxid != null" > dkmxid = #{dkmxid,jdbcType=INTEGER}, </if> <if test="bcid != null" > bcid = #{bcid,jdbcType=INTEGER}, </if> <if test="remarks != null" > remarks = #{remarks,jdbcType=VARCHAR}, </if> <if test="punchmode != null" > punchmode = #{punchmode,jdbcType=INTEGER}, </if> <if test="punchequipment != null" > punchequipment = #{punchequipment,jdbcType=VARCHAR}, </if> </set> where id = #{id,jdbcType=INTEGER} </update> <update id="updateByPrimaryKey" parameterType="cn.timer.api.bean.kqgl.PunchRecord" > update kqgl_asso_dkjl set dktime = #{dktime,jdbcType=BIGINT}, lon = #{lon,jdbcType=DOUBLE}, lat = #{lat,jdbcType=DOUBLE}, address = #{address,jdbcType=VARCHAR}, results = #{results,jdbcType=INTEGER}, user_id = #{userId,jdbcType=INTEGER}, type = #{type,jdbcType=INTEGER}, status = #{status,jdbcType=INTEGER}, sort = #{sort,jdbcType=INTEGER}, card_type = #{cardType,jdbcType=INTEGER}, macname = #{macname,jdbcType=VARCHAR}, mac = #{mac,jdbcType=VARCHAR}, qyid = #{qyid,jdbcType=INTEGER}, attdate = #{attdate,jdbcType=VARCHAR}, attime = #{attime,jdbcType=BIGINT}, dkmxid = #{dkmxid,jdbcType=INTEGER}, bcid = #{bcid,jdbcType=INTEGER}, remarks = #{remarks,jdbcType=VARCHAR}, punchmode = #{punchmode,jdbcType=INTEGER}, punchequipment = #{punchequipment,jdbcType=VARCHAR} where id = #{id,jdbcType=INTEGER} </update> <select id="selectOriginalAttendanceRecord" resultMap="BaseResultMap"> select dkjl.*, bmgw.dept, bmgw.post, info.`name` username from kqgl_asso_dkjl dkjl LEFT JOIN yggl_main_emp as info on info.emp_num = dkjl.user_id and info.org_code = #{qyid,jdbcType=INTEGER} LEFT JOIN (select m.name as post,um.name as dept,m.id as mid from zzgl_bmgw_m m left join zzgl_bmgw_m um on um.id = m.up_id ) as bmgw on bmgw.mid = info.bmgw_id where dkjl.qyid = #{qyid,jdbcType=INTEGER} ORDER BY dkjl.id ASC </select> <select id="selFuzzyOriginalAttendance" resultMap="BaseResultMap"> select dkjl.*, bmgw.dept, bmgw.post, info.`name` username from kqgl_asso_dkjl dkjl LEFT JOIN yggl_main_emp as info on info.emp_num = dkjl.user_id and info.org_code = #{qyid,jdbcType=INTEGER} LEFT JOIN (select m.name as post,um.name as dept,m.id as mid from zzgl_bmgw_m m left join zzgl_bmgw_m um on um.id = m.up_id ) as bmgw on bmgw.mid = info.bmgw_id where dkjl.qyid = #{qyid,jdbcType=INTEGER} <if test="start != ''" > and dkjl.attime >= #{start,jdbcType=VARCHAR} </if> <if test="end != ''" > and dkjl.attime <= #{end,jdbcType=VARCHAR} </if> <if test="text != ''" > and (info.`name` like CONCAT('%',#{text,jdbcType=VARCHAR},'%') or info.emp_num = #{text,jdbcType=VARCHAR}) </if> ORDER BY dkjl.id ASC </select> <select id="getDetailedRecordClock" resultMap="BaseResultMap"> select * from kqgl_asso_dkjl dkjl where dkjl.attime >= #{start} and dkjl.attime <= #{end} and dkjl.user_id = #{userId,jdbcType=INTEGER} and dkjl.status != 0 </select> <select id="selectPunchResults" resultMap="BaseResultMap"> select * from kqgl_asso_dkjl dkjl where dkjl.attime >= #{start} and dkjl.attime <= #{end} and dkjl.user_id = #{userId,jdbcType=INTEGER} and dkjl.sort = #{sort,jdbcType=INTEGER} </select> <select id="ViewAttendanceDetails" resultMap="BaseResultMap"> select * from kqgl_asso_dkjl dkjl where dkjl.user_id = #{userId,jdbcType=INTEGER} and dkjl.attime >= #{start} and dkjl.attime <= #{end} and dkjl.`status` != 0 </select> <select id="MaintenancePunchCard" resultMap="BaseResultMap"> select * from kqgl_asso_dkjl dkjl where dkjl.attime >= #{start} and dkjl.attime <= #{end} and dkjl.user_id = #{userId,jdbcType=INTEGER} limit 1 </select> <select id="getMaintenancePunchCardList" resultMap="BaseResultMap"> select * from kqgl_asso_dkjl dkjl where dkjl.attime >= #{start} and dkjl.attime <= #{end} and dkjl.user_id = #{userId,jdbcType=INTEGER} and dkjl.`status` > 0 and dkjl.sort > 0 and dkjl.qyid = #{qyid} and dkjl.dkmxid > 0 and dkjl.id > 0 ORDER BY dkjl.id ASC </select> </mapper>