tomatozq 5 lat temu
rodzic
commit
c7f9b386ba

+ 6 - 2
src/main/java/com/jpsoft/smart/listener/WebStateListener.java

@@ -19,7 +19,9 @@ public class WebStateListener implements ServletContextListener {
         // TODO Auto-generated method stub
         System.out.println("web应用销毁");
 
-//        tcpServer.stop();
+        if(tcpServer!=null) {
+            tcpServer.stop();
+        }
     }
 
     @Override
@@ -27,6 +29,8 @@ public class WebStateListener implements ServletContextListener {
         // TODO Auto-generated method stub
         System.out.println("web应用初始化");
 
-//        tcpServer.start();
+        if(tcpServer!=null) {
+            tcpServer.start();
+        }
     }
 }

+ 40 - 0
src/main/java/com/jpsoft/smart/modules/base/controller/EmployeeInfoController.java

@@ -146,6 +146,46 @@ public class EmployeeInfoController {
     }
 
 
+    @ApiOperation(value="批量删除")
+    @PostMapping("batchDelete")
+    @ResponseBody
+    public MessageResult<Integer> batchDelete(@RequestBody List<Long> idList,@RequestAttribute String subject){
+        MessageResult<Integer> msgResult = new MessageResult<>();
+
+        try {
+            int affectCount = 0;
+
+            for (Long id : idList) {
+                EmployeeInfo employeeInfo = employeeInfoService.get(id);
+
+                if(employeeInfo!=null) {
+                    employeeInfo.setDelFlag(true);
+                    employeeInfo.setUpdateBy(subject);
+                    employeeInfo.setUpdateTime(new Date());
+
+                    affectCount += employeeInfoService.update(employeeInfo);
+                }
+            }
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(affectCount);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("删除失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
     @ApiOperation(value="分页列表")
     @RequestMapping(value = "pageList",method = RequestMethod.POST)
     @ResponseBody

+ 1 - 1
src/main/resources/mapper/base/EmployeeInfo.xml

@@ -101,7 +101,7 @@
 			from base_employee_info e,base_company_info c
 		]]>
         <where>
-            e.company_id = c.id_ and c.del_flag=0
+            e.company_id = c.id_ and e.del_flag=0
             <if test="searchParams.employeeName != null">
                 and e.name_ like #{searchParams.employeeName}
             </if>

+ 134 - 129
src/main/resources/mapper/sys/DataDictionary.xml

@@ -1,150 +1,155 @@
 <?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">
 <!-- namespace必须指向DAO接口 -->
 <mapper namespace="com.jpsoft.smart.modules.sys.dao.DataDictionaryDAO">
-	<resultMap id="DataDictionaryMap" type="DataDictionary">
-		<id property="id" column="id_" />
-			<result property="name" column="name_" />
-			<result property="value" column="value_" />
-			<result property="sortNo" column="sort_no" />
-			<result property="parentId" column="parent_id" />
-			<result property="parentName" column="parent_name"/>
-			<result property="dataType" column="data_type" />
-			<result property="createBy" column="create_by" />
-			<result property="createDate" column="create_date" />
-			<result property="updateBy" column="update_by" />
-			<result property="updateDate" column="update_date" />
-			<result property="activated" column="activated_" />
-			<result property="delFlag" column="del_flag"/>
-			</resultMap>
-	<insert id="insert" parameterType="DataDictionary">
-	<!--
-	<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
-		select sys_guid() from dual
-	</selectKey>
-	-->
-	<![CDATA[
+    <resultMap id="DataDictionaryMap" type="com.jpsoft.smart.modules.sys.entity.DataDictionary">
+        <id property="id" column="id_"/>
+        <result property="name" column="name_"/>
+        <result property="value" column="value_"/>
+        <result property="sortNo" column="sort_no"/>
+        <result property="parentId" column="parent_id"/>
+        <result property="parentName" column="parent_name"/>
+        <result property="dataType" column="data_type"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createDate" column="create_date"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateDate" column="update_date"/>
+        <result property="activated" column="activated_"/>
+        <result property="delFlag" column="del_flag"/>
+    </resultMap>
+    <insert id="insert" parameterType="com.jpsoft.smart.modules.sys.entity.DataDictionary">
+        <!--
+        <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
+            select sys_guid() from dual
+        </selectKey>
+        -->
+        <![CDATA[
 		insert into sys_data_dictionary
 	    (id_,name_,value_,sort_no,parent_id,data_type,create_by,create_date,update_by,update_date,activated_,del_flag)
 		values
 		(
-#{id,jdbcType=VARCHAR}
-,#{name,jdbcType=VARCHAR}
-,#{value,jdbcType=VARCHAR}
-,#{sortNo,jdbcType= NUMERIC }
-,#{parentId,jdbcType=VARCHAR}
-,#{dataType,jdbcType= NUMERIC }
-,#{createBy,jdbcType=VARCHAR}
-,#{createDate,jdbcType= TIMESTAMP }
-,#{updateBy,jdbcType=VARCHAR}
-,#{updateDate,jdbcType= TIMESTAMP }
-,#{activated,jdbcType= NUMERIC }
-,#{delFlag,jdbcType= NUMERIC }
+            #{id,jdbcType=VARCHAR}
+            ,#{name,jdbcType=VARCHAR}
+            ,#{value,jdbcType=VARCHAR}
+            ,#{sortNo,jdbcType= NUMERIC }
+            ,#{parentId,jdbcType=VARCHAR}
+            ,#{dataType,jdbcType= NUMERIC }
+            ,#{createBy,jdbcType=VARCHAR}
+            ,#{createDate,jdbcType= TIMESTAMP }
+            ,#{updateBy,jdbcType=VARCHAR}
+            ,#{updateDate,jdbcType= TIMESTAMP }
+            ,#{activated,jdbcType= NUMERIC }
+            ,#{delFlag,jdbcType= NUMERIC }
 		)
 	]]>
-	</insert>
-	<delete id="delete" parameterType="string">
-		delete from sys_data_dictionary where id_=#{id,jdbcType=VARCHAR}
-	</delete>
-	<update id="update" parameterType="DataDictionary">
-		update sys_data_dictionary
-		<set>
-				<if test="name!=null">
-		name_=#{name,jdbcType=VARCHAR},
-		</if>
-				<if test="value!=null">
-		value_=#{value,jdbcType=VARCHAR},
-		</if>
-				<if test="sortNo!=null">
-		sort_no=#{sortNo,jdbcType= NUMERIC },
-		</if>
-				<if test="parentId!=null">
-		parent_id=#{parentId,jdbcType=VARCHAR},
-		</if>
-			<if test="dataType!=null">
-				data_type=#{dataType,jdbcType= NUMERIC },
-			</if>
-			<if test="createBy!=null">
-				create_by=#{createBy,jdbcType=VARCHAR},
-			</if>
-			<if test="createDate!=null">
-				create_date=#{createDate,jdbcType= TIMESTAMP },
-			</if>
-			<if test="updateBy!=null">
-				update_by=#{updateBy,jdbcType=VARCHAR},
-			</if>
-			<if test="updateDate!=null">
-				update_date=#{updateDate,jdbcType= TIMESTAMP },
-			</if>
-			<if test="activated!=null">
-				activated_=#{activated,jdbcType= NUMERIC },
-			</if>
-			<if test="delFlag!=null">
-				del_flag=#{delFlag,jdbcType= NUMERIC },
-			</if>
-		</set>
-	where id_=#{id}
-	</update>
-	<select id="get" parameterType="string" resultMap="DataDictionaryMap">
-		select a.*,b.name_ as parent_name
-		from sys_data_dictionary a left join sys_data_dictionary b on a.parent_id = b.id_
-		where a.id_=#{0} and a.del_flag = 0
-	</select>
-	<select id="exist" parameterType="string" resultType="int">
-		select count(*) from sys_data_dictionary where id_=#{0} and del_flag = 0
-	</select>
-	<select id="list" resultMap="DataDictionaryMap">
-		select * from sys_data_dictionary where del_flag = 0
-	</select>
-	<select id="search" parameterType="hashmap" resultMap="DataDictionaryMap">
-		<![CDATA[
+    </insert>
+    <delete id="delete" parameterType="string">
+        delete from sys_data_dictionary where id_=#{id,jdbcType=VARCHAR}
+    </delete>
+    <update id="update" parameterType="com.jpsoft.smart.modules.sys.entity.DataDictionary">
+        update sys_data_dictionary
+        <set>
+            <if test="name!=null">
+                name_=#{name,jdbcType=VARCHAR},
+            </if>
+            <if test="value!=null">
+                value_=#{value,jdbcType=VARCHAR},
+            </if>
+            <if test="sortNo!=null">
+                sort_no=#{sortNo,jdbcType= NUMERIC },
+            </if>
+            <if test="parentId!=null">
+                parent_id=#{parentId,jdbcType=VARCHAR},
+            </if>
+            <if test="dataType!=null">
+                data_type=#{dataType,jdbcType= NUMERIC },
+            </if>
+            <if test="createBy!=null">
+                create_by=#{createBy,jdbcType=VARCHAR},
+            </if>
+            <if test="createDate!=null">
+                create_date=#{createDate,jdbcType= TIMESTAMP },
+            </if>
+            <if test="updateBy!=null">
+                update_by=#{updateBy,jdbcType=VARCHAR},
+            </if>
+            <if test="updateDate!=null">
+                update_date=#{updateDate,jdbcType= TIMESTAMP },
+            </if>
+            <if test="activated!=null">
+                activated_=#{activated,jdbcType= NUMERIC },
+            </if>
+            <if test="delFlag!=null">
+                del_flag=#{delFlag,jdbcType= NUMERIC },
+            </if>
+        </set>
+        where id_=#{id}
+    </update>
+    <select id="get" parameterType="string" resultMap="DataDictionaryMap">
+        select a.*,b.name_ as parent_name
+        from sys_data_dictionary a left join sys_data_dictionary b on a.parent_id = b.id_
+        where a.id_=#{0} and a.del_flag = 0
+    </select>
+    <select id="exist" parameterType="string" resultType="int">
+        select count(*) from sys_data_dictionary where id_=#{0} and del_flag = 0
+    </select>
+    <select id="list" resultMap="DataDictionaryMap">
+        select * from sys_data_dictionary where del_flag = 0
+    </select>
+    <select id="search" parameterType="hashmap" resultMap="DataDictionaryMap">
+        <![CDATA[
 			SELECT
 				a.*,b.name_ AS parent_name
 			FROM
 				sys_data_dictionary a
 			LEFT JOIN sys_data_dictionary b ON a.parent_id = b.id_
 		]]>
-		<where>
-				a.del_flag = 0
-			<if test="searchParams.id != null">
-				and a.ID_ like #{searchParams.id}
-			</if>
-			<if test="searchParams.name != null">
-				and a.name_ like #{searchParams.name}
-			</if>
-			<if test="searchParams.excludeId != null">
-				<![CDATA[
+        <where>
+            a.del_flag = 0
+            <if test="searchParams.id != null">
+                and a.ID_ like #{searchParams.id}
+            </if>
+            <if test="searchParams.name != null">
+                and a.name_ like #{searchParams.name}
+            </if>
+            <if test="searchParams.excludeId != null">
+                <![CDATA[
 				and a.ID_ <> #{searchParams.excludeId}
 				]]>
-			</if>
-			<if test="searchParams.dataType != null">
-				and a.data_type = #{searchParams.dataType}
-			</if>
+            </if>
+            <if test="searchParams.dataType != null">
+                and a.data_type = #{searchParams.dataType}
+            </if>
+            <if test="searchParams.parentId != null">
+                <![CDATA[
+				and a.parent_id = #{searchParams.parentId}
+				]]>
+            </if>
 
-		</where>
-		<foreach item="sort" collection="sortList"  open="order by" separator=",">
-	        ${sort.name} ${sort.order}
-	 	</foreach>
-	</select>
+        </where>
+        <foreach item="sort" collection="sortList" open="order by" separator=",">
+            ${sort.name} ${sort.order}
+        </foreach>
+    </select>
 
-	<select id="queryChildren" resultType="java.util.HashMap" parameterType="string" >
-		SELECT
-		a.id_ as id,a.name_ as name,a.value_ as value
-		FROM
-		sys_data_dictionary a where a.del_flag = 0
-		and data_type = 2
-		and a.parent_id = #{0}
-	</select>
+    <select id="queryChildren" resultType="java.util.HashMap" parameterType="string">
+        SELECT
+        a.id_ as id,a.name_ as name,a.value_ as value
+        FROM
+        sys_data_dictionary a where a.del_flag = 0
+        and data_type = 2
+        and a.parent_id = #{0}
+    </select>
 
-	<select id="getName" parameterType="string" resultType="string">
-		select a.name_ as name
-		from sys_data_dictionary a
-		where a.id_=#{0} and a.del_flag = 0
-	</select>
-	<select id="getValue" parameterType="string" resultType="string">
-		select a.value_ as value
-		from sys_data_dictionary a
-		where a.id_=#{0} and a.del_flag = 0
-	</select>
+    <select id="getName" parameterType="string" resultType="string">
+        select a.name_ as name
+        from sys_data_dictionary a
+        where a.id_=#{0} and a.del_flag = 0
+    </select>
+    <select id="getValue" parameterType="string" resultType="string">
+        select a.value_ as value
+        from sys_data_dictionary a
+        where a.id_=#{0} and a.del_flag = 0
+    </select>
 </mapper>

+ 2 - 2
src/main/resources/mapper/sys/Menu.xml

@@ -18,7 +18,7 @@
         <result property="updateBy" column="update_by"/>
         <result property="delFlag" column="del_flag"/>
     </resultMap>
-    <insert id="insert" parameterType="Menu">
+    <insert id="insert" parameterType="com.jpsoft.smart.modules.sys.entity.Menu">
         <!--
         <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
             select sys_guid() from dual
@@ -133,7 +133,7 @@
         and rm.menu_id = m.id_
         )
         <if test="parentId==null">
-            and m.parent_id is null
+            and (m.parent_id is null or m.parent_id='')
         </if>
         <if test="parentId!=null">
             and m.parent_id = #{parentId}