兴安访客小程序对接部分迁移
This commit is contained in:
@@ -236,5 +236,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="queryJuniorBranch" resultType="com.dcsoft.system.domain.SysBranch">
|
||||
WITH RECURSIVE subdepartments AS (
|
||||
SELECT id, name, parent_id
|
||||
FROM sys_branch
|
||||
WHERE parent_id = #{branchId}
|
||||
UNION ALL
|
||||
SELECT d.id, d.name, d.parent_id
|
||||
FROM sys_branch d
|
||||
JOIN subdepartments sd ON d.parent_id = sd.id
|
||||
)
|
||||
SELECT * FROM subdepartments
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -15,11 +15,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="dictType" column="dict_type" />
|
||||
<result property="dictValue" column="dict_value" />
|
||||
</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
|
||||
select notice_id,
|
||||
notice_title,
|
||||
notice_type,
|
||||
cast(notice_content as char) as notice_content,
|
||||
status,
|
||||
dict_type,
|
||||
dict_value,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
remark
|
||||
from sys_notice
|
||||
</sql>
|
||||
|
||||
<select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
|
||||
@@ -30,36 +43,51 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<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>
|
||||
<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>
|
||||
<select id="selectNotice" resultMap="SysNoticeResult">
|
||||
<include refid="selectNoticeVo"/>
|
||||
<where>
|
||||
<if test="dictType != null and dictType != ''">
|
||||
AND dict_type = #{dictType}
|
||||
</if>
|
||||
<if test="dictValue != null and dictValue != ''">
|
||||
AND dict_value = #{dictValue}
|
||||
</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()
|
||||
)
|
||||
<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="dictType != null and dictType != '' ">dict_type, </if>
|
||||
<if test="dictValue != null and dictValue != '' ">dict_value, </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="dictType != null and dictType != ''">#{dictType}, </if>
|
||||
<if test="dictValue != null and dictValue != ''">#{dictValue}, </if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateNotice" parameterType="SysNotice">
|
||||
@@ -70,7 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<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()
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where notice_id = #{noticeId}
|
||||
</update>
|
||||
|
||||
@@ -10,6 +10,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="nickName" column="nick_name" />
|
||||
<result property="phone" column="phone" />
|
||||
<result property="openid" column="openid" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="idcard" column="idcard" />
|
||||
<result property="visitingUnit" column="visiting_unit" />
|
||||
<result property="avatar" column="avatar" />
|
||||
<result property="deleteState" column="delete_state" />
|
||||
<result property="createdBy" column="created_by" />
|
||||
<result property="createdTime" column="created_time" />
|
||||
@@ -18,7 +22,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</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
|
||||
select id,
|
||||
user_name,
|
||||
nick_name,
|
||||
phone,
|
||||
openid,
|
||||
user_id,
|
||||
idcard,
|
||||
visiting_unit,
|
||||
avatar,
|
||||
delete_state,
|
||||
created_by,
|
||||
created_time,
|
||||
updated_by,
|
||||
updated_time
|
||||
from vis_visitor_register
|
||||
</sql>
|
||||
|
||||
<select id="selectVisVisitorRegisterList" parameterType="VisVisitorRegister" resultMap="VisVisitorRegisterResult">
|
||||
@@ -44,11 +62,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<insert id="insertVisVisitorRegister" parameterType="VisVisitorRegister">
|
||||
insert into vis_visitor_register
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
id,
|
||||
<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="userId != null">user_id,</if>
|
||||
<if test="idcard != null">idcard,</if>
|
||||
<if test="visitingUnit != null">visiting_unit,</if>
|
||||
<if test="avatar != null">avatar,</if>
|
||||
<if test="deleteState != null">delete_state,</if>
|
||||
<if test="createdBy != null">created_by,</if>
|
||||
<if test="createdTime != null">created_time,</if>
|
||||
@@ -56,17 +78,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updatedTime != null">updated_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
REPLACE(uuid(), '-', ''),
|
||||
<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="userId != null">#{userId},</if>
|
||||
<if test="idcard != null">#{idcard},</if>
|
||||
<if test="visitingUnit != null">#{visitingUnit},</if>
|
||||
<if test="avatar != null">#{avatar},</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>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateVisVisitorRegister" parameterType="VisVisitorRegister">
|
||||
@@ -76,6 +102,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="nickName != null">nick_name = #{nickName},</if>
|
||||
<if test="phone != null">phone = #{phone},</if>
|
||||
<if test="openid != null">openid = #{openid},</if>
|
||||
<if test="idcard != null">idcard = #{idcard},</if>
|
||||
<if test="visitingUnit != null">visiting_unit = #{visitingUnit},</if>
|
||||
<if test="avatar != null">avatar = #{avatar},</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>
|
||||
@@ -108,4 +137,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="queryVisitorRegister" resultType="java.lang.String">
|
||||
select id from vis_visitor_register where user_name = #{name} and phone = #{phone}
|
||||
</select>
|
||||
<select id="selectVisVisitorRegisterByUserId" parameterType="Long" resultMap="VisVisitorRegisterResult">
|
||||
select
|
||||
vvr.id,
|
||||
vvr.user_name as user_name,
|
||||
IFNULL(vvr.phone,su.phonenumber) as phone,
|
||||
su.openid,
|
||||
su.user_id,
|
||||
vvr.user_id,
|
||||
vvr.idcard,
|
||||
vvr.visiting_unit,
|
||||
vvr.avatar,
|
||||
vvr.delete_state,
|
||||
vvr.created_by,
|
||||
vvr.created_time,
|
||||
vvr.updated_by,
|
||||
vvr.updated_time
|
||||
from sys_user su left join vis_visitor_register vvr on vvr.user_id = su.user_id
|
||||
where su.user_id = #{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -808,4 +808,106 @@
|
||||
where visitor_id = #{id} and vvar.reviewer = vv.user_id
|
||||
order by ifnull(createdTime, 'zzz')
|
||||
</select>
|
||||
|
||||
<select id="selectAppVisitorFollow" resultType="java.lang.Long">
|
||||
select distinct
|
||||
vv.parent_id
|
||||
from vis_visitor vv left join vis_visitor vv1 on vv.parent_id = vv1.id
|
||||
where vv.parent_id is not null
|
||||
<choose>
|
||||
<when test="examineState != null and examineState == 3">
|
||||
and vv1.examine_state = '0'
|
||||
</when>
|
||||
<when test="examineState != null and examineState != 3">
|
||||
and vv1.examine_state = #{examineState}
|
||||
</when>
|
||||
</choose>
|
||||
and vv.phone = #{createBy}
|
||||
and vv1.park = #{park}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectAppVisitorList" parameterType="Visitor" resultMap="VisitorResult">
|
||||
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,
|
||||
vv.instance_id,
|
||||
vv.examine_state,
|
||||
vv.visitor_type,
|
||||
vv.park,
|
||||
vv.current_node,
|
||||
vv.user_task_count,
|
||||
vv.procdef_id,
|
||||
vv.proc_id
|
||||
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
|
||||
<where>
|
||||
<if test="name != null and name != ''">and vv.name like concat('%', #{name}, '%')</if>
|
||||
<if test="createBy != null ">and vv.create_by = #{createBy}</if>
|
||||
<if test="examineState != null and examineState != 3">and vv.examine_state = #{examineState}</if>
|
||||
<if test="park != null and park != ''">and vv.park = #{park}</if>
|
||||
<if test="visitorType != null">and vv.visitor_type = #{visitorType}</if>
|
||||
and vv.parent_id is null
|
||||
<if test="ids != null and ids.size() > 0">
|
||||
or vv.id in
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="queryCode" resultType="com.dcsoft.system.visitor.domain.CheckCodeVo">
|
||||
SELECT
|
||||
vcc.visitor_id as visitorId,
|
||||
vcc.`code`
|
||||
FROM
|
||||
vis_check_code vcc
|
||||
JOIN (SELECT max(created_time) as created_time, visitor_id FROM vis_check_code GROUP BY visitor_id) t ON vcc.created_time = t.created_time
|
||||
left join vis_visitor vv on vv.examine_state = 0 and vcc.visitor_id = vv.id
|
||||
WHERE t.visitor_id IN
|
||||
<foreach collection="list" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
and vv.examine_state = 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user