first commit

This commit is contained in:
zc
2025-06-05 09:51:30 +08:00
commit b3657fb024
680 changed files with 83364 additions and 0 deletions

View File

@@ -0,0 +1,118 @@
<?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.dcsoft.system.car.mapper.TbCarMapper">
<resultMap type="TbCar" id="TbCarResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="carType" column="car_type" />
<result property="drivingUrl" column="driving_url" />
<result property="carNo" column="car_no" />
<result property="plateType" column="plate_type" />
<result property="plateColor" column="plate_color" />
<result property="cardNo" column="card_no" />
<result property="struStartTime" column="stru_start_time" />
<result property="struStopTime" column="stru_stop_time" />
<result property="personNo" column="person_no" />
<result property="isDel" column="is_del" />
<result property="sync" column="sync" />
<result property="ownerName" column="owner_name" />
<result property="ownerPhone" column="owner_phone" />
</resultMap>
<sql id="selectTbCarVo">
select id, car_no, plate_type,user_id,car_type,driving_url, plate_color, card_no, stru_start_time, stru_stop_time, person_no, is_del, sync,owner_name,owner_phone from tb_car
</sql>
<select id="selectTbCarList" parameterType="TbCar" resultMap="TbCarResult">
<include refid="selectTbCarVo"/>
<where>
<if test="carNo != null and carNo != ''"> and car_no = #{carNo}</if>
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
<if test="plateType != null and plateType != ''"> and plate_type = #{plateType}</if>
<if test="plateColor != null and plateColor != ''"> and plate_color = #{plateColor}</if>
<if test="struStartTime != null "> and stru_start_time = #{struStartTime}</if>
<if test="struStopTime != null "> and stru_stop_time = #{struStopTime}</if>
<if test="personNo != null and personNo != ''"> and person_no = #{personNo}</if>
<if test="sync != null and sync != ''"> and sync = #{sync}</if>
<if test="carType != null"> and car_type = #{carType}</if>
</where>
</select>
<select id="selectTbCarById" parameterType="Long" resultMap="TbCarResult">
<include refid="selectTbCarVo"/>
where id = #{id}
</select>
<insert id="insertTbCar" parameterType="TbCar">
insert into tb_car
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="userId != null">user_id,</if>
<if test="carType != null">car_type,</if>
<if test="drivingUrl != null">driving_url,</if>
<if test="carNo != null and carNo != ''">car_no,</if>
<if test="plateType != null and plateType != ''">plate_type,</if>
<if test="plateColor != null">plate_color,</if>
<if test="cardNo != null">card_no,</if>
<if test="struStartTime != null">stru_start_time,</if>
<if test="struStopTime != null">stru_stop_time,</if>
<if test="personNo != null">person_no,</if>
<if test="isDel != null">is_del,</if>
<if test="sync != null and sync != ''">sync,</if>
<if test="ownerName != null and ownerName != ''">owner_name,</if>
<if test="ownerPhone != null and ownerPhone != ''">owner_phone,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="userId != null">#{userId},</if>
<if test="carType != null">#{carType},</if>
<if test="drivingUrl != null">#{drivingUrl},</if>
<if test="carNo != null and carNo != ''">#{carNo},</if>
<if test="plateType != null and plateType != ''">#{plateType},</if>
<if test="plateColor != null">#{plateColor},</if>
<if test="cardNo != null">#{cardNo},</if>
<if test="struStartTime != null">#{struStartTime},</if>
<if test="struStopTime != null">#{struStopTime},</if>
<if test="personNo != null">#{personNo},</if>
<if test="isDel != null">#{isDel},</if>
<if test="sync != null and sync != ''">#{sync},</if>
<if test="ownerName != null and ownerName != ''">#{ownerName},</if>
<if test="ownerPhone != null and ownerPhone != ''">#{ownerPhone},</if>
</trim>
</insert>
<update id="updateTbCar" parameterType="TbCar">
update tb_car
<trim prefix="SET" suffixOverrides=",">
<if test="carNo != null and carNo != ''">car_no = #{carNo},</if>
<if test="plateType != null and plateType != ''">plate_type = #{plateType},</if>
<if test="plateColor != null">plate_color = #{plateColor},</if>
<if test="cardNo != null">card_no = #{cardNo},</if>
<if test="struStartTime != null">stru_start_time = #{struStartTime},</if>
<if test="struStopTime != null">stru_stop_time = #{struStopTime},</if>
<if test="personNo != null">person_no = #{personNo},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="sync != null and sync != ''">sync = #{sync},</if>
<if test="ownerName != null and ownerName != ''">owner_name = #{ownerName},</if>
<if test="ownerPhone != null and ownerPhone != ''">owner_phone = #{ownerPhone},</if>
<if test="userId != null and userId != ''">user_id = #{userId},</if>
<if test="carType != null and carType != ''">car_type = #{carType},</if>
<if test="drivingUrl != null and drivingUrl != ''">driving_url = #{drivingUrl},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTbCarById" parameterType="Long">
delete from tb_car where id = #{id}
</delete>
<delete id="deleteTbCarByIds" parameterType="String">
delete from tb_car where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,141 @@
<?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.dcsoft.system.car.mapper.TbCarRecordMapper">
<resultMap type="TbCarRecord" id="TbCarRecordResult">
<result property="id" column="id" />
<result property="parkCode" column="park_code" />
<result property="uniqueNo" column="unique_no" />
<result property="direction" column="direction" />
<result property="plateNo" column="plate_no" />
<result property="cardNo" column="card_no" />
<result property="passTime" column="pass_time" />
<result property="vehType" column="veh_type" />
<result property="vehColor" column="veh_color" />
<result property="operatorName" column="operator_name" />
<result property="terminalNo" column="terminal_no" />
<result property="gateName" column="gate_name" />
<result property="laneName" column="lane_name" />
<result property="inPassTime" column="in_pass_time" />
<result property="inUniqueNo" column="in_unique_no" />
<result property="shouldPay" column="should_pay" />
<result property="actualPay" column="actual_pay" />
<result property="picFilePath" column="pic_file_path" />
<result property="picPlateFilePath" column="pic_plate_file_path" />
<result property="picVehicleFileData" column="pic_vehicle_file_data" />
<result property="picPlateFileData" column="pic_plate_file_data" />
<result property="dataType" column="data_type" />
</resultMap>
<sql id="selectTbCarRecordVo">
select id, park_code, unique_no, direction, plate_no, card_no, pass_time, veh_type, veh_color, operator_name, terminal_no, gate_name, lane_name, in_pass_time, in_unique_no, should_pay, actual_pay, pic_file_path, pic_plate_file_path, pic_vehicle_file_data, pic_plate_file_data, data_type from tb_car_record
</sql>
<select id="selectTbCarRecordList" parameterType="TbCarRecord" resultMap="TbCarRecordResult">
<include refid="selectTbCarRecordVo"/>
<where>
<if test="plateNo != null and plateNo != ''"> and plate_no = #{plateNo}</if>
<if test="passTime != null "> and pass_time = #{passTime}</if>
<if test="vehType != null and vehType != ''"> and veh_type = #{vehType}</if>
<if test="vehColor != null and vehColor != ''"> and veh_color = #{vehColor}</if>
</where>
</select>
<select id="selectTbCarRecordById" parameterType="Long" resultMap="TbCarRecordResult">
<include refid="selectTbCarRecordVo"/>
where id = #{id}
</select>
<insert id="insertTbCarRecord" parameterType="TbCarRecord">
insert into tb_car_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="parkCode != null and parkCode != ''">park_code,</if>
<if test="uniqueNo != null and uniqueNo != ''">unique_no,</if>
<if test="direction != null">direction,</if>
<if test="plateNo != null and plateNo != ''">plate_no,</if>
<if test="cardNo != null and cardNo != ''">card_no,</if>
<if test="passTime != null">pass_time,</if>
<if test="vehType != null">veh_type,</if>
<if test="vehColor != null">veh_color,</if>
<if test="operatorName != null and operatorName != ''">operator_name,</if>
<if test="terminalNo != null and terminalNo != ''">terminal_no,</if>
<if test="gateName != null and gateName != ''">gate_name,</if>
<if test="laneName != null and laneName != ''">lane_name,</if>
<if test="inPassTime != null">in_pass_time,</if>
<if test="inUniqueNo != null and inUniqueNo != ''">in_unique_no,</if>
<if test="shouldPay != null and shouldPay != ''">should_pay,</if>
<if test="actualPay != null">actual_pay,</if>
<if test="picFilePath != null">pic_file_path,</if>
<if test="picPlateFilePath != null">pic_plate_file_path,</if>
<if test="picVehicleFileData != null">pic_vehicle_file_data,</if>
<if test="picPlateFileData != null">pic_plate_file_data,</if>
<if test="dataType != null">data_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="parkCode != null and parkCode != ''">#{parkCode},</if>
<if test="uniqueNo != null and uniqueNo != ''">#{uniqueNo},</if>
<if test="direction != null">#{direction},</if>
<if test="plateNo != null and plateNo != ''">#{plateNo},</if>
<if test="cardNo != null and cardNo != ''">#{cardNo},</if>
<if test="passTime != null">#{passTime},</if>
<if test="vehType != null">#{vehType},</if>
<if test="vehColor != null">#{vehColor},</if>
<if test="operatorName != null and operatorName != ''">#{operatorName},</if>
<if test="terminalNo != null and terminalNo != ''">#{terminalNo},</if>
<if test="gateName != null and gateName != ''">#{gateName},</if>
<if test="laneName != null and laneName != ''">#{laneName},</if>
<if test="inPassTime != null">#{inPassTime},</if>
<if test="inUniqueNo != null and inUniqueNo != ''">#{inUniqueNo},</if>
<if test="shouldPay != null and shouldPay != ''">#{shouldPay},</if>
<if test="actualPay != null">#{actualPay},</if>
<if test="picFilePath != null">#{picFilePath},</if>
<if test="picPlateFilePath != null">#{picPlateFilePath},</if>
<if test="picVehicleFileData != null">#{picVehicleFileData},</if>
<if test="picPlateFileData != null">#{picPlateFileData},</if>
<if test="dataType != null">#{dataType},</if>
</trim>
</insert>
<update id="updateTbCarRecord" parameterType="TbCarRecord">
update tb_car_record
<trim prefix="SET" suffixOverrides=",">
<if test="parkCode != null and parkCode != ''">park_code = #{parkCode},</if>
<if test="uniqueNo != null and uniqueNo != ''">unique_no = #{uniqueNo},</if>
<if test="direction != null">direction = #{direction},</if>
<if test="plateNo != null and plateNo != ''">plate_no = #{plateNo},</if>
<if test="cardNo != null and cardNo != ''">card_no = #{cardNo},</if>
<if test="passTime != null">pass_time = #{passTime},</if>
<if test="vehType != null">veh_type = #{vehType},</if>
<if test="vehColor != null">veh_color = #{vehColor},</if>
<if test="operatorName != null and operatorName != ''">operator_name = #{operatorName},</if>
<if test="terminalNo != null and terminalNo != ''">terminal_no = #{terminalNo},</if>
<if test="gateName != null and gateName != ''">gate_name = #{gateName},</if>
<if test="laneName != null and laneName != ''">lane_name = #{laneName},</if>
<if test="inPassTime != null">in_pass_time = #{inPassTime},</if>
<if test="inUniqueNo != null and inUniqueNo != ''">in_unique_no = #{inUniqueNo},</if>
<if test="shouldPay != null and shouldPay != ''">should_pay = #{shouldPay},</if>
<if test="actualPay != null">actual_pay = #{actualPay},</if>
<if test="picFilePath != null">pic_file_path = #{picFilePath},</if>
<if test="picPlateFilePath != null">pic_plate_file_path = #{picPlateFilePath},</if>
<if test="picVehicleFileData != null">pic_vehicle_file_data = #{picVehicleFileData},</if>
<if test="picPlateFileData != null">pic_plate_file_data = #{picPlateFileData},</if>
<if test="dataType != null">data_type = #{dataType},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTbCarRecordById" parameterType="Long">
delete from tb_car_record where id = #{id}
</delete>
<delete id="deleteTbCarRecordByIds" parameterType="String">
delete from tb_car_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,72 @@
<?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.dcsoft.system.mapper.SysBackGroupMapper">
<resultMap type="SysBackGroup" id="SysBackGroupResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="avatar" column="avatar" />
<result property="logo" column="logo" />
</resultMap>
<sql id="selectSysBackGroupVo">
select id, name, avatar,logo from sys_back_group
</sql>
<select id="selectSysBackGroupList" parameterType="SysBackGroup" resultMap="SysBackGroupResult">
<include refid="selectSysBackGroupVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="avatar != null and avatar != ''"> and avatar = #{avatar}</if>
<if test="logo != null and logo != ''"> and logo = #{logo}</if>
</where>
</select>
<select id="selectSysBackGroupById" parameterType="Long" resultMap="SysBackGroupResult">
<include refid="selectSysBackGroupVo"/>
where id = #{id}
</select>
<insert id="insertSysBackGroup" parameterType="SysBackGroup" useGeneratedKeys="true" keyProperty="id">
insert into sys_back_group
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="avatar != null">avatar,</if>
<if test="logo != null">logo,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="avatar != null">#{avatar},</if>
<if test="logo != null">#{logo},</if>
</trim>
</insert>
<update id="updateSysBackGroup" parameterType="SysBackGroup">
update sys_back_group
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="avatar != null">avatar = #{avatar},</if>
<if test="logo != null">logo = #{logo},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysBackGroupById" parameterType="Long">
delete from sys_back_group where id = #{id}
</delete>
<delete id="deleteSysBackGroupByIds" parameterType="String">
delete from sys_back_group where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteSysBackGroup" >
delete from sys_back_group
</delete>
</mapper>

View File

