Pārlūkot izejas kodu

代码生成,企业后台功能

xiao547607 4 gadi atpakaļ
vecāks
revīzija
d58adc816c

+ 18 - 0
common/src/main/java/com/jpsoft/enterprise/modules/base/dao/IndustryInfoDAO.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.IndustryInfo;
+import java.util.Map;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+
+@Repository
+public interface IndustryInfoDAO {
+	int insert(IndustryInfo entity);
+	int update(IndustryInfo entity);
+	int exist(String id);
+	IndustryInfo get(String id);
+	int delete(String id);
+	List<IndustryInfo> list();
+	List<IndustryInfo> search(Map<String, Object> searchParams, List<Sort> sortList);
+}

+ 8 - 0
common/src/main/java/com/jpsoft/enterprise/modules/base/entity/CompanyInfo.java

@@ -23,6 +23,8 @@ public class CompanyInfo {
     private String companyName;
     @ApiModelProperty(value = "公司类型(1:企联会员,2:分会企业)")
     private String type;
+    @ApiModelProperty(value = "字典:企业类型")
+    private String typeN;
     @ApiModelProperty(value = "logo地址")
     private String logoUrl;
     @ApiModelProperty(value = "社会信用代码")
@@ -33,10 +35,16 @@ public class CompanyInfo {
     private String businessLicenseUrl;
     @ApiModelProperty(value = "企业规模(1:1-50人,2:50-100人,3:100人以上)")
     private String scale;
+    @ApiModelProperty(value = "字典:企业规模")
+    private String scaleN;
     @ApiModelProperty(value = "所属行业(1:计算机/IT,2:食品加工,3:服务业)")
     private String industry;
+    @ApiModelProperty(value = "字典:所属行业")
+    private String industryN;
     @ApiModelProperty(value = "所在地区(1:荆州区,2:沙市区,3:开发区,4:石首市)")
     private String region;
+    @ApiModelProperty(value = "字典:区域")
+    private String regionN;
     @ApiModelProperty(value = "公司介绍")
     private String companyIntroduction;
     @ApiModelProperty(value = "企业家介绍")

+ 39 - 0
common/src/main/java/com/jpsoft/enterprise/modules/base/entity/IndustryInfo.java

@@ -0,0 +1,39 @@
+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_industry_info的实体类
+ */
+@Data
+@ApiModel(value = "base_industry_info的实体类")
+public class IndustryInfo {
+        @ApiModelProperty(value = "")
+    private String id;
+        @ApiModelProperty(value = "行业名称")
+    private String industryName;
+        @ApiModelProperty(value = "父id")
+    private String parentId;
+        @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/IndustryInfoService.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.IndustryInfo;
+import com.github.pagehelper.Page;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+
+public interface IndustryInfoService {
+	IndustryInfo get(String id);
+	boolean exist(String id);
+	int insert(IndustryInfo model);
+	int update(IndustryInfo model);
+	int delete(String id);
+	List<IndustryInfo> list();
+	Page<IndustryInfo> 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/IndustryInfoServiceImpl.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.IndustryInfoDAO;
+import com.jpsoft.enterprise.modules.base.entity.IndustryInfo;
+import com.jpsoft.enterprise.modules.base.service.IndustryInfoService;
+import com.github.pagehelper.Page;
+import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.github.pagehelper.PageHelper;
+
+@Transactional
+@Component(value="industryInfoService")
+public class IndustryInfoServiceImpl implements IndustryInfoService {
+	@Resource(name="industryInfoDAO")
+	private IndustryInfoDAO industryInfoDAO;
+
+	@Override
+	public IndustryInfo get(String id) {
+		// TODO Auto-generated method stub
+		return industryInfoDAO.get(id);
+	}
+
+	@Override
+	public int insert(IndustryInfo model) {
+		// TODO Auto-generated method stub
+		//model.setId(UUID.randomUUID().toString());
+		
+		return industryInfoDAO.insert(model);
+	}
+
+	@Override
+	public int update(IndustryInfo model) {
+		// TODO Auto-generated method stub
+		return industryInfoDAO.update(model);		
+	}
+
+	@Override
+	public int delete(String id) {
+		// TODO Auto-generated method stub
+		return industryInfoDAO.delete(id);
+	}
+
+	@Override
+	public boolean exist(String id) {
+		// TODO Auto-generated method stub
+		int count = industryInfoDAO.exist(id);
+		
+		return count > 0 ? true : false;
+	}
+	
+	@Override
+	public List<IndustryInfo> list() {
+		// TODO Auto-generated method stub
+		return industryInfoDAO.list();
+	}
+		
+	@Override
+	public Page<IndustryInfo> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {
+        Page<IndustryInfo> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
+            industryInfoDAO.search(searchParams,sortList);
+        });
+        
+        return page;
+	}
+}

+ 3 - 0
common/src/main/resources/mapper/base/CompanyInfo.xml

@@ -128,6 +128,9 @@
 			<if test="searchParams.id != null">
 				and ID_ like #{searchParams.id}
 			</if>
+			<if test="searchParams.companyName != null">
+				and company_name like #{searchParams.companyName}
+			</if>
 			<if test="searchParams.region != null">
 				and region_ = #{searchParams.region}
 			</if>

+ 91 - 0
common/src/main/resources/mapper/base/IndustryInfo.xml

@@ -0,0 +1,91 @@
+<?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.IndustryInfoDAO">
+	<resultMap id="IndustryInfoMap" type="com.jpsoft.enterprise.modules.base.entity.IndustryInfo">
+		<id property="id" column="id_" />
+			<result property="industryName" column="industry_name" />
+			<result property="parentId" column="parent_id" />
+			<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.IndustryInfo">
+	<!--
+	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+		select sys_guid() from dual
+	</selectKey>
+	-->
+	<![CDATA[
+		insert into base_industry_info
+	    (id_,industry_name,parent_id,create_by,create_time,update_by,update_time,del_flag)
+		values
+		(
+#{id,jdbcType=VARCHAR}
+,#{industryName,jdbcType=VARCHAR}
+,#{parentId,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_industry_info where id_=#{id,jdbcType=VARCHAR}
+	</delete>
+	<update id="update" parameterType="com.jpsoft.enterprise.modules.base.entity.IndustryInfo">
+		update base_industry_info
+		<set>
+				<if test="industryName!=null">
+		industry_name=#{industryName,jdbcType=VARCHAR},
+		</if>
+				<if test="parentId!=null">
+		parent_id=#{parentId,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="IndustryInfoMap">
+		select 
+id_,industry_name,parent_id,create_by,create_time,update_by,update_time,del_flag		from base_industry_info where id_=#{0}
+	</select>
+	<select id="exist" parameterType="string" resultType="int">
+		select count(*) from base_industry_info where id_=#{0}
+	</select>
+	<select id="list" resultMap="IndustryInfoMap">
+		select * from base_industry_info
+	</select>
+	<select id="search" parameterType="hashmap" resultMap="IndustryInfoMap">
+		<![CDATA[
+			select * from base_industry_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>

+ 37 - 4
web/src/main/java/com/jpsoft/enterprise/modules/base/controller/CompanyInfoController.java

@@ -6,6 +6,7 @@ import com.jpsoft.enterprise.modules.base.service.CompanyInfoService;
 import com.jpsoft.enterprise.modules.common.dto.MessageResult;
 import com.jpsoft.enterprise.modules.common.utils.PojoUtils;
 import com.jpsoft.enterprise.modules.common.dto.Sort;
+import com.jpsoft.enterprise.modules.sys.service.DataDictionaryService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
@@ -18,6 +19,10 @@ import javax.servlet.http.HttpServletRequest;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
+/**
+ * 企业管理
+ * sz
+ */
 @RestController
 @RequestMapping("/base/companyInfo")
 @Api(description = "companyInfo")
@@ -26,6 +31,8 @@ public class CompanyInfoController {
 
     @Autowired
     private CompanyInfoService companyInfoService;
+    @Autowired
+    private DataDictionaryService dataDictionaryService;
 
     @ApiOperation(value="创建空记录")
     @GetMapping("create")
@@ -196,7 +203,11 @@ public class CompanyInfoController {
     @ApiOperation(value="列表")
     @RequestMapping(value = "pageList",method = RequestMethod.POST)
     public MessageResult<Map> pageList(
-            String id,
+            @RequestParam(value="companyName",defaultValue="") String companyName,
+            @RequestParam(value="type",defaultValue="") String type,
+            @RequestParam(value="industry",defaultValue="") String industry,
+            @RequestParam(value="scale",defaultValue="") String scale,
+            @RequestParam(value="region",defaultValue="") String region,
             @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
             @RequestParam(value="pageSize",defaultValue="20") int pageSize,
             @RequestAttribute String subject){
@@ -209,13 +220,35 @@ public class CompanyInfoController {
         Map<String,Object> searchParams = new HashMap<>();
 
         List<Sort> sortList = new ArrayList<>();
-        sortList.add(new Sort("id_","asc"));
+        sortList.add(new Sort("create_time","desc"));
+
+        if (StringUtils.isNotEmpty(companyName)) {
+            searchParams.put("companyName","%" + companyName + "%");
+        }
+
+        if (StringUtils.isNotEmpty(type)) {
+            searchParams.put("type",type);
+        }
 
-        if (StringUtils.isNotEmpty(id)) {
-            searchParams.put("id","%" + id + "%");
+        if (StringUtils.isNotEmpty(industry)) {
+            searchParams.put("industry",industry);
+        }
+
+        if (StringUtils.isNotEmpty(scale)) {
+            searchParams.put("scale",scale);
+        }
+
+        if (StringUtils.isNotEmpty(region)) {
+            searchParams.put("region",region);
         }
 
         Page<CompanyInfo> page = companyInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
+        for(CompanyInfo ci : page.getResult()){
+            ci.setIndustryN(dataDictionaryService.findNameByCatalogNameAndValue("所属行业",ci.getIndustry()));
+            ci.setTypeN(dataDictionaryService.findNameByCatalogNameAndValue("企业类型",ci.getType()));
+            ci.setScaleN(dataDictionaryService.findNameByCatalogNameAndValue("企业规模",ci.getScale()));
+            ci.setRegionN(dataDictionaryService.findNameByCatalogNameAndValue("区域",ci.getRegion()));
+        }
 
         msgResult.setResult(true);
         msgResult.setData(PojoUtils.pageWrapper(page));