Pārlūkot izejas kodu

用户管理功能逻辑删除修改

git-svn-id: https://192.168.57.71/svn/jsgkj@984 931142cf-59ea-a443-aa0e-51397b428577
ld_zhouk 8 gadi atpakaļ
vecāks
revīzija
c8647f8a19

+ 2 - 2
gkaqv2/trunk/modules/frame/src/main/java/com/xt/js/gkaq/frame/service/UserGroupService.java

@@ -2,14 +2,14 @@ package com.xt.js.gkaq.frame.service;
 
 import java.util.List;
 
-import com.xt.js.gkaq.common.BaseService;
+import com.xt.js.gkaq.common.BaseUUIDModelService;
 import com.xt.js.gkaq.frame.model.UserGroupModel;
 
 /**
  * Óû§·Ö×éÐÅÏ¢·þÎñ½Ó¿Ú
  * 
  */
-public interface UserGroupService extends BaseService<UserGroupModel> {
+public interface UserGroupService extends BaseUUIDModelService<UserGroupModel> {
 
     public List<UserGroupModel> findByUserId(String userId);
     

+ 2 - 2
gkaqv2/trunk/modules/frame/src/main/java/com/xt/js/gkaq/frame/service/UserInfoService.java

@@ -1,12 +1,12 @@
 package com.xt.js.gkaq.frame.service;
 
-import com.xt.js.gkaq.common.BaseService;
+import com.xt.js.gkaq.common.BaseUUIDModelService;
 import com.xt.js.gkaq.frame.model.UserInfoModel;
 
 /**
  * Óû§»ù´¡ÐÅÏ¢·þÎñ½Ó¿Ú
  * 
  */
-public interface UserInfoService extends BaseService<UserInfoModel> {
+public interface UserInfoService extends BaseUUIDModelService<UserInfoModel> {
 
 }

+ 20 - 2
gkaqv2/trunk/modules/frame/src/main/java/com/xt/js/gkaq/frame/service/impl/UserInfoServiceImpl.java

@@ -1,16 +1,22 @@
 package com.xt.js.gkaq.frame.service.impl;
 
+import java.util.Date;
+
+import org.apache.shiro.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import com.xt.js.gkaq.common.BaseMapper;
-import com.xt.js.gkaq.common.BaseServiceImpl;
+import com.xt.js.gkaq.common.BaseUUIDModel;
+import com.xt.js.gkaq.common.BaseUUIDModelServiceImpl;
+import com.xt.js.gkaq.common.User;
 import com.xt.js.gkaq.frame.mappers.UserInfoModelMapper;
 import com.xt.js.gkaq.frame.model.UserInfoModel;
 import com.xt.js.gkaq.frame.service.UserInfoService;
 
 @Service
-public class UserInfoServiceImpl extends BaseServiceImpl<UserInfoModel> implements UserInfoService {
+public class UserInfoServiceImpl extends BaseUUIDModelServiceImpl<UserInfoModel> implements UserInfoService {
 
     @Autowired
 	private UserInfoModelMapper mapper;
@@ -20,4 +26,16 @@ public class UserInfoServiceImpl extends BaseServiceImpl<UserInfoModel> implemen
 		return mapper;
 	}
 
+    @Override
+    @Transactional
+    public int add(UserInfoModel record) {
+        Date now = new Date();
+        record.setCreateTime(now);
+        record.setUpdateTime(now);
+        User u = (User) SecurityUtils.getSubject().getPrincipal();
+        record.setCreateUser(u.getLoginName());
+        record.setUpdateUser(u.getLoginName());
+        record.setState(BaseUUIDModel.STATE_DRAFT);
+        return mapper.insert(record);
+    }
 }

+ 5 - 2
gkaqv2/trunk/modules/frame/src/main/resources/com/xt/js/gkaq/frame/mappers/UserModelMapper.xml

@@ -56,11 +56,12 @@
 		where ID = #{id,jdbcType=VARCHAR}
 	</select>
 	<select id="selectByLoginName" parameterType="java.lang.String"
-		resultMap="BaseResultMap">
+		resultMap="BaseResultMap">
+		<bind name="STATE_DEL" value="@com.xt.js.gkaq.common.BaseUUIDModel@STATE_DELETE"/>
 		select ID, REAL_NAME, LOGIN_NAME, LOGIN_PASSWORD, ORGID, SEX, PHONE, EMAIL,
 		CREATE_TIME,UPDATE_TIME, STATE,CREATE_USER,UPDATE_USER
 		from AQ_BASIC_FRAME_USER
-		where LOGIN_NAME = #{loginName,jdbcType=VARCHAR}
+		where LOGIN_NAME = #{loginName,jdbcType=VARCHAR} and STATE != #{STATE_DEL}
 	</select>
 	<select id="selectAll" resultMap="BaseResultMap">
 		select ID, REAL_NAME, LOGIN_NAME, LOGIN_PASSWORD, ORGID, SEX, PHONE, EMAIL,
@@ -102,9 +103,11 @@
 		)
 	</select>
   	<select id="selectAllByCond" resultMap="BaseResultMap" parameterType="com.xt.js.gkaq.frame.model.UserModel" >
+		<bind name="STATE_DEL" value="@com.xt.js.gkaq.common.BaseUUIDModel@STATE_DELETE"/>
 		select ID, REAL_NAME, LOGIN_NAME, LOGIN_PASSWORD, ORGID, SEX, PHONE, EMAIL
 		from AQ_BASIC_FRAME_USER
     	<where>
+			STATE != #{STATE_DEL}
 		    <if test="realName != null and realName != ''">
 		        and REAL_NAME like #{realName,jdbcType=VARCHAR}
 		    </if>