@@ -0,0 +1,243 @@
<?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.dcsoft.system.mapper.SysBlackListMapper">
<resultMap type="SysBlackList" id="SysBlackListResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="phone" column="phone" />
<result property="sex" column="sex" />
<result property="idcard" column="idcard" />
<result property="carNo" column="car_no" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectSysBlackListVo">
select id, name, phone, sex, idcard, car_no, remark, create_by, create_time, update_by, update_time from sys_black_list
</sql>
<select id="selectSysBlackListList" parameterType="SysBlackList" resultMap="SysBlackListResult">
<include refid="selectSysBlackListVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="sex != null and sex != ''"> and sex = #{sex}</if>
<if test="idcard != null and idcard != ''"> and idcard = #{idcard}</if>
<if test="carNo != null and carNo != ''"> and car_no = #{carNo}</if>
</where>
</select>
<select id="selectSysBlackListById" parameterType="Long" resultMap="SysBlackListResult">
<include refid="selectSysBlackListVo"/>
where id = #{id}
</select>
<select id="queryPersonnelInfo" resultType="com.dcsoft.system.visitor.domain.PersonnelInfoVo">
select id, name, idcard, car_no carNo, phone, avatar, date_format(in_time, '%Y-%m-%d %H:%i:%s') inTime,
date_format(out_time, '%Y-%m-%d %H:%i:%s') outTime, type
from vis_visitor
where 1=1
and user_id in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
order by create_time desc
limit 1
</select>
<select id="queryGeneralInfo" resultType="com.dcsoft.system.visitor.domain.PersonnelInfoVo">
select id, name, idcard, car_no carNo, phone, avatar, type from vis_visitor where parent_id = #{id}
</select>
<select id="queryPeople" resultType="com.dcsoft.system.visitor.domain.PersonnelInfoVo">
select distinct sp.id, sp.name, sp.branch_id branchId, sb.name branchName, sp.phone
from sys_people sp left join sys_branch sb on sp.branch_id = sb.id
where sp.del_flag = '0'
<if test="name != null and name != ''">
and sp.name like concat('%', #{name}, '%')
</if>
</select>
<select id="queryAuditedVisitor" resultType="com.dcsoft.system.visitor.domain.VisitorParamVo">
select case
when vve.examine = '0' then '1'
when vve.examine = '1' then '2'
when vve.examine is null then '0'
end reviewStatus,
date_format(vv.in_time, '%Y-%m-%d %H:%i:%s') inTime,
vv.end_time endTime
from vis_visitor vv
left join vis_visitor_examine vve on vv.id = vve.visitor_id
WHERE date_format(vv.create_time, '%Y-%m-%d') = date_format(now(), '%Y-%m-%d')
<if test="idcard != null and idcard != ''">
and vv.idcard = #{idcard}
</if>
and vv.parent_id is null
and vv.in_time is null
order by vv.create_time desc
limit 1
</select>
<select id="queryVisitorInfo" resultType="com.dcsoft.system.visitor.domain.VisitorInfoVo">
select vv.id,
vv.avatar,
vv.name,
vv.phone,
vv.sex,
vv.idcard,
vv.car_no carNo,
vv.flag,
vv.dept_id deptId,
sb.name deptName,
vv.user_id userId,
sp.name userName,
date_format(vv.start_time, '%Y-%m-%d %H:%i:%s') startTime,
date_format(vv.end_time, '%Y-%m-%d %H:%i:%s') endTime,
vv.matter,
vv.res,
vv.remark,
vv.source,
case
when vv.in_time is null and vv.out_time is null then '1' # 未签到
when vv.in_time is not null and vv.out_time is null then '2' # 已签到未签离
when vv.in_time is not null and vv.out_time is not null then '3' # 已签离
end state,
ifnull(type, 0) type,
id_card_start_time idCardStartTime,
id_card_end_time idCardEndTime,
id_card_address idCardAddress,
visiting_unit visitingUnit
from vis_visitor vv
left join sys_people sp on vv.user_id = sp.id and sp.del_flag = '0'
left join sys_branch sb on vv.dept_id = sb.id
where 1=1
and vv.parent_id is null
<if test="idcard != null and idcard != ''">
and vv.idcard = #{idcard}
</if>
<if test="id != null and id != ''">
and vv.id = #{id}
</if>
<if test="type != null and type == '1'.toString()">
and date_format(vv.create_time, '%Y-%m-%d') = date_format(now(), '%Y-%m-%d')
and vv.in_time is not null
</if>
<if test="type != null and type == '2'.toString()">
and date_format(vv.create_time, '%Y-%m-%d') = date_format(now(), '%Y-%m-%d')
and vv.out_time is null
</if>
order by vv.create_time desc, id desc
limit 1
</select>
<select id="queryFollowUp" resultType="com.dcsoft.system.visitor.domain.VisitorInfoVo">
select id,
avatar,
name,
phone,
sex,
idcard,
car_no carNo,
flag,
dept_id deptId,
user_id userId,
date_format(start_time, '%Y-%m-%d %H:%i:%s') startTime,
date_format(end_time, '%Y-%m-%d %H:%i:%s') endTime,
matter,
res,
remark,
case
when in_time is null and out_time is null then '1' # 未签到
when in_time is not null and out_time is null then '2' # 已签到未签离
when in_time is not null and out_time is not null then '3' # 已签离
end state
from vis_visitor
where 1=1
<if test="idcard != null and idcard != ''">
and parent_id = (select id from vis_visitor where idcard = #{idcard} order by create_time desc limit 1)
</if>
<if test="id != null and id != ''">
and parent_id = #{id}
</if>
</select>
<select id="queryBlackById" resultType="com.dcsoft.system.domain.SysBlackList">
select id,
name,
phone,
sex,
idcard,
car_no,
remark,
create_by,
create_time,
update_by,
update_time
from sys_black_list
where idcard = #{idcard}
</select>
<select id="queryVisitorType" resultType="com.dcsoft.system.visitor.domain.VisitorInfoVo">
select type, date_format(in_time, '%Y-%m-%d %H:%i:%s') inTime
from vis_visitor vv
WHERE date_format(vv.create_time, '%Y-%m-%d') = date_format(now(), '%Y-%m-%d')
and vv.idcard = #{idcard}
order by vv.create_time desc, id desc
limit 1
</select>
<insert id="insertSysBlackList" parameterType="SysBlackList" useGeneratedKeys="true" keyProperty="id">
insert into sys_black_list
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if>
<if test="phone != null">phone,</if>
<if test="sex != null">sex,</if>
<if test="idcard != null">idcard,</if>
<if test="carNo != null">car_no,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
<if test="phone != null">#{phone},</if>
<if test="sex != null">#{sex},</if>
<if test="idcard != null">#{idcard},</if>
<if test="carNo != null">#{carNo},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateSysBlackList" parameterType="SysBlackList">
update sys_black_list
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="idcard != null">idcard = #{idcard},</if>
<if test="carNo != null">car_no = #{carNo},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysBlackListById" parameterType="Long">
delete from sys_black_list where id = #{id}
</delete>
<delete id="deleteSysBlackListByIds" parameterType="String">
delete from sys_black_list where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,240 @@
<?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.dcsoft.system.mapper.SysBranchMapper">
<resultMap type="SysBranch" id="SysBranchResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="leader" column="leader" />
<result property="phone" column="phone" />
<result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" />
<result property="spaceId" column="space_id" />
<result property="deptId" column="dept_id" />
<result property="ruleId" column="rule_id" />
<result property="remark" column="remark" />
<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="ruleId" column="rule_id" />
<result property="ladderRuleId" column="ladder_rule_id" />
</resultMap>
<sql id="selectSysBranchVo">
select b.id, b.name, b.leader, b.phone, b.parent_id, b.ancestors, b.space_id,b.dept_id, b.remark, b.create_by,
b.create_time, b.update_by, b.update_time, b.rule_id, b.ladder_rule_id, b.is_examine isExamine
from sys_branch b
left join sys_dept d on b.dept_id = d.dept_id
</sql>
<select id="selectSysBranchList" parameterType="SysBranch" resultMap="SysBranchResult">
<include refid="selectSysBranchVo"/>
<where>
<if test="id != null and id != ''"> and b.id = #{id}</if>
<if test="name != null and name != ''"> and b.name like concat('%', #{name}, '%')</if>
<if test="leader != null and leader != ''"> and b.leader = #{leader}</if>
<if test="phone != null and phone != ''"> and b.phone = #{phone}</if>
<if test="parentId != null "> and b.parent_id = #{parentId}</if>
<if test="ancestors != null and ancestors != ''"> and b.ancestors = #{ancestors}</if>
<if test="spaceId != null "> and b.space_id = #{spaceId}</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</where>
order by b.id asc
</select>
<select id="selectSysBranchById" parameterType="String" resultMap="SysBranchResult">
<include refid="selectSysBranchVo"/>
where id = #{id}
</select>
<insert id="insertSysBranch" parameterType="SysBranch">
insert into sys_branch
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="name != null and name != ''">name,</if>
<if test="leader != null">leader,</if>
<if test="phone != null">phone,</if>
<if test="parentId != null">parent_id,</if>
<if test="ancestors != null">ancestors,</if>
<if test="spaceId != null">space_id,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="deptId != null">dept_id,</if>
<if test="ruleId != null">rule_id,</if>
<if test="ladderRuleId != null">ladder_rule_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="leader != null">#{leader},</if>
<if test="phone != null">#{phone},</if>
<if test="parentId != null">#{parentId},</if>
<if test="ancestors != null">#{ancestors},</if>
<if test="spaceId != null">#{spaceId},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="deptId != null">#{deptId},</if>
<if test="ruleId != null">#{ruleId},</if>
<if test="ladderRuleId != null">#{ladderRuleId},</if>
</trim>
</insert>
<insert id="saveBranchTree">
insert into sys_branch (id, name, parent_id, level, ancestors)
values
<foreach collection="list" item="i" index="index" separator=",">
(
#{i.deptcode},
#{i.name},
#{i.parentcode},
#{i.level},
#{i.ancestors}
)
</foreach>
ON DUPLICATE KEY UPDATE
name = values(name),
parent_id = values(parent_id),
level = values(level),
ancestors = values(ancestors);
</insert>
<insert id="saveUserInfo">
insert into sys_people (sex, branch_id, position, name, phone, gh, guid, del_flag)
VALUES
<foreach collection="list" item="i" index="index" separator=",">
(
#{i.sex},
#{i.ssbm},
#{i.posts},
#{i.lastname},
#{i.telphone},
#{i.workcode},
REPLACE(uuid(), '-', ''),
#{i.delFlag}
)
</foreach>
ON DUPLICATE KEY UPDATE
sex = values(sex),
branch_id = values(branch_id),
position = values(position),
name = values(name),
phone = values(phone),
del_flag = values(del_flag)
</insert>
<insert id="saveStation">
insert into jj_station(id, postid, deptcode, postname, postcode, begindate)
VALUES
<foreach collection="list" item="i" index="index" separator=",">
(
REPLACE(uuid(), '-', ''),
#{i.postid},
#{i.deptcode},
#{i.postname},
#{i.postcode},
#{i.begindate}
)
</foreach>
</insert>
<update id="updateSysBranch" parameterType="SysBranch">
update sys_branch
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="leader != null">leader = #{leader},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="ancestors != null">ancestors = #{ancestors},</if>
<if test="spaceId != null">space_id = #{spaceId},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="ruleId != null">rule_id = #{ruleId},</if>
<if test="ladderRuleId != null">ladder_rule_id = #{ladderRuleId},</if>
<if test="isExamine != null">is_examine = #{isExamine},</if>
</trim>
where id = #{id}
</update>
<update id="updateBranchTree">
update sys_branch
<trim prefix="set" suffixOverrides=",">
<trim prefix="ancestors =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="null != item.ancestors">
WHEN ID=#{item.id} THEN #{item.ancestors}
</if>
</foreach>
</trim>
</trim>
WHERE
ID IN
<foreach collection="list" index="index" item="item" separator="," open="(" close=")">
#{item.id}
</foreach>
</update>
<delete id="deleteSysBranchById" parameterType="Long">
delete from sys_branch where id = #{id}
</delete>
<delete id="deleteSysBranchByBranchId" parameterType="String">
delete from sys_branch where id = #{id}
</delete>
<delete id="deleteSysBranchByIds" parameterType="String">
delete from sys_branch where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectSysBranchByDeptId" parameterType="Long" resultMap="SysBranchResult">
<include refid="selectSysBranchVo"/>
where b.dept_id = #{deptId} limit 1
</select>
<select id="queryBranchTree" resultMap="SysBranchResult">
select b.id, b.name, b.leader, b.phone, b.parent_id, b.ancestors, b.space_id,b.dept_id, b.remark, b.create_by,
b.create_time, b.update_by, b.update_time,b.rule_id
from sys_branch b
left join sys_dept d on b.dept_id = d.dept_id
where b.level in('1', '2')
</select>
<select id="selectBranchTree" resultType="com.dcsoft.system.domain.vo.JjDivisionVo">
select b.id, b.parent_id parentId from sys_branch b
LEFT JOIN sys_dept d ON b.dept_id = d.dept_id
<where>
<!-- 数据范围过滤 -->
${sysPeople.params.dataScope}
</where>
</select>
<select id="selectBranchTreeOther" resultType="com.dcsoft.system.domain.vo.JjDivisionVo">
select b.id, b.parent_id parentId from sys_branch b
LEFT JOIN sys_dept d ON b.dept_id = d.dept_id
<where>
<!-- 数据范围过滤 -->
${sysPeople.params.dataScope}
</where>
</select>
<select id="queryPropertyDept" resultType="com.dcsoft.system.domain.SysBranch">
select id, name
from sys_branch
<where>
<if test="parentId != null and parentId != ''">
parent_id = #{parentId}
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,117 @@
<?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.dcsoft.system.mapper.SysConfigMapper">
<resultMap type="SysConfig" id="SysConfigResult">
<id property="configId" column="config_id" />
<result property="configName" column="config_name" />
<result property="configKey" column="config_key" />
<result property="configValue" column="config_value" />
<result property="configType" column="config_type" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectConfigVo">
select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark
from sys_config
</sql>
<!-- 查询条件 -->
<sql id="sqlwhereSearch">
<where>
<if test="configId !=null">
and config_id = #{configId}
</if>
<if test="configKey !=null and configKey != ''">
and config_key = #{configKey}
</if>
</where>
</sql>
<select id="selectConfig" parameterType="SysConfig" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
<include refid="sqlwhereSearch"/>
</select>
<select id="selectConfigList" parameterType="SysConfig" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
<where>
<if test="configName != null and configName != ''">
AND config_name like concat('%', #{configName}, '%')
</if>
<if test="configType != null and configType != ''">
AND config_type = #{configType}
</if>
<if test="configKey != null and configKey != ''">
AND config_key like concat('%', #{configKey}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
</where>
</select>
<select id="selectConfigById" parameterType="Long" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
where config_id = #{configId}
</select>
<select id="checkConfigKeyUnique" parameterType="String" resultMap="SysConfigResult">
<include refid="selectConfigVo"/>
where config_key = #{configKey} limit 1
</select>
<insert id="insertConfig" parameterType="SysConfig">
insert into sys_config (
<if test="configName != null and configName != '' ">config_name,</if>
<if test="configKey != null and configKey != '' ">config_key,</if>
<if test="configValue != null and configValue != '' ">config_value,</if>
<if test="configType != null and configType != '' ">config_type,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
create_time
)values(
<if test="configName != null and configName != ''">#{configName},</if>
<if test="configKey != null and configKey != ''">#{configKey},</if>
<if test="configValue != null and configValue != ''">#{configValue},</if>
<if test="configType != null and configType != ''">#{configType},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
sysdate()
)
</insert>
<update id="updateConfig" parameterType="SysConfig">
update sys_config
<set>
<if test="configName != null and configName != ''">config_name = #{configName},</if>
<if test="configKey != null and configKey != ''">config_key = #{configKey},</if>
<if test="configValue != null and configValue != ''">config_value = #{configValue},</if>
<if test="configType != null and configType != ''">config_type = #{configType},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
update_time = sysdate()
</set>
where config_id = #{configId}
</update>
<delete id="deleteConfigById" parameterType="Long">
delete from sys_config where config_id = #{configId}
</delete>
<delete id="deleteConfigByIds" parameterType="Long">
delete from sys_config where config_id in
<foreach item="configId" collection="array" open="(" separator="," close=")">
#{configId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,166 @@
<?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.dcsoft.system.mapper.SysDeptMapper">
<resultMap type="SysDept" id="SysDeptResult">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" />
<result property="deptName" column="dept_name" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="phone" column="phone" />
<result property="email" column="email" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="parentName" column="parent_name" />
<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="externalId" column="external_id" />
</resultMap>
<sql id="selectDeptVo">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time,d.external_id
from sys_dept d
</sql>
<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where d.del_flag = '0'
<if test="deptId != null and deptId != 0">
AND dept_id = #{deptId}
</if>
<if test="parentId != null and parentId != 0">
AND parent_id = #{parentId}
</if>
<if test="deptName != null and deptName != ''">
AND dept_name like concat('%', #{deptName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
order by d.parent_id, d.order_num
</select>
<select id="selectDeptListByRoleId" resultType="Long">
select d.dept_id
from sys_dept d
left join sys_role_dept rd on d.dept_id = rd.dept_id
where rd.role_id = #{roleId}
<if test="deptCheckStrictly">
and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
</if>
order by d.parent_id, d.order_num
</select>
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where dept_id = #{deptId}
</select>
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
</select>
<select id="hasChildByDeptId" parameterType="Long" resultType="int">
select count(1) from sys_dept
where del_flag = '0' and parent_id = #{deptId} limit 1
</select>
<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
select * from sys_dept where find_in_set(#{deptId}, ancestors)
</select>
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
</select>
<select id="checkDeptNameUnique" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
</select>
<insert id="insertDept" parameterType="SysDept" useGeneratedKeys="true" keyProperty="deptId" >
insert into sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if>
<if test="ancestors != null and ancestors != ''">ancestors,</if>
<if test="orderNum != null">order_num,</if>
<if test="leader != null and leader != ''">leader,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="externalId != null and externalId != ''">external_id,</if>
create_time
)values(
<if test="deptId != null and deptId != 0">#{deptId},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="leader != null and leader != ''">#{leader},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="externalId != null and externalId != ''">#{externalId},</if>
sysdate()
)
</insert>
<update id="updateDept" parameterType="SysDept">
update sys_dept
<set>
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="leader != null">leader = #{leader},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="email != null">email = #{email},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="externalId != null and externalId != ''">external_id = #{externalId},</if>
update_time = sysdate()
</set>
where dept_id = #{deptId}
</update>
<update id="updateDeptChildren" parameterType="java.util.List">
update sys_dept set ancestors =
<foreach collection="depts" item="item" index="index"
separator=" " open="case dept_id" close="end">
when #{item.deptId} then #{item.ancestors}
</foreach>
where dept_id in
<foreach collection="depts" item="item" index="index"
separator="," open="(" close=")">
#{item.deptId}
</foreach>
</update>
<update id="updateDeptStatusNormal" parameterType="Long">
update sys_dept set status = '0' where dept_id in
<foreach collection="array" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
</update>
<delete id="deleteDeptById" parameterType="Long">
update sys_dept set del_flag = '2' where dept_id = #{deptId}
</delete>
<select id="findByParentExternalId" parameterType="String" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where external_id = #{externalId}
</select>
</mapper>

View File

@@ -0,0 +1,124 @@
<?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.dcsoft.system.mapper.SysDictDataMapper">
<resultMap type="SysDictData" id="SysDictDataResult">
<id property="dictCode" column="dict_code" />
<result property="dictSort" column="dict_sort" />
<result property="dictLabel" column="dict_label" />
<result property="dictValue" column="dict_value" />
<result property="dictType" column="dict_type" />
<result property="cssClass" column="css_class" />
<result property="listClass" column="list_class" />
<result property="isDefault" column="is_default" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDictDataVo">
select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark
from sys_dict_data
</sql>
<select id="selectDictDataList" parameterType="SysDictData" resultMap="SysDictDataResult">
<include refid="selectDictDataVo"/>
<where>
<if test="dictType != null and dictType != ''">
AND dict_type = #{dictType}
</if>
<if test="dictLabel != null and dictLabel != ''">
AND dict_label like concat('%', #{dictLabel}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
</where>
order by dict_sort asc
</select>
<select id="selectDictDataByType" parameterType="SysDictData" resultMap="SysDictDataResult">
<include refid="selectDictDataVo"/>
where status = '0' and dict_type = #{dictType} order by dict_sort asc
</select>
<select id="selectDictLabel" resultType="String">
select dict_label from sys_dict_data
where dict_type = #{dictType} and dict_value = #{dictValue}
</select>
<select id="selectDictDataById" parameterType="Long" resultMap="SysDictDataResult">
<include refid="selectDictDataVo"/>
where dict_code = #{dictCode}
</select>
<select id="countDictDataByType" resultType="Integer">
select count(1) from sys_dict_data where dict_type=#{dictType}
</select>
<delete id="deleteDictDataById" parameterType="Long">
delete from sys_dict_data where dict_code = #{dictCode}
</delete>
<delete id="deleteDictDataByIds" parameterType="Long">
delete from sys_dict_data where dict_code in
<foreach collection="array" item="dictCode" open="(" separator="," close=")">
#{dictCode}
</foreach>
</delete>
<update id="updateDictData" parameterType="SysDictData">
update sys_dict_data
<set>
<if test="dictSort != null">dict_sort = #{dictSort},</if>
<if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if>
<if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if>
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
<if test="cssClass != null">css_class = #{cssClass},</if>
<if test="listClass != null">list_class = #{listClass},</if>
<if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where dict_code = #{dictCode}
</update>
<update id="updateDictDataType" parameterType="String">
update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType}
</update>
<insert id="insertDictData" parameterType="SysDictData">
insert into sys_dict_data(
<if test="dictSort != null">dict_sort,</if>
<if test="dictLabel != null and dictLabel != ''">dict_label,</if>
<if test="dictValue != null and dictValue != ''">dict_value,</if>
<if test="dictType != null and dictType != ''">dict_type,</if>
<if test="cssClass != null and cssClass != ''">css_class,</if>
<if test="listClass != null and listClass != ''">list_class,</if>
<if test="isDefault != null and isDefault != ''">is_default,</if>
<if test="status != null">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="dictSort != null">#{dictSort},</if>
<if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if>
<if test="dictValue != null and dictValue != ''">#{dictValue},</if>
<if test="dictType != null and dictType != ''">#{dictType},</if>
<if test="cssClass != null and cssClass != ''">#{cssClass},</if>
<if test="listClass != null and listClass != ''">#{listClass},</if>
<if test="isDefault != null and isDefault != ''">#{isDefault},</if>
<if test="status != null">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
</mapper>

View File

@@ -0,0 +1,105 @@
<?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.dcsoft.system.mapper.SysDictTypeMapper">
<resultMap type="SysDictType" id="SysDictTypeResult">
<id property="dictId" column="dict_id" />
<result property="dictName" column="dict_name" />
<result property="dictType" column="dict_type" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDictTypeVo">
select dict_id, dict_name, dict_type, status, create_by, create_time, remark
from sys_dict_type
</sql>
<select id="selectDictTypeList" parameterType="SysDictType" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
<where>
<if test="dictName != null and dictName != ''">
AND dict_name like concat('%', #{dictName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="dictType != null and dictType != ''">
AND dict_type like concat('%', #{dictType}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
</where>
</select>
<select id="selectDictTypeAll" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
</select>
<select id="selectDictTypeById" parameterType="Long" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
where dict_id = #{dictId}
</select>
<select id="selectDictTypeByType" parameterType="String" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
where dict_type = #{dictType}
</select>
<select id="checkDictTypeUnique" parameterType="String" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
where dict_type = #{dictType} limit 1
</select>
<delete id="deleteDictTypeById" parameterType="Long">
delete from sys_dict_type where dict_id = #{dictId}
</delete>
<delete id="deleteDictTypeByIds" parameterType="Long">
delete from sys_dict_type where dict_id in
<foreach collection="array" item="dictId" open="(" separator="," close=")">
#{dictId}
</foreach>
</delete>
<update id="updateDictType" parameterType="SysDictType">
update sys_dict_type
<set>
<if test="dictName != null and dictName != ''">dict_name = #{dictName},</if>
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where dict_id = #{dictId}
</update>
<insert id="insertDictType" parameterType="SysDictType">
insert into sys_dict_type(
<if test="dictName != null and dictName != ''">dict_name,</if>
<if test="dictType != null and dictType != ''">dict_type,</if>
<if test="status != null">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="dictName != null and dictName != ''">#{dictName},</if>
<if test="dictType != null and dictType != ''">#{dictType},</if>
<if test="status != null">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
</mapper>

View File

@@ -0,0 +1,131 @@
<?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.dcsoft.system.mapper.SysEmpowerRecordMapper">
<resultMap type="SysEmpowerRecord" id="SysEmpowerRecordResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="peopleId" column="people_id" />
<result property="infoDown" column="info_down" />
<result property="empower" column="empower" />
<result property="equipmentId" column="equipment_id" />
<result property="status" column="status" />
<result property="remark" column="remark" />
<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="ruleId" column="rule_id" />
<result property="entryExitType" column="entry_exit_type" />
<association property="equipment" column="equipment_id" javaType="SysEquipment" resultMap="equipmentResult" />
<association property="people" column="people_id" javaType="SysPeople" resultMap="peopleResult" />
</resultMap>
<resultMap id="equipmentResult" type="SysEquipment">
<id property="id" column="equipment_id" />
<result property="name" column="equipmentName" />
</resultMap>
<resultMap id="peopleResult" type="SysPeople">
<id property="id" column="people_id" />
<result property="name" column="peopleName" />
<result property="avatar" column="peopleAvatar" />
</resultMap>
<sql id="selectSysEmpowerRecordVo">
select ser.id, ser.name, ser.people_id, ser.info_down, ser.empower, ser.equipment_id, ser.status, ser.remark, ser.create_by,
ser.create_time, ser.update_by, ser.update_time, ser.rule_id, p.name peopleName,p.avatar peopleAvatar,e.name equipmentName,
e.entry_exit_type
from sys_empower_record ser
left join sys_people p on ser.people_id=p.id
left join sys_equipment e on ser.equipment_id=e.id
</sql>
<select id="selectSysEmpowerRecordList" parameterType="SysEmpowerRecord" resultMap="SysEmpowerRecordResult">
<include refid="selectSysEmpowerRecordVo"/>
<where>
<if test="name != null and name != ''"> and ser.name like concat('%', #{name}, '%')</if>
<if test="peopleId != null and peopleId != ''"> and ser.people_id = #{peopleId}</if>
<if test="peopleName != null and peopleName != ''"> and p.name like concat('%', #{peopleName}, '%')</if>
<if test="infoDown != null and infoDown != ''"> and ser.info_down = #{infoDown}</if>
<if test="empower != null and empower != ''"> and ser.empower = #{empower}</if>
<if test="equipmentId != null "> and ser.equipment_id = #{equipmentId}</if>
<if test="status != null and status != ''"> and ser.status = #{status}</if>
<if test="ruleId != null "> and ser.rule_id = #{ruleId}</if>
<if test="gh != null "> and p.gh = #{gh}</if>
</where>
</select>
<select id="selectSysEmpowerRecordById" parameterType="Long" resultMap="SysEmpowerRecordResult">
<include refid="selectSysEmpowerRecordVo"/>
where ser.id = #{id}
</select>
<insert id="insertSysEmpowerRecord" parameterType="SysEmpowerRecord" useGeneratedKeys="true" keyProperty="id">
insert into sys_empower_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="peopleId != null">people_id,</if>
<if test="infoDown != null">info_down,</if>
<if test="empower != null">empower,</if>
<if test="equipmentId != null">equipment_id,</if>
<if test="status != null">status,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="ruleId != null">rule_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="peopleId != null">#{peopleId},</if>
<if test="infoDown != null">#{infoDown},</if>
<if test="empower != null">#{empower},</if>
<if test="equipmentId != null">#{equipmentId},</if>
<if test="status != null">#{status},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="ruleId != null">#{ruleId},</if>
</trim>
</insert>
<update id="updateSysEmpowerRecord" parameterType="SysEmpowerRecord">
update sys_empower_record
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="peopleId != null">people_id = #{peopleId},</if>
<if test="infoDown != null">info_down = #{infoDown},</if>
<if test="empower != null">empower = #{empower},</if>
<if test="equipmentId != null">equipment_id = #{equipmentId},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="ruleId != null">rule_id = #{ruleId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysEmpowerRecordById" parameterType="Long">
delete from sys_empower_record where id = #{id}
</delete>
<delete id="deleteSysEmpowerRecordByIds" parameterType="String">
delete from sys_empower_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteSysEmpowerRecordByPeopleId" parameterType="Long">
delete from sys_empower_record where people_id = #{peopleId}
</delete>
</mapper>

View File

@@ -0,0 +1,522 @@
<?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.dcsoft.system.mapper.SysEquipmentMapper">
<resultMap type="SysEquipment" id="SysEquipmentResult">
<result property="id" column="id" />
<result property="productId" column="product_id" />
<result property="name" column="name" />
<result property="sequence" column="sequence" />
<result property="ip" column="ip" />
<result property="password" column="password" />
<result property="spaceId" column="space_id" />
<result property="pointId" column="point_id" />
<result property="remark" column="remark" />
<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="state" column="state" />
<result property="flag" column="flag" />
<result property="comRecTimeWindow" column="com_rec_time_window" />
<result property="comRecRank" column="com_rec_rank" />
<result property="comRecDistModeType" column="com_rec_dist_mode_type" />
<result property="languageType" column="language_type" />
<result property="comRelayTime" column="com_relay_time" />
<result property="timeZone" column="time_zone" />
<result property="faceEnable" column="face_enable" />
<result property="faceScore" column="face_score" />
<result property="faceDetectionType" column="face_detection_type" />
<result property="repeatRegEnable" column="repeat_reg_enable" />
<result property="regInterval" column="reg_interval" />
<result property="cardEnable" column="card_enable" />
<result property="recSucTtsModeType" column="rec_suc_tts_mode_type" />
<result property="recSucTtsModeContent" column="rec_suc_tts_mode_content" />
<result property="recSucDisplayText1Type" column="rec_suc_display_text1_type" />
<result property="recSucDisplayText1Content" column="rec_suc_display_text1_content" />
<result property="recSucDisplayText2Type" column="rec_suc_display_text2_type" />
<result property="recSucDisplayText2Content" column="rec_suc_display_text2_content" />
<result property="recSucComModeType" column="rec_suc_com_mode_type" />
<result property="recSucComModeContent" column="rec_suc_com_mode_content" />
<result property="recSucWiegandType" column="rec_suc_wiegand_type" />
<result property="recSucWiegandContent" column="rec_suc_wiegand_content" />
<result property="recSucRelayType" column="rec_suc_relay_type" />
<result property="recFailEnable" column="rec_fail_enable" />
<result property="recFailTimesThreshold" column="rec_fail_times_threshold" />
<result property="recFailTtsModeType" column="rec_fail_tts_mode_type" />
<result property="recFailTtsModeContent" column="rec_fail_tts_mode_content" />
<result property="recFailDisplayTextType" column="rec_fail_display_text_type" />
<result property="recFailDisplayTextContent" column="rec_fail_display_text_content" />
<result property="recFailComModeType" column="rec_fail_com_mode_type" />
<result property="recFailComModeContent" column="rec_fail_com_mode_content" />
<result property="recFailWiegandType" column="rec_fail_wiegand_type" />
<result property="recFailWiegandContent" column="rec_fail_wiegand_content" />
<result property="recFailRelayType" column="rec_fail_relay_type" />
<result property="recNoPerTtsModeType" column="rec_no_per_tts_mode_type" />
<result property="recNoPerTtsModeContent" column="rec_no_per_tts_mode_content" />
<result property="recNoPerDisplayText1Type" column="rec_no_per_display_text1_type" />
<result property="recNoPerDisplayText1Content" column="rec_no_per_display_text1_content" />
<result property="recNoPerDisplayText2Type" column="rec_no_per_display_text2_type" />
<result property="recNoPerDisplayText2Content" column="rec_no_per_display_text2_content" />
<result property="recNoPerComModeType" column="rec_no_per_com_mode_type" />
<result property="recNoPerComModeContent" column="rec_no_per_com_mode_content" />
<result property="recNoPerWiegandType" column="rec_no_per_wiegand_type" />
<result property="recNoPerWiegandContent" column="rec_no_per_wiegand_content" />
<result property="recNoPerRelayType" column="rec_no_per_relay_type" />
<result property="scrDisplayText1Type" column="scr_display_text1_type" />
<result property="scrDisplayText1Content" column="scr_display_text1_content" />
<result property="scrDisplayText2Type" column="scr_display_text2_type" />
<result property="scrDisplayText2Content" column="scr_display_text2_content" />
<result property="isShowDeviceKey" column="is_show_device_key" />
<result property="isShowIp" column="is_show_ip" />
<result property="isShowPersonCount" column="is_show_person_count" />
<result property="scrImage1Url" column="scr_image1_url" />
<result property="scrImage2Url" column="scr_image2_url" />
<result property="isTemperatureOpen" column="is_temperature_open" />
<result property="temperatureCompensation" column="temperature_compensation" />
<result property="temperatureMeasureMax" column="temperature_measure_max" />
<result property="temperatureMeasureMin" column="temperature_measure_min" />
<result property="tempMapSwitch" column="temp_map_switch" />
<result property="tempUnit" column="temp_unit" />
<result property="isMaskOpen" column="is_mask_open" />
<result property="errorTemperature" column="error_temperature" />
<result property="backUrl" column="back_url" />
<result property="isCj" column="is_cj" />
<result property="entryExitType" column="entry_exit_type" />
<result property="bigtype" column="bigtype" />
<result property="fileType" column="file_type" />
<association property="product" column="product_id" javaType="SysProduct" resultMap="productResult" />
<association property="point" column="point_id" javaType="SysPoint" resultMap="pointResult" />
</resultMap>
<resultMap id="productResult" type="SysProduct">
<id property="id" column="product_id" />
<result property="name" column="productName" />
<result property="avatar" column="productAvatar" />
</resultMap>
<resultMap id="pointResult" type="SysPoint">
<id property="id" column="point_id" />
<result property="name" column="pointName" />
</resultMap>
<sql id="selectSysEquipmentVo">
select e.id, e.product_id, e.name, e.sequence, e.ip, e.password, e.space_id, e.point_id, e.remark, e.create_by, e.create_time, e.update_by, e.update_time, e.state,
e.flag, e.com_rec_time_window, e.com_rec_rank, e.com_rec_dist_mode_type, e.language_type, e.com_relay_time, e.time_zone, e.face_enable, e.face_score, e.face_detection_type,
e.repeat_reg_enable, e.reg_interval,e.card_enable, e.rec_suc_tts_mode_type, e.rec_suc_tts_mode_content, e.rec_suc_display_text1_type, e.rec_suc_display_text1_content,
e.rec_suc_display_text2_type, e.rec_suc_display_text2_content, e.rec_suc_com_mode_type, e.rec_suc_com_mode_content, e.rec_suc_wiegand_type, e.rec_suc_wiegand_content,
e.rec_suc_relay_type, e.rec_fail_enable, e.rec_fail_times_threshold, e.rec_fail_tts_mode_type, e.rec_fail_tts_mode_content, e.rec_fail_display_text_type, e.rec_fail_display_text_content,
e.rec_fail_com_mode_type,e.rec_fail_com_mode_content, e.rec_fail_wiegand_type, e.rec_fail_wiegand_content, e.rec_fail_relay_type, e.rec_no_per_tts_mode_type, e.rec_no_per_tts_mode_content,
e.rec_no_per_display_text1_type, e.rec_no_per_display_text1_content, e.rec_no_per_display_text2_type, e.rec_no_per_display_text2_content, e.rec_no_per_com_mode_type, e.rec_no_per_com_mode_content,
e.rec_no_per_wiegand_type, e.rec_no_per_wiegand_content, e.rec_no_per_relay_type, e.scr_display_text1_type, e.scr_display_text1_content, e.scr_display_text2_type, e.scr_display_text2_content,
e.is_show_device_key, e.is_show_ip, e.is_show_person_count, e.scr_image1_url, e.scr_image2_url, e.is_temperature_open, e.temperature_compensation, e.temperature_measure_max, e.temperature_measure_min,
e.temp_map_switch, e.temp_unit, e.is_mask_open, e.error_temperature,p.avatar productAvatar,p.name productName,pt.name pointName,e.back_url,e.is_cj,
e.entry_exit_type, p.bigtype, e.file_type
from sys_equipment e
left join sys_product p on e.product_id = p.id
left join sys_point pt on e.point_id = pt.id
</sql>
<select id="selectSysEquipmentList" parameterType="SysEquipment" resultMap="SysEquipmentResult">
<include refid="selectSysEquipmentVo"/>
<where>
<if test="productId != null "> and e.product_id = #{productId}</if>
<if test="name != null and name != ''"> and e.name like concat('%', #{name}, '%')</if>
<if test="sequence != null and sequence != ''"> and e.sequence = #{sequence}</if>
<if test="ip != null and ip != ''"> and e.ip = #{ip}</if>
<if test="password != null and password != ''"> and e.password = #{password}</if>
<if test="spaceId != null "> and e.space_id = #{spaceId}</if>
<if test="pointId != null "> and e.point_id = #{pointId}</if>
<if test="isCj != null and isCj != ''"> and e.is_cj = #{isCj}</if>
<if test="flag != null and flag != ''"> and e.flag = #{flag}</if>
<if test="bigtype != null and bigtype != ''"> and p.bigtype = #{bigtype}</if>
</where>
</select>
<select id="selectSysEquipmentById" parameterType="Long" resultMap="SysEquipmentResult">
<include refid="selectSysEquipmentVo"/>
where e.id = #{id}
</select>
<insert id="insertSysEquipment" parameterType="SysEquipment">
insert into sys_equipment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="productId != null">product_id,</if>
<if test="name != null and name != ''">name,</if>
<if test="sequence != null">sequence,</if>
<if test="ip != null">ip,</if>
<if test="password != null">password,</if>
<if test="spaceId != null">space_id,</if>
<if test="pointId != null">point_id,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="state != null">state,</if>
<if test="flag != null">flag,</if>
<if test="comRecTimeWindow != null">com_rec_time_window,</if>
<if test="comRecRank != null">com_rec_rank,</if>
<if test="comRecDistModeType != null">com_rec_dist_mode_type,</if>
<if test="languageType != null">language_type,</if>
<if test="comRelayTime != null">com_relay_time,</if>
<if test="timeZone != null">time_zone,</if>
<if test="faceEnable != null">face_enable,</if>
<if test="faceScore != null">face_score,</if>
<if test="faceDetectionType != null">face_detection_type,</if>
<if test="repeatRegEnable != null">repeat_reg_enable,</if>
<if test="regInterval != null">reg_interval,</if>
<if test="cardEnable != null">card_enable,</if>
<if test="recSucTtsModeType != null">rec_suc_tts_mode_type,</if>
<if test="recSucTtsModeContent != null">rec_suc_tts_mode_content,</if>
<if test="recSucDisplayText1Type != null">rec_suc_display_text1_type,</if>
<if test="recSucDisplayText1Content != null">rec_suc_display_text1_content,</if>
<if test="recSucDisplayText2Type != null">rec_suc_display_text2_type,</if>
<if test="recSucDisplayText2Content != null">rec_suc_display_text2_content,</if>
<if test="recSucComModeType != null">rec_suc_com_mode_type,</if>
<if test="recSucComModeContent != null">rec_suc_com_mode_content,</if>
<if test="recSucWiegandType != null">rec_suc_wiegand_type,</if>
<if test="recSucWiegandContent != null">rec_suc_wiegand_content,</if>
<if test="recSucRelayType != null">rec_suc_relay_type,</if>
<if test="recFailEnable != null">rec_fail_enable,</if>
<if test="recFailTimesThreshold != null">rec_fail_times_threshold,</if>
<if test="recFailTtsModeType != null">rec_fail_tts_mode_type,</if>
<if test="recFailTtsModeContent != null">rec_fail_tts_mode_content,</if>
<if test="recFailDisplayTextType != null">rec_fail_display_text_type,</if>
<if test="recFailDisplayTextContent != null">rec_fail_display_text_content,</if>
<if test="recFailComModeType != null">rec_fail_com_mode_type,</if>
<if test="recFailComModeContent != null">rec_fail_com_mode_content,</if>
<if test="recFailWiegandType != null">rec_fail_wiegand_type,</if>
<if test="recFailWiegandContent != null">rec_fail_wiegand_content,</if>
<if test="recFailRelayType != null">rec_fail_relay_type,</if>
<if test="recNoPerTtsModeType != null">rec_no_per_tts_mode_type,</if>
<if test="recNoPerTtsModeContent != null">rec_no_per_tts_mode_content,</if>
<if test="recNoPerDisplayText1Type != null">rec_no_per_display_text1_type,</if>
<if test="recNoPerDisplayText1Content != null">rec_no_per_display_text1_content,</if>
<if test="recNoPerDisplayText2Type != null">rec_no_per_display_text2_type,</if>
<if test="recNoPerDisplayText2Content != null">rec_no_per_display_text2_content,</if>
<if test="recNoPerComModeType != null">rec_no_per_com_mode_type,</if>
<if test="recNoPerComModeContent != null">rec_no_per_com_mode_content,</if>
<if test="recNoPerWiegandType != null">rec_no_per_wiegand_type,</if>
<if test="recNoPerWiegandContent != null">rec_no_per_wiegand_content,</if>
<if test="recNoPerRelayType != null">rec_no_per_relay_type,</if>
<if test="scrDisplayText1Type != null">scr_display_text1_type,</if>
<if test="scrDisplayText1Content != null">scr_display_text1_content,</if>
<if test="scrDisplayText2Type != null">scr_display_text2_type,</if>
<if test="scrDisplayText2Content != null">scr_display_text2_content,</if>
<if test="isShowDeviceKey != null">is_show_device_key,</if>
<if test="isShowIp != null">is_show_ip,</if>
<if test="isShowPersonCount != null">is_show_person_count,</if>
<if test="scrImage1Url != null">scr_image1_url,</if>
<if test="scrImage2Url != null">scr_image2_url,</if>
<if test="isTemperatureOpen != null">is_temperature_open,</if>
<if test="temperatureCompensation != null">temperature_compensation,</if>
<if test="temperatureMeasureMax != null">temperature_measure_max,</if>
<if test="temperatureMeasureMin != null">temperature_measure_min,</if>
<if test="tempMapSwitch != null">temp_map_switch,</if>
<if test="tempUnit != null">temp_unit,</if>
<if test="isMaskOpen != null">is_mask_open,</if>
<if test="errorTemperature != null">error_temperature,</if>
<if test="backUrl != null">back_url,</if>
<if test="isCj != null">is_cj,</if>
<if test="entryExitType != null">entry_exit_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="productId != null">#{productId},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="sequence != null">#{sequence},</if>
<if test="ip != null">#{ip},</if>
<if test="password != null">#{password},</if>
<if test="spaceId != null">#{spaceId},</if>
<if test="pointId != null">#{pointId},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="state != null">#{state},</if>
<if test="flag != null">#{flag},</if>
<if test="comRecTimeWindow != null">#{comRecTimeWindow},</if>
<if test="comRecRank != null">#{comRecRank},</if>
<if test="comRecDistModeType != null">#{comRecDistModeType},</if>
<if test="languageType != null">#{languageType},</if>
<if test="comRelayTime != null">#{comRelayTime},</if>
<if test="timeZone != null">#{timeZone},</if>
<if test="faceEnable != null">#{faceEnable},</if>
<if test="faceScore != null">#{faceScore},</if>
<if test="faceDetectionType != null">#{faceDetectionType},</if>
<if test="repeatRegEnable != null">#{repeatRegEnable},</if>
<if test="regInterval != null">#{regInterval},</if>
<if test="cardEnable != null">#{cardEnable},</if>
<if test="recSucTtsModeType != null">#{recSucTtsModeType},</if>
<if test="recSucTtsModeContent != null">#{recSucTtsModeContent},</if>
<if test="recSucDisplayText1Type != null">#{recSucDisplayText1Type},</if>
<if test="recSucDisplayText1Content != null">#{recSucDisplayText1Content},</if>
<if test="recSucDisplayText2Type != null">#{recSucDisplayText2Type},</if>
<if test="recSucDisplayText2Content != null">#{recSucDisplayText2Content},</if>
<if test="recSucComModeType != null">#{recSucComModeType},</if>
<if test="recSucComModeContent != null">#{recSucComModeContent},</if>
<if test="recSucWiegandType != null">#{recSucWiegandType},</if>
<if test="recSucWiegandContent != null">#{recSucWiegandContent},</if>
<if test="recSucRelayType != null">#{recSucRelayType},</if>
<if test="recFailEnable != null">#{recFailEnable},</if>
<if test="recFailTimesThreshold != null">#{recFailTimesThreshold},</if>
<if test="recFailTtsModeType != null">#{recFailTtsModeType},</if>
<if test="recFailTtsModeContent != null">#{recFailTtsModeContent},</if>
<if test="recFailDisplayTextType != null">#{recFailDisplayTextType},</if>
<if test="recFailDisplayTextContent != null">#{recFailDisplayTextContent},</if>
<if test="recFailComModeType != null">#{recFailComModeType},</if>
<if test="recFailComModeContent != null">#{recFailComModeContent},</if>
<if test="recFailWiegandType != null">#{recFailWiegandType},</if>
<if test="recFailWiegandContent != null">#{recFailWiegandContent},</if>
<if test="recFailRelayType != null">#{recFailRelayType},</if>
<if test="recNoPerTtsModeType != null">#{recNoPerTtsModeType},</if>
<if test="recNoPerTtsModeContent != null">#{recNoPerTtsModeContent},</if>
<if test="recNoPerDisplayText1Type != null">#{recNoPerDisplayText1Type},</if>
<if test="recNoPerDisplayText1Content != null">#{recNoPerDisplayText1Content},</if>
<if test="recNoPerDisplayText2Type != null">#{recNoPerDisplayText2Type},</if>
<if test="recNoPerDisplayText2Content != null">#{recNoPerDisplayText2Content},</if>
<if test="recNoPerComModeType != null">#{recNoPerComModeType},</if>
<if test="recNoPerComModeContent != null">#{recNoPerComModeContent},</if>
<if test="recNoPerWiegandType != null">#{recNoPerWiegandType},</if>
<if test="recNoPerWiegandContent != null">#{recNoPerWiegandContent},</if>
<if test="recNoPerRelayType != null">#{recNoPerRelayType},</if>
<if test="scrDisplayText1Type != null">#{scrDisplayText1Type},</if>
<if test="scrDisplayText1Content != null">#{scrDisplayText1Content},</if>
<if test="scrDisplayText2Type != null">#{scrDisplayText2Type},</if>
<if test="scrDisplayText2Content != null">#{scrDisplayText2Content},</if>
<if test="isShowDeviceKey != null">#{isShowDeviceKey},</if>
<if test="isShowIp != null">#{isShowIp},</if>
<if test="isShowPersonCount != null">#{isShowPersonCount},</if>
<if test="scrImage1Url != null">#{scrImage1Url},</if>
<if test="scrImage2Url != null">#{scrImage2Url},</if>
<if test="isTemperatureOpen != null">#{isTemperatureOpen},</if>
<if test="temperatureCompensation != null">#{temperatureCompensation},</if>
<if test="temperatureMeasureMax != null">#{temperatureMeasureMax},</if>
<if test="temperatureMeasureMin != null">#{temperatureMeasureMin},</if>
<if test="tempMapSwitch != null">#{tempMapSwitch},</if>
<if test="tempUnit != null">#{tempUnit},</if>
<if test="isMaskOpen != null">#{isMaskOpen},</if>
<if test="errorTemperature != null">#{errorTemperature},</if>
<if test="backUrl != null">#{backUrl},</if>
<if test="isCj != null">#{isCj},</if>
<if test="entryExitType != null">#{entryExitType},</if>
</trim>
</insert>
<insert id="saveFile">
insert into sys_file (id, business_id, business_type, url, file_name) VALUES
<foreach collection="list" item="i" index="index" separator=",">
(
#{i.id},
#{i.businessId},
#{i.businessType},
#{i.url},
#{i.fileName}
)
</foreach>
</insert>
<update id="updateSysEquipment" parameterType="SysEquipment">
update sys_equipment
<trim prefix="SET" suffixOverrides=",">
<if test="productId != null">product_id = #{productId},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="sequence != null">sequence = #{sequence},</if>
<if test="ip != null">ip = #{ip},</if>
<if test="password != null">password = #{password},</if>
<if test="spaceId != null">space_id = #{spaceId},</if>
<if test="pointId != null">point_id = #{pointId},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="state != null">state = #{state},</if>
<if test="flag != null">flag = #{flag},</if>
<if test="comRecTimeWindow != null">com_rec_time_window = #{comRecTimeWindow},</if>
<if test="comRecRank != null">com_rec_rank = #{comRecRank},</if>
<if test="comRecDistModeType != null">com_rec_dist_mode_type = #{comRecDistModeType},</if>
<if test="languageType != null">language_type = #{languageType},</if>
<if test="comRelayTime != null">com_relay_time = #{comRelayTime},</if>
<if test="timeZone != null">time_zone = #{timeZone},</if>
<if test="faceEnable != null">face_enable = #{faceEnable},</if>
<if test="faceScore != null">face_score = #{faceScore},</if>
<if test="faceDetectionType != null">face_detection_type = #{faceDetectionType},</if>
<if test="repeatRegEnable != null">repeat_reg_enable = #{repeatRegEnable},</if>
<if test="regInterval != null">reg_interval = #{regInterval},</if>
<if test="cardEnable != null">card_enable = #{cardEnable},</if>
<if test="recSucTtsModeType != null">rec_suc_tts_mode_type = #{recSucTtsModeType},</if>
<if test="recSucTtsModeContent != null">rec_suc_tts_mode_content = #{recSucTtsModeContent},</if>
<if test="recSucDisplayText1Type != null">rec_suc_display_text1_type = #{recSucDisplayText1Type},</if>
<if test="recSucDisplayText1Content != null">rec_suc_display_text1_content = #{recSucDisplayText1Content},</if>
<if test="recSucDisplayText2Type != null">rec_suc_display_text2_type = #{recSucDisplayText2Type},</if>
<if test="recSucDisplayText2Content != null">rec_suc_display_text2_content = #{recSucDisplayText2Content},</if>
<if test="recSucComModeType != null">rec_suc_com_mode_type = #{recSucComModeType},</if>
<if test="recSucComModeContent != null">rec_suc_com_mode_content = #{recSucComModeContent},</if>
<if test="recSucWiegandType != null">rec_suc_wiegand_type = #{recSucWiegandType},</if>
<if test="recSucWiegandContent != null">rec_suc_wiegand_content = #{recSucWiegandContent},</if>
<if test="recSucRelayType != null">rec_suc_relay_type = #{recSucRelayType},</if>
<if test="recFailEnable != null">rec_fail_enable = #{recFailEnable},</if>
<if test="recFailTimesThreshold != null">rec_fail_times_threshold = #{recFailTimesThreshold},</if>
<if test="recFailTtsModeType != null">rec_fail_tts_mode_type = #{recFailTtsModeType},</if>
<if test="recFailTtsModeContent != null">rec_fail_tts_mode_content = #{recFailTtsModeContent},</if>
<if test="recFailDisplayTextType != null">rec_fail_display_text_type = #{recFailDisplayTextType},</if>
<if test="recFailDisplayTextContent != null">rec_fail_display_text_content = #{recFailDisplayTextContent},</if>
<if test="recFailComModeType != null">rec_fail_com_mode_type = #{recFailComModeType},</if>
<if test="recFailComModeContent != null">rec_fail_com_mode_content = #{recFailComModeContent},</if>
<if test="recFailWiegandType != null">rec_fail_wiegand_type = #{recFailWiegandType},</if>
<if test="recFailWiegandContent != null">rec_fail_wiegand_content = #{recFailWiegandContent},</if>
<if test="recFailRelayType != null">rec_fail_relay_type = #{recFailRelayType},</if>
<if test="recNoPerTtsModeType != null">rec_no_per_tts_mode_type = #{recNoPerTtsModeType},</if>
<if test="recNoPerTtsModeContent != null">rec_no_per_tts_mode_content = #{recNoPerTtsModeContent},</if>
<if test="recNoPerDisplayText1Type != null">rec_no_per_display_text1_type = #{recNoPerDisplayText1Type},</if>
<if test="recNoPerDisplayText1Content != null">rec_no_per_display_text1_content = #{recNoPerDisplayText1Content},</if>
<if test="recNoPerDisplayText2Type != null">rec_no_per_display_text2_type = #{recNoPerDisplayText2Type},</if>
<if test="recNoPerDisplayText2Content != null">rec_no_per_display_text2_content = #{recNoPerDisplayText2Content},</if>
<if test="recNoPerComModeType != null">rec_no_per_com_mode_type = #{recNoPerComModeType},</if>
<if test="recNoPerComModeContent != null">rec_no_per_com_mode_content = #{recNoPerComModeContent},</if>
<if test="recNoPerWiegandType != null">rec_no_per_wiegand_type = #{recNoPerWiegandType},</if>
<if test="recNoPerWiegandContent != null">rec_no_per_wiegand_content = #{recNoPerWiegandContent},</if>
<if test="recNoPerRelayType != null">rec_no_per_relay_type = #{recNoPerRelayType},</if>
<if test="scrDisplayText1Type != null">scr_display_text1_type = #{scrDisplayText1Type},</if>
<if test="scrDisplayText1Content != null">scr_display_text1_content = #{scrDisplayText1Content},</if>
<if test="scrDisplayText2Type != null">scr_display_text2_type = #{scrDisplayText2Type},</if>
<if test="scrDisplayText2Content != null">scr_display_text2_content = #{scrDisplayText2Content},</if>
<if test="isShowDeviceKey != null">is_show_device_key = #{isShowDeviceKey},</if>
<if test="isShowIp != null">is_show_ip = #{isShowIp},</if>
<if test="isShowPersonCount != null">is_show_person_count = #{isShowPersonCount},</if>
<if test="scrImage1Url != null">scr_image1_url = #{scrImage1Url},</if>
<if test="scrImage2Url != null">scr_image2_url = #{scrImage2Url},</if>
<if test="isTemperatureOpen != null">is_temperature_open = #{isTemperatureOpen},</if>
<if test="temperatureCompensation != null">temperature_compensation = #{temperatureCompensation},</if>
<if test="temperatureMeasureMax != null">temperature_measure_max = #{temperatureMeasureMax},</if>
<if test="temperatureMeasureMin != null">temperature_measure_min = #{temperatureMeasureMin},</if>
<if test="tempMapSwitch != null">temp_map_switch = #{tempMapSwitch},</if>
<if test="tempUnit != null">temp_unit = #{tempUnit},</if>
<if test="isMaskOpen != null">is_mask_open = #{isMaskOpen},</if>
<if test="errorTemperature != null">error_temperature = #{errorTemperature},</if>
<if test="backUrl != null">back_url = #{backUrl},</if>
<if test="isCj != null">is_cj = #{isCj},</if>
<if test="entryExitType != null">entry_exit_type = #{entryExitType},</if>
<if test="fileType != null">file_type = #{fileType},</if>
</trim>
where id = #{id}
</update>
<update id="updateEquipmentByDeviceKey">
update sys_equipment
<trim prefix="SET" suffixOverrides=",">
<if test="password != null">password = #{password},</if>
<if test="deviceIp != null">ip = #{deviceIp},</if>
<if test="name != null">name = #{name},</if>
<if test="fileType != null">file_type = #{fileType},</if>
</trim>
where sequence = #{deviceKey}
</update>
<delete id="deleteSysEquipmentById" parameterType="Long">
delete from sys_equipment where id = #{id}
</delete>
<delete id="deleteSysEquipmentByIds" parameterType="String">
delete from sys_equipment where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteFile">
delete from sys_file where business_id = #{businessId} and business_type = #{businessType}
</delete>
<select id="selectEquipmentBySequence" parameterType="String" resultMap="SysEquipmentResult">
<include refid="selectSysEquipmentVo"/>
where e.sequence = #{sequence}
</select>
<select id="queryEquipmentInfo" resultType="com.dcsoft.system.domain.SysEquipment">
select ip, password
from sys_equipment
where point_id in
<foreach item="pointId" collection="pointIds" open="(" separator="," close=")">
#{pointId}
</foreach>
</select>
<select id="queryPeopleInfo" resultType="com.dcsoft.system.domain.SysPeople">
select ser.id,
p.name,
ser.people_id,
ser.info_down,
ser.empower,
ser.equipment_id,
ser.status,
ser.remark,
ser.rule_id ruleId,
p.name peopleName,
p.avatar peopleAvatar,
e.name equipmentName
from sys_empower_record ser
left join sys_people p on ser.people_id = p.id
left join sys_equipment e on ser.equipment_id = e.id
where p.del_flag = '0'
and e.sequence = #{sequence}
and p.gh = #{gh}
limit 1
</select>
<select id="selectSysEquipmentPeopleById" parameterType="Long" resultType="java.util.Map">
select distinct people_id
from sys_empower_record ser where equipment_id= #{id} and status='0'
</select>
<select id="queryDeviceSequence" resultType="java.lang.String">
select sp.bigtype from sys_equipment se left join sys_product sp on se.product_id = sp.id where se.sequence = #{deviceKey}
</select>
<select id="queryEmpowerRecord" resultType="com.dcsoft.system.domain.SysEmpowerRecord">
select ser.rule_id
from sys_empower_record ser
left join sys_people sp on ser.people_id = sp.id and sp.del_flag = '0'
left join sys_equipment se on se.id = ser.equipment_id
where sp.gh = #{gh}
and se.sequence = #{sequence}
group by ser.rule_id
</select>
<select id="queryPeople" resultType="com.dcsoft.system.domain.SysPeople">
select name, gh, door_no, id
from sys_people
where 1=1
<if test="gh != null and gh != ''">
and gh = #{gh}
</if>
<if test="doorNo != null and doorNo != ''">
and door_no = #{doorNo}
</if>
limit 1
</select>
<select id="queryEmpower" resultType="com.dcsoft.system.domain.SysEquipment">
select name, sequence, id from sys_equipment where sequence = #{sequence} limit 1
</select>
<select id="queryEquipmentByDeviceKey" resultType="com.dcsoft.system.domain.SysEquipment">
select name, sequence, id, ip, password, file_type fileType
from sys_equipment
where 1=1
<if test="deviceKey != null and deviceKey != ''">
and sequence = #{deviceKey}
</if>
limit 1
</select>
<select id="queryEquipmentByIp" resultType="com.dcsoft.system.domain.SysEquipment">
select name, sequence, id, ip, password
from sys_equipment
where ip in
<foreach item="ip" collection="ipList" open="(" separator="," close=")">
#{ip}
</foreach>
</select>
<select id="queryFile" resultType="com.dcsoft.system.domain.vo.SysFileVo">
select url, file_name fileName from sys_file where business_id = #{businessId} and business_type = #{businessType}
</select>
</mapper>

View File

@@ -0,0 +1,54 @@
<?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.dcsoft.system.mapper.SysLogininforMapper">
<resultMap type="SysLogininfor" id="SysLogininforResult">
<id property="infoId" column="info_id" />
<result property="userName" column="user_name" />
<result property="status" column="status" />
<result property="ipaddr" column="ipaddr" />
<result property="msg" column="msg" />
<result property="accessTime" column="access_time" />
</resultMap>
<insert id="insertLogininfor" parameterType="SysLogininfor">
insert into sys_logininfor (user_name, status, ipaddr, msg, access_time)
values (#{userName}, #{status}, #{ipaddr}, #{msg}, sysdate())
</insert>
<select id="selectLogininforList" parameterType="SysLogininfor" resultMap="SysLogininforResult">
select info_id, user_name, ipaddr, status, msg, access_time from sys_logininfor
<where>
<if test="ipaddr != null and ipaddr != ''">
AND ipaddr like concat('%', #{ipaddr}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="userName != null and userName != ''">
AND user_name like concat('%', #{userName}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND access_time &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND access_time &lt;= #{params.endTime}
</if>
</where>
order by info_id desc
</select>
<delete id="deleteLogininforByIds" parameterType="Long">
delete from sys_logininfor where info_id in
<foreach collection="array" item="infoId" open="(" separator="," close=")">
#{infoId}
</foreach>
</delete>
<update id="cleanLogininfor">
truncate table sys_logininfor
</update>
</mapper>

View File

@@ -0,0 +1,115 @@
<?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.dcsoft.system.mapper.SysManageRecordMapper">
<resultMap type="SysManageRecord" id="SysManageRecordResult">
<result property="id" column="id" />
<result property="type" column="type" />
<result property="peopleId" column="people_id" />
<result property="branchId" column="branch_id" />
<result property="ruleId" column="rule_id" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<association property="branch" column="branch_id" javaType="SysBranch" resultMap="branchResult" />
<association property="people" column="people_id" javaType="SysPeople" resultMap="peopleResult" />
<association property="rule" column="rule_id" javaType="SysRule" resultMap="ruleResult" />
</resultMap>
<resultMap id="branchResult" type="SysBranch">
<id property="id" column="branch_id" />
<result property="name" column="branchName" />
</resultMap>
<resultMap id="peopleResult" type="SysPeople">
<id property="id" column="people_id" />
<result property="name" column="peopleName" />
</resultMap>
<resultMap id="ruleResult" type="SysRule">
<id property="id" column="rule_id" />
<result property="name" column="ruleName" />
</resultMap>
<sql id="selectSysManageRecordVo">
select smr.id, smr.type, smr.people_id, smr.branch_id, smr.rule_id, smr.remark, smr.create_by, smr.create_time, smr.update_by, smr.update_time,
b.name branchName ,p.name peopleName ,r.name ruleName
from sys_manage_record smr
left join sys_branch b on smr.branch_id=b.id
left join sys_people p on smr.people_id=p.id
left join sys_rule r on smr.rule_id=r.id
</sql>
<select id="selectSysManageRecordList" parameterType="SysManageRecord" resultMap="SysManageRecordResult">
<include refid="selectSysManageRecordVo"/>
<where>
<if test="type != null "> and smr.type = #{type}</if>
<if test="peopleId != null "> and smr.people_id = #{peopleId}</if>
<if test="branchId != null "> and smr.branch_id = #{branchId}</if>
<if test="ruleId != null "> and smr.rule_id = #{ruleId}</if>
</where>
</select>
<select id="selectSysManageRecordById" parameterType="Long" resultMap="SysManageRecordResult">
<include refid="selectSysManageRecordVo"/>
where smr.id = #{id}
</select>
<insert id="insertSysManageRecord" parameterType="SysManageRecord" useGeneratedKeys="true" keyProperty="id">
insert into sys_manage_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="type != null">type,</if>
<if test="peopleId != null">people_id,</if>
<if test="branchId != null">branch_id,</if>
<if test="ruleId != null">rule_id,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="type != null">#{type},</if>
<if test="peopleId != null">#{peopleId},</if>
<if test="branchId != null">#{branchId},</if>
<if test="ruleId != null">#{ruleId},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateSysManageRecord" parameterType="SysManageRecord">
update sys_manage_record
<trim prefix="SET" suffixOverrides=",">
<if test="type != null">type = #{type},</if>
<if test="peopleId != null">people_id = #{peopleId},</if>
<if test="branchId != null">branch_id = #{branchId},</if>
<if test="ruleId != null">rule_id = #{ruleId},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysManageRecordById" parameterType="Long">
delete from sys_manage_record where id = #{id}
</delete>
<delete id="deleteSysManageRecordByIds" parameterType="String">
delete from sys_manage_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,202 @@
<?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.dcsoft.system.mapper.SysMenuMapper">
<resultMap type="SysMenu" id="SysMenuResult">
<id property="menuId" column="menu_id" />
<result property="menuName" column="menu_name" />
<result property="parentName" column="parent_name" />
<result property="parentId" column="parent_id" />
<result property="orderNum" column="order_num" />
<result property="path" column="path" />
<result property="component" column="component" />
<result property="query" column="query" />
<result property="isFrame" column="is_frame" />
<result property="isCache" column="is_cache" />
<result property="menuType" column="menu_type" />
<result property="visible" column="visible" />
<result property="status" column="status" />
<result property="perms" column="perms" />
<result property="icon" column="icon" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectMenuVo">
select menu_id, menu_name, parent_id, order_num, path, component, `query`, is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time
from sys_menu
</sql>
<select id="selectMenuList" parameterType="SysMenu" resultMap="SysMenuResult">
<include refid="selectMenuVo"/>
<where>
<if test="menuName != null and menuName != ''">
AND menu_name like concat('%', #{menuName}, '%')
</if>
<if test="visible != null and visible != ''">
AND visible = #{visible}
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
</where>
order by parent_id, order_num
</select>
<select id="selectMenuTreeAll" resultMap="SysMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m where m.menu_type in ('M', 'C') and m.status = 0
order by m.parent_id, m.order_num
</select>
<select id="selectMenuListByUserId" parameterType="SysMenu" resultMap="SysMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role ur on rm.role_id = ur.role_id
left join sys_role ro on ur.role_id = ro.role_id
where ur.user_id = #{params.userId}
<if test="menuName != null and menuName != ''">
AND m.menu_name like concat('%', #{menuName}, '%')
</if>
<if test="visible != null and visible != ''">
AND m.visible = #{visible}
</if>
<if test="status != null and status != ''">
AND m.status = #{status}
</if>
order by m.parent_id, m.order_num
</select>
<select id="selectMenuTreeByUserId" parameterType="Long" resultMap="SysMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role ur on rm.role_id = ur.role_id
left join sys_role ro on ur.role_id = ro.role_id
left join sys_user u on ur.user_id = u.user_id
where u.user_id = #{userId} and m.menu_type in ('M', 'C') and m.status = 0 AND ro.status = 0
order by m.parent_id, m.order_num
</select>
<select id="selectMenuListByRoleId" resultType="Long">
select m.menu_id
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
where rm.role_id = #{roleId}
<if test="menuCheckStrictly">
and m.menu_id not in (select m.parent_id from sys_menu m inner join sys_role_menu rm on m.menu_id = rm.menu_id and rm.role_id = #{roleId})
</if>
order by m.parent_id, m.order_num
</select>
<select id="selectMenuPerms" resultType="String">
select distinct m.perms
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role ur on rm.role_id = ur.role_id
</select>
<select id="selectMenuPermsByUserId" parameterType="Long" resultType="String">
select distinct m.perms
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role ur on rm.role_id = ur.role_id
left join sys_role r on r.role_id = ur.role_id
where m.status = '0' and r.status = '0' and ur.user_id = #{userId}
</select>
<select id="selectMenuPermsByRoleId" parameterType="Long" resultType="String">
select distinct m.perms
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
where m.status = '0' and rm.role_id = #{roleId}
</select>
<select id="selectMenuById" parameterType="Long" resultMap="SysMenuResult">
<include refid="selectMenuVo"/>
where menu_id = #{menuId}
</select>
<select id="hasChildByMenuId" resultType="Integer">
select count(1) from sys_menu where parent_id = #{menuId}
</select>
<select id="checkMenuNameUnique" parameterType="SysMenu" resultMap="SysMenuResult">
<include refid="selectMenuVo"/>
where menu_name=#{menuName} and parent_id = #{parentId} limit 1
</select>
<update id="updateMenu" parameterType="SysMenu">
update sys_menu
<set>
<if test="menuName != null and menuName != ''">menu_name = #{menuName},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="path != null and path != ''">path = #{path},</if>
<if test="component != null">component = #{component},</if>
<if test="query != null">`query` = #{query},</if>
<if test="isFrame != null and isFrame != ''">is_frame = #{isFrame},</if>
<if test="isCache != null and isCache != ''">is_cache = #{isCache},</if>
<if test="menuType != null and menuType != ''">menu_type = #{menuType},</if>
<if test="visible != null">visible = #{visible},</if>
<if test="status != null">status = #{status},</if>
<if test="perms !=null">perms = #{perms},</if>
<if test="icon !=null and icon != ''">icon = #{icon},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where menu_id = #{menuId}
</update>
<insert id="insertMenu" parameterType="SysMenu">
insert into sys_menu(
<if test="menuId != null and menuId != 0">menu_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="menuName != null and menuName != ''">menu_name,</if>
<if test="orderNum != null">order_num,</if>
<if test="path != null and path != ''">path,</if>
<if test="component != null and component != ''">component,</if>
<if test="query != null and query != ''">`query`,</if>
<if test="isFrame != null and isFrame != ''">is_frame,</if>
<if test="isCache != null and isCache != ''">is_cache,</if>
<if test="menuType != null and menuType != ''">menu_type,</if>
<if test="visible != null">visible,</if>
<if test="status != null">status,</if>
<if test="perms !=null and perms != ''">perms,</if>
<if test="icon != null and icon != ''">icon,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="menuId != null and menuId != 0">#{menuId},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="menuName != null and menuName != ''">#{menuName},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="path != null and path != ''">#{path},</if>
<if test="component != null and component != ''">#{component},</if>
<if test="query != null and query != ''">#{query},</if>
<if test="isFrame != null and isFrame != ''">#{isFrame},</if>
<if test="isCache != null and isCache != ''">#{isCache},</if>
<if test="menuType != null and menuType != ''">#{menuType},</if>
<if test="visible != null">#{visible},</if>
<if test="status != null">#{status},</if>
<if test="perms !=null and perms != ''">#{perms},</if>
<if test="icon != null and icon != ''">#{icon},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<delete id="deleteMenuById" parameterType="Long">
delete from sys_menu where menu_id = #{menuId}
</delete>
</mapper>

View File

@@ -0,0 +1,89 @@
<?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.dcsoft.system.mapper.SysNoticeMapper">
<resultMap type="SysNotice" id="SysNoticeResult">
<result property="noticeId" column="notice_id" />
<result property="noticeTitle" column="notice_title" />
<result property="noticeType" column="notice_type" />
<result property="noticeContent" column="notice_content" />
<result property="status" column="status" />
<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" />
</resultMap>
<sql id="selectNoticeVo">
select notice_id, notice_title, notice_type, cast(notice_content as char) as notice_content, status, create_by, create_time, update_by, update_time, remark
from sys_notice
</sql>
<select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
<include refid="selectNoticeVo"/>
where notice_id = #{noticeId}
</select>
<select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
<include refid="selectNoticeVo"/>
<where>
<if test="noticeTitle != null and noticeTitle != ''">
AND notice_title like concat('%', #{noticeTitle}, '%')
</if>
<if test="noticeType != null and noticeType != ''">
AND notice_type = #{noticeType}
</if>
<if test="createBy != null and createBy != ''">
AND create_by like concat('%', #{createBy}, '%')
</if>
</where>
</select>
<insert id="insertNotice" parameterType="SysNotice">
insert into sys_notice (
<if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
<if test="noticeType != null and noticeType != '' ">notice_type, </if>
<if test="noticeContent != null and noticeContent != '' ">notice_content, </if>
<if test="status != null and status != '' ">status, </if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>
<if test="noticeType != null and noticeType != ''">#{noticeType}, </if>
<if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if>
<if test="status != null and status != ''">#{status}, </if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateNotice" parameterType="SysNotice">
update sys_notice
<set>
<if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if>
<if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if>
<if test="noticeContent != null">notice_content = #{noticeContent}, </if>
<if test="status != null and status != ''">status = #{status}, </if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where notice_id = #{noticeId}
</update>
<delete id="deleteNoticeById" parameterType="Long">
delete from sys_notice where notice_id = #{noticeId}
</delete>
<delete id="deleteNoticeByIds" parameterType="Long">
delete from sys_notice where notice_id in
<foreach item="noticeId" collection="array" open="(" separator="," close=")">
#{noticeId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,83 @@
<?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.dcsoft.system.mapper.SysOperLogMapper">
<resultMap type="SysOperLog" id="SysOperLogResult">
<id property="operId" column="oper_id" />
<result property="title" column="title" />
<result property="businessType" column="business_type" />
<result property="method" column="method" />
<result property="requestMethod" column="request_method" />
<result property="operatorType" column="operator_type" />
<result property="operName" column="oper_name" />
<result property="deptName" column="dept_name" />
<result property="operUrl" column="oper_url" />
<result property="operIp" column="oper_ip" />
<result property="operParam" column="oper_param" />
<result property="jsonResult" column="json_result" />
<result property="status" column="status" />
<result property="errorMsg" column="error_msg" />
<result property="operTime" column="oper_time" />
<result property="costTime" column="cost_time" />
</resultMap>
<sql id="selectOperLogVo">
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_param, json_result, status, error_msg, oper_time, cost_time
from sys_oper_log
</sql>
<insert id="insertOperlog" parameterType="SysOperLog">
insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_param, json_result, status, error_msg, cost_time, oper_time)
values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime}, sysdate())
</insert>
<select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult">
<include refid="selectOperLogVo"/>
<where>
<if test="title != null and title != ''">
AND title like concat('%', #{title}, '%')
</if>
<if test="businessType != null">
AND business_type = #{businessType}
</if>
<if test="businessTypes != null and businessTypes.length > 0">
AND business_type in
<foreach collection="businessTypes" item="businessType" open="(" separator="," close=")">
#{businessType}
</foreach>
</if>
<if test="status != null">
AND status = #{status}
</if>
<if test="operName != null and operName != ''">
AND oper_name like concat('%', #{operName}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND oper_time &gt;= #{params.beginTime}
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND oper_time &lt;= #{params.endTime}
</if>
</where>
order by oper_id desc
</select>
<delete id="deleteOperLogByIds" parameterType="Long">
delete from sys_oper_log where oper_id in
<foreach collection="array" item="operId" open="(" separator="," close=")">
#{operId}
</foreach>
</delete>
<select id="selectOperLogById" parameterType="Long" resultMap="SysOperLogResult">
<include refid="selectOperLogVo"/>
where oper_id = #{operId}
</select>
<update id="cleanOperLog">
truncate table sys_oper_log
</update>
</mapper>

View File

@@ -0,0 +1,102 @@
<?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.dcsoft.system.mapper.SysPeopleEquipmentMapper">
<resultMap type="SysPeopleEquipment" id="SysPeopleEquipmentResult">
<result property="id" column="id" />
<result property="peopleId" column="people_id" />
<result property="equipmentId" column="equipment_id" />
<result property="guid" column="guid" />
<result property="faceGuid" column="face_guid" />
<result property="visitorId" column="visitor_id" />
<result property="otherId" column="other_id" />
</resultMap>
<sql id="selectSysPeopleEquipmentVo">
select id, people_id, equipment_id, guid, face_guid,visitor_id,other_id from sys_people_equipment
</sql>
<select id="selectSysPeopleEquipmentList" parameterType="SysPeopleEquipment" resultMap="SysPeopleEquipmentResult">
<include refid="selectSysPeopleEquipmentVo"/>
<where>
<if test="peopleId != null "> and people_id = #{peopleId}</if>
<if test="equipmentId != null "> and equipment_id = #{equipmentId}</if>
<if test="guid != null and guid != ''"> and guid = #{guid}</if>
<if test="faceGuid != null and faceGuid != ''"> and face_guid = #{faceGuid}</if>
<if test="visitorId != null "> and visitor_id = #{visitorId}</if>
<if test="otherId != null "> and other_id = #{otherId}</if>
</where>
</select>
<select id="selectSysPeopleEquipmentById" parameterType="Long" resultMap="SysPeopleEquipmentResult">
<include refid="selectSysPeopleEquipmentVo"/>
where id = #{id}
</select>
<insert id="insertSysPeopleEquipment" parameterType="SysPeopleEquipment" useGeneratedKeys="true" keyProperty="id">
insert into sys_people_equipment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="peopleId != null">people_id,</if>
<if test="equipmentId != null">equipment_id,</if>
<if test="guid != null">guid,</if>
<if test="faceGuid != null">face_guid,</if>
<if test="visitorId != null">visitor_id,</if>
<if test="otherId != null">other_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="peopleId != null">#{peopleId},</if>
<if test="equipmentId != null">#{equipmentId},</if>
<if test="guid != null">#{guid},</if>
<if test="faceGuid != null">#{faceGuid},</if>
<if test="visitorId != null">#{visitorId},</if>
<if test="otherId != null">#{otherId},</if>
</trim>
</insert>
<update id="updateSysPeopleEquipment" parameterType="SysPeopleEquipment">
update sys_people_equipment
<trim prefix="SET" suffixOverrides=",">
<if test="peopleId != null">people_id = #{peopleId},</if>
<if test="equipmentId != null">equipment_id = #{equipmentId},</if>
<if test="guid != null">guid = #{guid},</if>
<if test="faceGuid != null">face_guid = #{faceGuid},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysPeopleEquipmentById" parameterType="Long">
delete from sys_people_equipment where id = #{id}
</delete>
<delete id="deleteSysPeopleEquipmentByIds" parameterType="String">
delete from sys_people_equipment where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectSysPeopleEquipmentByGuId" parameterType="String" resultMap="SysPeopleEquipmentResult">
<include refid="selectSysPeopleEquipmentVo"/>
where guid = #{guid}
</select>
<select id="selectSysPeopleEquipmentByPeopleId" parameterType="String" resultMap="SysPeopleEquipmentResult">
<include refid="selectSysPeopleEquipmentVo"/>
where people_id = #{peopleId}
</select>
<select id="selectSysPeopleEquipmentByVisitorId" parameterType="String" resultMap="SysPeopleEquipmentResult">
<include refid="selectSysPeopleEquipmentVo"/>
where visitor_id = #{visitorId}
</select>
<delete id="deleteSysPeopleEquipmentByOtherId" parameterType="Long">
delete from sys_people_equipment where other_id = #{otherId}
</delete>
</mapper>

View File

@@ -0,0 +1,206 @@
<?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.dcsoft.system.mapper.SysPeopleLeaveMapper">
<resultMap type="SysPeopleLeave" id="SysPeopleLeaveResult">
<result property="id" column="id" />
<result property="gh" column="gh" />
<result property="name" column="name" />
<result property="sex" column="sex" />
<result property="branchId" column="branch_id" />
<result property="idcard" column="idcard" />
<result property="leaveTime" column="leave_time" />
<result property="peopleId" column="people_id" />
<result property="leaveReason" column="leave_reason" />
<result property="remark" column="remark" />
<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="branchName" column="branch_name" />
<result property="status" column="status" />
</resultMap>
<sql id="selectSysPeopleLeaveVo">
select spl.id, spl.gh, spl.name, spl.sex, spl.branch_id, spl.idcard, spl.leave_time, spl.people_id,
spl.leave_reason, spl.remark, spl.create_by, spl.create_time, spl.update_by, spl.update_time,b.name branch_name,spl.status
from sys_people_leave spl
left join sys_branch b on spl.branch_id = b.id
</sql>
<select id="selectSysPeopleLeaveList" parameterType="SysPeopleLeave" resultMap="SysPeopleLeaveResult">
<include refid="selectSysPeopleLeaveVo"/>
<where>
<if test="gh != null and gh != ''"> and spl.gh = #{gh}</if>
<if test="name != null and name != ''"> and spl.name like concat('%', #{name}, '%')</if>
<if test="branchId != null "> and spl.branch_id = #{branchId}</if>
<if test="leaveTime != null "> and spl.leave_time = #{leaveTime}</if>
<if test="type != null and type == '0'.toString()">
and date_format(DATE_SUB(NOW(), INTERVAL 3 MONTH), '%Y-%m-%d 00:00:00') &lt;= spl.leave_time
and spl.leave_time &lt;= date_format(NOW(), '%Y-%m-%d 00:00:00')
</if>
<if test="leaveReason != null and leaveReason != ''"> and spl.leave_reason = #{leaveReason}</if>
<if test="status != null and status != '' "> and spl.status = #{status}</if>
</where>
</select>
<select id="selectSysPeopleLeaveById" parameterType="Long" resultMap="SysPeopleLeaveResult">
<include refid="selectSysPeopleLeaveVo"/>
where spl.id = #{id}
</select>
<select id="queryPeopleLeaveList" resultType="com.dcsoft.system.domain.SysPeopleLeave">
select gh, name, sex, branch_id, leave_time, people_id, leave_reason, status, id
from sys_people_leave
where 1 = 1
and gh in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item.gh}
</foreach>
</select>
<insert id="insertSysPeopleLeave" parameterType="SysPeopleLeave" useGeneratedKeys="true" keyProperty="id">
insert into sys_people_leave
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="gh != null">gh,</if>
<if test="name != null and name != ''">name,</if>
<if test="sex != null">sex,</if>
<if test="branchId != null">branch_id,</if>
<if test="idcard != null">idcard,</if>
<if test="leaveTime != null">leave_time,</if>
<if test="peopleId != null">people_id,</if>
<if test="leaveReason != null">leave_reason,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="status != null">status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="gh != null">#{gh},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="sex != null">#{sex},</if>
<if test="branchId != null">#{branchId},</if>
<if test="idcard != null">#{idcard},</if>
<if test="leaveTime != null">#{leaveTime},</if>
<if test="peopleId != null">#{peopleId},</if>
<if test="leaveReason != null">#{leaveReason},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="status != null">#{status},</if>
</trim>
</insert>
<insert id="savePeopleLeaveList">
insert into sys_people_leave (gh, name, sex, branch_id, leave_time, people_id, leave_reason, status)
VALUES
<foreach collection="list" item="i" index="index" separator=",">
(
#{i.gh},
#{i.name},
#{i.sex},
#{i.branchId},
#{i.leaveTime},
#{i.peopleId},
#{i.leaveReason},
#{i.status}
)
</foreach>
</insert>
<update id="updateSysPeopleLeave" parameterType="SysPeopleLeave">
update sys_people_leave
<trim prefix="SET" suffixOverrides=",">
<if test="gh != null">gh = #{gh},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="branchId != null">branch_id = #{branchId},</if>
<if test="idcard != null">idcard = #{idcard},</if>
<if test="leaveTime != null">leave_time = #{leaveTime},</if>
<if test="peopleId != null">people_id = #{peopleId},</if>
<if test="leaveReason != null">leave_reason = #{leaveReason},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="status != null">status = #{status},</if>
</trim>
where id = #{id}
</update>
<update id="updatePeopleLeaveList">
UPDATE sys_people_leave
<trim prefix="set" suffixOverrides=",">
<trim prefix="name =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="null != item.name">
WHEN gh=#{item.gh} THEN #{item.name}
</if>
</foreach>
</trim>
<trim prefix="sex =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="null != item.sex">
WHEN gh=#{item.gh} THEN #{item.sex}
</if>
</foreach>
</trim>
<trim prefix="branch_id =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="null != item.branchId">
WHEN gh=#{item.gh} THEN #{item.branchId}
</if>
</foreach>
</trim>
<trim prefix="leave_time =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="null != item.leaveTime">
WHEN gh=#{item.gh} THEN #{item.leaveTime}
</if>
</foreach>
</trim>
<trim prefix="people_id =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="null != item.peopleId">
WHEN gh=#{item.gh} THEN #{item.peopleId}
</if>
</foreach>
</trim>
<trim prefix="leave_reason =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="null != item.leaveReason">
WHEN gh=#{item.gh} THEN #{item.leaveReason}
</if>
</foreach>
</trim>
<trim prefix="status =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="null != item.status">
WHEN gh=#{item.gh} THEN #{item.status}
</if>
</foreach>
</trim>
</trim>
WHERE
gh IN
<foreach collection="list" index="index" item="item" separator="," open="(" close=")">
#{item.gh}
</foreach>
</update>
<delete id="deleteSysPeopleLeaveById" parameterType="Long">
delete from sys_people_leave where id = #{id}
</delete>
<delete id="deleteSysPeopleLeaveByIds" parameterType="String">
delete from sys_people_leave where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,322 @@
<?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.dcsoft.system.mapper.SysPeopleMapper">
<resultMap type="SysPeople" id="SysPeopleResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="phone" column="phone" />
<result property="sex" column="sex" />
<result property="avatar" column="avatar" />
<result property="branchId" column="branch_id" />
<result property="position" column="position" />
<result property="idcard" column="idcard" />
<result property="carNo" column="car_no" />
<result property="doorNo" column="door_no" />
<result property="guid" column="guid" />
<result property="faceGuid" column="face_guid" />
<result property="userId" column="user_id" />
<result property="remark" column="remark" />
<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="gh" column="gh" />
<result property="fingerprint" column="fingerprint" />
<result property="joinTime" column="join_time" />
<result property="down" column="down" />
<result property="branchName" column="branchName" />
<result property="delFlag" column="del_flag" />
<result property="openid" column="openid" />
<result property="isExamine" column="is_examine" />
<association property="branch" column="branch_id" javaType="SysBranch" resultMap="branchResult" />
</resultMap>
<resultMap id="branchResult" type="SysBranch">
<id property="id" column="branch_id" />
<result property="name" column="branchName" />
<result property="ruleId" column="rule_id" />
</resultMap>
<sql id="selectSysPeopleVo">
select p.id, p.name, p.phone, p.sex, p.avatar, p.branch_id, p.position, p.idcard, p.car_no,p.door_no, p.guid, p.face_guid, p.openid, b.is_examine,
p.user_id, p.remark, p.create_by, p.create_time, p.update_by, p.update_time ,b.name branchName,p.gh,p.fingerprint,p.join_time,p.down,p.del_flag,b.rule_id
from sys_people p left join sys_branch b on p.branch_id=b.id
left join sys_user u on u.user_id = p.user_id
left join sys_dept d on u.dept_id = d.dept_id
</sql>
<select id="selectSysPeopleList" parameterType="SysPeople" resultMap="SysPeopleResult">
<include refid="selectSysPeopleVo"/>
<where>
<if test="sysPeople.id != null and sysPeople.id != ''"> and p.id = #{sysPeople.id}</if>
<if test="sysPeople.delFlag != null and sysPeople.delFlag != ''"> and p.del_flag = #{sysPeople.delFlag}</if>
<if test="sysPeople.name != null and sysPeople.name != ''"> and p.name like concat('%', #{sysPeople.name}, '%')</if>
<if test="sysPeople.phone != null and sysPeople.phone != ''"> and p.phone like concat('%', #{sysPeople.phone}, '%')</if>
<if test="sysPeople.sex != null and sysPeople.sex != ''"> and p.sex = #{sysPeople.sex}</if>
<if test="sysPeople.doorNo != null and sysPeople.doorNo != ''"> and p.door_no = #{sysPeople.doorNo}</if>
<!-- <if test="branchId != null ">-->
<!-- AND (p.branch_id = #{branchId} OR p.branch_id IN ( SELECT t.id FROM sys_branch t WHERE find_in_set(#{branchId}, ancestors) ))-->
<!-- </if>-->
<if test="list != null and list.size() > 0">
and p.branch_id in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="sysPeople.downFlag != null and sysPeople.downFlag != ''">
<if test="sysPeople.downFlag=='yxf'">
and p.down >0
</if>
<if test="sysPeople.downFlag=='wxf'">
and p.down =0
</if>
</if>
<if test="sysPeople.guidFlag != null and sysPeople.guidFlag != ''">
<if test="sysPeople.guidFlag=='yzc'">
and p.guid is not null
</if>
<if test="sysPeople.guidFlag=='wzc'">
and p.guid is null
</if>
</if>
<if test="sysPeople.faceFlag != null and sysPeople.faceFlag != ''">
<if test="sysPeople.faceFlag=='yzc'">
and p.face_guid is not null
</if>
<if test="sysPeople.faceFlag=='wzc'">
and p.face_guid is null
</if>
</if>
<if test="sysPeople.cardFlag != null and sysPeople.cardFlag != ''">
<if test="sysPeople.cardFlag=='yzc'">
and p.door_no is not null
</if>
<if test="sysPeople.cardFlag=='wzc'">
and p.door_no is null
</if>
</if>
<if test="sysPeople.delFlag != null"> and p.del_flag = #{sysPeople.delFlag}</if>
<if test="sysPeople.branchParent != null and sysPeople.branchParent != ''"> and b.id like concat(#{sysPeople.branchParent}, '%')</if>
</where>
</select>
<select id="selectSysPeopleById" parameterType="Long" resultMap="SysPeopleResult">
<include refid="selectSysPeopleVo"/>
where p.id = #{id}
</select>
<insert id="insertSysPeople" parameterType="SysPeople" useGeneratedKeys="true" keyProperty="id">
insert into sys_people
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if>
<if test="phone != null">phone,</if>
<if test="sex != null">sex,</if>
<if test="avatar != null">avatar,</if>
<if test="branchId != null">branch_id,</if>
<if test="position != null">position,</if>
<if test="idcard != null">idcard,</if>
<if test="carNo != null">car_no,</if>
<if test="doorNo != null">door_no,</if>
<if test="guid != null">guid,</if>
<if test="faceGuid != null">face_guid,</if>
<if test="userId != null">user_id,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="gh != null">gh,</if>
<if test="fingerprint != null">fingerprint,</if>
<if test="joinTime != null">join_time,</if>
<if test="down != null">down,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
<if test="phone != null">#{phone},</if>
<if test="sex != null">#{sex},</if>
<if test="avatar != null">#{avatar},</if>
<if test="branchId != null">#{branchId},</if>
<if test="position != null">#{position},</if>
<if test="idcard != null">#{idcard},</if>
<if test="carNo != null">#{carNo},</if>
<if test="doorNo != null">#{doorNo},</if>
<if test="guid != null">#{guid},</if>
<if test="faceGuid != null">#{faceGuid},</if>
<if test="userId != null">#{userId},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="gh != null">#{gh},</if>
<if test="fingerprint != null">#{fingerprint},</if>
<if test="joinTime != null">#{joinTime},</if>
<if test="down != null">#{down},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updateSysPeople" parameterType="SysPeople">
update sys_people
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="avatar != null">avatar = #{avatar},</if>
<if test="branchId != null">branch_id = #{branchId},</if>
<if test="position != null">position = #{position},</if>
<if test="idcard != null">idcard = #{idcard},</if>
<if test="carNo != null">car_no = #{carNo},</if>
<if test="doorNo != null">door_no = #{doorNo},</if>
<if test="guid != null">guid = #{guid},</if>
<if test="faceGuid != null">face_guid = #{faceGuid},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="gh != null">gh = #{gh},</if>
<if test="fingerprint != null">fingerprint = #{fingerprint},</if>
<if test="joinTime != null">join_time = #{joinTime},</if>
<if test="down != null">down = #{down},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="openid != null">openid = #{openid},</if>
</trim>
where id = #{id}
</update>
<update id="deleteSysPeopleById" parameterType="Long">
update sys_people set del_flag='2' where id = #{id}
</update>
<update id="deleteSysPeopleByIds" parameterType="String">
update sys_people set del_flag='2' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<update id="deleteSysPeopleByGuid" parameterType="String">
update sys_people set del_flag='2' where guid = #{guid}
</update>
<update id="updatePeople">
update sys_people set del_flag='2', update_time = now() where gh = #{gh}
</update>
<update id="updatePeopleInfo">
update sys_people set openid= #{openid} where phone = #{phone} and name = #{name}
</update>
<select id="selectByGuid" parameterType="SysPeople" resultMap="SysPeopleResult">
<include refid="selectSysPeopleVo"/>
where p.guid = #{guid}
</select>
<select id="selectSysPeopleByUserId" parameterType="Long" resultMap="SysPeopleResult">
<include refid="selectSysPeopleVo"/>
where p.id = #{userId}
</select>
<select id="selectSysPeopleByBranchUser" parameterType="String" resultMap="SysPeopleResult">
<include refid="selectSysPeopleVo"/>
where p.name = #{userName} and b.name = #{branchName} and p.del_flag = '0'
</select>
<select id="selectSysPeopleByGh" parameterType="String" resultMap="SysPeopleResult">
<include refid="selectSysPeopleVo"/>
where p.gh = #{gh} limit 1
</select>
<select id="selectSysPeopleByPhoneUser" parameterType="SysPeople" resultMap="SysPeopleResult">
<include refid="selectSysPeopleVo"/>
where p.name = #{name} and
p.phone = #{phone} and p.del_flag = '0'
</select>
<select id="queryPeopleInfo" resultType="com.dcsoft.system.domain.SysPeople">
select id from sys_people where del_flag = '0' and down = '0' limit 5
</select>
<select id="queryPeople" resultType="com.dcsoft.system.domain.SysPeople">
select id, gh
from sys_people
where del_flag = '0'
<if test="list != null and list.size() > 0">
and gh in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="queryPeopleDetails" resultType="com.dcsoft.system.domain.SysPeople">
select name from sys_people where del_flag = '0' and gh = #{gh}
</select>
<select id="selectSysPeopleByUserName" parameterType="String" resultMap="SysPeopleResult">
<include refid="selectSysPeopleVo"/>
where p.name = #{userName}
limit 1
</select>
<select id="selectDoorNo" resultType="java.lang.String">
select sp.door_no doorNo
from sys_empower_record ser
left join sys_people sp on ser.people_id = sp.id
where sp.del_flag = '0'
and ser.id = #{id}
limit 1
</select>
<select id="selectPeopleById" resultType="java.lang.String">
select id from sys_people where del_flag = '0' and door_no = #{card} limit 1
</select>
<select id="queryPeopleById" resultType="com.dcsoft.system.domain.vo.OfficialAccountVo">
select name, phone, id, date_format(create_time, '%Y-%m-%d %H:%i:%s') createTime, avatar, position from sys_people where id = #{id}
union all
select user_name name, phone, id, date_format(created_time, '%Y-%m-%d %H:%i:%s') createTime, '' avatar, '' position from vis_visitor_register where id = #{id}
</select>
<select id="selectSysPeopleByOpenId" parameterType="String" resultMap="SysPeopleResult">
<include refid="selectSysPeopleVo"/>
where p.openid = #{openid} limit 1
</select>
<select id="selectSysPeopleGh" parameterType="String" resultMap="SysPeopleResult">
<include refid="selectSysPeopleVo"/>
where p.phone = #{phone} and p.name = #{userName} limit 1
</select>
<select id="queryPeopleName" resultType="com.dcsoft.system.domain.SysPeople">
select phone, name, id, branch_id branchId, position, id
from sys_people
where del_flag = '0'
and phone = #{phone}
<if test="list != null and list.size() > 0">
and branch_id in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
limit 1
</select>
<select id="selectSysPeopleByDoorNo" resultType="com.dcsoft.system.domain.SysPeople">
select * from sys_people where del_flag = '0' and door_no = #{doorNo} limit 1
</select>
<select id="queryEmpowerRecord" resultType="com.dcsoft.system.domain.SysPeople">
select phone, p.name, p.id, branch_id branchId
from sys_empower_record ser
left join sys_people p on ser.people_id=p.id
left join sys_equipment e on ser.equipment_id=e.id
where rule_id != '10' and p.phone = #{phone} limit 1
</select>
<select id="queryPeopleByOpenid" resultType="com.dcsoft.system.domain.SysPeople">
select id visitorRegisterId, user_name name, phone, openid from vis_visitor_register where openid = #{openid}
</select>
<select id="queryPeopleByPosition" resultType="com.dcsoft.system.domain.SysPeople">
select id, name, position from sys_people where del_flag = '0' and position = #{position}
</select>
<select id="querySysPeopleInfo" resultType="com.dcsoft.system.domain.SysPeople">
select ifnull(phone, '0') phone, id from sys_people where del_flag = '0' and user_id = #{userId}
</select>
</mapper>

View File

@@ -0,0 +1,291 @@
<?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.dcsoft.system.mapper.SysPeopleOtherMapper">
<resultMap type="SysPeopleOther" id="SysPeopleOtherResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="phone" column="phone" />
<result property="sex" column="sex" />
<result property="avatar" column="avatar" />
<result property="branchId" column="branch_id" />
<result property="position" column="position" />
<result property="idcard" column="idcard" />
<result property="carNo" column="car_no" />
<result property="guid" column="guid" />
<result property="faceGuid" column="face_guid" />
<result property="remark" column="remark" />
<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="down" column="down" />
<result property="branchName" column="branchName" />
<result property="delFlag" column="del_flag" />
<result property="validTimeStart" column="valid_time_start" />
<result property="validTimeEnd" column="valid_time_end" />
<result property="file1" column="file1" />
<result property="file2" column="file2" />
<result property="file3" column="file3" />
<association property="branch" column="branch_id" javaType="SysBranch" resultMap="branchResult" />
</resultMap>
<resultMap id="branchResult" type="SysBranch">
<id property="id" column="branch_id" />
<result property="name" column="branchName" />
<result property="ruleId" column="rule_id" />
</resultMap>
<sql id="selectSysPeopleOtherVo">
select p.id, p.name, p.phone, p.sex, p.avatar, p.branch_id, p.position, p.idcard, p.car_no, p.guid, p.face_guid,p.valid_time_start,p.valid_time_end,
p.remark, p.create_by, p.create_time, p.update_by, p.update_time ,b.name branchName,p.down,p.del_flag,b.rule_id,p.file1,p.file2,p.file3
from sys_people_other p
left join sys_branch b on p.branch_id=b.id
left join sys_dept d on b.dept_id = d.dept_id
</sql>
<select id="selectSysPeopleOtherList" parameterType="SysPeopleOther" resultMap="SysPeopleOtherResult">
<include refid="selectSysPeopleOtherVo"/>
<where>
<if test="sysPeopleOther.id != null and sysPeopleOther.id != ''"> and p.id = #{sysPeopleOther.id}</if>
<if test="sysPeopleOther.delFlag != null and sysPeopleOther.delFlag != ''"> and p.del_flag = #{sysPeopleOther.delFlag}</if>
<if test="sysPeopleOther.name != null and sysPeopleOther.name != ''"> and p.name like concat('%', #{sysPeopleOther.name}, '%')</if>
<if test="sysPeopleOther.phone != null and sysPeopleOther.phone != ''"> and p.phone like concat('%', #{sysPeopleOther.phone}, '%')</if>
<if test="sysPeopleOther.sex != null and sysPeopleOther.sex != ''"> and p.sex = #{sysPeopleOther.sex}</if>
<!-- <if test="branchId != null ">-->
<!-- AND (p.branch_id = #{branchId} OR p.branch_id IN ( SELECT t.id FROM sys_branch t WHERE find_in_set(#{branchId}, ancestors) ))-->
<!-- </if>-->
<if test="list != null and list.size() > 0">
and p.branch_id in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="sysPeopleOther.downFlag != null and sysPeopleOther.downFlag != ''">
<if test="sysPeopleOther.downFlag=='yxf'">
and p.down >0
</if>
<if test="sysPeopleOther.downFlag=='wxf'">
and p.down =0
</if>
</if>
<if test="sysPeopleOther.guidFlag != null and sysPeopleOther.guidFlag != ''">
<if test="sysPeopleOther.guidFlag=='yzc'">
and p.guid is not null
</if>
<if test="sysPeopleOther.guidFlag=='wzc'">
and p.guid is null
</if>
</if>
<if test="sysPeopleOther.faceFlag != null and sysPeopleOther.faceFlag != ''">
<if test="sysPeopleOther.faceFlag=='yzc'">
and p.face_guid is not null
</if>
<if test="sysPeopleOther.faceFlag=='wzc'">
and p.face_guid is null
</if>
</if>
<if test="sysPeopleOther.cardFlag != null and sysPeopleOther.cardFlag != ''">
<if test="sysPeopleOther.cardFlag=='yzc'">
and p.door_no is not null
</if>
<if test="sysPeopleOther.cardFlag=='wzc'">
and p.door_no is null
</if>
</if>
<if test="sysPeopleOther.delFlag != null"> and p.del_flag = #{sysPeopleOther.delFlag}</if>
<if test="sysPeopleOther.branchParent != null and sysPeopleOther.branchParent != ''"> and b.id like concat(#{sysPeopleOther.branchParent}, '%')</if>
<!-- 数据范围过滤 -->
</where>
</select>
<select id="selectSysPeopleOtherById" parameterType="Long" resultMap="SysPeopleOtherResult">
<include refid="selectSysPeopleOtherVo"/>
where p.id = #{id}
</select>
<insert id="insertSysPeopleOther" parameterType="SysPeopleOther" useGeneratedKeys="true" keyProperty="id">
insert into sys_people_other
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if>
<if test="phone != null">phone,</if>
<if test="sex != null">sex,</if>
<if test="avatar != null">avatar,</if>
<if test="branchId != null">branch_id,</if>
<if test="position != null">position,</if>
<if test="idcard != null">idcard,</if>
<if test="carNo != null">car_no,</if>
<if test="guid != null">guid,</if>
<if test="faceGuid != null">face_guid,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="down != null">down,</if>
<if test="delFlag != null">del_flag,</if>
<if test="validTimeStart != null">valid_time_start,</if>
<if test="validTimeEnd != null">valid_time_end,</if>
<if test="file1 != null">file1,</if>
<if test="file2 != null">file2,</if>
<if test="file3 != null">file3,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
<if test="phone != null">#{phone},</if>
<if test="sex != null">#{sex},</if>
<if test="avatar != null">#{avatar},</if>
<if test="branchId != null">#{branchId},</if>
<if test="position != null">#{position},</if>
<if test="idcard != null">#{idcard},</if>
<if test="carNo != null">#{carNo},</if>
<if test="guid != null">#{guid},</if>
<if test="faceGuid != null">#{faceGuid},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="down != null">#{down},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="validTimeStart != null">#{validTimeStart},</if>
<if test="validTimeEnd != null">#{validTimeEnd},</if>
<if test="file1 != null">#{file1},</if>
<if test="file2 != null">#{file2},</if>
<if test="file3 != null">#{file3},</if>
</trim>
</insert>
<update id="updateSysPeopleOther" parameterType="SysPeopleOther">
update sys_people_other
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="avatar != null">avatar = #{avatar},</if>
<if test="branchId != null">branch_id = #{branchId},</if>
<if test="position != null">position = #{position},</if>
<if test="idcard != null">idcard = #{idcard},</if>
<if test="carNo != null">car_no = #{carNo},</if>
<if test="guid != null">guid = #{guid},</if>
<if test="faceGuid != null">face_guid = #{faceGuid},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="down != null">down = #{down},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="validTimeStart != null">valid_time_start = #{validTimeStart},</if>
<if test="validTimeEnd != null">valid_time_end = #{validTimeEnd},</if>
<if test="file1 != null">file1 = #{file1},</if>
<if test="file2 != null">file2 = #{file2},</if>
<if test="file3 != null">file3 = #{file3},</if>
</trim>
where id = #{id}
</update>
<update id="deleteSysPeopleOtherById" parameterType="Long">
update sys_people_other set del_flag='2' where id = #{id}
</update>
<update id="deleteSysPeopleOtherByIds" parameterType="String">
update sys_people_other set del_flag='2' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<update id="deleteSysPeopleOtherByGuid" parameterType="String">
update sys_people_other set del_flag='2' where guid = #{guid}
</update>
<update id="updatePeople">
update sys_people_other set del_flag='2', update_time = now() where gh = #{gh}
</update>
<update id="updatePeopleInfo">
update sys_people_other set openid= #{openid} where phone = #{phone} and name = #{name}
</update>
<select id="selectByGuid" parameterType="SysPeopleOther" resultMap="SysPeopleOtherResult">
<include refid="selectSysPeopleOtherVo"/>
where p.guid = #{guid}
</select>
<select id="selectSysPeopleOtherByUserId" parameterType="Long" resultMap="SysPeopleOtherResult">
<include refid="selectSysPeopleOtherVo"/>
where p.id = #{userId}
</select>
<select id="selectSysPeopleOtherByBranchUser" parameterType="String" resultMap="SysPeopleOtherResult">
<include refid="selectSysPeopleOtherVo"/>
where p.name = #{userName} and b.name = #{branchName} and p.del_flag = '0'
</select>
<select id="selectSysPeopleOtherByGh" parameterType="String" resultMap="SysPeopleOtherResult">
<include refid="selectSysPeopleOtherVo"/>
where p.gh = #{gh} and p.del_flag = '0'
</select>
<select id="selectSysPeopleOtherByPhoneUser" parameterType="SysPeopleOther" resultMap="SysPeopleOtherResult">
<include refid="selectSysPeopleOtherVo"/>
where p.name = #{name} and
p.phone = #{phone} and p.del_flag = '0'
</select>
<select id="queryPeopleInfo" resultType="com.dcsoft.system.domain.SysPeopleOther">
select id from sys_people_other where del_flag = '0' and down = '0' limit 5
</select>
<select id="queryPeople" resultType="com.dcsoft.system.domain.SysPeopleOther">
select id, gh
from sys_people_other
where del_flag = '0'
<if test="list != null and list.size() > 0">
and gh in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="queryPeopleDetails" resultType="com.dcsoft.system.domain.SysPeopleOther">
select name from sys_people_other where del_flag = '0' and gh = #{gh}
</select>
<select id="selectSysPeopleOtherByUserName" parameterType="String" resultMap="SysPeopleOtherResult">
<include refid="selectSysPeopleOtherVo"/>
where p.name = #{userName}
limit 1
</select>
<select id="selectDoorNo" resultType="java.lang.String">
select sp.door_no doorNo
from sys_empower_record ser
left join sys_people_other sp on ser.people_id = sp.id
where sp.del_flag = '0'
and ser.id = #{id}
limit 1
</select>
<select id="selectPeopleById" resultType="java.lang.String">
select id from sys_people_other where del_flag = '0' and door_no = #{card} limit 1
</select>
<select id="queryPeopleById" resultMap="SysPeopleOtherResult">
<include refid="selectSysPeopleOtherVo"/>
where p.id = #{id}
</select>
<select id="selectSysPeopleOtherByOpenId" parameterType="String" resultMap="SysPeopleOtherResult">
<include refid="selectSysPeopleOtherVo"/>
where p.openid = #{openid} limit 1
</select>
<select id="selectSysPeopleOtherGh" parameterType="String" resultMap="SysPeopleOtherResult">
<include refid="selectSysPeopleOtherVo"/>
where p.phone = #{phone} and p.name = #{userName} limit 1
</select>
<select id="queryPeopleName" resultType="com.dcsoft.system.domain.SysPeopleOther">
select phone, name, id, branch_id branchId from sys_people_other where del_flag = '0' and phone = #{phone}
</select>
</mapper>

View File

@@ -0,0 +1,307 @@
<?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.dcsoft.system.mapper.SysPeopleRecordMapper">
<resultMap type="SysPeopleRecord" id="SysPeopleRecordResult">
<result property="id" column="id" />
<result property="peopleId" column="people_id" />
<result property="equipmentId" column="equipment_id" />
<result property="deviceIp" column="device_ip" />
<result property="admitGuid" column="admit_guid" />
<result property="recMode" column="rec_mode" />
<result property="filePath" column="file_path" />
<result property="showTime" column="show_time" />
<result property="showDate" column="show_date" />
<result property="aliveType" column="alive_type" />
<result property="recScore" column="rec_score" />
<result property="deviceNo" column="device_no" />
<result property="deviceVersion" column="device_version" />
<result property="source" column="source" />
<result property="type" column="type" />
<result property="cardNo" column="card_no" />
<result property="deviceName" column="device_name" />
<result property="recType" column="rec_type" />
<result property="result" column="result" />
<result property="permissionTimeType" column="permission_time_type" />
<result property="passTimeType" column="pass_time_type" />
<result property="recModeType" column="rec_mode_type" />
<result property="storageId" column="storage_id" />
<result property="timestamp" column="timestamp" />
<result property="admitName" column="admit_name" />
<result property="remark" column="remark" />
<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="flag" column="flag" />
<result property="groupId" column="group_id" />
<result property="peopleName" column="people_name" />
<result property="equipmentName" column="equipmentName" />
<result property="gh" column="gh" />
<result property="sign" column="sign" />
<association property="equipment" column="equipment_id" javaType="SysEquipment" resultMap="equipmentResult" />
</resultMap>
<resultMap id="equipmentResult" type="SysEquipment">
<id property="id" column="equipment_id" />
<result property="name" column="equipmentName" />
</resultMap>
<sql id="selectSysPeopleRecordVo">
select spr.id, spr.people_id, spr.equipment_id, spr.device_ip, spr.admit_guid, spr.rec_mode, spr.file_path, spr.show_time, spr.show_date, spr.alive_type,
spr.rec_score, spr.device_no, spr.device_version, spr.source, spr.type, spr.card_no, spr.device_name, spr.rec_type, spr.result, spr.permission_time_type,
spr.pass_time_type, spr.rec_mode_type, spr.storage_id, spr.timestamp, spr.admit_name, spr.remark, spr.create_by, spr.create_time, spr.update_by, spr.update_time,
e.name equipmentName,spr.flag,spr.group_id,p.name people_name,p.gh,spr.sign
from sys_people_record spr
left join sys_equipment e on spr.equipment_id=e.id
left join sys_people p on spr.people_id=p.id
</sql>
<select id="selectSysPeopleRecordList" parameterType="SysPeopleRecord" resultMap="SysPeopleRecordResult">
<include refid="selectSysPeopleRecordVo"/>
<where>
<if test="peopleId != null and peopleId != ''"> and spr.people_id = #{peopleId}</if>
<if test="equipmentId != null and equipmentId != ''"> and spr.equipment_id = #{equipmentId}</if>
<if test="deviceIp != null and deviceIp != ''"> and spr.device_ip = #{deviceIp}</if>
<if test="admitGuid != null and admitGuid != ''"> and spr.admit_guid = #{admitGuid}</if>
<if test="recMode != null and recMode != ''"> and spr.rec_mode = #{recMode}</if>
<if test="filePath != null and filePath != ''"> and spr.file_path = #{filePath}</if>
<if test="showTime != null "> and spr.show_time = #{showTime}</if>
<if test="showDate != null "> and DATE_FORMAT(spr.show_date, '%Y-%m-%d') = DATE_FORMAT(#{showDate}, '%Y-%m-%d')</if>
<if test="aliveType != null and aliveType != ''"> and spr.alive_type = #{aliveType}</if>
<if test="recScore != null and recScore != ''"> and spr.rec_score = #{recScore}</if>
<if test="deviceNo != null and deviceNo != ''"> and spr.device_no = #{deviceNo}</if>
<if test="deviceVersion != null and deviceVersion != ''"> and spr.device_version = #{deviceVersion}</if>
<if test="source != null and source != ''"> and spr.source = #{source}</if>
<if test="type != null and type != ''"> and spr.type = #{type}</if>
<if test="cardNo != null and cardNo != ''"> and spr.card_no = #{cardNo}</if>
<if test="deviceName != null and deviceName != ''"> and spr.device_name like concat('%', #{deviceName}, '%')</if>
<if test="recType != null and recType != ''"> and spr.rec_type = #{recType}</if>
<if test="result != null and result != ''"> and spr.result = #{result}</if>
<if test="permissionTimeType != null and permissionTimeType != ''"> and spr.permission_time_type = #{permissionTimeType}</if>
<if test="passTimeType != null and passTimeType != ''"> and spr.pass_time_type = #{passTimeType}</if>
<if test="recModeType != null and recModeType != ''"> and spr.rec_mode_type = #{recModeType}</if>
<if test="storageId != null and storageId != ''"> and spr.storage_id = #{storageId}</if>
<if test="timestamp != null "> and spr.timestamp = #{timestamp}</if>
<if test="flag != null and flag != ''"> and spr.flag = #{flag}</if>
<if test="groupId != null and groupId != ''">
<if test="groupId == -1 ">
and spr.group_id is not null
</if>
<if test="groupId != -1 ">
and spr.group_id = #{groupId}
</if>
</if>
<if test="admitName != null and admitName != ''"> and spr.admit_name like concat('%', #{admitName}, '%')</if>
<if test="peopleName != null and peopleName != ''"> and p.name like concat('%', #{peopleName}, '%')</if>
</where>
order by spr.show_time desc
</select>
<select id="selectSysPeopleRecordLists" parameterType="SysPeopleRecord" resultMap="SysPeopleRecordResult">
<include refid="selectSysPeopleRecordVo"/>
<where>
<if test="peopleId != null and peopleId != ''"> and spr.people_id = #{peopleId}</if>
<if test="equipmentId != null and equipmentId != ''"> and spr.equipment_id = #{equipmentId}</if>
<if test="deviceIp != null and deviceIp != ''"> and spr.device_ip = #{deviceIp}</if>
<if test="admitGuid != null and admitGuid != ''"> and spr.admit_guid = #{admitGuid}</if>
<if test="recMode != null and recMode != ''"> and spr.rec_mode = #{recMode}</if>
<if test="filePath != null and filePath != ''"> and spr.file_path = #{filePath}</if>
<if test="showTime != null "> and spr.show_time = #{showTime}</if>
<if test="showDate != null "> and DATE_FORMAT(spr.show_date, '%Y-%m-%d') = DATE_FORMAT(#{showDate}, '%Y-%m-%d')</if>
<if test="aliveType != null and aliveType != ''"> and spr.alive_type = #{aliveType}</if>
<if test="recScore != null and recScore != ''"> and spr.rec_score = #{recScore}</if>
<if test="deviceNo != null and deviceNo != ''"> and spr.device_no = #{deviceNo}</if>
<if test="deviceVersion != null and deviceVersion != ''"> and spr.device_version = #{deviceVersion}</if>
<if test="source != null and source != ''"> and spr.source = #{source}</if>
<if test="type != null and type != ''"> and spr.type = #{type}</if>
<if test="cardNo != null and cardNo != ''"> and spr.card_no = #{cardNo}</if>
<if test="deviceName != null and deviceName != ''"> and spr.device_name like concat('%', #{deviceName}, '%')</if>
<if test="recType != null and recType != ''"> and spr.rec_type = #{recType}</if>
<if test="result != null and result != ''"> and spr.result = #{result}</if>
<if test="permissionTimeType != null and permissionTimeType != ''"> and spr.permission_time_type = #{permissionTimeType}</if>
<if test="passTimeType != null and passTimeType != ''"> and spr.pass_time_type = #{passTimeType}</if>
<if test="recModeType != null and recModeType != ''"> and spr.rec_mode_type = #{recModeType}</if>
<if test="storageId != null and storageId != ''"> and spr.storage_id = #{storageId}</if>
<if test="timestamp != null "> and spr.timestamp = #{timestamp}</if>
<if test="flag != null and flag != ''"> and spr.flag = #{flag}</if>
<if test="groupId != null and groupId != ''">
<if test="groupId == -1 ">
and spr.group_id is not null
</if>
<if test="groupId != -1 ">
and spr.group_id = #{groupId}
</if>
</if>
<if test="admitName != null and admitName != ''"> and spr.admit_name like concat('%', #{admitName}, '%')</if>
<if test="peopleName != null and peopleName != ''"> and p.name like concat('%', #{peopleName}, '%')</if>
</where>
order by spr.show_time
</select>
<select id="selectSysPeopleRecordById" parameterType="Long" resultMap="SysPeopleRecordResult">
<include refid="selectSysPeopleRecordVo"/>
where spr.id = #{id}
</select>
<insert id="insertSysPeopleRecord" parameterType="SysPeopleRecord" useGeneratedKeys="true" keyProperty="id">
insert into sys_people_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="peopleId != null">people_id,</if>
<if test="equipmentId != null">equipment_id,</if>
<if test="deviceIp != null">device_ip,</if>
<if test="admitGuid != null">admit_guid,</if>
<if test="recMode != null">rec_mode,</if>
<if test="filePath != null">file_path,</if>
<if test="showTime != null">show_time,</if>
<if test="showDate != null">show_date,</if>
<if test="aliveType != null">alive_type,</if>
<if test="recScore != null">rec_score,</if>
<if test="deviceNo != null">device_no,</if>
<if test="deviceVersion != null">device_version,</if>
<if test="source != null">source,</if>
<if test="type != null">type,</if>
<if test="cardNo != null">card_no,</if>
<if test="deviceName != null">device_name,</if>
<if test="recType != null">rec_type,</if>
<if test="result != null">result,</if>
<if test="permissionTimeType != null">permission_time_type,</if>
<if test="passTimeType != null">pass_time_type,</if>
<if test="recModeType != null">rec_mode_type,</if>
<if test="storageId != null">storage_id,</if>
<if test="timestamp != null">timestamp,</if>
<if test="admitName != null">admit_name,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="groupId != null">group_id,</if>
<if test="flag != null">flag,</if>
<if test="sign != null">sign,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="peopleId != null">#{peopleId},</if>
<if test="equipmentId != null">#{equipmentId},</if>
<if test="deviceIp != null">#{deviceIp},</if>
<if test="admitGuid != null">#{admitGuid},</if>
<if test="recMode != null">#{recMode},</if>
<if test="filePath != null">#{filePath},</if>
<if test="showTime != null">#{showTime},</if>
<if test="showDate != null">#{showDate},</if>
<if test="aliveType != null">#{aliveType},</if>
<if test="recScore != null">#{recScore},</if>
<if test="deviceNo != null">#{deviceNo},</if>
<if test="deviceVersion != null">#{deviceVersion},</if>
<if test="source != null">#{source},</if>
<if test="type != null">#{type},</if>
<if test="cardNo != null">#{cardNo},</if>
<if test="deviceName != null">#{deviceName},</if>
<if test="recType != null">#{recType},</if>
<if test="result != null">#{result},</if>
<if test="permissionTimeType != null">#{permissionTimeType},</if>
<if test="passTimeType != null">#{passTimeType},</if>
<if test="recModeType != null">#{recModeType},</if>
<if test="storageId != null">#{storageId},</if>
<if test="timestamp != null">#{timestamp},</if>
<if test="admitName != null">#{admitName},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="groupId != null">#{groupId},</if>
<if test="flag != null">#{flag},</if>
<if test="sign != null">#{sign},</if>
</trim>
</insert>
<update id="updateSysPeopleRecord" parameterType="SysPeopleRecord">
update sys_people_record
<trim prefix="SET" suffixOverrides=",">
<if test="peopleId != null">people_id = #{peopleId},</if>
<if test="equipmentId != null">equipment_id = #{equipmentId},</if>
<if test="deviceIp != null">device_ip = #{deviceIp},</if>
<if test="admitGuid != null">admit_guid = #{admitGuid},</if>
<if test="recMode != null">rec_mode = #{recMode},</if>
<if test="filePath != null">file_path = #{filePath},</if>
<if test="showTime != null">show_time = #{showTime},</if>
<if test="showDate != null">show_date = #{showDate},</if>
<if test="aliveType != null">alive_type = #{aliveType},</if>
<if test="recScore != null">rec_score = #{recScore},</if>
<if test="deviceNo != null">device_no = #{deviceNo},</if>
<if test="deviceVersion != null">device_version = #{deviceVersion},</if>
<if test="source != null">source = #{source},</if>
<if test="type != null">type = #{type},</if>
<if test="cardNo != null">card_no = #{cardNo},</if>
<if test="deviceName != null">device_name = #{deviceName},</if>
<if test="recType != null">rec_type = #{recType},</if>
<if test="result != null">result = #{result},</if>
<if test="permissionTimeType != null">permission_time_type = #{permissionTimeType},</if>
<if test="passTimeType != null">pass_time_type = #{passTimeType},</if>
<if test="recModeType != null">rec_mode_type = #{recModeType},</if>
<if test="storageId != null">storage_id = #{storageId},</if>
<if test="timestamp != null">timestamp = #{timestamp},</if>
<if test="admitName != null">admit_name = #{admitName},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="groupId != null">group_id = #{groupId},</if>
<if test="flag != null">flag = #{flag},</if>
<if test="sign != null">sign = #{sign},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysPeopleRecordById" parameterType="Long">
delete from sys_people_record where id = #{id}
</delete>
<delete id="deleteSysPeopleRecordByIds" parameterType="String">
delete from sys_people_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="topApi" resultType="java.util.Map">
select count(1) num from sys_branch
union all
select count(1) num from sys_people
union all
select count(1) num from sys_equipment
union all
select count(1) num from kq_group
</select>
<select id="selectPeopleRecordById" resultType="java.lang.String">
select id from sys_equipment where sequence = #{deviceKey} limit 1
</select>
<select id="queryThroughCount" resultType="com.dcsoft.system.domain.SysPeopleRecord">
select date.DATE hour,
sum(if(date_format(now(), '%Y-%m-%d') = date_format(create_time, '%Y-%m-%d'), 1, 0)) today,
sum(if(date_format(CURDATE() - INTERVAL 1 DAY, '%Y-%m-%d') = date_format(create_time, '%Y-%m-%d'), 1, 0)) yesterday
from (SELECT DATE_FORMAT(DATE_ADD(NOW(), INTERVAL ((@I := @I + 1)) HOUR), '%H:00') AS DATE
FROM (SELECT A
FROM (SELECT 1 AS A UNION SELECT 2 UNION SELECT 3 UNION SELECT 4) AS A
JOIN (SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6) AS B
ON 1) AS B,
(SELECT @I := -1) AS I
ORDER BY DATE) date
left join sys_people_record spr on SUBSTRING(date.DATE, 1, 2) = date_format(create_time, '%H')
group by date.DATE
order by date.DATE
</select>
</mapper>

View File

@@ -0,0 +1,91 @@
<?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.dcsoft.system.mapper.SysPeopleRuleMapper">
<resultMap type="SysPeopleRule" id="SysPeopleRuleResult">
<result property="id" column="id" />
<result property="peopleId" column="people_id" />
<result property="ruleId" column="rule_id" />
<result property="equipmentId" column="equipment_id" />
<result property="sync" column="sync" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectSysPeopleRuleVo">
select id, people_id, rule_id,equipment_id, sync, remark, create_by, create_time, update_by, update_time from sys_people_rule
</sql>
<select id="selectSysPeopleRuleList" parameterType="SysPeopleRule" resultMap="SysPeopleRuleResult">
<include refid="selectSysPeopleRuleVo"/>
<where>
<if test="peopleId != null "> and people_id = #{peopleId}</if>
<if test="ruleId != null "> and rule_id = #{ruleId}</if>
<if test="sync != null "> and sync = #{sync}</if>
</where>
</select>
<select id="selectSysPeopleRuleById" parameterType="Long" resultMap="SysPeopleRuleResult">
<include refid="selectSysPeopleRuleVo"/>
where id = #{id}
</select>
<insert id="insertSysPeopleRule" parameterType="SysPeopleRule" useGeneratedKeys="true" keyProperty="id">
insert into sys_people_rule
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="peopleId != null">people_id,</if>
<if test="ruleId != null">rule_id,</if>
<if test="equipmentId != null">equipment_id,</if>
<if test="sync != null">sync,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="peopleId != null">#{peopleId},</if>
<if test="ruleId != null">#{ruleId},</if>
<if test="equipmentId != null">#{equipmentId},</if>
<if test="sync != null">#{sync},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateSysPeopleRule" parameterType="SysPeopleRule">
update sys_people_rule
<trim prefix="SET" suffixOverrides=",">
<if test="peopleId != null">people_id = #{peopleId},</if>
<if test="ruleId != null">rule_id = #{ruleId},</if>
<if test="equipmentId != null">equipment_id = #{equipmentId},</if>
<if test="sync != null">sync = #{sync},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysPeopleRuleById" parameterType="Long">
delete from sys_people_rule where id = #{id}
</delete>
<delete id="deleteSysPeopleRuleByIds" parameterType="String">
delete from sys_people_rule where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,98 @@
<?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.dcsoft.system.mapper.SysPointMapper">
<resultMap type="SysPoint" id="SysPointResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="spaceId" column="space_id" />
<result property="remark" column="remark" />
<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="sort" column="sort" />
<association property="space" column="space_id" javaType="SysSpace" resultMap="spaceResult" />
</resultMap>
<resultMap id="spaceResult" type="SysSpace">
<id property="id" column="space_id" />
<result property="name" column="spaceName" />
</resultMap>
<sql id="selectSysPointVo">
select p.id, p.name, p.space_id, p.remark, p.create_by, p.create_time, p.update_by, p.update_time,s.name spaceName,p.sort
from sys_point p
left join sys_space s on s.id=p.space_id
</sql>
<select id="selectSysPointList" parameterType="SysPoint" resultMap="SysPointResult">
<include refid="selectSysPointVo"/>
<where>
<if test="name != null and name != ''"> and p.name like concat('%', #{name}, '%')</if>
<if test="spaceId != null "> and p.space_id = #{spaceId}</if>
</where>
order by p.sort
</select>
<select id="selectSysPointById" parameterType="Long" resultMap="SysPointResult">
<include refid="selectSysPointVo"/>
where p.id = #{id}
</select>
<insert id="insertSysPoint" parameterType="SysPoint">
insert into sys_point
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="name != null and name != ''">name,</if>
<if test="spaceId != null">space_id,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="sort != null">sort,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="spaceId != null">#{spaceId},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="sort != null">#{sort},</if>
</trim>
</insert>
<update id="updateSysPoint" parameterType="SysPoint">
update sys_point
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="spaceId != null">space_id = #{spaceId},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="sort != null">sort = #{sort},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysPointById" parameterType="Long">
delete from sys_point where id = #{id}
</delete>
<delete id="deleteSysPointByIds" parameterType="String">
delete from sys_point where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,122 @@
<?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.dcsoft.system.mapper.SysPostMapper">
<resultMap type="SysPost" id="SysPostResult">
<id property="postId" column="post_id" />
<result property="postCode" column="post_code" />
<result property="postName" column="post_name" />
<result property="postSort" column="post_sort" />
<result property="status" column="status" />
<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" />
</resultMap>
<sql id="selectPostVo">
select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark
from sys_post
</sql>
<select id="selectPostList" parameterType="SysPost" resultMap="SysPostResult">
<include refid="selectPostVo"/>
<where>
<if test="postCode != null and postCode != ''">
AND post_code like concat('%', #{postCode}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="postName != null and postName != ''">
AND post_name like concat('%', #{postName}, '%')
</if>
</where>
</select>
<select id="selectPostAll" resultMap="SysPostResult">
<include refid="selectPostVo"/>
</select>
<select id="selectPostById" parameterType="Long" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_id = #{postId}
</select>
<select id="selectPostListByUserId" parameterType="Long" resultType="Long">
select p.post_id
from sys_post p
left join sys_user_post up on up.post_id = p.post_id
left join sys_user u on u.user_id = up.user_id
where u.user_id = #{userId}
</select>
<select id="selectPostsByUserName" parameterType="String" resultMap="SysPostResult">
select p.post_id, p.post_name, p.post_code
from sys_post p
left join sys_user_post up on up.post_id = p.post_id
left join sys_user u on u.user_id = up.user_id
where u.user_name = #{userName}
</select>
<select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_name=#{postName} limit 1
</select>
<select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_code=#{postCode} limit 1
</select>
<update id="updatePost" parameterType="SysPost">
update sys_post
<set>
<if test="postCode != null and postCode != ''">post_code = #{postCode},</if>
<if test="postName != null and postName != ''">post_name = #{postName},</if>
<if test="postSort != null">post_sort = #{postSort},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where post_id = #{postId}
</update>
<insert id="insertPost" parameterType="SysPost" useGeneratedKeys="true" keyProperty="postId">
insert into sys_post(
<if test="postId != null and postId != 0">post_id,</if>
<if test="postCode != null and postCode != ''">post_code,</if>
<if test="postName != null and postName != ''">post_name,</if>
<if test="postSort != null">post_sort,</if>
<if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="postId != null and postId != 0">#{postId},</if>
<if test="postCode != null and postCode != ''">#{postCode},</if>
<if test="postName != null and postName != ''">#{postName},</if>
<if test="postSort != null">#{postSort},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<delete id="deletePostById" parameterType="Long">
delete from sys_post where post_id = #{postId}
</delete>
<delete id="deletePostByIds" parameterType="Long">
delete from sys_post where post_id in
<foreach collection="array" item="postId" open="(" separator="," close=")">
#{postId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,122 @@
<?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.dcsoft.system.mapper.SysProductMapper">
<resultMap type="SysProduct" id="SysProductResult">
<result property="id" column="id" />
<result property="avatar" column="avatar" />
<result property="name" column="name" />
<result property="version" column="version" />
<result property="bigtype" column="bigtype" />
<result property="subtype" column="subtype" />
<result property="genre" column="genre" />
<result property="describes" column="describes" />
<result property="network" column="network" />
<result property="dataFormat" column="data_format" />
<result property="scale" column="scale" />
<result property="attestation" column="attestation" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectSysProductVo">
select id, avatar, name, version, bigtype, subtype, genre, describes, network, data_format, scale, attestation, create_by, create_time, update_by, update_time from sys_product
</sql>
<select id="selectSysProductList" parameterType="SysProduct" resultMap="SysProductResult">
<include refid="selectSysProductVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="bigtype != null and bigtype != ''"> and bigtype = #{bigtype}</if>
<if test="subtype != null and subtype != ''"> and subtype = #{subtype}</if>
<if test="genre != null and genre != ''"> and genre = #{genre}</if>
<if test="describes != null and describes != ''"> and describes = #{describes}</if>
<if test="network != null and network != ''"> and network = #{network}</if>
<if test="dataFormat != null and dataFormat != ''"> and data_format = #{dataFormat}</if>
<if test="scale != null and scale != ''"> and scale = #{scale}</if>
<if test="attestation != null and attestation != ''"> and attestation = #{attestation}</if>
</where>
</select>
<select id="selectSysProductById" parameterType="Long" resultMap="SysProductResult">
<include refid="selectSysProductVo"/>
where id = #{id}
</select>
<insert id="insertSysProduct" parameterType="SysProduct">
insert into sys_product
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="avatar != null">avatar,</if>
<if test="name != null and name != ''">name,</if>
<if test="version != null">version,</if>
<if test="bigtype != null">bigtype,</if>
<if test="subtype != null">subtype,</if>
<if test="genre != null">genre,</if>
<if test="describes != null">describes,</if>
<if test="network != null">network,</if>
<if test="dataFormat != null">data_format,</if>
<if test="scale != null">scale,</if>
<if test="attestation != null">attestation,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="avatar != null">#{avatar},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="version != null">#{version},</if>
<if test="bigtype != null">#{bigtype},</if>
<if test="subtype != null">#{subtype},</if>
<if test="genre != null">#{genre},</if>
<if test="describes != null">#{describes},</if>
<if test="network != null">#{network},</if>
<if test="dataFormat != null">#{dataFormat},</if>
<if test="scale != null">#{scale},</if>
<if test="attestation != null">#{attestation},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateSysProduct" parameterType="SysProduct">
update sys_product
<trim prefix="SET" suffixOverrides=",">
<if test="avatar != null">avatar = #{avatar},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="version != null">version = #{version},</if>
<if test="bigtype != null">bigtype = #{bigtype},</if>
<if test="subtype != null">subtype = #{subtype},</if>
<if test="genre != null">genre = #{genre},</if>
<if test="describes != null">describes = #{describes},</if>
<if test="network != null">network = #{network},</if>
<if test="dataFormat != null">data_format = #{dataFormat},</if>
<if test="scale != null">scale = #{scale},</if>
<if test="attestation != null">attestation = #{attestation},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysProductById" parameterType="Long">
delete from sys_product where id = #{id}
</delete>
<delete id="deleteSysProductByIds" parameterType="String">
delete from sys_product where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,34 @@
<?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.dcsoft.system.mapper.SysRoleDeptMapper">
<resultMap type="SysRoleDept" id="SysRoleDeptResult">
<result property="roleId" column="role_id" />
<result property="deptId" column="dept_id" />
</resultMap>
<delete id="deleteRoleDeptByRoleId" parameterType="Long">
delete from sys_role_dept where role_id=#{roleId}
</delete>
<select id="selectCountRoleDeptByDeptId" resultType="Integer">
select count(1) from sys_role_dept where dept_id=#{deptId}
</select>
<delete id="deleteRoleDept" parameterType="Long">
delete from sys_role_dept where role_id in
<foreach collection="array" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
</delete>
<insert id="batchRoleDept">
insert into sys_role_dept(role_id, dept_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.roleId},#{item.deptId})
</foreach>
</insert>
</mapper>

View File

@@ -0,0 +1,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.dcsoft.system.mapper.SysRoleMapper">
<resultMap type="SysRole" id="SysRoleResult">
<id property="roleId" column="role_id" />
<result property="roleName" column="role_name" />
<result property="roleKey" column="role_key" />
<result property="roleSort" column="role_sort" />
<result property="dataScope" column="data_scope" />
<result property="menuCheckStrictly" column="menu_check_strictly" />
<result property="deptCheckStrictly" column="dept_check_strictly" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<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" />
</resultMap>
<sql id="selectRoleVo">
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
r.status, r.del_flag, r.create_time, r.remark
from sys_role r
left join sys_user_role ur on ur.role_id = r.role_id
left join sys_user u on u.user_id = ur.user_id
left join sys_dept d on u.dept_id = d.dept_id
</sql>
<select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.del_flag = '0'
<if test="roleId != null and roleId != 0">
AND r.role_id = #{roleId}
</if>
<if test="roleName != null and roleName != ''">
AND r.role_name like concat('%', #{roleName}, '%')
</if>
<if test="status != null and status != ''">
AND r.status = #{status}
</if>
<if test="roleKey != null and roleKey != ''">
AND r.role_key like concat('%', #{roleKey}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(r.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(r.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
order by r.role_sort
</select>
<select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
WHERE r.del_flag = '0' and ur.user_id = #{userId}
</select>
<select id="selectRoleAll" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
</select>
<select id="selectRoleListByUserId" parameterType="Long" resultType="Long">
select r.role_id
from sys_role r
left join sys_user_role ur on ur.role_id = r.role_id
left join sys_user u on u.user_id = ur.user_id
where u.user_id = #{userId}
</select>
<select id="selectRoleById" parameterType="Long" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.role_id = #{roleId}
</select>
<select id="selectRolesByUserName" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
WHERE r.del_flag = '0' and u.user_name = #{userName}
</select>
<select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.role_name=#{roleName} and r.del_flag = '0' limit 1
</select>
<select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
where r.role_key=#{roleKey} and r.del_flag = '0' limit 1
</select>
<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
insert into sys_role(
<if test="roleId != null and roleId != 0">role_id,</if>
<if test="roleName != null and roleName != ''">role_name,</if>
<if test="roleKey != null and roleKey != ''">role_key,</if>
<if test="roleSort != null">role_sort,</if>
<if test="dataScope != null and dataScope != ''">data_scope,</if>
<if test="menuCheckStrictly != null">menu_check_strictly,</if>
<if test="deptCheckStrictly != null">dept_check_strictly,</if>
<if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="roleId != null and roleId != 0">#{roleId},</if>
<if test="roleName != null and roleName != ''">#{roleName},</if>
<if test="roleKey != null and roleKey != ''">#{roleKey},</if>
<if test="roleSort != null">#{roleSort},</if>
<if test="dataScope != null and dataScope != ''">#{dataScope},</if>
<if test="menuCheckStrictly != null">#{menuCheckStrictly},</if>
<if test="deptCheckStrictly != null">#{deptCheckStrictly},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateRole" parameterType="SysRole">
update sys_role
<set>
<if test="roleName != null and roleName != ''">role_name = #{roleName},</if>
<if test="roleKey != null and roleKey != ''">role_key = #{roleKey},</if>
<if test="roleSort != null">role_sort = #{roleSort},</if>
<if test="dataScope != null and dataScope != ''">data_scope = #{dataScope},</if>
<if test="menuCheckStrictly != null">menu_check_strictly = #{menuCheckStrictly},</if>
<if test="deptCheckStrictly != null">dept_check_strictly = #{deptCheckStrictly},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where role_id = #{roleId}
</update>
<delete id="deleteRoleById" parameterType="Long">
update sys_role set del_flag = '2' where role_id = #{roleId}
</delete>
<delete id="deleteRoleByIds" parameterType="Long">
update sys_role set del_flag = '2' where role_id in
<foreach collection="array" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,34 @@
<?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.dcsoft.system.mapper.SysRoleMenuMapper">
<resultMap type="SysRoleMenu" id="SysRoleMenuResult">
<result property="roleId" column="role_id" />
<result property="menuId" column="menu_id" />
</resultMap>
<select id="checkMenuExistRole" resultType="Integer">
select count(1) from sys_role_menu where menu_id = #{menuId}
</select>
<delete id="deleteRoleMenuByRoleId" parameterType="Long">
delete from sys_role_menu where role_id=#{roleId}
</delete>
<delete id="deleteRoleMenu" parameterType="Long">
delete from sys_role_menu where role_id in
<foreach collection="array" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
</delete>
<insert id="batchRoleMenu">
insert into sys_role_menu(role_id, menu_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.roleId},#{item.menuId})
</foreach>
</insert>
</mapper>

View File

@@ -0,0 +1,120 @@
<?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.dcsoft.system.mapper.SysRuleMapper">
<resultMap type="SysRule" id="SysRuleResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="admittanceStart" column="admittance_start" />
<result property="admittanceEnd" column="admittance_end" />
<result property="spaceId" column="space_id" />
<result property="spaceName" column="space_name" />
<result property="pointId" column="point_id" />
<result property="remark" column="remark" />
<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="type" column="type" />
<result property="permission" column="permission" />
</resultMap>
<sql id="selectSysRuleVo">
select sr.id, sr.name, sr.start_time, sr.end_time, sr.admittance_start, sr.admittance_end, sr.space_id, sr.point_id,
sr.remark, sr.create_by, sr.create_time, sr.update_by, sr.update_time, sr.type, sr.permission,ss.name space_name
from sys_rule sr
left join sys_space ss on sr.space_id =ss.id
</sql>
<select id="selectSysRuleList" parameterType="SysRule" resultMap="SysRuleResult">
<include refid="selectSysRuleVo"/>
<where>
<if test="name != null and name != ''"> and sr.name like concat('%', #{name}, '%')</if>
<if test="startTime != null "> and sr.start_time = #{startTime}</if>
<if test="endTime != null "> and sr.end_time = #{endTime}</if>
<if test="admittanceStart != null and admittanceStart != ''"> and sr.admittance_start = #{admittanceStart}</if>
<if test="admittanceEnd != null and admittanceEnd != ''"> and sr.admittance_end = #{admittanceEnd}</if>
<if test="spaceId != null "> and sr.space_id = #{spaceId}</if>
<if test="pointId != null and pointId != ''"> and sr.point_id = #{pointId}</if>
<if test="type != null and type != ''"> and sr.type = #{type}</if>
<if test="permission != null and permission != ''"> and sr.permission = #{permission}</if>
</where>
</select>
<select id="selectSysRuleById" parameterType="Long" resultMap="SysRuleResult">
<include refid="selectSysRuleVo"/>
where sr.id = #{id}
</select>
<insert id="insertSysRule" parameterType="SysRule" useGeneratedKeys="true" keyProperty="id">
insert into sys_rule
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
<if test="admittanceStart != null">admittance_start,</if>
<if test="admittanceEnd != null">admittance_end,</if>
<if test="spaceId != null">space_id,</if>
<if test="pointId != null">point_id,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="type != null">type,</if>
<if test="permission != null">permission,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="admittanceStart != null">#{admittanceStart},</if>
<if test="admittanceEnd != null">#{admittanceEnd},</if>
<if test="spaceId != null">#{spaceId},</if>
<if test="pointId != null">#{pointId},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="type != null">#{type},</if>
<if test="permission != null">#{permission},</if>
</trim>
</insert>
<update id="updateSysRule" parameterType="SysRule">
update sys_rule
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="admittanceStart != null">admittance_start = #{admittanceStart},</if>
<if test="admittanceEnd != null">admittance_end = #{admittanceEnd},</if>
<if test="spaceId != null">space_id = #{spaceId},</if>
<if test="pointId != null">point_id = #{pointId},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="type != null">type = #{type},</if>
<if test="permission != null">permission = #{permission},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysRuleById" parameterType="Long">
delete from sys_rule where id = #{id}
</delete>
<delete id="deleteSysRuleByIds" parameterType="String">
delete from sys_rule where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,114 @@
<?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.dcsoft.system.mapper.SysSpaceMapper">
<resultMap type="SysSpace" id="SysSpaceResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="parentId" column="parent_id" />
<result property="ancestors" column="ancestors" />
<result property="type" column="type" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectSysSpaceVo">
select id, name, parent_id, ancestors, type, remark, create_by, create_time, update_by, update_time from sys_space
</sql>
<select id="selectSysSpaceList" parameterType="SysSpace" resultMap="SysSpaceResult">
<include refid="selectSysSpaceVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="type != null and type != ''"> and type = #{type}</if>
</where>
</select>
<select id="selectSysSpaceById" parameterType="Long" resultMap="SysSpaceResult">
<include refid="selectSysSpaceVo"/>
where id = #{id}
</select>
<select id="selectTree" resultType="com.dcsoft.system.domain.vo.SysAuthTree">
select id, name label, parent_id parentId, type, '1' deviceId, '1' channelId
from sys_space
where 1=1
<if test="name != null and name != ''">
and name like concat('%', #{name}, '%')
</if>
union all
select p.id, p.name label, p.space_id parentId, '1' type, '1' deviceId, '1' channelId
from sys_point p
where 1=1
<if test="name != null and name != ''">
and name like concat('%', #{name}, '%')
</if>
union all
select c.id, c.name label, c.point_id parentId, '2' type, c.device_id deviceId, c.channel_id channelId
from tb_camera c
where 1=1
<if test="name != null and name != ''">
and name like concat('%', #{name}, '%')
</if>
</select>
<insert id="insertSysSpace" parameterType="SysSpace">
insert into sys_space
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null and id != 0">id,</if>
<if test="name != null and name != ''">name,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="ancestors != null">ancestors,</if>
<if test="type != null and type != ''">type,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null and id != 0">#{id},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="ancestors != null">#{ancestors},</if>
<if test="type != null and type != ''">#{type},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateSysSpace" parameterType="SysSpace">
update sys_space
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="ancestors != null">ancestors = #{ancestors},</if>
<if test="type != null and type != ''">type = #{type},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysSpaceById" parameterType="Long">
delete from sys_space where id = #{id}
</delete>
<delete id="deleteSysSpaceByIds" parameterType="String">
delete from sys_space where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,147 @@
<?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.dcsoft.system.mapper.SysSyncRuleMapper">
<resultMap type="SysSyncRule" id="SysSyncRuleResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="guid" column="guid" />
<result property="allDeptUrl" column="all_dept_url" />
<result property="addDeptUrl" column="add_dept_url" />
<result property="allPeopleUrl" column="all_people_url" />
<result property="addPeopleUrl" column="add_people_url" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectSysSyncRuleVo">
select id, name, guid, all_dept_url, add_dept_url, all_people_url, add_people_url, remark, create_by, create_time, update_by, update_time from sys_sync_rule
</sql>
<select id="selectSysSyncRuleList" parameterType="SysSyncRule" resultMap="SysSyncRuleResult">
<include refid="selectSysSyncRuleVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
</where>
</select>
<select id="selectSysSyncRuleById" parameterType="Long" resultMap="SysSyncRuleResult">
<include refid="selectSysSyncRuleVo"/>
where id = #{id}
</select>
<insert id="insertSysSyncRule" parameterType="SysSyncRule" useGeneratedKeys="true" keyProperty="id">
insert into sys_sync_rule
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if>
<if test="guid != null and guid != ''">guid,</if>
<if test="allDeptUrl != null and allDeptUrl != ''">all_dept_url,</if>
<if test="addDeptUrl != null and addDeptUrl != ''">add_dept_url,</if>
<if test="allPeopleUrl != null and allPeopleUrl != ''">all_people_url,</if>
<if test="addPeopleUrl != null and addPeopleUrl != ''">add_people_url,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
<if test="guid != null and guid != ''">#{guid},</if>
<if test="allDeptUrl != null and allDeptUrl != ''">#{allDeptUrl},</if>
<if test="addDeptUrl != null and addDeptUrl != ''">#{addDeptUrl},</if>
<if test="allPeopleUrl != null and allPeopleUrl != ''">#{allPeopleUrl},</if>
<if test="addPeopleUrl != null and addPeopleUrl != ''">#{addPeopleUrl},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateSysSyncRule" parameterType="SysSyncRule">
update sys_sync_rule
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="guid != null and guid != ''">guid = #{guid},</if>
<if test="allDeptUrl != null and allDeptUrl != ''">all_dept_url = #{allDeptUrl},</if>
<if test="addDeptUrl != null and addDeptUrl != ''">add_dept_url = #{addDeptUrl},</if>
<if test="allPeopleUrl != null and allPeopleUrl != ''">all_people_url = #{allPeopleUrl},</if>
<if test="addPeopleUrl != null and addPeopleUrl != ''">add_people_url = #{addPeopleUrl},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSysSyncRuleById" parameterType="Long">
delete from sys_sync_rule where id = #{id}
</delete>
<delete id="deleteSysSyncRuleByIds" parameterType="String">
delete from sys_sync_rule where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="insetSysSyncRuleItem" parameterType="SysSyncItem" >
insert into sys_sync_item
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dept != null and dept != ''">dept,</if>
<if test="ruleId != null and ruleId != ''">rule_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dept != null and dept != ''">#{dept},</if>
<if test="ruleId != null and ruleId != ''">#{ruleId},</if>
</trim>
</insert>
<delete id="deleteSysSyncRuleItem" parameterType="Long">
delete from sys_sync_item where rule_id = #{id}
</delete>
<select id="selectSysSyncRuleItem" parameterType="Long" resultMap="SysSyncItemResult">
<include refid="selectSysSyncItemVo"/>
where rule_id = #{id}
</select>
<resultMap type="SysSyncItem" id="SysSyncItemResult">
<result property="id" column="id" />
<result property="dept" column="dept" />
<result property="ruleId" column="rule_id" />
</resultMap>
<sql id="selectSysSyncItemVo">
select id, dept,rule_id from sys_sync_item
</sql>
<select id="selectSysSyncItemRuleList" parameterType="SysSyncRule" resultMap="SysSyncRuleResult">
<include refid="selectSysSyncRulesVo"/>
<where>
and ssi.dept=#{branchId}
</where>
</select>
<select id="queryParkDept" resultType="com.dcsoft.system.domain.SysSyncItem">
select ssi.dept
from sys_sync_rule ssr
left join sys_sync_item ssi on ssr.id = ssi.rule_id
where guid = #{tdGuid}
</select>
<sql id="selectSysSyncRulesVo">
select ssr.id, ssr.name,ssr.guid, ssr.all_dept_url, ssr.add_dept_url, ssr.all_people_url, ssr.add_people_url, ssr.remark, ssr.create_by, ssr.create_time, ssr.update_by, ssr.update_time
from sys_sync_rule ssr
left join sys_sync_item ssi on ssr.id=ssi.rule_id
</sql>
</mapper>

View File

@@ -0,0 +1,256 @@
<?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.dcsoft.system.mapper.SysUserMapper">
<resultMap type="SysUser" id="SysUserResult">
<id property="userId" column="user_id" />
<result property="deptId" column="dept_id" />
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
<result property="email" column="email" />
<result property="phonenumber" column="phonenumber" />
<result property="sex" column="sex" />
<result property="avatar" column="avatar" />
<result property="password" column="password" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="loginIp" column="login_ip" />
<result property="loginDate" column="login_date" />
<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" />
<result property="openid" column="openid" />
<result property="externalId" column="external_id" />
<result property="equipmentId" column="equipment_id" />
<association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult" />
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
</resultMap>
<resultMap id="deptResult" type="SysDept">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
<result property="deptName" column="dept_name" />
<result property="ancestors" column="ancestors" />
<result property="orderNum" column="order_num" />
<result property="leader" column="leader" />
<result property="status" column="dept_status" />
</resultMap>
<resultMap id="RoleResult" type="SysRole">
<id property="roleId" column="role_id" />
<result property="roleName" column="role_name" />
<result property="roleKey" column="role_key" />
<result property="roleSort" column="role_sort" />
<result property="dataScope" column="data_scope" />
<result property="status" column="role_status" />
</resultMap>
<sql id="selectUserVo">
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status,u.openid,u.external_id,u.equipment_id
from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id
left join sys_role r on r.role_id = ur.role_id
</sql>
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader,u.openid from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
where u.del_flag = '0'
<if test="userId != null and userId != 0">
AND u.user_id = #{userId}
</if>
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="status != null and status != ''">
AND u.status = #{status}
</if>
<if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND date_format(u.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
<if test="deptId != null and deptId != 0">
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id
left join sys_role r on r.role_id = ur.role_id
where u.del_flag = '0' and r.role_id = #{roleId}
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
left join sys_user_role ur on u.user_id = ur.user_id
left join sys_role r on r.role_id = ur.role_id
where u.del_flag = '0' and (r.role_id != #{roleId} or r.role_id IS NULL)
and u.user_id not in (select u.user_id from sys_user u inner join sys_user_role ur on u.user_id = ur.user_id and ur.role_id = #{roleId})
<if test="userName != null and userName != ''">
AND u.user_name like concat('%', #{userName}, '%')
</if>
<if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.user_name = #{userName} and u.del_flag = '0'
</select>
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.user_id = #{userId}
</select>
<select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult">
select user_id, user_name from sys_user where user_name = #{userName} and del_flag = '0' limit 1
</select>
<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag = '0' limit 1
</select>
<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1
</select>
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
insert into sys_user(
<if test="userId != null and userId != 0">user_id,</if>
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="nickName != null and nickName != ''">nick_name,</if>
<if test="email != null and email != ''">email,</if>
<if test="avatar != null and avatar != ''">avatar,</if>
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
<if test="sex != null and sex != ''">sex,</if>
<if test="password != null and password != ''">password,</if>
<if test="status != null and status != ''">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="openid != null and openid != ''">openid,</if>
<if test="externalId != null and externalId != ''">external_id,</if>
<if test="equipmentId != null and equipmentId != ''">equipment_id,</if>
create_time
)values(
<if test="userId != null and userId != ''">#{userId},</if>
<if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="nickName != null and nickName != ''">#{nickName},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="avatar != null and avatar != ''">#{avatar},</if>
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
<if test="sex != null and sex != ''">#{sex},</if>
<if test="password != null and password != ''">#{password},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="openid != null and openid != ''">#{openid},</if>
<if test="externalId != null and externalId != ''">#{externalId},</if>
<if test="equipmentId != null and equipmentId != ''">#{equipmentId},</if>
sysdate()
)
</insert>
<update id="updateUser" parameterType="SysUser">
update sys_user
<set>
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
<if test="email != null ">email = #{email},</if>
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
<if test="sex != null and sex != ''">sex = #{sex},</if>
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
<if test="password != null and password != ''">password = #{password},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
<if test="loginDate != null">login_date = #{loginDate},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="openid != null">openid = #{openid},</if>
<if test="externalId != null">external_id = #{externalId},</if>
<if test="equipmentId != null">equipment_id = #{equipmentId},</if>
update_time = sysdate()
</set>
where user_id = #{userId}
</update>
<update id="updateUserStatus" parameterType="SysUser">
update sys_user set status = #{status} where user_id = #{userId}
</update>
<update id="updateUserAvatar" parameterType="SysUser">
update sys_user set avatar = #{avatar} where user_name = #{userName}
</update>
<update id="resetUserPwd" parameterType="SysUser">
update sys_user set password = #{password} where user_name = #{userName}
</update>
<delete id="deleteUserById" parameterType="Long">
update sys_user set del_flag = '2' where user_id = #{userId}
</delete>
<delete id="deleteUserByIds" parameterType="Long">
update sys_user set del_flag = '2' where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
<select id="selectUserByOpenId" parameterType="String" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.openid = #{openid} and u.del_flag = '0'
</select>
<update id="updateOpenId" parameterType="SysUser">
update sys_user set openid = #{openid} where user_id = #{userId}
</update>
<update id="updateAppletAvatar">
update sys_user set avatar = #{avatar} where user_name = #{userName}
</update>
<select id="selectUserByExternalId" parameterType="String" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.external_id = #{externalId} and u.del_flag = '0'
</select>
<select id="queryUserInfo" resultType="com.dcsoft.system.api.domain.SysUser">
select avatar from sys_user where user_name = #{userName} and del_flag = '0' limit 1
</select>
</mapper>

View File

@@ -0,0 +1,34 @@
<?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.dcsoft.system.mapper.SysUserPostMapper">
<resultMap type="SysUserPost" id="SysUserPostResult">
<result property="userId" column="user_id" />
<result property="postId" column="post_id" />
</resultMap>
<delete id="deleteUserPostByUserId" parameterType="Long">
delete from sys_user_post where user_id=#{userId}
</delete>
<select id="countUserPostById" resultType="Integer">
select count(1) from sys_user_post where post_id=#{postId}
</select>
<delete id="deleteUserPost" parameterType="Long">
delete from sys_user_post where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
<insert id="batchUserPost">
insert into sys_user_post(user_id, post_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.userId},#{item.postId})
</foreach>
</insert>
</mapper>

View File

@@ -0,0 +1,44 @@
<?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.dcsoft.system.mapper.SysUserRoleMapper">
<resultMap type="SysUserRole" id="SysUserRoleResult">
<result property="userId" column="user_id" />
<result property="roleId" column="role_id" />
</resultMap>
<delete id="deleteUserRoleByUserId" parameterType="Long">
delete from sys_user_role where user_id=#{userId}
</delete>
<select id="countUserRoleByRoleId" resultType="Integer">
select count(1) from sys_user_role where role_id=#{roleId}
</select>
<delete id="deleteUserRole" parameterType="Long">
delete from sys_user_role where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
<insert id="batchUserRole">
insert into sys_user_role(user_id, role_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.userId},#{item.roleId})
</foreach>
</insert>
<delete id="deleteUserRoleInfo" parameterType="SysUserRole">
delete from sys_user_role where user_id=#{userId} and role_id=#{roleId}
</delete>
<delete id="deleteUserRoleInfos">
delete from sys_user_role where role_id=#{roleId} and user_id in
<foreach collection="userIds" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,132 @@
<?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.dcsoft.system.visitor.mapper.VisVisitorExamineMapper">
<resultMap type="VisVisitorExamine" id="VisVisitorExamineResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="phone" column="phone" />
<result property="visitorId" column="visitor_id" />
<result property="admittanceStart" column="admittance_start" />
<result property="admittanceEnd" column="admittance_end" />
<result property="spaceId" column="space_id" />
<result property="pointId" column="point_id" />
<result property="type" column="type" />
<result property="permission" column="permission" />
<result property="remark" column="remark" />
<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="examine" column="examine" />
<result property="ruleId" column="rule_id" />
</resultMap>
<sql id="selectVisVisitorExamineVo">
select id, name, phone, visitor_id, admittance_start, admittance_end, space_id, point_id, type, permission, remark, create_by, create_time, update_by, update_time,examine,rule_id from vis_visitor_examine
</sql>
<select id="selectVisVisitorExamineList" parameterType="VisVisitorExamine" resultMap="VisVisitorExamineResult">
<include refid="selectVisVisitorExamineVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="visitorId != null "> and visitor_id = #{visitorId}</if>
<if test="admittanceStart != null and admittanceStart != ''"> and admittance_start = #{admittanceStart}</if>
<if test="admittanceEnd != null and admittanceEnd != ''"> and admittance_end = #{admittanceEnd}</if>
<if test="spaceId != null "> and space_id = #{spaceId}</if>
<if test="pointId != null and pointId != ''"> and point_id = #{pointId}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="permission != null and permission != ''"> and permission = #{permission}</if>
</where>
</select>
<select id="selectVisVisitorExamineById" parameterType="Long" resultMap="VisVisitorExamineResult">
<include refid="selectVisVisitorExamineVo"/>
where id = #{id}
</select>
<insert id="insertVisVisitorExamine" parameterType="VisVisitorExamine" useGeneratedKeys="true" keyProperty="id">
insert into vis_visitor_examine
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if>
<if test="phone != null">phone,</if>
<if test="visitorId != null">visitor_id,</if>
<if test="admittanceStart != null">admittance_start,</if>
<if test="admittanceEnd != null">admittance_end,</if>
<if test="spaceId != null">space_id,</if>
<if test="pointId != null">point_id,</if>
<if test="type != null">type,</if>
<if test="permission != null">permission,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="examine != null">examine,</if>
<if test="ruleId != null">rule_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
<if test="phone != null">#{phone},</if>
<if test="visitorId != null">#{visitorId},</if>
<if test="admittanceStart != null">#{admittanceStart},</if>
<if test="admittanceEnd != null">#{admittanceEnd},</if>
<if test="spaceId != null">#{spaceId},</if>
<if test="pointId != null">#{pointId},</if>
<if test="type != null">#{type},</if>
<if test="permission != null">#{permission},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="examine != null">#{examine},</if>
<if test="ruleId != null">#{ruleId},</if>
</trim>
</insert>
<update id="updateVisVisitorExamine" parameterType="VisVisitorExamine">
update vis_visitor_examine
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="visitorId != null">visitor_id = #{visitorId},</if>
<if test="admittanceStart != null">admittance_start = #{admittanceStart},</if>
<if test="admittanceEnd != null">admittance_end = #{admittanceEnd},</if>
<if test="spaceId != null">space_id = #{spaceId},</if>
<if test="pointId != null">point_id = #{pointId},</if>
<if test="type != null">type = #{type},</if>
<if test="permission != null">permission = #{permission},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="examine != null">examine = #{examine},</if>
<if test="ruleId != null">rule_id = #{ruleId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteVisVisitorExamineById" parameterType="Long">
delete from vis_visitor_examine where id = #{id}
</delete>
<delete id="deleteVisVisitorExamineByIds" parameterType="String">
delete from vis_visitor_examine where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteVisVisitorExamineByVisitorId" parameterType="Long">
delete from vis_visitor_examine where visitor_id = #{visitorId}
</delete>
</mapper>

View File

@@ -0,0 +1,111 @@
<?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.dcsoft.system.visitor.mapper.VisVisitorRegisterMapper">
<resultMap type="VisVisitorRegister" id="VisVisitorRegisterResult">
<result property="id" column="id" />
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
<result property="phone" column="phone" />
<result property="openid" column="openid" />
<result property="deleteState" column="delete_state" />
<result property="createdBy" column="created_by" />
<result property="createdTime" column="created_time" />
<result property="updatedBy" column="updated_by" />
<result property="updatedTime" column="updated_time" />
</resultMap>
<sql id="selectVisVisitorRegisterVo">
select id, user_name, nick_name, phone, openid, delete_state, created_by, created_time, updated_by, updated_time from vis_visitor_register
</sql>
<select id="selectVisVisitorRegisterList" parameterType="VisVisitorRegister" resultMap="VisVisitorRegisterResult">
<include refid="selectVisVisitorRegisterVo"/>
<where>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="openid != null and openid != ''"> and openid = #{openid}</if>
<if test="deleteState != null and deleteState != ''"> and delete_state = #{deleteState}</if>
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
<if test="createdTime != null "> and created_time = #{createdTime}</if>
<if test="updatedBy != null and updatedBy != ''"> and updated_by = #{updatedBy}</if>
<if test="updatedTime != null "> and updated_time = #{updatedTime}</if>
</where>
</select>
<select id="selectVisVisitorRegisterById" parameterType="String" resultMap="VisVisitorRegisterResult">
<include refid="selectVisVisitorRegisterVo"/>
where id = #{id}
</select>
<insert id="insertVisVisitorRegister" parameterType="VisVisitorRegister">
insert into vis_visitor_register
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="userName != null">user_name,</if>
<if test="nickName != null">nick_name,</if>
<if test="phone != null">phone,</if>
<if test="openid != null">openid,</if>
<if test="deleteState != null">delete_state,</if>
<if test="createdBy != null">created_by,</if>
<if test="createdTime != null">created_time,</if>
<if test="updatedBy != null">updated_by,</if>
<if test="updatedTime != null">updated_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="userName != null">#{userName},</if>
<if test="nickName != null">#{nickName},</if>
<if test="phone != null">#{phone},</if>
<if test="openid != null">#{openid},</if>
<if test="deleteState != null">#{deleteState},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="createdTime != null">#{createdTime},</if>
<if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedTime != null">#{updatedTime},</if>
</trim>
</insert>
<update id="updateVisVisitorRegister" parameterType="VisVisitorRegister">
update vis_visitor_register
<trim prefix="SET" suffixOverrides=",">
<if test="userName != null">user_name = #{userName},</if>
<if test="nickName != null">nick_name = #{nickName},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="openid != null">openid = #{openid},</if>
<if test="deleteState != null">delete_state = #{deleteState},</if>
<if test="createdBy != null">created_by = #{createdBy},</if>
<if test="createdTime != null">created_time = #{createdTime},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteVisVisitorRegisterById" parameterType="String">
delete from vis_visitor_register where id = #{id}
</delete>
<delete id="deleteVisVisitorRegisterByIds" parameterType="String">
delete from vis_visitor_register where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="saveVisitorRegister">
insert into vis_visitor_register (id, user_name, nick_name, phone, openid)
values (#{visitorRegisterId}, #{name}, #{name}, #{phone}, #{openid})
</insert>
<update id="updateVisitorRegisterByOpenid">
update vis_visitor_register set openid = #{openid} where user_name = #{name} and phone = #{phone}
</update>
<select id="queryVisitorRegister" resultType="java.lang.String">
select id from vis_visitor_register where user_name = #{name} and phone = #{phone}
</select>
</mapper>

View File

@@ -0,0 +1,811 @@
<?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.dcsoft.system.visitor.mapper.VisitorMapper">
<resultMap type="Visitor" id="VisitorResult">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="phone" column="phone"/>
<result property="sex" column="sex"/>
<result property="avatar" column="avatar"/>
<result property="idcard" column="idcard"/>
<result property="carNo" column="car_no"/>
<result property="userId" column="user_id"/>
<result property="deptId" column="dept_id"/>
<result property="flag" column="flag"/>
<result property="startTime" column="start_time"/>
<result property="endTime" column="end_time"/>
<result property="matter" column="matter"/>
<result property="res" column="res"/>
<result property="guid" column="guid"/>
<result property="faceGuid" column="face_guid"/>
<result property="remark" column="remark"/>
<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="parentId" column="parent_id"/>
<result property="inTime" column="in_time"/>
<result property="outTime" column="out_time"/>
<result property="peopleName" column="people_name"/>
<result property="peoplePhone" column="people_phone"/>
<result property="source" column="source"/>
<result property="driver" column="driver"/>
<result property="transportPermit" column="transport_permit"/>
<result property="security" column="security"/>
<result property="position" column="position"/>
<result property="visitorPosition" column="visitorPosition"/>
<result property="visitingUnit" column="visiting_unit"/>
<result property="reviewer2" column="reviewer2"/>
<result property="reviewer3" column="reviewer3"/>
<association property="branch" column="dept_id" javaType="SysBranch" resultMap="branchResult"/>
<association property="people" column="user_id" javaType="SysPeople" resultMap="peopleResult"/>
<association property="examine" column="id" javaType="VisVisitorExamine" resultMap="examineResult"/>
</resultMap>
<resultMap id="examineResult" type="VisVisitorExamine">
<id property="visitorId" column="id"/>
<result property="admittanceStart" column="admittance_start"/>
<result property="admittanceEnd" column="admittance_end"/>
<result property="pointId" column="point_id"/>
<result property="examine" column="examine"/>
<result property="createBy" column="examine_name"/>
</resultMap>
<resultMap id="branchResult" type="SysBranch">
<id property="id" column="dept_id"/>
<result property="name" column="branch_name"/>
</resultMap>
<resultMap id="peopleResult" type="SysPeople">
<id property="id" column="user_id"/>
<result property="name" column="people_name"/>
</resultMap>
<sql id="selectVisitorVo">
select distinct
vv.id,
vv.name,
vv.phone,
vv.sex,
vv.avatar,
vv.idcard,
vv.car_no,
vv.user_id,
vv.dept_id,
vv.flag,
vv.start_time,
vv.end_time,
vv.matter,
vv.res,
vv.guid,
vv.face_guid,
vv.remark,
vv.create_by,
vv.create_time,
vv.update_by,
vv.parent_id,
vv.update_time,
vve.admittance_start,
vve.admittance_end,
vve.point_id,
sb.name branch_name,
if(sp.name is not null, sp.name, vv.user_name) people_name,
vve.examine,
vv.in_time,
vv.out_time,
vve.create_by examine_name,
sp.phone people_phone,
vv.source,
sp.position,
vv.position visitorPosition,
vv.visiting_unit,
vv.reviewer2,
vv.reviewer3
from vis_visitor vv
left join vis_visitor_examine vve on vv.id = vve.visitor_id
left join sys_branch sb on vv.dept_id = sb.id
left join sys_people sp on vv.user_id = sp.id
left join sys_dept d on d.dept_id = sb.dept_id
left join sys_user u on u.user_id = sp.user_id
left join vis_visitor_audit_records vvar on vvar.visitor_id = vv.id
</sql>
<select id="selectVisitorList" parameterType="Visitor" resultMap="VisitorResult">
<include refid="selectVisitorVo"/>
<where>
and vv.parent_id is null
<if test="name != null and name != ''">and vv.name like concat('%', #{name}, '%')</if>
<if test="phone != null and phone != ''">and vv.phone like concat('%', #{phone}, '%')</if>
<if test="tabFlag == null or tabFlag == ''">
<if test="peoplePhone != null and peoplePhone != ''">
and (sp.phone in
<foreach collection="peoplePhone.split(',')" item="item" index="index" open="(" separator="," close=")"> #{item} </foreach>
or vv.phone = #{peoplePhone})
</if>
</if>
<if test="tabFlag != null and tabFlag != ''">
<if test="peoplePhone != null and peoplePhone != ''">
and sp.phone in
<foreach collection="peoplePhone.split(',')" item="item" index="index" open="(" separator="," close=")"> #{item} </foreach>
</if>
</if>
<if test="sex != null and sex != ''">and vv.sex = #{sex}</if>
<if test="avatar != null and avatar != ''">and vv.avatar = #{avatar}</if>
<if test="userId != null ">and vv.user_id = #{userId}</if>
<if test="deptId != null ">and vv.dept_id = #{deptId}</if>
<if test="startTime != null ">and date_format(vv.start_time, '%Y-%m-%d') = date_format(#{startTime},
'%Y-%m-%d')
</if>
<if test="peoplePhone != null and peoplePhone != '' and position == null">
<if test="tabFlag == 'wsh' ">
and vvar.id is null
</if>
<if test="tabFlag == 'ysh' ">
and vvar.id is not null
</if>
</if>
<if test="peoplePhone == null or peoplePhone == '' or position != null">
<if test="tabFlag == 'wsh' ">
and vve.id is null
</if>
<if test="tabFlag == 'ysh' ">
and vve.id is not null
</if>
</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</where>
union all
select distinct vv1.id,
vv1.name,
vv1.phone,
vv1.sex,
vv1.avatar,
vv1.idcard,
vv1.car_no,
vv1.user_id,
vv1.dept_id,
vv1.flag,
vv1.start_time,
vv1.end_time,
vv1.matter,
vv1.res,
vv1.guid,
vv1.face_guid,
vv1.remark,
vv1.create_by,
vv1.create_time,
vv1.update_by,
vv1.parent_id,
vv1.update_time,
vve.admittance_start,
vve.admittance_end,
vve.point_id,
sb.name branch_name,
if(sp.name is not null, sp.name, vv1.user_name) people_name,
vve.examine,
vv1.in_time,
vv1.out_time,
vve.create_by examine_name,
sp.phone people_phone,
vv1.source,
sp.position,
vv1.position visitorPosition,
vv1.visiting_unit visitingUnit,
vv1.reviewer2,
vv1.reviewer3
from vis_visitor_review_process vvrp
left join vis_visitor vv1 on vv1.id = vvrp.visitor_id
left join sys_people s on vvrp.reviewer = s.id
left join vis_visitor_examine vve on vv1.id = vve.visitor_id
left join sys_branch sb on vv1.dept_id = sb.id
left join sys_people sp on vv1.user_id = sp.id
left join vis_visitor_audit_records vvar on vvar.next_step_reviewer = vvrp.reviewer and vvar.visitor_id = vvrp.visitor_id
where 1=1
and vv1.id is not null
<if test="nextStepReviewer != null and nextStepReviewer != ''">
and vvar.next_step_reviewer in
<foreach collection="nextStepReviewer.split(',')" item="item" index="index" open="(" separator="," close=")"> #{item} </foreach>
</if>
<choose>
<when test="peoplePhone != null and peoplePhone != '' and tabFlag != null">
and s.phone in
<foreach collection="peoplePhone.split(',')" item="item" index="index" open="(" separator="," close=")"> #{item} </foreach>
</when>
<otherwise>
and sp.phone = #{peoplePhone}
</otherwise>
</choose>
<if test="peoplePhone != null and peoplePhone != '' and position == null">
<if test="tabFlag != null and tabFlag != ''">
<if test="tabFlag == 'wsh' ">
and vvrp.state is null
</if>
<if test="tabFlag == 'ysh' ">
and vvrp.state is not null
</if>
</if>
</if>
<if test="peoplePhone == null or peoplePhone == '' or position != null">
<if test="tabFlag == 'wsh' ">
and vve.id is null
</if>
<if test="tabFlag == 'ysh' ">
and vve.id is not null
</if>
</if>
order by create_time desc
</select>
<select id="selectVisitorItemList" parameterType="Visitor" resultMap="VisitorResult">
<include refid="selectVisitorVo"/>
<where>
<if test="parentId != null ">and vv.parent_id = #{parentId}</if>
</where>
</select>
<select id="selectVisitorById" parameterType="Long" resultMap="VisitorResult">
<include refid="selectVisitorVo"/>
where vv.id = #{id}
</select>
<insert id="insertVisitor" parameterType="Visitor" useGeneratedKeys="true" keyProperty="id">
insert into vis_visitor
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">id,</if>
<if test="name != null and name != ''">name,</if>
<if test="phone != null">phone,</if>
<if test="sex != null">sex,</if>
<if test="avatar != null">avatar,</if>
<if test="idcard != null">idcard,</if>
<if test="carNo != null">car_no,</if>
<if test="userId != null">user_id,</if>
<if test="deptId != null">dept_id,</if>
<if test="flag != null">flag,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
<if test="matter != null">matter,</if>
<if test="res != null">res,</if>
<if test="guid != null">guid,</if>
<if test="faceGuid != null">face_guid,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="parentId != null">parent_id,</if>
<if test="inTime != null">in_time,</if>
<if test="outTime != null">out_time,</if>
<if test="source != null">source,</if>
<if test="idCardStartTime != null">id_card_start_time,</if>
<if test="idCardEndTime != null">id_card_end_time,</if>
<if test="idCardAddress != null">id_card_address,</if>
<if test="visitingUnit != null">visiting_unit,</if>
<if test="userName != null">user_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null and id != ''">#{id},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="phone != null">#{phone},</if>
<if test="sex != null">#{sex},</if>
<if test="avatar != null">#{avatar},</if>
<if test="idcard != null">#{idcard},</if>
<if test="carNo != null">#{carNo},</if>
<if test="userId != null">#{userId},</if>
<if test="deptId != null">#{deptId},</if>
<if test="flag != null">#{flag},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="matter != null">#{matter},</if>
<if test="res != null">#{res},</if>
<if test="guid != null">#{guid},</if>
<if test="faceGuid != null">#{faceGuid},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="parentId != null">#{parentId},</if>
<if test="inTime != null">#{inTime},</if>
<if test="outTime != null">#{outTime},</if>
<if test="source != null">#{source},</if>
<if test="idCardStartTime != null">#{idCardStartTime},</if>
<if test="idCardEndTime != null">#{idCardEndTime},</if>
<if test="idCardAddress != null">#{idCardAddress},</if>
<if test="visitingUnit != null">#{visitingUnit},</if>
<if test="userName != null">#{userName},</if>
</trim>
</insert>
<insert id="saveVisCheckCode">
insert into vis_check_code (id, code, start_time, end_time, visitor_id)
VALUES (#{id}, #{code}, #{startTime}, #{endTime}, #{visitorId})
</insert>
<insert id="saveVisitorRecord">
insert into vis_visitor_record (id, visitor_id, sequence, start_time)
VALUES (REPLACE(uuid(), '-', ''), #{visitorId}, #{sequence}, #{startTime})
</insert>
<insert id="saveVisitorAuditRecords">
insert into vis_visitor_audit_records (id, visitor_id, reviewer, state, next_step_reviewer)
VALUES (REPLACE(uuid(), '-', ''), #{id}, #{reviewer}, #{state}, #{nextStepReviewer})
</insert>
<insert id="saveFile">
insert into sys_file (id, business_id, business_type, url, file_name) VALUES
<foreach collection="list" item="i" index="index" separator=",">
(
#{i.id},
#{i.businessId},
#{i.businessType},
#{i.url},
#{i.fileName}
)
</foreach>
</insert>
<insert id="saveVisitorReviewProcess">
insert into vis_visitor_review_process (id, visitor_id, reviewer, type)
VALUES (REPLACE(uuid(), '-', ''), #{id}, #{reviewer}, #{type})
</insert>
<update id="updateVisitor" parameterType="Visitor">
update vis_visitor
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="avatar != null">avatar = #{avatar},</if>
<if test="idcard != null">idcard = #{idcard},</if>
<if test="carNo != null">car_no = #{carNo},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="flag != null">flag = #{flag},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="matter != null">matter = #{matter},</if>
<if test="res != null">res = #{res},</if>
<if test="guid != null">guid = #{guid},</if>
<if test="faceGuid != null">face_guid = #{faceGuid},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="inTime != null">in_time = #{inTime},</if>
<if test="outTime != null">out_time = #{outTime},</if>
<if test="type != null">type = #{type},</if>
<if test="idCardStartTime != null">id_card_start_time = #{idCardStartTime},</if>
<if test="idCardEndTime != null">id_card_end_time = #{idCardEndTime},</if>
<if test="idCardAddress != null">id_card_address = #{idCardAddress},</if>
<if test="visitingUnit != null">visiting_unit = #{visitingUnit},</if>
<if test="userName != null">user_name = #{userName},</if>
<if test="visitorPosition != null">position = #{visitorPosition},</if>
<if test="reviewer2 != null">reviewer2 = #{reviewer2},</if>
<if test="reviewer3 != null">reviewer3 = #{reviewer3},</if>
</trim>
where id = #{id}
</update>
<update id="updateVisitorPushType">
update vis_visitor
set push_type = '1'
where 1=1
and id in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item.id}
</foreach>
</update>
<update id="updateVisitorInfo">
update vis_visitor
<trim prefix="SET" suffixOverrides=",">
<if test="inTime != null">in_time = #{inTime},</if>
<if test="outTime != null">out_time = #{outTime},</if>
<if test="type != null">type = #{type},</if>
</trim>
where idcard = #{idcard}
and date_format(create_time, '%Y-%m-%d') = date_format(now(), '%Y-%m-%d')
</update>
<update id="updateVisitorInfoGuid">
UPDATE vis_visitor
<trim prefix="set" suffixOverrides=",">
<trim prefix="guid =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="null != item.guid">
WHEN ID=#{item.id} THEN #{item.guid}
</if>
</foreach>
</trim>
<trim prefix="face_guid =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="null != item.faceGuid">
WHEN ID=#{item.id} THEN #{item.faceGuid}
</if>
</foreach>
</trim>
</trim>
WHERE
ID IN
<foreach collection="list" index="index" item="item" separator="," open="(" close=")">
#{item.id}
</foreach>
</update>
<update id="updateVisitorRecord">
update vis_visitor_record
set end_time = #{endTime}
where visitor_id = #{visitorId}
</update>
<update id="updateDisconnect">
update vis_visitor
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="avatar != null">avatar = #{avatar},</if>
<if test="idcard != null">idcard = #{idcard},</if>
<if test="carNo != null">car_no = #{carNo},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="flag != null">flag = #{flag},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="matter != null">matter = #{matter},</if>
<if test="res != null">res = #{res},</if>
<if test="guid != null">guid = #{guid},</if>
<if test="faceGuid != null">face_guid = #{faceGuid},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="inTime != null">in_time = #{inTime},</if>
<if test="outTime != null">out_time = #{outTime},</if>
<if test="type != null">type = #{type},</if>
<if test="idCardStartTime != null">id_card_start_time = #{idCardStartTime},</if>
<if test="idCardEndTime != null">id_card_end_time = #{idCardEndTime},</if>
<if test="idCardAddress != null">id_card_address = #{idCardAddress},</if>
<if test="visitingUnit != null">visiting_unit = #{visitingUnit},</if>
<if test="userName != null">user_name = #{userName},</if>
</trim>
where idcard = #{idcard} and out_time is null
</update>
<update id="updateVisitorReviewProcess">
update vis_visitor_review_process
set state = #{state}
where visitor_id = #{id}
<if test="reviewer != null and reviewer != ''">
and reviewer = #{reviewer}
</if>
</update>
<delete id="deleteVisitorById" parameterType="Long">
delete
from vis_visitor
where id = #{id}
</delete>
<delete id="deleteVisitorByIds" parameterType="String">
delete from vis_visitor where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteVisitorItemByParentId" parameterType="Long">
delete
from vis_visitor
where parent_id = #{parentId}
</delete>
<delete id="deleteVisitorRecordList">
update vis_visitor_record set delete_state = '1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteFile">
delete from sys_file where business_id = #{businessId} and business_type = #{businessType}
</delete>
<select id="selectByGuid" parameterType="String" resultMap="VisitorResult">
<include refid="selectVisitorVo"/>
where vv.guid = #{guid}
</select>
<select id="selectVisitorByPhone" parameterType="String" resultMap="VisitorResult">
<include refid="selectVisitorVo"/>
where vv.phone = #{phone} LIMIT 1
</select>
<select id="queryVisitorInfo" resultType="com.dcsoft.system.visitor.domain.Visitor">
select tler.rule_id ladderRuleId, start_time startTime, end_time endTime
from vis_visitor vv
left join sys_people sp on vv.user_id = sp.id
left join t_ladder_empower_record tler on tler.people_id = sp.id
where tler.delete_state = '0'
and sp.del_flag = '0'
and tler.status = '0'
and tler.info_down = '0'
and tler.serial_number = #{sequence}
and tler.people_id = #{id}
</select>
<select id="selectVisitorInfo" resultType="com.dcsoft.system.visitor.domain.Visitor">
select tler.rule_id ladderRuleId, start_time startTime, end_time endTime
from vis_visitor vv
left join sys_people sp on vv.user_id = sp.id
left join t_ladder_empower_record tler on tler.people_id = sp.id
where tler.delete_state = '0'
and sp.del_flag = '0'
and tler.status = '0'
and tler.info_down = '0'
and tler.serial_number = #{sequence}
and vv.id = #{id}
</select>
<select id="queryVisitorAppointment" resultType="com.dcsoft.system.visitor.domain.Visitor">
select
date_format(vv.in_time, '%Y-%m-%d %H:%i:%s') inTime,
date_format(vv.out_time, '%Y-%m-%d %H:%i:%s') outTime,
case
when vv.in_time is not null THEN '2'
when vve.id is null THEN '0'
when vve.id is not null THEN '1'
END state,
vv.id,
vv.avatar,
vv.name,
vv.phone,
vv.sex,
vv.idcard,
vv.car_no carNo,
vv.flag,
vv.dept_id deptId,
vv.user_id userId,
date_format(vv.start_time, '%Y-%m-%d %H:%i:%s') startTime,
date_format(vv.end_time, '%Y-%m-%d %H:%i:%s') endTime,
vv.matter,
vv.res,
vv.remark,
ifnull(vv.type, 0) type,
id_card_start_time idCardStartTime,
id_card_end_time id_cardEndTime,
id_card_address idCardAddress
from vis_visitor vv
left join vis_visitor_examine vve on vv.id = vve.visitor_id
where date_format(vv.create_time, '%Y-%m-%d') = date_format(now(), '%Y-%m-%d')
and vv.out_time is null
and vv.parent_id is null
<if test="idcard != null and idcard != ''">
and vv.idcard like concat('%', #{idcard}, '%')
</if>
<if test="name != null and name != ''">
and (vv.name like concat('%', #{name}, '%') or vv.phone like concat('%', #{name}, '%'))
</if>
order by vv.create_time desc, id desc
</select>
<select id="queryVisitor" resultType="java.lang.Integer">
select count(1)
from vis_visitor
where idcard = #{idcard}
and out_time is null
</select>
<select id="queryVisitorInfoById" resultType="com.dcsoft.system.visitor.domain.PersonnelInfoVo">
select idcard
from vis_visitor
where id = #{id}
</select>
<select id="queryVisitorUnsigned" resultType="com.dcsoft.system.visitor.domain.Visitor">
select id, name, phone, idcard
from vis_visitor
where 1 = 1
and out_time is null
and in_time is not null
order by create_time desc
</select>
<select id="queryVisCheckCodeById" resultType="com.dcsoft.system.visitor.domain.CheckCodeVo">
select id, code, start_time startTime, end_time endTime
from vis_check_code
where id = #{id}
limit 1
</select>
<select id="queryVisCheckCode" resultType="java.lang.String">
select id
from vis_check_code
where visitor_id = #{visitorId}
limit 1
</select>
<select id="querySysManageRecord" resultType="com.dcsoft.system.domain.SysManageRecord">
select any_value(id) id,
any_value(people_id) peopleId,
rule_id ruleId
from sys_empower_record
where people_id = #{userId}
group by rule_id
</select>
<select id="queryVisitorGuid" resultType="com.dcsoft.system.visitor.domain.Visitor">
select guid, id
from vis_visitor
where guid = #{guid}
limit 1
</select>
<select id="queryVisitorRecord" resultType="java.lang.Integer">
select count(1)
from vis_visitor_record
where visitor_id = #{id}
and start_time is not null
</select>
<select id="queryVisitorRecordList" resultType="com.dcsoft.system.visitor.domain.VisitorRecordVo">
select vv.name,
vvr.sequence,
sp.name peopleName,
vvr.start_time startTime,
vvr.end_time endTime,
vvr.id
from vis_visitor_record vvr
left join vis_visitor vv on vvr.visitor_id = vv.id
left join sys_people sp on sp.id = vv.user_id and sp.del_flag = '0'
where vvr.delete_state = '0'
<if test="name != null and name != ''">
and vv.name like concat('%', #{name}, '%')
</if>
<if test="startTimeTxt != null and startTimeTxt != ''">
and date_format(vv.start_time, '%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> date_format(#{startTimeTxt}, '%Y-%m-%d
%H:%i:%s')
</if>
<if test="endTimeTxt != null and endTimeTxt != ''">
and date_format(vv.end_time, '%Y-%m-%d %H:%i:%s') >= date_format(#{endTimeTxt}, '%Y-%m-%d %H:%i:%s')
</if>
order by vvr.created_time desc
</select>
<select id="querySysBranch" resultType="com.dcsoft.system.domain.SysBranch">
SELECT
ID.LEVEL,
DATA.id,
DATA.name
FROM
(
SELECT
@ids AS _ids,
( SELECT @ids := GROUP_CONCAT( id ) FROM sys_branch WHERE FIND_IN_SET( parent_id, @ids ) ) AS cids,
@l := @l + 1 AS LEVEL
FROM
sys_branch,
( SELECT @ids := #{deptType}, @l := 0 ) b
WHERE
@ids IS NOT NULL
) ID,
sys_branch DATA
WHERE
FIND_IN_SET( DATA.id, ID._ids )
ORDER BY
LEVEL,
id
</select>
<select id="queryVisitorDayCount" resultType="java.lang.Integer">
select count(1)
from vis_visitor
where dept_id = #{type}
and type = '2'
and date_format(now(), '%Y-%m-%d') = date_format(update_time, '%Y-%m-%d')
</select>
<select id="queryVisitorWeekCount" resultType="java.lang.Integer">
select count(1)
from vis_visitor
where dept_id = #{type}
and type = '2'
and date_format(now(), '%Y-%v') = date_format(update_time, '%Y-%v')
</select>
<select id="queryVisitorMonthCount" resultType="java.lang.Integer">
select count(1)
from vis_visitor
where dept_id = #{type}
and type = '2'
and date_format(now(), '%Y-%m') = date_format(update_time, '%Y-%m')
</select>
<select id="queryVisitorAvatar" resultType="com.dcsoft.system.visitor.domain.VisitorRecordVo">
select avatar visitorAvatar
from vis_visitor
where type = '2'
order by update_time desc
limit 10
</select>
<select id="queryVisitorById" resultType="com.dcsoft.system.visitor.domain.VisitorRecordVo">
select vv.id, vv.start_time startTime, vv.end_time endTime
from vis_visitor vv
left join vis_visitor_examine vve on vv.id = vve.visitor_id
left join vis_check_code vcc on vv.id = vcc.visitor_id
where vve.id is not null
and vcc.id is not null
and vv.out_time is null
and vv.phone = #{phone}
limit 1
</select>
<select id="queryVisitorByIdCount" resultType="java.lang.Integer">
select count(1)
from vis_visitor
where phone = #{phone}
and out_time is null
</select>
<select id="queryExportVisitorInfo" resultType="com.dcsoft.system.visitor.domain.Visitor">
select vv.name, vv.phone, vv.start_time startTime, vv.end_time endTime, sp.name userName, vv.matter
from vis_visitor vv
left join sys_people sp on vv.user_id = sp.id and sp.del_flag = '0'
where 1 = 1
and date_format(vv.create_time, '%Y-%m-%d') >= date_format(DATE_SUB(CURDATE(), INTERVAL 6 DAY), '%Y-%m-%d')
and date_format(vv.create_time, '%Y-%m-%d') <![CDATA[ <= ]]> date_format(now(), '%Y-%m-%d')
</select>
<select id="queryBranch" resultType="java.lang.String">
select b.id
from sys_branch b
left join sys_dept d on b.dept_id = d.dept_id
where b.rule_id is not null
and b.rule_id != '10'
</select>
<select id="queryBranch1" resultType="java.lang.String">
select GROUP_CONCAT(sb.name)
from (WITH RECURSIVE parents_cte (id, parent_id) AS (SELECT id, parent_id
FROM sys_branch
WHERE id in (#{s})-- 子机id替换问号
UNION ALL
SELECT p.id, p.parent_id
FROM sys_branch p
INNER JOIN parents_cte ON parents_cte.parent_id = p.id)
SELECT id y, #{s} j
FROM parents_cte) t
left join sys_branch sb on t.y = sb.id
group by t.j
</select>
<select id="queryPropertyExaminePeople" resultType="com.dcsoft.system.domain.SysPeople">
select sp.name, sp.id, sp.phone
from sys_people sp
left join sys_branch sb on sp.branch_id = sb.id
where sp.del_flag = '0'
and sb.parent_id = #{deptId}
</select>
<select id="querySysFile" resultType="com.dcsoft.system.domain.vo.SysFileVo">
select url, file_name fileName from sys_file where business_id = #{businessId} and business_type = #{businessType}
</select>
<select id="queryVisitorReviewProcess" resultType="com.dcsoft.system.domain.SysPeople">
select sp.phone, sp.id
from vis_visitor_audit_records vvar
left join sys_people sp on vvar.next_step_reviewer = sp.id
where sp.del_flag = '0'
and vvar.visitor_id = #{id}
order by vvar.created_time desc
limit 1
</select>
<select id="queryReviewProcess" resultType="java.lang.String">
select reviewer from vis_visitor_review_process where visitor_id = #{id} and type = #{position}
</select>
<select id="queryVisitorReviewProcessCount" resultType="java.lang.Integer">
select sum(if(state is null, 1, 0)) state from vis_visitor_review_process where visitor_id = #{id} group by visitor_id
</select>
<select id="queryVisitorReviewProcessList"
resultType="com.dcsoft.system.visitor.domain.VisitorReviewProcessVo">
select reviewer,
state,
sp.position type,
date_format(updated_time, '%Y-%m-%d %H:%i:%s') createdTime,
sp.name reviewerName
from vis_visitor_review_process vvrp
left join sys_people sp on vvrp.reviewer = sp.id and sp.del_flag = '0'
where visitor_id = #{id}
union all
select reviewer,
state,
sp.position type,
date_format(created_time, '%Y-%m-%d %H:%i:%s') createdTime,
sp.name reviewerName
from vis_visitor_audit_records vvar
left join sys_people sp on vvar.reviewer = sp.id and sp.del_flag = '0'
left join vis_visitor vv on vvar.visitor_id = vv.id
where visitor_id = #{id} and vvar.reviewer = vv.user_id
order by ifnull(createdTime, 'zzz')
</select>
</mapper>

View File

@@ -0,0 +1,75 @@
<?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.dcsoft.system.vehicle.mapper.CarChargeItemMapper">
<resultMap type="CarChargeItem" id="CarChargeItemResult">
<result property="id" column="id" />
<result property="chargeId" column="charge_id" />
<result property="startLong" column="start_long" />
<result property="endLong" column="end_long" />
<result property="chargeMoney" column="charge_money" />
</resultMap>
<sql id="selectCarChargeItemVo">
select id, charge_id, start_long, end_long, charge_money from car_charge_item
</sql>
<select id="selectCarChargeItemList" parameterType="CarChargeItem" resultMap="CarChargeItemResult">
<include refid="selectCarChargeItemVo"/>
<where>
<if test="chargeId != null "> and charge_id = #{chargeId}</if>
<if test="startLong != null "> and start_long = #{startLong}</if>
<if test="endLong != null "> and end_long = #{endLong}</if>
<if test="chargeMoney != null "> and charge_money = #{chargeMoney}</if>
</where>
</select>
<select id="selectCarChargeItemById" parameterType="Long" resultMap="CarChargeItemResult">
<include refid="selectCarChargeItemVo"/>
where id = #{id}
</select>
<insert id="insertCarChargeItem" parameterType="CarChargeItem" useGeneratedKeys="true" keyProperty="id">
insert into car_charge_item
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="chargeId != null">charge_id,</if>
<if test="startLong != null">start_long,</if>
<if test="endLong != null">end_long,</if>
<if test="chargeMoney != null">charge_money,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="chargeId != null">#{chargeId},</if>
<if test="startLong != null">#{startLong},</if>
<if test="endLong != null">#{endLong},</if>
<if test="chargeMoney != null">#{chargeMoney},</if>
</trim>
</insert>
<update id="updateCarChargeItem" parameterType="CarChargeItem">
update car_charge_item
<trim prefix="SET" suffixOverrides=",">
<if test="chargeId != null">charge_id = #{chargeId},</if>
<if test="startLong != null">start_long = #{startLong},</if>
<if test="endLong != null">end_long = #{endLong},</if>
<if test="chargeMoney != null">charge_money = #{chargeMoney},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCarChargeItemById" parameterType="Long">
delete from car_charge_item where id = #{id}
</delete>
<delete id="deleteCarChargeItemByIds" parameterType="String">
delete from car_charge_item where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteChargeItemByChargeId" parameterType="Long">
delete from car_charge_item where charge_id = #{id}
</delete>
</mapper>

View File

@@ -0,0 +1,102 @@
<?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.dcsoft.system.vehicle.mapper.CarChargeMapper">
<resultMap type="CarCharge" id="CarChargeResult">
<result property="id" column="id" />
<result property="parkId" column="park_id" />
<result property="parkName" column="park_name" />
<result property="name" column="name" />
<result property="type" column="type" />
<result property="timeLong" column="time_long" />
<result property="chargeMoney" column="charge_money" />
<result property="status" column="status" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectCarChargeVo">
select cc.id, cc.park_id, cc.name, cc.type, cc.time_long, cc.charge_money, cc.status, cc.remark, cc.create_by,
cc.create_time, cc.update_by, cc.update_time ,cp.name park_name
from car_charge cc
left join car_park cp on cc.park_id=cp.id
</sql>
<select id="selectCarChargeList" parameterType="CarCharge" resultMap="CarChargeResult">
<include refid="selectCarChargeVo"/>
<where>
<if test="parkId != null "> and cc.park_id = #{parkId}</if>
<if test="name != null and name != ''"> and cc.name like concat('%', #{name}, '%')</if>
<if test="status != null and status != ''"> and cc.status = #{status}</if>
</where>
</select>
<select id="selectCarChargeById" parameterType="Long" resultMap="CarChargeResult">
<include refid="selectCarChargeVo"/>
where cc.id = #{id}
</select>
<insert id="insertCarCharge" parameterType="CarCharge" useGeneratedKeys="true" keyProperty="id">
insert into car_charge
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parkId != null">park_id,</if>
<if test="name != null">name,</if>
<if test="type != null">type,</if>
<if test="timeLong != null">time_long,</if>
<if test="chargeMoney != null">charge_money,</if>
<if test="status != null">status,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parkId != null">#{parkId},</if>
<if test="name != null">#{name},</if>
<if test="type != null">#{type},</if>
<if test="timeLong != null">#{timeLong},</if>
<if test="chargeMoney != null">#{chargeMoney},</if>
<if test="status != null">#{status},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateCarCharge" parameterType="CarCharge">
update car_charge
<trim prefix="SET" suffixOverrides=",">
<if test="parkId != null">park_id = #{parkId},</if>
<if test="name != null">name = #{name},</if>
<if test="type != null">type = #{type},</if>
<if test="timeLong != null">time_long = #{timeLong},</if>
<if test="chargeMoney != null">charge_money = #{chargeMoney},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCarChargeById" parameterType="Long">
delete from car_charge where id = #{id}
</delete>
<delete id="deleteCarChargeByIds" parameterType="String">
delete from car_charge where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,166 @@
<?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.dcsoft.system.vehicle.mapper.CarInfoMapper">
<resultMap type="CarInfo" id="CarInfoResult">
<result property="customerId" column="customer_id" />
<result property="enableTime" column="enable_time" />
<result property="overdueTime" column="overdue_time" />
<result property="enable" column="enable" />
<result property="plate" column="plate" />
<result property="timeSegEnable" column="time_seg_enable" />
<result property="segTime" column="seg_time" />
<result property="needAlarm" column="need_alarm" />
<result property="vehicleCode" column="vehicle_code" />
<result property="vehicleComment" column="vehicle_comment" />
<result property="peopleId" column="people_id" />
<result property="delFlag" column="del_flag" />
<result property="sync" column="sync" />
<result property="remark" column="remark" />
<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="parkId" column="park_id" />
<result property="peopleName" column="people_name" />
<result property="parkName" column="park_name" />
<result property="num" column="num" />
<result property="carType" column="car_type" />
<result property="unit" column="unit" />
<result property="phone" column="phone" />
</resultMap>
<sql id="selectCarInfoVo">
select ci.customer_id, ci.enable_time, ci.overdue_time, ci.enable, ci.plate, ci.time_seg_enable, ci.seg_time, ci.need_alarm,
ci.vehicle_code, ci.vehicle_comment, ci.people_id, ci.del_flag, ci.sync, ci.remark,
ci.create_by, ci.create_time, ci.update_by, ci.update_time,ci.park_id, cp.name park_name,p.name people_name,
ci.num,ci.car_type,ci.unit,ci.phone
from car_info ci
left join car_park cp on ci.park_id=cp.id
left join sys_people p on ci.people_id=p.id
</sql>
<select id="selectCarInfoList" parameterType="CarInfo" resultMap="CarInfoResult">
<include refid="selectCarInfoVo"/>
<where>
1=1 and ci.del_flag=0
<if test="enableTime != null "> and ci.enable_time = #{enableTime}</if>
<if test="overdueTime != null "> and ci.overdue_time = #{overdueTime}</if>
<if test="enable != null and enable != ''"> and ci.enable = #{enable}</if>
<if test="plate != null and plate != ''"> and ci.plate like concat('%', #{plate}, '%') </if>
<if test="peopleId != null "> and ci.people_id = #{peopleId}</if>
<if test="peopleName != null "> and p.name = #{peopleName}</if>
<if test="unit != null "> and ci.unit = #{unit}</if>
</where>
</select>
<select id="selectCarInfoByCustomerId" parameterType="Long" resultMap="CarInfoResult">
<include refid="selectCarInfoVo"/>
where ci.customer_id = #{customerId}
</select>
<insert id="insertCarInfo" parameterType="CarInfo" useGeneratedKeys="true" keyProperty="customerId">
insert into car_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerId != null">customer_id,</if>
<if test="enableTime != null">enable_time,</if>
<if test="overdueTime != null">overdue_time,</if>
<if test="enable != null">enable,</if>
<if test="plate != null and plate != ''">plate,</if>
<if test="timeSegEnable != null and timeSegEnable != ''">time_seg_enable,</if>
<if test="segTime != null">seg_time,</if>
<if test="needAlarm != null">need_alarm,</if>
<if test="vehicleCode != null">vehicle_code,</if>
<if test="vehicleComment != null">vehicle_comment,</if>
<if test="peopleId != null">people_id,</if>
<if test="delFlag != null">del_flag,</if>
<if test="sync != null">sync,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="parkId != null">park_id,</if>
<if test="num != null">num,</if>
<if test="carType != null">car_type,</if>
<if test="unit != null">unit,</if>
<if test="phone != null">phone,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="customerId != null">#{customerId},</if>
<if test="enableTime != null">#{enableTime},</if>
<if test="overdueTime != null">#{overdueTime},</if>
<if test="enable != null">#{enable},</if>
<if test="plate != null and plate != ''">#{plate},</if>
<if test="timeSegEnable != null and timeSegEnable != ''">#{timeSegEnable},</if>
<if test="segTime != null">#{segTime},</if>
<if test="needAlarm != null">#{needAlarm},</if>
<if test="vehicleCode != null">#{vehicleCode},</if>
<if test="vehicleComment != null">#{vehicleComment},</if>
<if test="peopleId != null">#{peopleId},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="sync != null">#{sync},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="parkId != null">#{parkId},</if>
<if test="num != null">#{num},</if>
<if test="carType != null">#{carType},</if>
<if test="unit != null">#{unit},</if>
<if test="phone != null">#{phone},</if>
</trim>
</insert>
<update id="updateCarInfo" parameterType="CarInfo">
update car_info
<trim prefix="SET" suffixOverrides=",">
<if test="enableTime != null">enable_time = #{enableTime},</if>
<if test="overdueTime != null">overdue_time = #{overdueTime},</if>
<if test="enable != null">enable = #{enable},</if>
<if test="plate != null and plate != ''">plate = #{plate},</if>
<if test="timeSegEnable != null and timeSegEnable != ''">time_seg_enable = #{timeSegEnable},</if>
<if test="segTime != null">seg_time = #{segTime},</if>
<if test="needAlarm != null">need_alarm = #{needAlarm},</if>
<if test="vehicleCode != null">vehicle_code = #{vehicleCode},</if>
<if test="vehicleComment != null">vehicle_comment = #{vehicleComment},</if>
<if test="peopleId != null">people_id = #{peopleId},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="sync != null">sync = #{sync},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="parkId != null">park_id = #{parkId},</if>
<if test="num != null">num = #{num},</if>
<if test="carType != null">car_type = #{carType},</if>
<if test="unit != null">unit = #{unit},</if>
<if test="phone != null">phone = #{phone},</if>
</trim>
where customer_id = #{customerId}
</update>
<update id="deleteCarInfoByCustomerId" parameterType="Long">
update car_info set del_flag=2 where customer_id = #{customerId}
</update>
<update id="deleteCarInfoByCustomerIds" parameterType="String">
update car_info set del_flag=2 where customer_id in
<foreach item="customerId" collection="array" open="(" separator="," close=")">
#{customerId}
</foreach>
</update>
<select id="selectCarInfoByCarNo" parameterType="String" resultMap="CarInfoResult">
<include refid="selectCarInfoVo"/>
where ci.plate = #{plate} and ci.del_flag=0
limit 1
</select>
</mapper>

View File

@@ -0,0 +1,76 @@
<?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.dcsoft.system.vehicle.mapper.CarParkItemMapper">
<resultMap type="CarParkItem" id="CarParkItemResult">
<result property="id" column="id" />
<result property="equipmentId" column="equipment_id" />
<result property="parkId" column="park_id" />
<result property="way" column="way" />
<result property="area" column="area" />
</resultMap>
<sql id="selectCarParkItemVo">
select id, equipment_id, park_id, way,area from car_park_item
</sql>
<select id="selectCarParkItemList" parameterType="CarParkItem" resultMap="CarParkItemResult">
<include refid="selectCarParkItemVo"/>
<where>
<if test="equipmentId != null "> and equipment_id = #{equipmentId}</if>
<if test="parkId != null "> and park_id = #{parkId}</if>
<if test="way != null and way != ''"> and way = #{way}</if>
</where>
</select>
<select id="selectCarParkItemById" parameterType="Long" resultMap="CarParkItemResult">
<include refid="selectCarParkItemVo"/>
where id = #{id}
</select>
<insert id="insertCarParkItem" parameterType="CarParkItem">
insert into car_park_item
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="equipmentId != null">equipment_id,</if>
<if test="parkId != null">park_id,</if>
<if test="way != null">way,</if>
<if test="area != null">area,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="equipmentId != null">#{equipmentId},</if>
<if test="parkId != null">#{parkId},</if>
<if test="way != null">#{way},</if>
<if test="area != null">#{area},</if>
</trim>
</insert>
<update id="updateCarParkItem" parameterType="CarParkItem">
update car_park_item
<trim prefix="SET" suffixOverrides=",">
<if test="equipmentId != null">equipment_id = #{equipmentId},</if>
<if test="parkId != null">park_id = #{parkId},</if>
<if test="way != null">way = #{way},</if>
<if test="area != null">area = #{area},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCarParkItemById" parameterType="Long">
delete from car_park_item where id = #{id}
</delete>
<delete id="deleteCarParkItemByIds" parameterType="String">
delete from car_park_item where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteParkItemByParkId" parameterType="Long">
delete from car_park_item where park_id = #{parkId}
</delete>
</mapper>

View File

@@ -0,0 +1,125 @@
<?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.dcsoft.system.vehicle.mapper.CarParkMapper">
<resultMap type="CarPark" id="CarParkResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="spaceId" column="space_id" />
<result property="carsNum" column="cars_num" />
<result property="surplusNum" column="surplus_num" />
<result property="remark" column="remark" />
<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="spaceName" column="space_name" />
</resultMap>
<sql id="selectCarParkVo">
select cp.id, cp.name, cp.space_id, cp.cars_num, cp.surplus_num, cp.remark, cp.create_by, cp.create_time,
cp.update_by, cp.update_time,ss.name space_name
from car_park cp
left join sys_space ss on cp.space_id=ss.id
</sql>
<select id="selectCarParkList" parameterType="CarPark" resultMap="CarParkResult">
<include refid="selectCarParkVo"/>
<where>
<if test="name != null and name != ''"> and cp.name like concat('%', #{name}, '%')</if>
</where>
</select>
<select id="selectCarParkById" parameterType="Long" resultMap="CarParkResult">
<include refid="selectCarParkVo"/>
where cp.id = #{id}
</select>
<insert id="insertCarPark" parameterType="CarPark" useGeneratedKeys="true" keyProperty="id">
insert into car_park
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="name != null">name,</if>
<if test="spaceId != null">space_id,</if>
<if test="carsNum != null">cars_num,</if>
<if test="surplusNum != null">surplus_num,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="name != null">#{name},</if>
<if test="spaceId != null">#{spaceId},</if>
<if test="carsNum != null">#{carsNum},</if>
<if test="surplusNum != null">#{surplusNum},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateCarPark" parameterType="CarPark">
update car_park
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="spaceId != null">space_id = #{spaceId},</if>
<if test="carsNum != null">cars_num = #{carsNum},</if>
<if test="surplusNum != null">surplus_num = #{surplusNum},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCarParkById" parameterType="Long">
delete from car_park where id = #{id}
</delete>
<delete id="deleteCarParkByIds" parameterType="String">
delete from car_park where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectItemTreeList" parameterType="Long" resultType="java.util.Map">
select dict_value id,dict_label name from sys_dict_data
where dict_type ='car_park_area'
and dict_value in (select DISTINCT area from car_park_item where park_id=#{id})
</select>
<select id="carPlay" parameterType="Long" resultType="java.util.Map">
select back_url url,id from sys_equipment where id in (select equipment_id from car_park_item where area=#{id})
</select>
<select id="carPlayRecord" parameterType="Long" resultType="java.util.Map">
select cpr.url,cpi.way,cpr.pass_time passTime from car_pass_record cpr left join sys_equipment se on cpr.sn=se.sequence
left join car_park_item cpi on cpi.equipment_id=se.id
where se.id in (select equipment_id from car_park_item where area=#{id})
ORDER BY cpr.pass_time desc limit 12
</select>
<delete id="deleteSelectCarInfo" parameterType="Long">
delete from car_equipment_open where equipment_id = #{id}
</delete>
<insert id="selectCarInfo" >
insert into car_equipment_open (equipment_id,io) values(#{id},#{flag})
</insert>
<select id="selectCarParkByName" parameterType="String" resultMap="CarParkResult">
<include refid="selectCarParkVo"/>
where cp.name = #{name}
</select>
</mapper>

View File

@@ -0,0 +1,97 @@
<?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.dcsoft.system.vehicle.mapper.CarParkRecordMapper">
<resultMap type="CarParkRecord" id="CarParkRecordResult">
<result property="id" column="id" />
<result property="equipmentId" column="equipment_id" />
<result property="parkId" column="park_id" />
<result property="customerId" column="customer_id" />
<result property="sync" column="sync" />
<result property="equipmentName" column="equipment_name" />
<result property="parkName" column="park_name" />
<result property="customerName" column="customer_name" />
</resultMap>
<sql id="selectCarParkRecordVo">
select cpr.id, cpr.equipment_id, cpr.park_id, cpr.customer_id, cpr.sync,
se.name equipment_name,cp.name park_name,ci.plate customer_name
from car_park_record cpr
left join sys_equipment se on cpr.equipment_id=se.id
left join car_park cp on cpr.park_id=cp.id
left join car_info ci on cpr.customer_id=ci.customer_id
</sql>
<select id="selectCarParkRecordList" parameterType="CarParkRecord" resultMap="CarParkRecordResult">
<include refid="selectCarParkRecordVo"/>
<where>
<if test="equipmentId != null "> and cpr.equipment_id = #{equipmentId}</if>
<if test="parkId != null "> and cpr.park_id = #{parkId}</if>
<if test="customerId != null "> and cpr.customer_id = #{customerId}</if>
<if test="customerName != null ">and ci.plate like concat('%', #{customerName}, '%') </if>
<if test="sync != null and sync != ''"> and cpr.sync = #{sync}</if>
</where>
</select>
<select id="selectCarParkRecordById" parameterType="Long" resultMap="CarParkRecordResult">
<include refid="selectCarParkRecordVo"/>
where cpr.id = #{id}
</select>
<insert id="insertCarParkRecord" parameterType="CarParkRecord" useGeneratedKeys="true" keyProperty="id">
insert into car_park_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="equipmentId != null">equipment_id,</if>
<if test="parkId != null">park_id,</if>
<if test="customerId != null">customer_id,</if>
<if test="sync != null">sync,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="equipmentId != null">#{equipmentId},</if>
<if test="parkId != null">#{parkId},</if>
<if test="customerId != null">#{customerId},</if>
<if test="sync != null">#{sync},</if>
</trim>
</insert>
<update id="updateCarParkRecord" parameterType="CarParkRecord">
update car_park_record
<trim prefix="SET" suffixOverrides=",">
<if test="equipmentId != null">equipment_id = #{equipmentId},</if>
<if test="parkId != null">park_id = #{parkId},</if>
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="sync != null">sync = #{sync},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCarParkRecordById" parameterType="Long">
delete from car_park_record where id = #{id}
</delete>
<delete id="deleteCarParkRecordByIds" parameterType="String">
delete from car_park_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteCarParkRecordByParkId" parameterType="Long">
delete from car_park_record where park_id = #{parkId}
</delete>
<update id="deleteCarParkRecordByCustomerIds" parameterType="String">
update car_park_record set sync=0 where customer_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<delete id="deleteCarParkRecordByCustomerId" parameterType="Long">
delete from car_park_record where customer_id = #{customerId}
</delete>
</mapper>

View File

@@ -0,0 +1,90 @@
<?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.dcsoft.system.vehicle.mapper.CarPassGatherMapper">
<resultMap type="CarPassGather" id="CarPassGatherResult">
<result property="id" column="id" />
<result property="parkId" column="park_id" />
<result property="parkName" column="park_name" />
<result property="area" column="area" />
<result property="license" column="license" />
<result property="joinTime" column="join_time" />
<result property="sn" column="sn" />
<result property="equipmentName" column="equipment_name" />
<result property="timeLong" column="time_long" />
</resultMap>
<sql id="selectCarPassGatherVo">
select cpg.id, cpg.park_id, cpg.area, cpg.license, cpg.join_time, cpg.sn,cp.name park_name,se.name equipment_name,HOUR(TIMEDIFF(NOW(),cpg.join_time)) AS time_long
from car_pass_gather cpg
left join car_park cp on cp.id=cpg.park_id
left join sys_equipment se on se.sequence=cpg.sn
</sql>
<select id="selectCarPassGatherList" parameterType="CarPassGather" resultMap="CarPassGatherResult">
<include refid="selectCarPassGatherVo"/>
<where>
<if test="parkId != null and parkId != ''"> and cpg.park_id = #{parkId}</if>
<if test="area != null and area != ''"> and cpg.area = #{area}</if>
<if test="license != null and license != ''"> and cpg.license like concat('%', #{license}, '%') </if>
<if test="joinTime != null "> and date_format(cpg.join_time, '%Y-%m-%d') = date_format(#{joinTime}, '%Y-%m-%d') </if>
</where>
</select>
<select id="selectCarPassGatherById" parameterType="Long" resultMap="CarPassGatherResult">
<include refid="selectCarPassGatherVo"/>
where cpg.id = #{id}
</select>
<insert id="insertCarPassGather" parameterType="CarPassGather" useGeneratedKeys="true" keyProperty="id">
insert into car_pass_gather
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parkId != null">park_id,</if>
<if test="area != null">area,</if>
<if test="license != null">license,</if>
<if test="joinTime != null">join_time,</if>
<if test="sn != null">sn,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parkId != null">#{parkId},</if>
<if test="area != null">#{area},</if>
<if test="license != null">#{license},</if>
<if test="joinTime != null">#{joinTime},</if>
<if test="sn != null">#{sn},</if>
</trim>
</insert>
<update id="updateCarPassGather" parameterType="CarPassGather">
update car_pass_gather
<trim prefix="SET" suffixOverrides=",">
<if test="parkId != null">park_id = #{parkId},</if>
<if test="area != null">area = #{area},</if>
<if test="license != null">license = #{license},</if>
<if test="joinTime != null">join_time = #{joinTime},</if>
<if test="sn != null">sn = #{sn},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCarPassGatherById" parameterType="Long">
delete from car_pass_gather where id = #{id}
</delete>
<delete id="deleteCarPassGatherByIds" parameterType="String">
delete from car_pass_gather where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="parkTop" parameterType="Long" resultType="java.util.Map">
select cars_num num from car_park
where id = #{parkId}
UNION ALL
select count(1) num from car_pass_gather
where park_id=#{parkId}
</select>
</mapper>

View File

@@ -0,0 +1,115 @@
<?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.dcsoft.system.vehicle.mapper.CarPassRecordMapper">
<resultMap type="CarPassRecord" id="CarPassRecordResult">
<result property="id" column="id" />
<result property="parkId" column="park_id" />
<result property="uniqueNo" column="unique_no" />
<result property="direction" column="direction" />
<result property="license" column="license" />
<result property="passTime" column="pass_time" />
<result property="triggerType" column="trigger_type" />
<result property="colorType" column="color_type" />
<result property="carColor" column="car_color" />
<result property="url" column="url" />
<result property="dataType" column="data_type" />
<result property="sn" column="sn" />
<result property="way" column="way" />
<result property="parkName" column="park_name" />
<result property="equipmentName" column="equipment_name" />
<result property="unit" column="unit" />
<result property="type" column="type" />
</resultMap>
<sql id="selectCarPassRecordVo">
select cpr.id, cpr.park_id, cpr.unique_no, cpr.direction, cpr.license, cpr.pass_time, cpr.trigger_type, cpr.color_type,
cpr.car_color, cpr.url, cpr.data_type, cpr.sn,cpi.way,cp.name park_name,se.name equipment_name,ci.unit,cpr.type
from car_pass_record cpr
left join sys_equipment se on cpr.sn=se.sequence
left join car_park_item cpi on cpi.equipment_id=se.id
left join car_park cp on cp.id=cpi.park_id
left join car_info ci on cpr.license=ci.plate
</sql>
<select id="selectCarPassRecordList" parameterType="CarPassRecord" resultMap="CarPassRecordResult">
<include refid="selectCarPassRecordVo"/>
<where>
<if test="direction != null and direction != ''"> and direction = #{direction}</if>
<if test="license != null and license != ''"> and license = #{license}</if>
<if test="passTime != null "> and date_format(pass_time, '%Y-%m-%d') = date_format(#{passTime}, '%Y-%m-%d')</if>
<if test="triggerType != null and triggerType != ''"> and trigger_type = #{triggerType}</if>
<if test="colorType != null and colorType != ''"> and color_type = #{colorType}</if>
<if test="carColor != null and carColor != ''"> and car_color = #{carColor}</if>
</where>
order by cpr.pass_time desc
</select>
<select id="selectCarPassRecordById" parameterType="Long" resultMap="CarPassRecordResult">
<include refid="selectCarPassRecordVo"/>
where id = #{id}
</select>
<insert id="insertCarPassRecord" parameterType="CarPassRecord">
insert into car_pass_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="parkId != null and parkId != ''">park_id,</if>
<if test="uniqueNo != null and uniqueNo != ''">unique_no,</if>
<if test="direction != null">direction,</if>
<if test="license != null and license != ''">license,</if>
<if test="passTime != null">pass_time,</if>
<if test="triggerType != null and triggerType != ''">trigger_type,</if>
<if test="colorType != null and colorType != ''">color_type,</if>
<if test="carColor != null">car_color,</if>
<if test="url != null">url,</if>
<if test="dataType != null">data_type,</if>
<if test="sn != null and sn != ''">sn,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="parkId != null and parkId != ''">#{parkId},</if>
<if test="uniqueNo != null and uniqueNo != ''">#{uniqueNo},</if>
<if test="direction != null">#{direction},</if>
<if test="license != null and license != ''">#{license},</if>
<if test="passTime != null">#{passTime},</if>
<if test="triggerType != null and triggerType != ''">#{triggerType},</if>
<if test="colorType != null and colorType != ''">#{colorType},</if>
<if test="carColor != null">#{carColor},</if>
<if test="url != null">#{url},</if>
<if test="dataType != null">#{dataType},</if>
<if test="sn != null and sn != ''">#{sn},</if>
</trim>
</insert>
<update id="updateCarPassRecord" parameterType="CarPassRecord">
update car_pass_record
<trim prefix="SET" suffixOverrides=",">
<if test="parkId != null and parkId != ''">park_id = #{parkId},</if>
<if test="uniqueNo != null and uniqueNo != ''">unique_no = #{uniqueNo},</if>
<if test="direction != null">direction = #{direction},</if>
<if test="license != null and license != ''">license = #{license},</if>
<if test="passTime != null">pass_time = #{passTime},</if>
<if test="triggerType != null and triggerType != ''">trigger_type = #{triggerType},</if>
<if test="colorType != null and colorType != ''">color_type = #{colorType},</if>
<if test="carColor != null">car_color = #{carColor},</if>
<if test="url != null">url = #{url},</if>
<if test="dataType != null">data_type = #{dataType},</if>
<if test="sn != null and sn != ''">sn = #{sn},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCarPassRecordById" parameterType="Long">
delete from car_pass_record where id = #{id}
</delete>
<delete id="deleteCarPassRecordByIds" parameterType="String">
delete from car_pass_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>