Commit 846eb32e authored by Quxl's avatar Quxl

x

parent 17e7a2af
......@@ -17,6 +17,7 @@ import com.egolm.film.bean.Fc_admin_group;
import com.egolm.film.bean.Fc_admin_group_filmtype;
import com.egolm.film.bean.Fc_admin_group_menu;
import com.egolm.film.bean.Fc_admin_menu;
import com.egolm.film.config.XRException;
import com.egolm.film.util.Common;
import com.egolm.film.util.SqlWhere;
......@@ -65,8 +66,13 @@ public class AdminAuthServiceImpl implements AdminAuthService {
@Override
public void saveAdmin(Fc_admin admin) {
jdbcTemplate.save(admin);
jdbcTemplate.executeUpdate("update fc_admin_group set user_num = user_num + 1 where group_id = ?", admin.getGroup_id());
int count = jdbcTemplate.queryForInt("select count(*) from fc_admin where username = ?", admin.getUsername());
if(count == 0) {
jdbcTemplate.save(admin);
jdbcTemplate.executeUpdate("update fc_admin_group set user_num = user_num + 1 where group_id = ?", admin.getGroup_id());
} else {
throw new XRException("用户名已存在");
}
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment