// Path: src/main/java/com/zhaidaosi/game/server/model/action/AttackAction.java
// public class AttackAction extends BaseAction {
// 
//     public static int ID = 1;
// 
//     private int level = 1;
// 
//     private int minDamage;
// 
//     private int maxDamage;
// 
//     public AttackAction() {
//         super(ID, "基本攻击");
//     }
// 
//     @Override
//     public void doAction(Object self, Object target, BaseHandlerChannel ch) {
//         Player selfPlayer = (Player) self;
//         Player targetPlayer = (Player) target;
//         int damage = minDamage + new java.util.Random().nextInt(maxDamage - minDamage);
//         targetPlayer.setHp(targetPlayer.getHp() - damage);
//         if (targetPlayer.getHp() < 0) {
//             targetPlayer.setHp(0);
//         }
//         String format = "%1$s 使用 %2$s(%3$d级) 攻击 %4$s 造成 %5$d 点伤害";
//         String msg = String.format(format, selfPlayer.getName(), this.getName(), this.getLevel(), targetPlayer.getName(), damage);
//         ch.writeGroup(Duel.write(msg, Duel.MSG, self, target));
//     }
// 
//     public int getMinDamage() {
//         return minDamage;
//     }
// 
//     public void setMinDamage(int minDamage) {
//         this.minDamage = minDamage;
//     }
// 
//     public int getMaxDamage() {
//         return maxDamage;
//     }
// 
//     public void setMaxDamage(int maxDamage) {
//         this.maxDamage = maxDamage;
//     }
// 
//     public int getLevel() {
//         return level;
//     }
// 
//     public void setLevel(int level) {
//         this.level = level;
//         this.maxDamage = 30 * level;
//         this.minDamage = 15 * level;
//     }
// 
// 
// }
// 
// Path: src/main/java/com/zhaidaosi/game/server/rsync/UserInfoRsync.java
// public class UserInfoRsync extends BaseRsync {
// 
//     private static final Logger log = LoggerFactory.getLogger(UserInfoRsync.class);
// 
//     @Override
//     public void runRsync() {
//         UserInfoService service = (UserInfoService) ServiceManager.getService(UserInfoService.BEAN_ID);
//         for (Map.Entry<Integer, IBaseModel> entry : rsyncMap.entrySet()) {
//             UserInfo userInfo = (UserInfo) entry.getValue();
//             service.update(userInfo);
//             log.info("rsync => " + userInfo);
//         }
//     }
// 
// }
// 
// Path: src/main/java/com/zhaidaosi/game/server/sdm/dao/UserInfoDAO.java
// @Repository
// public class UserInfoDAO extends BaseDao {
//     // property constants
//     public static final String UID = "uid";
//     public static final String NICKNAME = "nickname";
//     public static final String LEVEL = "level";
//     public static final String EXPERIENCE = "experience";
//     public static final String ACTIONS = "actions";
// 
//     public UserInfoDAO() {
//         super.setTableName("user_info");
//         super.setModelName("UserInfo");
//     }
// 
// }


import java.util.HashMap;
import java.util.Map;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import com.zhaidaosi.game.jgframework.common.BaseJson;
import com.zhaidaosi.game.jgframework.common.sdm.BaseService;
import com.zhaidaosi.game.jgframework.common.sdm.IBaseModel;
import com.zhaidaosi.game.jgframework.rsync.RsyncManager;
import com.zhaidaosi.game.server.model.action.AttackAction;
import com.zhaidaosi.game.server.rsync.UserInfoRsync;
import com.zhaidaosi.game.server.sdm.dao.UserInfoDAO;
package com.zhaidaosi.game.server.sdm.service;





public class UserInfoService extends BaseService {

    public final static String BEAN_ID = "userInfoService";

    @Autowired
    protected UserInfoDAO dao;

    @PostConstruct
    protected void setDao() {
        super.setDao(dao);
    }

