Browse Source

新增打卡其他信息

anderx 4 months ago
parent
commit
c1ef001fc2

+ 76 - 11
src/main/java/com/goafanti/common/dao/PublicReleaseClockMapper.java

@@ -1,28 +1,93 @@
 package com.goafanti.common.dao;
 
 import com.goafanti.common.model.PublicReleaseClock;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
 /**
-* @author Administrator
-* @description 针对表【public_release_clock(公出打卡表)】的数据库操作Mapper
-* @createDate 2024-04-19 14:56:48
-* @Entity com.goafanti.common.model.PublicReleaseClock
-*/
+ * 公出打卡表(PublicReleaseClock)表数据库访问层
+ *
+ * @author makejava
+ * @since 2025-08-27 11:44:45
+ */
 public interface PublicReleaseClockMapper {
 
-    int deleteByPrimaryKey(Integer id);
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param id 主键
+     * @return 实例对象
+     */
+    PublicReleaseClock selectById(Integer id);
 
-    int insert(PublicReleaseClock record);
 
-    int insertSelective(PublicReleaseClock record);
+    /**
+     * 查询指定行数据
+     *
+     * @param publicReleaseClock 查询条件
+     * @param pageable           分页对象
+     * @return 对象列表
+     */
+    List<PublicReleaseClock> findPublicReleaseClockList(PublicReleaseClock publicReleaseClock);
+
+    /**
+     * 统计总行数
+     *
+     * @param publicReleaseClock 查询条件
+     * @return 总行数
+     */
+    int findPublicReleaseClockCount(PublicReleaseClock publicReleaseClock);
+
+    /**
+     * 新增数据
+     *
+     * @param publicReleaseClock 实例对象
+     * @return 影响行数
+     */
+    int insert(PublicReleaseClock publicReleaseClock);
+
+    /**
+     * 批量新增数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<PublicReleaseClock> 实例对象列表
+     * @return 影响行数
+     */
+    int insertBatch(@Param("entities") List<PublicReleaseClock> entities);
+
+    /**
+     * 批量新增或按主键更新数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<PublicReleaseClock> 实例对象列表
+     * @return 影响行数
+     * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
+     */
+    int insertOrUpdateBatch(@Param("entities") List<PublicReleaseClock> entities);
+
+    /**
+     * 修改数据
+     *
+     * @param publicReleaseClock 实例对象
+     * @return 影响行数
+     */
+    int update(PublicReleaseClock publicReleaseClock);
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param id 主键
+     * @return 影响行数
+     */
+    int deleteById(Integer id);
 
-    PublicReleaseClock selectByPrimaryKey(Integer id);
 
-    int updateByPrimaryKeySelective(PublicReleaseClock record);
 
-    int updateByPrimaryKey(PublicReleaseClock record);
+
+
+    int insertSelective(PublicReleaseClock record);
+
 
     List<PublicReleaseClock> selectList(List<Integer> list);
+
 }
+

+ 186 - 70
src/main/java/com/goafanti/common/mapper/PublicReleaseClockMapper.xml

@@ -1,102 +1,218 @@
 <?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">
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.goafanti.common.dao.PublicReleaseClockMapper">
 
-    <resultMap id="BaseResultMap" type="com.goafanti.common.model.PublicReleaseClock">
-            <id property="id" column="id" jdbcType="INTEGER"/>
-            <result property="prid" column="prid" jdbcType="INTEGER"/>
-            <result property="prdid" column="prdid" jdbcType="INTEGER"/>
-            <result property="photoUrl" column="photo_url" jdbcType="VARCHAR"/>
-            <result property="clockInTime" column="clock_in_time" jdbcType="TIMESTAMP"/>
-            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+    <resultMap type="com.goafanti.common.model.PublicReleaseClock" id="PublicReleaseClockMap">
+        <result property="id" column="id" jdbcType="INTEGER"/>
+        <result property="prid" column="prid" jdbcType="INTEGER"/>
+        <result property="prdid" column="prdid" jdbcType="INTEGER"/>
+        <result property="photoUrl" column="photo_url" jdbcType="VARCHAR"/>
+        <result property="clockInTime" column="clock_in_time" jdbcType="TIMESTAMP"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <result property="longitude" column="longitude" jdbcType="VARCHAR"/>
+        <result property="latitude" column="latitude" jdbcType="VARCHAR"/>
+        <result property="districtName" column="district_name" jdbcType="VARCHAR"/>
     </resultMap>
 
