Parcourir la source

完成党群服务表,茶园工业区特色表

zhao il y a 7 mois
Parent
commit
85498dc4cc

+ 52 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/controller/PartyServiceController.java

@@ -0,0 +1,52 @@
+package com.example.nngkxxdp.controller;
+
+import com.example.nngkxxdp.entity.PartyService;
+import com.example.nngkxxdp.service.PartyServiceService;
+import com.example.nngkxxdp.util.BaseResult;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.List;
+
+@RestController
+@RequestMapping("/partyService")
+public class PartyServiceController {
+    @Autowired
+    private PartyServiceService partyServiceService;
+
+    //查询全部
+    @GetMapping
+    public List<PartyService> findAll() {
+        return partyServiceService.findAll();
+    }
+
+    @GetMapping("/listAll/{pid}")
+    public BaseResult findByParkId(@PathVariable("pid")Long id) {
+        HashMap<String, Object> byParkId = partyServiceService.findByParkId(id);
+        return BaseResult.ok(byParkId);
+    }
+
+    //根据id查询
+    @GetMapping("/{id}")
+    public PartyService findById(@PathVariable("id")Long id) {
+        return partyServiceService.findById(id);
+    }
+
+    //添加或修改
+    @PutMapping
+    public void addOrUpdate(@RequestBody PartyService partyService) {
+        if( partyService.getId()==null){
+            partyServiceService.insert(partyService);
+        }else{
+            partyServiceService.update(partyService);
+        }
+    }
+
+    //根据id删除数据
+    @DeleteMapping("/{id}")
+    public String deleteById(@PathVariable("id")Long id) {
+        partyServiceService.deleteById(id);
+        return "删除成功";
+    }
+}

+ 49 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/controller/SpecialServiceController.java

@@ -0,0 +1,49 @@
+package com.example.nngkxxdp.controller;
+
+import com.example.nngkxxdp.entity.SpecialService;
+import com.example.nngkxxdp.service.SpecialServiceService;
+import com.example.nngkxxdp.util.BaseResult;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@RequestMapping("/specialService")
+public class SpecialServiceController {
+    @Autowired
+    private SpecialServiceService specialServiceService;
+
+    //查询全部
+    @GetMapping
+    public BaseResult findAll() {
+        return BaseResult.ok(specialServiceService.findAll());
+    }
+
+
+    @GetMapping("/listAll/{pid}")
+    public BaseResult findByParkId(@PathVariable("pid")Long id) {
+        return BaseResult.ok(specialServiceService.findByParkId(id));
+    }
+
+    //根据id查询
+    @GetMapping("/{id}")
+    public SpecialService findById(@PathVariable("id")Long id) {
+        return specialServiceService.findById(id);
+    }
+
+    //添加或修改
+    @PutMapping
+    public void addOrUpdate(@RequestBody SpecialService specialService) {
+        if( specialService.getId()==null){
+            specialServiceService.insert(specialService);
+        }else{
+            specialServiceService.update(specialService);
+        }
+    }
+
+    //根据id删除数据
+    @DeleteMapping("/{id}")
+    public String deleteById(@PathVariable("id")Long id) {
+        specialServiceService.deleteById(id);
+        return "删除成功";
+    }
+}

+ 38 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/dao/PartyServiceDao.java

@@ -0,0 +1,38 @@
+package com.example.nngkxxdp.dao;
+
+import com.example.nngkxxdp.entity.ParkData;
+import com.example.nngkxxdp.entity.PartyService;
+
+import java.util.List;
+
+/**
+* @author zhao
+* @description 针对表【t_party_service】的数据库操作Mapper
+* @createDate 2024-09-19 10:25:11
+* @Entity com.example.nngkxxdp.entity.PartyService
+*/
+public interface PartyServiceDao {
+
+    //查询全部
+    List<PartyService> findAll();
+
+    //根据id查询
+    PartyService findById(Long id);
+
+    //添加
+    void insert(PartyService partyService);
+
+    //修改
+    void update(PartyService partyService);
+
+    //根据Id删除一条数据
+    void deleteById(Long id);
+
+    List<PartyService> findByParkId(Long id);
+
+    ParkData findParkData(Long id);
+}
+
+
+
+

+ 37 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/dao/SpecialServiceDao.java

