浏览代码

代码生成

xiao547607 4 年之前
父节点
当前提交
33c49204ee

+ 18 - 0
common/src/main/java/com/jpsoft/enterprise/modules/base/dao/EnterpriseInfoDAO.java

@@ -0,0 +1,18 @@
+package com.jpsoft.enterprise.modules.base.dao;
+
+import java.util.List;
+import org.springframework.stereotype.Repository;
+import com.jpsoft.enterprise.modules.base.entity.EnterpriseInfo;
+import java.util.Map;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+
+@Repository
+public interface EnterpriseInfoDAO {
+	int insert(EnterpriseInfo entity);
+	int update(EnterpriseInfo entity);
+	int exist(String id);
+	EnterpriseInfo get(String id);
+	int delete(String id);
+	List<EnterpriseInfo> list();
+	List<EnterpriseInfo> search(Map<String, Object> searchParams, List<Sort> sortList);
+}

+ 49 - 0
common/src/main/java/com/jpsoft/enterprise/modules/base/entity/EnterpriseInfo.java

@@ -0,0 +1,49 @@
+package com.jpsoft.enterprise.modules.base.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.text.SimpleDateFormat;
+import java.math.BigDecimal;
+import org.springframework.format.annotation.DateTimeFormat;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+/**
+  描述:base_enterprise_info的实体类
+ */
+@Data
+@ApiModel(value = "base_enterprise_info的实体类")
+public class EnterpriseInfo {
+        @ApiModelProperty(value = "")
+    private String id;
+        @ApiModelProperty(value = "企联简介")
+    private String enterpriseIntroduction;
+        @ApiModelProperty(value = "企联章程")
+    private String enterpriseConstitution;
+        @ApiModelProperty(value = "组织架构")
+    private String organStructure;
+        @ApiModelProperty(value = "基本职能")
+    private String basicFunction;
+        @ApiModelProperty(value = "负责人及分工")
+    private String chargePerson;
+        @ApiModelProperty(value = "分会简介")
+    private String branchIntroduction;
+        @ApiModelProperty(value = "联系方式")
+    private String contactInformation;
+        @ApiModelProperty(value = "创建人")
+    private String createBy;
+        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+        @ApiModelProperty(value = "更新人")
+    private String updateBy;
+        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
+	    @ApiModelProperty(value = "更新时间")
+    private Date updateTime;
+        @ApiModelProperty(value = "是否删除")
+    private Boolean delFlag;
+}

+ 17 - 0
common/src/main/java/com/jpsoft/enterprise/modules/base/service/EnterpriseInfoService.java

@@ -0,0 +1,17 @@
+package com.jpsoft.enterprise.modules.base.service;
+
+import java.util.List;
+import java.util.Map;
+import com.jpsoft.enterprise.modules.base.entity.EnterpriseInfo;
+import com.github.pagehelper.Page;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+
+public interface EnterpriseInfoService {
+	EnterpriseInfo get(String id);
+	boolean exist(String id);
+	int insert(EnterpriseInfo model);
+	int update(EnterpriseInfo model);
+	int delete(String id);
+	List<EnterpriseInfo> list();
+	Page<EnterpriseInfo> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
+}

+ 70 - 0
common/src/main/java/com/jpsoft/enterprise/modules/base/service/impl/EnterpriseInfoServiceImpl.java

@@ -0,0 +1,70 @@
+package com.jpsoft.enterprise.modules.base.service.impl;
+
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import javax.annotation.Resource;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.jpsoft.enterprise.modules.base.dao.EnterpriseInfoDAO;
+import com.jpsoft.enterprise.modules.base.entity.EnterpriseInfo;
+import com.jpsoft.enterprise.modules.base.service.EnterpriseInfoService;
+import com.github.pagehelper.Page;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value="enterpriseInfoService")
+public class EnterpriseInfoServiceImpl implements EnterpriseInfoService {
+	@Resource(name="enterpriseInfoDAO")
+	private EnterpriseInfoDAO enterpriseInfoDAO;
+
+	@Override
+	public EnterpriseInfo get(String id) {
+		// TODO Auto-generated method stub
+		return enterpriseInfoDAO.get(id);
+	}
+
+	@Override
+	public int insert(EnterpriseInfo model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+		
+		return enterpriseInfoDAO.insert(model);
+	}
+
+	@Override
+	public int update(EnterpriseInfo model) {
+		// TODO Auto-generated method stub
+		return enterpriseInfoDAO.update(model);		
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return enterpriseInfoDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = enterpriseInfoDAO.exist(id);
+		
+		return count > 0 ? true : false;
+	}
+	
+	@Override
+	public List<EnterpriseInfo> list() {
+		// TODO Auto-generated method stub
+		return enterpriseInfoDAO.list();
+	}
+		
+	@Override
+	public Page<EnterpriseInfo> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {
+        Page<EnterpriseInfo> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
+            enterpriseInfoDAO.search(searchParams,sortList);
+        });
+        
+        return page;
+	}
+}

+ 116 - 0
common/src/main/resources/mapper/base/EnterpriseInfo.xml

