1
0
gushoubang 2 місяців тому
батько
коміт
a76e52f746

+ 35 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/domain/Jsgcghxk.java

@@ -0,0 +1,35 @@
+package com.siwei.apply.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 建设工程规划许可对象 t_jsgcghxk
+ */
+@Data
+public class Jsgcghxk {
+    private String id; // 主键
+    private String projectId; // 项目ID
+    private String ydwz; // 用地位置
+    private String qs; // 期数
+    private String jsgm; // 建设规模
+    private String zsbh; // 证书编号
+    private String fzjg; // 发证机关
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date fzDate; // 发证日期
+    private String attachment; // 附件
+    private Boolean hasOnchain; // 是否上链
+    private String creatorId; // 创建人ID
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createdAt; // 创建时间
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updatedAt; // 更新时间
+
+    public void generateId() {
+        this.id = java.util.UUID.randomUUID().toString();
+    }
+}

+ 17 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/mapper/JsgcghxkMapper.java

@@ -0,0 +1,17 @@
+package com.siwei.apply.mapper;
+
+import com.siwei.apply.domain.Jsgcghxk;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 建设工程规划许可 Mapper接口
+ */
+@Mapper
+public interface JsgcghxkMapper {
+    String add(Jsgcghxk jsgcghxk);
+
+    Jsgcghxk get(@Param("id") String id);
+
+    void update(Jsgcghxk jsgcghxk);
+}

+ 14 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/JsgcghxkService.java

@@ -0,0 +1,14 @@
+package com.siwei.apply.service;
+
+import com.siwei.apply.domain.Jsgcghxk;
+
+/**
+ * 建设工程规划许可 服务接口
+ */
+public interface JsgcghxkService {
+    String add(Jsgcghxk jsgcghxk);
+
+    Jsgcghxk get(String id);
+
+    void update(Jsgcghxk jsgcghxk);
+}

+ 37 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/impl/JsgcghxkServiceImpl.java

@@ -0,0 +1,37 @@
+package com.siwei.apply.service.impl;
+
+import com.siwei.apply.domain.Jsgcghxk;
+import com.siwei.apply.mapper.JsgcghxkMapper;
+import com.siwei.apply.service.JsgcghxkService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import static com.siwei.apply.common.Common.UserId;
+
+/**
+ * 建设工程规划许可 服务实现类
+ */
+@Service
+public class JsgcghxkServiceImpl implements JsgcghxkService {
+
+    @Autowired
+    private JsgcghxkMapper jsgcghxkMapper;
+
+    @Override
+    public String add(Jsgcghxk jsgcghxk) {
+        jsgcghxk.generateId();
+        jsgcghxk.setCreatorId(UserId);
+        jsgcghxkMapper.add(jsgcghxk);
+        return jsgcghxk.getId();
+    }
+
+    @Override
+    public Jsgcghxk get(String id) {
+        return jsgcghxkMapper.get(id);
+    }
+
+    @Override
+    public void update(Jsgcghxk jsgcghxk) {
+        jsgcghxkMapper.update(jsgcghxk);
+    }
+}

+ 59 - 0
siwei-modules/siwei-apply/src/main/resources/mapper/JsgcghxkMapper.xml

@@ -0,0 +1,59 @@
+<?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.siwei.apply.mapper.JsgcghxkMapper">
+
+    <!-- ResultMap 映射 -->
+    <resultMap id="JsgcghxkResultMap" type="com.siwei.apply.domain.Jsgcghxk">
+        <id property="id" column="id"/>
+        <result property="projectId" column="project_id"/>
+        <result property="ydwz" column="ydwz"/>
+        <result property="qs" column="qs"/>
+        <result property="jsgm" column="jsgm"/>
+        <result property="zsbh" column="zsbh"/>
+        <result property="fzjg" column="fzjg"/>
+        <result property="fzDate" column="fz_date"/>
+        <result property="attachment" column="attachment" typeHandler="com.siwei.apply.handler.JsonbTypeHandler"/>
+        <result property="hasOnchain" column="has_onchain"/>
+        <result property="creatorId" column="creator_id"/>
+        <result property="createdAt" column="created_at"/>
+        <result property="updatedAt" column="updated_at"/>
+    </resultMap>
+
+    <!-- 新增 -->
+    <insert id="add" parameterType="com.siwei.apply.domain.Jsgcghxk">
+        INSERT INTO t_jsgcghxk (id, project_id, ydwz, qs, jsgm, zsbh, fzjg, fz_date, has_onchain,
+                                creator_id, created_at, updated_at)
+        VALUES (#{id}, #{projectId}, #{ydwz}, #{qs}, #{jsgm}, #{zsbh}, #{fzjg}, #{fzDate},
+                #{hasOnchain}, #{creatorId}, #{createdAt}, #{updatedAt})
+    </insert>
+
+    <!-- 查询 -->
+    <select id="get" resultMap="JsgcghxkResultMap">
+        SELECT *
+        FROM t_jsgcghxk
+        WHERE id = #{id}
+    </select>
+
+    <!-- 更新 -->
+    <update id="update" parameterType="com.siwei.apply.domain.Jsgcghxk">
+        UPDATE t_jsgcghxk
+        <set>
+            <if test="projectId != null">project_id = #{projectId},</if>
+            <if test="ydwz != null">ydwz = #{ydwz},</if>
+            <if test="qs != null">qs = #{qs},</if>
+            <if test="jsgm != null">jsgm = #{jsgm},</if>
+            <if test="zsbh != null">zsbh = #{zsbh},</if>
+            <if test="fzjg != null">fzjg = #{fzjg},</if>
+            <if test="fzDate != null">fz_date = #{fzDate},</if>
+            <if test="hasOnchain != null">has_onchain = #{hasOnchain},</if>
+            <if test="creatorId != null">creator_id = #{creatorId},</if>
+            <if test="createdAt != null">created_at = #{createdAt},</if>
+            updated_at = now()
+        </set>
+        WHERE id = #{id}
+    </update>
+
+</mapper>