@@ -0,0 +1,37 @@
+package com.example.nngkxxdp.dao;
+
+import com.example.nngkxxdp.entity.ParkData;
+import com.example.nngkxxdp.entity.SpecialService;
+
+import java.util.List;
+
+/**
+* @author zhao
+* @description 针对表【t_special_service】的数据库操作Mapper
+* @createDate 2024-09-19 10:16:30
+* @Entity com.example.nngkxxdp.entity.SpecialService
+*/
+public interface SpecialServiceDao {
+    //查询全部
+    List<SpecialService> findAll();
+
+    //根据id查询
+    SpecialService findById(Long id);
+
+    //添加
+    void insert(SpecialService specialService);
+
+    //修改
+    void update(SpecialService specialService);
+
+    //根据Id删除一条数据
+    void deleteById(Long id);
+
+    List<SpecialService> findByParkId(Long id);
+
+    ParkData findParkData(Long id);
+}
+
+
+
+

+ 4 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/entity/ParkData.java

@@ -13,6 +13,10 @@ public class ParkData implements Serializable {
     private String totalArea;
     private String buildArea;
     private String industry;
+    private String desc;
     private String addr;
+    private String contacts;
+    private String contactsPhone;
+    private String contactsAddr;
     private Date creatTime;
 }

+ 64 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/entity/PartyService.java

@@ -0,0 +1,64 @@
+package com.example.nngkxxdp.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 
+ * @TableName t_party_service
+ */
+
+@Data
+public class PartyService implements Serializable {
+    /**
+     * 党群服务表id
+     */
+
+    private Integer id;
+
+    /**
+     * 1.党建服务事项  2.工会服务事项  3.统战服务事项
+     */
+    private String partyForm;
+
+    /**
+     * 表格内容
+     */
+    private String information;
+
+    /**
+     * 联系人
+     */
+    private String contacts;
+
+    /**
+     * 联系人电话
+     */
+    private String contactsPhone;
+
+    /**
+     * 联系人地址
+     */
+    private String contactsAddr;
+
+    /**
+     * 联系人职能
+     */
+    private String contactsFunction;
+
+    /**
+     * 建会工作
+     */
+    private String createWork;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    private Long parkId;
+    private ParkData parkData;
+    private static final long serialVersionUID = 1L;
+}

+ 39 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/entity/SpecialService.java

@@ -0,0 +1,39 @@
+package com.example.nngkxxdp.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 
+ * @TableName t_special_service
+ */
+
+@Data
+public class SpecialService implements Serializable {
+    /**
+     * 茶园工业园区特色服务id
+     */
+
+    private Integer id;
+
+    /**
+     * 1.载体服务  2.政策申报服务 3.市场服务  4.企业人才服务  5.投融资服务 
+     */
+    private String parkForm;
+
+    /**
+     * 表格内容
+     */
+    private String information;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    private Long parkId;
+    private ParkData parkData;
+    private static final long serialVersionUID = 1L;
+}

+ 31 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/service/PartyServiceService.java

@@ -0,0 +1,31 @@
+package com.example.nngkxxdp.service;
+
+import com.example.nngkxxdp.entity.PartyService;
+
+import java.util.HashMap;
+import java.util.List;
+
+/**
+* @author zhao
+* @description 针对表【t_party_service】的数据库操作Service
+* @createDate 2024-09-19 10:25:11
+*/
+public interface PartyServiceService{
+    //查询全部
+    List<PartyService> findAll();
+
+    //根据id查询
+    PartyService findById(Long id);
+
+    //添加
+    void insert(PartyService partyService);
+
+    //修改
+    void update(PartyService partyService);
+
+    //根据Id删除一条数据
+    void deleteById(Long id);
+
+
+    HashMap<String,Object> findByParkId(Long id);
+}

+ 30 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/service/SpecialServiceService.java

@@ -0,0 +1,30 @@
+package com.example.nngkxxdp.service;
+
+import com.example.nngkxxdp.entity.SpecialService;
+import com.example.nngkxxdp.util.BaseResult;
+
+import java.util.List;
+
+/**
+* @author zhao
+* @description 针对表【t_special_service】的数据库操作Service
+* @createDate 2024-09-19 10:16:30
+*/
+public interface SpecialServiceService{
+    //查询全部
+    List<SpecialService> findAll();
+
+    //根据id查询
+    SpecialService findById(Long id);
+
+    //添加
+    void insert(SpecialService specialService);
+
+    //修改
+    void update(SpecialService specialService);
+
+    //根据Id删除一条数据
+    void deleteById(Long id);
+
+    BaseResult findByParkId(Long id);
+}