-    <sql id="Base_Column_List">
-        id,prid,prdid,
-        photo_url,clock_in_time,create_time
+    <sql id="PublicReleaseClockAllSql">
+        id, prid, prdid, photo_url, clock_in_time, create_time, longitude, latitude, district_name
     </sql>
 
-    <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    <!--查询单个-->
+    <select id="selectById" resultMap="PublicReleaseClockMap">
         select
-        <include refid="Base_Column_List" />
+        <include refid="PublicReleaseClockAllSql"/>
         from public_release_clock
-        where  id = #{id,jdbcType=INTEGER} 
+        where id = #{id}
     </select>
 
-
-    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
-        delete from public_release_clock
-        where  id = #{id,jdbcType=INTEGER} 
-    </delete>
-    <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicReleaseClock" useGeneratedKeys="true">
-        insert into public_release_clock
-        ( id,prid,prdid
-        ,photo_url,clock_in_time,create_time
-        )
-        values (#{id,jdbcType=INTEGER},#{prid,jdbcType=INTEGER},#{prdid,jdbcType=INTEGER}
-        ,#{photoUrl,jdbcType=VARCHAR},#{clockInTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP}
-        )
+    <!--新增所有列-->
+    <insert id="insert" keyProperty="id" useGeneratedKeys="true">
+        insert into public_release_clock(prid, prdid, photo_url, clock_in_time, create_time, longitude, latitude,
+                                         district_name)
+        values (#{prid}, #{prdid}, #{photoUrl}, #{clockInTime}, #{createTime}, #{longitude}, #{latitude},
+                #{districtName})
     </insert>
+
     <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.PublicReleaseClock" useGeneratedKeys="true">
         insert into public_release_clock
         <trim prefix="(" suffix=")" suffixOverrides=",">
-                <if test="id != null">id,</if>
-                <if test="prid != null">prid,</if>
-                <if test="prdid != null">prdid,</if>
-                <if test="photoUrl != null">photo_url,</if>
-                <if test="clockInTime != null">clock_in_time,</if>
-                <if test="createTime != null">create_time,</if>
+            <if test="id != null">id,</if>
+            <if test="prid != null">prid,</if>
+            <if test="prdid != null">prdid,</if>
+            <if test="photoUrl != null">photo_url,</if>
+            <if test="clockInTime != null">clock_in_time,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="longitude != null">longitude,</if>
+            <if test="latitude != null">latitude,</if>
+            <if test="districtName != null">district_name,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
-                <if test="id != null">#{id,jdbcType=INTEGER},</if>
-                <if test="prid != null">#{prid,jdbcType=INTEGER},</if>
-                <if test="prdid != null">#{prdid,jdbcType=INTEGER},</if>
-                <if test="photoUrl != null">#{photoUrl,jdbcType=VARCHAR},</if>
-                <if test="clockInTime != null">#{clockInTime,jdbcType=TIMESTAMP},</if>
-                <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
+            <if test="id != null">#{id,jdbcType=INTEGER},</if>
+            <if test="prid != null">#{prid,jdbcType=INTEGER},</if>
+            <if test="prdid != null">#{prdid,jdbcType=INTEGER},</if>
+            <if test="photoUrl != null">#{photoUrl,jdbcType=VARCHAR},</if>
+            <if test="clockInTime != null">#{clockInTime,jdbcType=TIMESTAMP},</if>
+            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
+            <if test="longitude != null">#{longitude,jdbcType=VARCHAR},</if>
+            <if test="latitude != null">#{latitude,jdbcType=VARCHAR},</if>
+            <if test="districtName != null">#{districtName,jdbcType=VARCHAR},</if>
         </trim>
     </insert>
-    <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.PublicReleaseClock">
+
+    <insert id="insertBatch">
+        insert into public_release_clock(prid, prdid, photo_url, clock_in_time, create_time, longitude, latitude,
+        district_name)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+            (#{entity.prid}, #{entity.prdid}, #{entity.photoUrl}, #{entity.clockInTime}, #{entity.createTime},
+            #{entity.longitude}, #{entity.latitude}, #{entity.districtName})
+        </foreach>
+    </insert>
+
+    <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
+        insert into public_release_clock(prid, prdid, photo_url, clock_in_time, create_time, longitude, latitude,
+        district_name)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+            (#{entity.prid}, #{entity.prdid}, #{entity.photoUrl}, #{entity.clockInTime}, #{entity.createTime},
+            #{entity.longitude}, #{entity.latitude}, #{entity.districtName})
+        </foreach>
+        on duplicate key update
+        prid = values(prid),
+        prdid = values(prdid),
+        photo_url = values(photo_url),
+        clock_in_time = values(clock_in_time),
+        create_time = values(create_time),
+        longitude = values(longitude),
+        latitude = values(latitude),
+        district_name = values(district_name)
+    </insert>
+
+    <!--通过主键修改数据-->
+    <update id="update">
         update public_release_clock
         <set>
-                <if test="prid != null">
-                    prid = #{prid,jdbcType=INTEGER},
-                </if>
-                <if test="prdid != null">
-                    prdid = #{prdid,jdbcType=INTEGER},
-                </if>
-                <if test="photoUrl != null">
-                    photo_url = #{photoUrl,jdbcType=VARCHAR},
-                </if>
-                <if test="clockInTime != null">
-                    clock_in_time = #{clockInTime,jdbcType=TIMESTAMP},
-                </if>
-                <if test="createTime != null">
-                    create_time = #{createTime,jdbcType=TIMESTAMP},
-                </if>
+            <if test="prid != null">
+                prid = #{prid},
+            </if>
+            <if test="prdid != null">
+                prdid = #{prdid},
+            </if>
+            <if test="photoUrl != null and photoUrl != ''">
+                photo_url = #{photoUrl},
+            </if>
+            <if test="clockInTime != null">
+                clock_in_time = #{clockInTime},
+            </if>
+            <if test="createTime != null">
+                create_time = #{createTime},
+            </if>
+            <if test="longitude != null and longitude != ''">
+                longitude = #{longitude},
+            </if>
+            <if test="latitude != null and latitude != ''">
+                latitude = #{latitude},
+            </if>
+            <if test="districtName != null and districtName != ''">
+                district_name = #{districtName},
+            </if>
         </set>
-        where   id = #{id,jdbcType=INTEGER} 
-    </update>
-    <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.PublicReleaseClock">
-        update public_release_clock
-        set 
-            prid =  #{prid,jdbcType=INTEGER},
-            prdid =  #{prdid,jdbcType=INTEGER},
-            photo_url =  #{photoUrl,jdbcType=VARCHAR},
-            clock_in_time =  #{clockInTime,jdbcType=TIMESTAMP},
-            create_time =  #{createTime,jdbcType=TIMESTAMP}
-        where   id = #{id,jdbcType=INTEGER} 
+        where id = #{id}
     </update>
 
-    <select id="selectList" resultMap="BaseResultMap">
+    <!--查询指定行数据-->
+    <select id="findPublicReleaseClockList" resultMap="PublicReleaseClockMap">
         select
-        <include refid="Base_Column_List" />
+        <include refid="PublicReleaseClockAllSql"/>
+
+        from public_release_clock
+        <where>
+            <if test="id != null">
+                and id = #{id}
+            </if>
+            <if test="prid != null">
+                and prid = #{prid}
+            </if>
+            <if test="prdid != null">
+                and prdid = #{prdid}
+            </if>
+            <if test="photoUrl != null and photoUrl != ''">
+                and photo_url = #{photoUrl}
+            </if>
+            <if test="clockInTime != null">
+                and clock_in_time = #{clockInTime}
+            </if>
+            <if test="createTime != null">
+                and create_time = #{createTime}
+            </if>
+            <if test="longitude != null and longitude != ''">
+                and longitude = #{longitude}
+            </if>
+            <if test="latitude != null and latitude != ''">
+                and latitude = #{latitude}
+            </if>
+            <if test="districtName != null and districtName != ''">
+                and district_name = #{districtName}
+            </if>
+        </where>
+        <if test="page_sql != null">
+            ${page_sql}
+        </if>
+    </select>
+
+    <!--统计总行数-->
+    <select id="findPublicReleaseClockCount" resultType="java.lang.Integer">
+        select count(1)
+        from public_release_clock
+        <where>
+            <if test="id != null">
+                and id = #{id}
+            </if>
+            <if test="prid != null">
+                and prid = #{prid}
+            </if>
+            <if test="prdid != null">
+                and prdid = #{prdid}
+            </if>
+            <if test="photoUrl != null and photoUrl != ''">
+                and photo_url = #{photoUrl}
+            </if>
+            <if test="clockInTime != null">
+                and clock_in_time = #{clockInTime}
+            </if>
+            <if test="createTime != null">
+                and create_time = #{createTime}
+            </if>
+            <if test="longitude != null and longitude != ''">
+                and longitude = #{longitude}
+            </if>
+            <if test="latitude != null and latitude != ''">
+                and latitude = #{latitude}
+            </if>
+            <if test="districtName != null and districtName != ''">
+                and district_name = #{districtName}
+            </if>
+        </where>
+    </select>
+
+    <!--通过主键删除-->
+    <delete id="deleteById">
+        delete
+        from public_release_clock
+        where id = #{id}
+    </delete>
+
+
+    <select id="selectList" resultMap="PublicReleaseClockMap">
+        select
+        <include refid="PublicReleaseClockAllSql" />
         from public_release_clock
         where prid in
         <foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
             #{item}
         </foreach>
     </select>
+
 </mapper>
+

+ 46 - 51
src/main/java/com/goafanti/common/model/PublicReleaseClock.java

@@ -1,129 +1,124 @@
 package com.goafanti.common.model;
 
-import com.fasterxml.jackson.annotation.JsonFormat;
-
 import java.io.Serializable;
 import java.util.Date;
 
+
 /**
- * 公出打卡表
- * @TableName public_release_clock
+ * 公出打卡表(PublicReleaseClock)实体类
+ *
+ * @author makejava
+ * @since 2025-08-27 11:44:45
  */
 public class PublicReleaseClock implements Serializable {
-    /**
-     * 
-     */
-    private Integer id;
+    private static final long serialVersionUID = -21241622729243982L;
 
+    private Integer id;
     /**
      * 公出编号
      */
     private Integer prid;
-
     /**
      * 公出详情编号
      */
     private Integer prdid;
-
     /**
      * 附件
      */
     private String photoUrl;
-
     /**
      * 打卡时间
      */
     private Date clockInTime;
-
     /**
      * 发起时间
      */
     private Date createTime;
-
-    private static final long serialVersionUID = 1L;
-
     /**
-     * 
+     * 经度
+     */
+    private String longitude;
+    /**
+     * 纬度
+     */
+    private String latitude;
+    /**
+     * 公出企业地址
      */
+    private String districtName;
+
+
     public Integer getId() {
         return id;
     }
 
-    /**
-     * 
-     */
     public void setId(Integer id) {
         this.id = id;
     }
 
-    /**
-     * 公出编号
-     */
     public Integer getPrid() {
         return prid;
     }
 
-    /**
-     * 公出编号
-     */
     public void setPrid(Integer prid) {
         this.prid = prid;
     }
 
-    /**
-     * 公出详情编号
-     */
     public Integer getPrdid() {
         return prdid;
     }
 
-    /**
-     * 公出详情编号
-     */
     public void setPrdid(Integer prdid) {
         this.prdid = prdid;
     }
 
-    /**
-     * 附件
-     */
     public String getPhotoUrl() {
         return photoUrl;
     }
 
-    /**
-     * 附件
-     */
     public void setPhotoUrl(String photoUrl) {
         this.photoUrl = photoUrl;
     }
 
-    /**
-     * 打卡时间
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
     public Date getClockInTime() {
         return clockInTime;
     }
 
-    /**
-     * 打卡时间
-     */
     public void setClockInTime(Date clockInTime) {
         this.clockInTime = clockInTime;
     }
 
-    /**
-     * 发起时间
-     */
     public Date getCreateTime() {
         return createTime;
     }
 
-    /**
-     * 发起时间
-     */
     public void setCreateTime(Date createTime) {
         this.createTime = createTime;
     }
-}
+
+    public String getLongitude() {
+        return longitude;
+    }
+
+    public void setLongitude(String longitude) {
+        this.longitude = longitude;
+    }
+
+    public String getLatitude() {
+        return latitude;
+    }
+
+    public void setLatitude(String latitude) {
+        this.latitude = latitude;
+    }
+
+    public String getDistrictName() {
+        return districtName;
+    }
+
+    public void setDistrictName(String districtName) {
+        this.districtName = districtName;
+    }
+
+}
+