@@ -0,0 +1,116 @@
+<?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">
+<!-- namespace必须指向DAO接口 -->
+<mapper namespace="com.jpsoft.enterprise.modules.base.dao.EnterpriseInfoDAO">
+	<resultMap id="EnterpriseInfoMap" type="com.jpsoft.enterprise.modules.base.entity.EnterpriseInfo">
+		<id property="id" column="id_" />
+			<result property="enterpriseIntroduction" column="enterprise_introduction" />
+			<result property="enterpriseConstitution" column="enterprise_constitution" />
+			<result property="organStructure" column="organ_structure" />
+			<result property="basicFunction" column="basic_function" />
+			<result property="chargePerson" column="charge_person" />
+			<result property="branchIntroduction" column="branch_introduction" />
+			<result property="contactInformation" column="contact_information" />
+			<result property="createBy" column="create_by" />
+			<result property="createTime" column="create_time" />
+			<result property="updateBy" column="update_by" />
+			<result property="updateTime" column="update_time" />
+			<result property="delFlag" column="del_flag" />
+			</resultMap>
+	<insert id="insert" parameterType="com.jpsoft.enterprise.modules.base.entity.EnterpriseInfo">
+	<!--
+	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+		select sys_guid() from dual
+	</selectKey>
+	-->
+	<![CDATA[
+		insert into base_enterprise_info
+	    (id_,enterprise_introduction,enterprise_constitution,organ_structure,basic_function,charge_person,branch_introduction,contact_information,create_by,create_time,update_by,update_time,del_flag)
+		values
+		(
+#{id,jdbcType=VARCHAR}
+,#{enterpriseIntroduction,jdbcType=VARCHAR}
+,#{enterpriseConstitution,jdbcType=VARCHAR}
+,#{organStructure,jdbcType=VARCHAR}
+,#{basicFunction,jdbcType=VARCHAR}
+,#{chargePerson,jdbcType=VARCHAR}
+,#{branchIntroduction,jdbcType=VARCHAR}
+,#{contactInformation,jdbcType=VARCHAR}
+,#{createBy,jdbcType=VARCHAR}
+,#{createTime,jdbcType= TIMESTAMP }
+,#{updateBy,jdbcType=VARCHAR}
+,#{updateTime,jdbcType= TIMESTAMP }
+,#{delFlag,jdbcType= NUMERIC }
+		)
+	]]>
+	</insert>
+	<delete id="delete" parameterType="string">
+		delete from base_enterprise_info where id_=#{id,jdbcType=VARCHAR}
+	</delete>
+	<update id="update" parameterType="com.jpsoft.enterprise.modules.base.entity.EnterpriseInfo">
+		update base_enterprise_info
+		<set>
+				<if test="enterpriseIntroduction!=null">
+		enterprise_introduction=#{enterpriseIntroduction,jdbcType=VARCHAR},
+		</if>
+				<if test="enterpriseConstitution!=null">
+		enterprise_constitution=#{enterpriseConstitution,jdbcType=VARCHAR},
+		</if>
+				<if test="organStructure!=null">
+		organ_structure=#{organStructure,jdbcType=VARCHAR},
+		</if>
+				<if test="basicFunction!=null">
+		basic_function=#{basicFunction,jdbcType=VARCHAR},
+		</if>
+				<if test="chargePerson!=null">
+		charge_person=#{chargePerson,jdbcType=VARCHAR},
+		</if>
+				<if test="branchIntroduction!=null">
+		branch_introduction=#{branchIntroduction,jdbcType=VARCHAR},
+		</if>
+				<if test="contactInformation!=null">
+		contact_information=#{contactInformation,jdbcType=VARCHAR},
+		</if>
+				<if test="createBy!=null">
+		create_by=#{createBy,jdbcType=VARCHAR},
+		</if>
+				<if test="createTime!=null">
+		create_time=#{createTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="updateBy!=null">
+		update_by=#{updateBy,jdbcType=VARCHAR},
+		</if>
+				<if test="updateTime!=null">
+		update_time=#{updateTime,jdbcType= TIMESTAMP },
+		</if>
+				<if test="delFlag!=null">
+		del_flag=#{delFlag,jdbcType= NUMERIC },
+		</if>
+		</set>
+	where id_=#{id}
+	</update>
+	<select id="get" parameterType="string" resultMap="EnterpriseInfoMap">
+		select 
+id_,enterprise_introduction,enterprise_constitution,organ_structure,basic_function,charge_person,branch_introduction,contact_information,create_by,create_time,update_by,update_time,del_flag		from base_enterprise_info where id_=#{0}
+	</select>
+	<select id="exist" parameterType="string" resultType="int">
+		select count(*) from base_enterprise_info where id_=#{0}
+	</select>
+	<select id="list" resultMap="EnterpriseInfoMap">
+		select * from base_enterprise_info
+	</select>
+	<select id="search" parameterType="hashmap" resultMap="EnterpriseInfoMap">
+		<![CDATA[
+			select * from base_enterprise_info
+		]]>
+		<where>
+			<if test="searchParams.id != null">
+				and ID_ like #{searchParams.id}
+			</if>
+		</where>
+		<foreach item="sort" collection="sortList"  open="order by" separator=",">
+	        ${sort.name} ${sort.order}
+	 	</foreach>
+	</select>
+</mapper>