+ 65 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/service/impl/PartyServiceServiceImpl.java

@@ -0,0 +1,65 @@
+package com.example.nngkxxdp.service.impl;
+
+import com.example.nngkxxdp.dao.PartyServiceDao;
+import com.example.nngkxxdp.entity.ParkData;
+import com.example.nngkxxdp.entity.PartyService;
+import com.example.nngkxxdp.service.PartyServiceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+* @author zhao
+* @description 针对表【t_party_service】的数据库操作Service实现
+* @createDate 2024-09-19 10:25:11
+*/
+@Service
+public class PartyServiceServiceImpl implements PartyServiceService{
+    @Autowired
+    private PartyServiceDao  partyServiceDao;
+
+    @Override
+    public List<PartyService> findAll() {
+        return partyServiceDao.findAll();
+    }
+
+    @Override
+    public PartyService findById(Long id) {
+        return partyServiceDao.findById(id);
+    }
+
+    @Override
+    public void insert(PartyService partyService) {
+        partyService.setCreateTime(new Date());
+        partyServiceDao.insert(partyService);
+    }
+
+    @Override
+    public void update(PartyService partyService) {
+        partyServiceDao.update(partyService);
+    }
+
+    @Override
+    public void deleteById(Long id) {
+        partyServiceDao.deleteById(id);
+    }
+
+    @Override
+    public HashMap<String, Object> findByParkId(Long id) {
+        List<PartyService> list = partyServiceDao.findByParkId(id);
+        ParkData parkData = partyServiceDao.findParkData(id);
+        HashMap<String, Object> map = new HashMap<>();
+        map.put("PartyServiceList",list);
+        map.put("parkData",parkData);
+        return map;
+    }
+
+
+}
+
+
+
+

+ 60 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/service/impl/SpecialServiceServiceImpl.java

@@ -0,0 +1,60 @@
+package com.example.nngkxxdp.service.impl;
+
+import com.example.nngkxxdp.dao.SpecialServiceDao;
+import com.example.nngkxxdp.entity.ParkData;
+import com.example.nngkxxdp.entity.SpecialService;
+import com.example.nngkxxdp.service.SpecialServiceService;
+import com.example.nngkxxdp.util.BaseResult;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+* @author zhao
+* @description 针对表【t_special_service】的数据库操作Service实现
+* @createDate 2024-09-19 10:16:30
+*/
+@Service
+public class SpecialServiceServiceImpl implements SpecialServiceService{
+    @Autowired
+    private SpecialServiceDao specialServiceDao;
+
+    @Override
+    public List<SpecialService> findAll() {
+        return specialServiceDao.findAll();
+    }
+
+    @Override
+    public SpecialService findById(Long id) {
+        return specialServiceDao.findById(id);
+    }
+
+    @Override
+    public void insert(SpecialService specialService) {
+        specialService.setCreateTime(new Date());
+        specialServiceDao.insert(specialService);
+    }
+
+    @Override
+    public void update(SpecialService specialService) {
+        specialServiceDao.update(specialService);
+    }
+
+    @Override
+    public void deleteById(Long id) {
+        specialServiceDao.deleteById(id);
+    }
+
+    @Override
+    public BaseResult findByParkId(Long id) {
+        List<SpecialService> list= specialServiceDao.findByParkId(id);
+        ParkData parkData = specialServiceDao.findParkData(id);
+        return BaseResult.ok(list,parkData);
+    }
+}
+
+
+
+

+ 26 - 0
nngkxxdp/src/main/java/com/example/nngkxxdp/util/BaseResult.java

@@ -1,7 +1,11 @@
 package com.example.nngkxxdp.util;
 
+import com.example.nngkxxdp.entity.ParkData;
+import com.example.nngkxxdp.entity.SpecialService;
+
 import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author zhoupeng
