Browse Source

proyecto inventario jakarta base de datos modificaciones

master
chore 6 months ago
parent
commit
e3cb0963b4
  1. BIN
      baseSC.mwb
  2. BIN
      baseSC.mwb.bak
  3. 176
      ejecutableDB.sql
  4. 3
      si-ejb/src/java/hola/BL/UsuarioBL.java

BIN
baseSC.mwb

Binary file not shown.

BIN
baseSC.mwb.bak

Binary file not shown.

176
ejecutableDB.sql

@ -1,5 +1,5 @@
-- MySQL Script generated by MySQL Workbench
-- Fri May 3 12:31:54 2024
-- Fri May 10 08:25:34 2024
-- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering
@ -15,41 +15,42 @@ SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,N
-- Schema sistemadeinventario
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `sistemadeinventario` DEFAULT CHARACTER SET utf8 ;
USE `sistemadeinventario` ;
-- -----------------------------------------------------
-- Table `sistemadeinventario`.`departamento`
-- Schema sistemadeinventario
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`departamento` (
`id` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(20) NULL,
`anaquel` VARCHAR(15) NULL,
`status` INT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Schema sistemadeinventario
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `sistemadeinventario` DEFAULT CHARACTER SET utf8 ;
USE `sistemadeinventario` ;
-- -----------------------------------------------------
-- Table `sistemadeinventario`.`tipo`
-- Table `sistemadeinventario`.`Registro`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`tipo` (
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`Registro` (
`id` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(20) NULL,
`status` INT NULL,
`Entrada` VARCHAR(10) NULL DEFAULT NULL,
`salida` VARCHAR(10) NULL DEFAULT NULL,
`Alta` VARCHAR(45) NULL DEFAULT NULL,
`baja` VARCHAR(45) NULL DEFAULT NULL,
`status` INT NULL DEFAULT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `sistemadeinventario`.`marca`
-- Table `sistemadeinventario`.`departamento`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`marca` (
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`departamento` (
`id` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(20) NULL,
`status` INT NULL,
`rutafoto` VARCHAR(100) NULL,
`nombre` VARCHAR(20) NULL DEFAULT NULL,
`anaquel` VARCHAR(15) NULL DEFAULT NULL,
`status` INT NULL DEFAULT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
ENGINE = InnoDB
AUTO_INCREMENT = 2
DEFAULT CHARACTER SET = utf8mb3;
-- -----------------------------------------------------
@ -57,9 +58,11 @@ ENGINE = InnoDB;
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`pais` (
`id` INT NOT NULL,
`nombre` VARCHAR(45) NULL,
`nombre` VARCHAR(45) NULL DEFAULT NULL,
`status` INT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;
-- -----------------------------------------------------
@ -67,16 +70,28 @@ ENGINE = InnoDB;
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`estado` (
`id` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(45) NULL,
`nombre` VARCHAR(45) NULL DEFAULT NULL,
`pais_idpais` INT NOT NULL,
`status` INT NULL,
PRIMARY KEY (`id`),
INDEX `fk_estado_pais1_idx` (`pais_idpais` ASC) VISIBLE,
CONSTRAINT `fk_estado_pais1`
FOREIGN KEY (`pais_idpais`)
REFERENCES `sistemadeinventario`.`pais` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
REFERENCES `sistemadeinventario`.`pais` (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;
-- -----------------------------------------------------
-- Table `sistemadeinventario`.`marca`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`marca` (
`id` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(20) NULL DEFAULT NULL,
`status` INT NULL DEFAULT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;
-- -----------------------------------------------------
@ -84,20 +99,31 @@ ENGINE = InnoDB;
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`provedor` (
`id` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(20) NULL,
`direccion` VARCHAR(20) NULL,
`correo` VARCHAR(15) NULL,
`telefono` VARCHAR(10) NULL,
`status` INT NULL,
`nombre` VARCHAR(20) NULL DEFAULT NULL,
`direccion` VARCHAR(20) NULL DEFAULT NULL,
`correo` VARCHAR(15) NULL DEFAULT NULL,
`telefono` VARCHAR(10) NULL DEFAULT NULL,
`status` INT NULL DEFAULT NULL,
`estado_idestado` INT NOT NULL,
PRIMARY KEY (`id`),
INDEX `fk_provedor_estado1_idx` (`estado_idestado` ASC) VISIBLE,
CONSTRAINT `fk_provedor_estado1`
FOREIGN KEY (`estado_idestado`)
REFERENCES `sistemadeinventario`.`estado` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
REFERENCES `sistemadeinventario`.`estado` (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;
-- -----------------------------------------------------
-- Table `sistemadeinventario`.`tipo`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`tipo` (
`id` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(20) NULL DEFAULT NULL,
`status` INT NULL DEFAULT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;
-- -----------------------------------------------------
@ -105,17 +131,17 @@ ENGINE = InnoDB;
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`producto` (
`id` INT NOT NULL AUTO_INCREMENT,
`cantidad` VARCHAR(10) NULL,
`nombre` VARCHAR(20) NULL,
`precio` INT NULL,
`codigoBarras` VARCHAR(15) NULL,
`medida` INT NULL,
`lote` VARCHAR(10) NULL,
`cantidad` VARCHAR(10) NULL DEFAULT NULL,
`nombre` VARCHAR(20) NULL DEFAULT NULL,
`precio` INT NULL DEFAULT NULL,
`codigoBarras` VARCHAR(15) NULL DEFAULT NULL,
`medida` INT NULL DEFAULT NULL,
`lote` VARCHAR(10) NULL DEFAULT NULL,
`departamento_id` INT NOT NULL,
`tipo_idtipo` INT NOT NULL,
`marca_idmarca` INT NOT NULL,
`provedor_idprovedor` INT NOT NULL,
`status` INT NULL,
`status` INT NULL DEFAULT NULL,
PRIMARY KEY (`id`),
INDEX `fk_producto_departamento_idx` (`departamento_id` ASC) VISIBLE,
INDEX `fk_producto_tipo1_idx` (`tipo_idtipo` ASC) VISIBLE,
@ -123,25 +149,18 @@ CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`producto` (
INDEX `fk_producto_provedor1_idx` (`provedor_idprovedor` ASC) VISIBLE,
CONSTRAINT `fk_producto_departamento`
FOREIGN KEY (`departamento_id`)
REFERENCES `sistemadeinventario`.`departamento` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_producto_tipo1`
FOREIGN KEY (`tipo_idtipo`)
REFERENCES `sistemadeinventario`.`tipo` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
REFERENCES `sistemadeinventario`.`departamento` (`id`),
CONSTRAINT `fk_producto_marca1`
FOREIGN KEY (`marca_idmarca`)
REFERENCES `sistemadeinventario`.`marca` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
REFERENCES `sistemadeinventario`.`marca` (`id`),
CONSTRAINT `fk_producto_provedor1`
FOREIGN KEY (`provedor_idprovedor`)
REFERENCES `sistemadeinventario`.`provedor` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
REFERENCES `sistemadeinventario`.`provedor` (`id`),
CONSTRAINT `fk_producto_tipo1`
FOREIGN KEY (`tipo_idtipo`)
REFERENCES `sistemadeinventario`.`tipo` (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;
-- -----------------------------------------------------
@ -149,9 +168,11 @@ ENGINE = InnoDB;
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`rol` (
`id` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(20) NULL,
`nombre` VARCHAR(20) NULL DEFAULT NULL,
`status` INT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;
-- -----------------------------------------------------
@ -159,32 +180,29 @@ ENGINE = InnoDB;
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `sistemadeinventario`.`usuario` (
`id` INT NOT NULL AUTO_INCREMENT,
`nombre` VARCHAR(45) NULL,
`sexo` CHAR NULL,
`telefono` VARCHAR(10) NULL,
`correo` VARCHAR(20) NULL,
`direccion` VARCHAR(40) NULL,
`status` INT NULL,
`npila` VARCHAR(15) NULL,
`username` VARCHAR(20) NULL,
`rutafoto` VARCHAR(100) NULL,
`nombre` VARCHAR(45) NULL DEFAULT NULL,
`sexo` CHAR(1) NULL DEFAULT NULL,
`telefono` VARCHAR(10) NULL DEFAULT NULL,
`correo` VARCHAR(20) NULL DEFAULT NULL,
`direccion` VARCHAR(40) NULL DEFAULT NULL,
`status` INT NULL DEFAULT NULL,
`npila` VARCHAR(15) NULL DEFAULT NULL,
`username` VARCHAR(20) NULL DEFAULT NULL,
`rol_idrol` INT NOT NULL,
`estado_idestado` INT NOT NULL,
PRIMARY KEY (`id`),
INDEX `fk_usuario_rol1_idx` (`rol_idrol` ASC) VISIBLE,
INDEX `fk_usuario_estado1_idx` (`estado_idestado` ASC) VISIBLE,
CONSTRAINT `fk_usuario_rol1`
FOREIGN KEY (`rol_idrol`)
REFERENCES `sistemadeinventario`.`rol` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_usuario_estado1`
FOREIGN KEY (`estado_idestado`)
REFERENCES `sistemadeinventario`.`estado` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
REFERENCES `sistemadeinventario`.`estado` (`id`),
CONSTRAINT `fk_usuario_rol1`
FOREIGN KEY (`rol_idrol`)
REFERENCES `sistemadeinventario`.`rol` (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb3;
USE `sistemadeinventario` ;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;

3
si-ejb/src/java/hola/BL/UsuarioBL.java

@ -87,10 +87,13 @@ public class UsuarioBL implements UsuarioBLLocal {
// Validar que los campos requeridos no estén vacíos
if (usuario.getNombre().isEmpty()
|| usuario.getSexo()== null
|| usuario.getNombre().isEmpty()
|| usuario.getTelefono().isEmpty()
|| usuario.getCorreo().isEmpty()
|| usuario.getDireccion().isEmpty()
|| usuario.getNpila().isEmpty()
|| usuario.getUsername().isEmpty()
|| usuario.getStatus() == null) {
// Enviar mensaje de error si algún campo está incompleto

Loading…
Cancel
Save