From 77d7257c02fc811a53b8d9207e4239f69c8a600c Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 15 六月 2023 14:33:36 +0800
Subject: [PATCH] 题目和标签代码提交

---
 smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml |  136 +++++++++++++++++++++++++++++++--------------
 1 files changed, 93 insertions(+), 43 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
index 8dd64f2..400feeb 100644
--- a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
@@ -1,56 +1,103 @@
 <?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">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.smartor.mapper.PatArchiveMapper">
-    
-    <resultMap type="PatArchive" id="PatArchiveResult">
-        <result property="patid"    column="patid"    />
-        <result property="name"    column="name"    />
-        <result property="sex"    column="sex"    />
-        <result property="iccardno"    column="iccardno"    />
-        <result property="birthdate"    column="birthdate"    />
-        <result property="age"    column="age"    />
-        <result property="source"    column="source"    />
-        <result property="archivetime"    column="archivetime"    />
-        <result property="archiveby"    column="archiveby"    />
-        <result property="telcode"    column="telcode"    />
-        <result property="relativetelcode"    column="relativetelcode"    />
-        <result property="iccardtype"    column="iccardtype"    />
-        <result property="orgid"    column="orgid"    />
-        <result property="openid"    column="openid"    />
-        <result property="delFlag"    column="del_flag"    />
-        <result property="updateBy"    column="update_by"    />
-        <result property="updateTime"    column="update_time"    />
-        <result property="createBy"    column="create_by"    />
-        <result property="createTime"    column="create_time"    />
-        <result property="isupload"    column="isupload"    />
-        <result property="uploadTime"    column="upload_time"    />
+
+    <resultMap type="com.smartor.domain.PatArchive" id="PatArchiveResult">
+        <result property="patid" column="patid"/>
+        <result property="name" column="name"/>
+        <result property="sex" column="sex"/>
+        <result property="iccardno" column="iccardno"/>
+        <result property="birthdate" column="birthdate"/>
+        <result property="age" column="age"/>
+        <result property="source" column="source"/>
+        <result property="archivetime" column="archivetime"/>
+        <result property="archiveby" column="archiveby"/>
+        <result property="telcode" column="telcode"/>
+        <result property="relativetelcode" column="relativetelcode"/>
+        <result property="iccardtype" column="iccardtype"/>
+        <result property="orgid" column="orgid"/>
+        <result property="openid" column="openid"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="isupload" column="isupload"/>
+        <result property="uploadTime" column="upload_time"/>
+        <result property="tag" column="tag"/>
     </resultMap>
 
     <sql id="selectPatArchiveVo">
-        select patid, name, sex, iccardno, birthdate, age, source, archivetime, archiveby, telcode, relativetelcode, iccardtype, orgid, openid, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time from pat_archive
+        select patid,
+               name,
+               sex,
+               iccardno,
+               birthdate,
+               age,
+               source,
+               archivetime,
+               archiveby,
+               telcode,
+               relativetelcode,
+               iccardtype,
+               orgid,
+               openid,
+               del_flag,
+               update_by,
+               update_time,
+               create_by,
+               create_time,
+               isupload,
+               upload_time
+        from pat_archive
     </sql>
 
-    <select id="selectPatArchiveList" parameterType="PatArchive" resultMap="PatArchiveResult">
+    <select id="selectPatArchiveList" parameterType="com.smartor.domain.PatArchive" resultMap="PatArchiveResult">
         <include refid="selectPatArchiveVo"/>
-        <where>  
-            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
-            <if test="iccardno != null  and iccardno != ''"> and iccardno = #{iccardno}</if>
-            <if test="source != null "> and source = #{source}</if>
-            <if test="telcode != null  and telcode != ''"> and telcode = #{telcode}</if>
-            <if test="orgid != null  and orgid != ''"> and orgid = #{orgid}</if>
-            <if test="isupload != null "> and isupload = #{isupload}</if>
-            <if test="uploadTime != null "> and upload_time = #{uploadTime}</if>
+        <where>
+            <if test="name != null  and name != ''">and name like concat('%', #{name}, '%')</if>
+            <if test="iccardno != null  and iccardno != ''">and iccardno = #{iccardno}</if>
+            <if test="source != null ">and source = #{source}</if>
+            <if test="telcode != null  and telcode != ''">and telcode = #{telcode}</if>
+            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
+            <if test="patid != null  and patid != ''">and patid = #{patid}</if>
+            <if test="isupload != null ">and isupload = #{isupload}</if>
+            <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
         </where>
     </select>
-    
+
+
+    <select id="patInfoByContion" parameterType="com.smartor.domain.PatArchiveReq" resultMap="PatArchiveResult">
+        select
+        a.patid,
+        a.name,
+        a.sex,
+        c.tagname as tag,
+        a.iccardtype,
+        a.iccardno,
+        a.age,
+        a.telcode,
+        a.create_time,
+        a.update_time,
+        a.birthdate
+        from pat_archive a,pat_archivetag b ,base_tag c
+        <where>
+            a.patid = b.patid and b.tagid = c.tagid
+            <if test="name != null  and name != ''">and a.name like concat('%', #{name}, '%')</if>
+            <if test="iccardno != null  and iccardno != ''">and iccardno = #{iccardno}</if>
+            <if test="telcode != null  and telcode != ''">and telcode = #{telcode}</if>
+            <if test="tagId != null  and tagId != ''">and c.tagid = #{tagId}</if>
+        </where>
+    </select>
+
     <select id="selectPatArchiveByPatid" parameterType="Long" resultMap="PatArchiveResult">
         <include refid="selectPatArchiveVo"/>
         where patid = #{patid}
     </select>
-        
-    <insert id="insertPatArchive" parameterType="PatArchive" useGeneratedKeys="true" keyProperty="patid">
+
+    <insert id="insertPatArchive" parameterType="com.smartor.domain.PatArchive" useGeneratedKeys="true" keyProperty="patid">
         insert into pat_archive
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="name != null">name,</if>
@@ -73,7 +120,7 @@
             <if test="createTime != null">create_time,</if>
             <if test="isupload != null">isupload,</if>
             <if test="uploadTime != null">upload_time,</if>
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="name != null">#{name},</if>
             <if test="sex != null">#{sex},</if>
@@ -95,10 +142,10 @@
             <if test="createTime != null">#{createTime},</if>
             <if test="isupload != null">#{isupload},</if>
             <if test="uploadTime != null">#{uploadTime},</if>
-         </trim>
+        </trim>
     </insert>
 
-    <update id="updatePatArchive" parameterType="PatArchive">
+    <update id="updatePatArchive" parameterType="com.smartor.domain.PatArchive">
         update pat_archive
         <trim prefix="SET" suffixOverrides=",">
             <if test="name != null">name = #{name},</if>
@@ -126,13 +173,16 @@
     </update>
 
     <delete id="deletePatArchiveByPatid" parameterType="Long">
-        delete from pat_archive where patid = #{patid}
+        delete
+        from pat_archive
+        where patid = #{patid}
     </delete>
 
     <delete id="deletePatArchiveByPatids" parameterType="String">
-        delete from pat_archive where patid in 
+        delete from pat_archive where patid in
         <foreach item="patid" collection="array" open="(" separator="," close=")">
             #{patid}
         </foreach>
     </delete>
+
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3