    public IBaseModel findByUid(int uid) {
// Path: src/main/java/com/zhaidaosi/game/server/model/action/AttackAction.java
// public class AttackAction extends BaseAction {
// 
//     public static int ID = 1;
// 
//     private int level = 1;
// 
//     private int minDamage;
// 
//     private int maxDamage;
// 
//     public AttackAction() {
//         super(ID, "基本攻击");
//     }
// 
//     @Override
//     public void doAction(Object self, Object target, BaseHandlerChannel ch) {
//         Player selfPlayer = (Player) self;
//         Player targetPlayer = (Player) target;
//         int damage = minDamage + new java.util.Random().nextInt(maxDamage - minDamage);
//         targetPlayer.setHp(targetPlayer.getHp() - damage);
//         if (targetPlayer.getHp() < 0) {
//             targetPlayer.setHp(0);
//         }
//         String format = "%1$s 使用 %2$s(%3$d级) 攻击 %4$s 造成 %5$d 点伤害";
//         String msg = String.format(format, selfPlayer.getName(), this.getName(), this.getLevel(), targetPlayer.getName(), damage);
//         ch.writeGroup(Duel.write(msg, Duel.MSG, self, target));
//     }
// 
//     public int getMinDamage() {
//         return minDamage;
//     }
// 
//     public void setMinDamage(int minDamage) {
//         this.minDamage = minDamage;
//     }
// 
//     public int getMaxDamage() {
//         return maxDamage;
//     }
// 
//     public void setMaxDamage(int maxDamage) {
//         this.maxDamage = maxDamage;
//     }
// 
//     public int getLevel() {
//         return level;
//     }
// 
//     public void setLevel(int level) {
//         this.level = level;
//         this.maxDamage = 30 * level;
//         this.minDamage = 15 * level;
//     }
// 
// 
// }
// 
// Path: src/main/java/com/zhaidaosi/game/server/rsync/UserInfoRsync.java
// public class UserInfoRsync extends BaseRsync {
// 
//     private static final Logger log = LoggerFactory.getLogger(UserInfoRsync.class);
// 
//     @Override
//     public void runRsync() {
//         UserInfoService service = (UserInfoService) ServiceManager.getService(UserInfoService.BEAN_ID);
//         for (Map.Entry<Integer, IBaseModel> entry : rsyncMap.entrySet()) {
//             UserInfo userInfo = (UserInfo) entry.getValue();
//             service.update(userInfo);
//             log.info("rsync => " + userInfo);
//         }
//     }
// 
// }
// 
// Path: src/main/java/com/zhaidaosi/game/server/sdm/dao/UserInfoDAO.java
// @Repository
// public class UserInfoDAO extends BaseDao {
//     // property constants
//     public static final String UID = "uid";
//     public static final String NICKNAME = "nickname";
//     public static final String LEVEL = "level";
//     public static final String EXPERIENCE = "experience";
//     public static final String ACTIONS = "actions";
// 
//     public UserInfoDAO() {
//         super.setTableName("user_info");
//         super.setModelName("UserInfo");
//     }
// 
// }


// Path: src/main/java/com/zhaidaosi/game/server/sdm/service/UserInfoService.java
import java.util.HashMap;
import java.util.Map;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import com.zhaidaosi.game.jgframework.common.BaseJson;
import com.zhaidaosi.game.jgframework.common.sdm.BaseService;
import com.zhaidaosi.game.jgframework.common.sdm.IBaseModel;
import com.zhaidaosi.game.jgframework.rsync.RsyncManager;
import com.zhaidaosi.game.server.model.action.AttackAction;
import com.zhaidaosi.game.server.rsync.UserInfoRsync;
import com.zhaidaosi.game.server.sdm.dao.UserInfoDAO;

package com.zhaidaosi.game.server.sdm.service;





public class UserInfoService extends BaseService {

    public final static String BEAN_ID = "userInfoService";

    @Autowired
    protected UserInfoDAO dao;

    @PostConstruct
    protected void setDao() {
        super.setDao(dao);
    }

    public IBaseModel findByUid(int uid) {
        IBaseModel model = RsyncManager.get(uid, UserInfoRsync.class);