@@ -14,6 +18,7 @@ public class BaseResult implements Serializable {
     private String result;
     private Object data;
     private String success;
+    private Object parkData;
 
     public static String getResultOk() {
         return "ok";
@@ -27,6 +32,18 @@ public class BaseResult implements Serializable {
         return "成功操作";
     }
 
+    public Object getParkData() {
+        return parkData;
+    }
+
+    public void setParkData(Object parkData) {
+        this.parkData = parkData;
+    }
+
+    public static BaseResult ok(List<SpecialService> list, ParkData parkData) {
+        return createResults("ok", list, parkData);
+    }
+
     public String getResult() {
         return this.result;
     }
@@ -63,6 +80,7 @@ public class BaseResult implements Serializable {
         return createResult("ok", data, "成功操作");
     }
 
+
     public static BaseResult notOk() {
         return createResult("not_ok", null, "");
     }
@@ -86,4 +104,12 @@ public class BaseResult implements Serializable {
         baseResult.setSuccess(success);
         return baseResult;
     }
+
+    private static BaseResult createResults(String result, Object data, Object datas) {
+        BaseResult baseResult = new BaseResult();
+        baseResult.setResult(result);
+        baseResult.setData(data);
+        baseResult.setParkData(datas);
+        return baseResult;
+    }
 }

+ 6 - 2
nngkxxdp/src/main/resources/mapper/ParkDataDao.xml

@@ -20,8 +20,8 @@
 
     <!-- 添加首页展示数据 -->
     <insert id="insert" parameterType="com.example.nngkxxdp.entity.ParkData" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
-        insert into t_park_data(title, subtitle, total_area, build_area, industry, addr, creat_time)
-        values (#{title}, #{subtitle}, #{totalArea}, #{buildArea}, #{industry}, #{addr}, #{creatTime})
+        insert into t_park_data(title, subtitle, total_area, build_area, industry,desc, addr,contacts, contacts_phone, contacts_addr, creat_time)
+        values (#{title}, #{subtitle}, #{totalArea}, #{buildArea}, #{industry},#{desc}, #{addr},#{contacts},#{contactsPhone},#{contactsAddr}, #{creatTime})
     </insert>
 
     <!-- 更新首页展示数据 -->
@@ -32,6 +32,10 @@
             total_area = #{totalArea},
             build_area = #{buildArea},
             industry = #{industry},
+            desc = #{desc},
+            contacts_addr = #{contactsAddr},
+            contacts = #{contacts},
+            contacts_phone = #{contactsPhone},
             addr = #{addr}
         where id = #{id}
     </update>

+ 67 - 0
nngkxxdp/src/main/resources/mapper/PartyServiceDao.xml

@@ -0,0 +1,67 @@
+<?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.example.nngkxxdp.dao.PartyServiceDao">
+
+    <resultMap id="BaseResultMap" type="com.example.nngkxxdp.entity.PartyService">
+            <id property="id" column="id" jdbcType="INTEGER"/>
+            <result property="partyForm" column="party_form" jdbcType="VARCHAR"/>
+            <result property="information" column="information" jdbcType="VARCHAR"/>
+            <result property="contacts" column="contacts" jdbcType="VARCHAR"/>
+            <result property="contactsPhone" column="contacts_phone" jdbcType="VARCHAR"/>
+            <result property="contactsAddr" column="contacts_addr" jdbcType="VARCHAR"/>
+            <result property="contactsFunction" column="contacts_function" jdbcType="VARCHAR"/>
+            <result property="createWork" column="create_work" jdbcType="VARCHAR"/>
+            <result property="parkId" column="parkId" jdbcType="INTEGER"/>
+            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <association property="parkData" javaType="com.example.nngkxxdp.entity.ParkData">
+            <result column="title" property="title"/>
+            <result column="id" property="id"/>
+            <result column="industry" property="industry"/>
+            <result column="contacts" property="contacts"/>
+            <result column="contacts_phone" property="contactsPhone"/>
+            <result column="contacts_addr" property="contactsAddr"/>
+            <result column="parkAddr" property="addr"/>
+        </association>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,party_form,information,
+        contacts,contacts_phone,contacts_addr,
+        contacts_function,create_work,parkId,create_time
+    </sql>
+    <insert id="insert">
+        insert into t_party_service(party_form,information,contacts,contacts_phone,contacts_addr,contacts_function,create_work,parkId,create_time)
+        values(#{partyForm},#{information},#{contacts},#{contactsPhone},#{contactsAddr},#{contactsFunction},#{createWork},#{parkId},#{createTime})
+    </insert>
+    <update id="update">
+        update t_party_service
+        set party_form = #{partyForm},
+            information = #{information},
+            contacts = #{contacts},
+            contacts_phone = #{contactsPhone},
+            contacts_addr = #{contactsAddr},
+            contacts_function = #{contactsFunction},
+            parkId = #{parkId},
+            create_work = #{createWork}
+        where id = #{id}
+    </update>
+    <delete id="deleteById">
+        delete from t_party_service where id = #{id}
+    </delete>
+    <select id="findAll" resultType="com.example.nngkxxdp.entity.PartyService">
+        select ps.*,pd.contacts,pd.contacts_phone,pd.contacts_addr,pd.title
+        from t_party_service ps
+        left join t_park_data pd on pd.id=ps.parkId
+    </select>
+    <select id="findById" resultType="com.example.nngkxxdp.entity.PartyService">
+        select * from t_party_service where id = #{id}
+    </select>
+    <select id="findByParkId" resultType="com.example.nngkxxdp.entity.PartyService">
+        select * from t_party_service where parkId = #{id}
+    </select>
+    <select id="findParkData" resultType="com.example.nngkxxdp.entity.ParkData">
+        select pd.contacts,pd.contacts_phone,pd.contacts_addr from t_park_data pd where id = #{id}
+    </select>
+</mapper>

+ 4 - 2
nngkxxdp/src/main/resources/mapper/SellBuildDao.xml

@@ -69,8 +69,10 @@
     <delete id="deleteById">
         delete from t_sell_build where id = #{id}
     </delete>
-    <select id="findAll" resultType="com.example.nngkxxdp.entity.SellBuild">
-        select * from t_sell_build
+    <select id="findAll" resultType="com.example.nngkxxdp.entity.SellBuild" resultMap="BaseResultMap">
+        select sb.*, sb.addr as landAddr,pd.title,pd.industry, pd.addr as parkAddr
+        from t_sell_build  sb
+        left join t_park_data pd on pd.id=sb.belong
     </select>
     <select id="findById" resultType="com.example.nngkxxdp.entity.SellBuild" resultMap="BaseResultMap">
         select sb.*, sb.addr as landAddr,pd.title,pd.industry, pd.addr as parkAddr

+ 59 - 0
nngkxxdp/src/main/resources/mapper/SpecialServiceDao.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.example.nngkxxdp.dao.SpecialServiceDao">
+
+    <resultMap id="BaseResultMap" type="com.example.nngkxxdp.entity.SpecialService">
+            <id property="id" column="id" jdbcType="INTEGER"/>
+            <result property="parkForm" column="park_form" jdbcType="VARCHAR"/>
+            <result property="information" column="information" jdbcType="VARCHAR"/>
+            <result property="parkId" column="parkId" jdbcType="INTEGER"/>
+            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <association property="parkData" javaType="com.example.nngkxxdp.entity.ParkData">
+            <result column="title" property="title"/>
+            <result column="id" property="id"/>
+            <result column="industry" property="industry"/>
+            <result column="contacts" property="contacts"/>
+            <result column="contacts_phone" property="contactsPhone"/>
+            <result column="contacts_addr" property="contactsAddr"/>
+            <result column="parkAddr" property="addr"/>
+        </association>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,park_form,information,parkId,
+        create_time
+    </sql>
+    <insert id="insert">
+        insert into t_special_service(park_form,information,parkId,create_time)
+        values(#{parkForm},#{information},#{parkId},#{createTime})
+    </insert>
+    <update id="update">
+        update t_special_service
+        set park_form = #{parkForm},
+            information = #{information},
+            parkId = #{parkId}
+        where id = #{id}
+    </update>
+    <delete id="deleteById">
+        delete from t_special_service where id = #{id}
+    </delete>
+    <select id="findAll" resultType="com.example.nngkxxdp.entity.SpecialService" resultMap="BaseResultMap">
+        /*select * from t_special_service*/
+        select ss.*,pd.contacts,pd.contacts_phone,pd.contacts_addr,pd.title from
+        t_special_service ss
+        left join t_park_data pd on pd.id=ss.parkId
+    </select>
+    <select id="findById" resultType="com.example.nngkxxdp.entity.SpecialService">
+        select * from t_special_service where id = #{id}
+    </select>
+
+
+    <select id="findByParkId" resultType="com.example.nngkxxdp.entity.SpecialService">
+        select * from t_special_service where parkId = #{parkId}
+    </select>
+    <select id="findParkData" resultType="com.example.nngkxxdp.entity.ParkData">
+        select * from t_park_data  where id = #{parkId}
+    </select>
+</mapper>