north-glass-erp/.idea/dataSources.local.xml
@@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="dataSourceStorageLocal" created-in="IU-232.8660.185"> <data-source name="@localhost" uuid="521b6701-da00-48a8-bf4f-cf6bbb7d685d"> <component name="dataSourceStorageLocal" created-in="IU-232.9559.62"> <data-source name="@localhost [2]" uuid="165c5447-d19a-4aaf-af5f-cee92ae696c2"> <database-info product="MySQL" version="8.0.22" jdbc-version="4.2" driver-name="MySQL Connector/J" driver-version="mysql-connector-java-8.0.25 (Revision: 08be9e9b4cba6aa115f9b27b215887af40b159e0)" dbms="MYSQL" exact-version="8.0.22" exact-driver-version="8.0"> <extra-name-characters>#@</extra-name-characters> <identifier-quote-string>`</identifier-quote-string> @@ -13,15 +13,13 @@ <introspection-scope> <node kind="schema"> <name qname="@" /> <name qname="erp_sd" /> <name qname="erp_user_info" /> <name qname="mm" /> <name qname="pp" /> <name qname="sd" /> </node> </introspection-scope> </schema-mapping> </data-source> <data-source name="@10.153.19.150" uuid="2f24a638-142d-4401-9e71-359f1be8d502"> <data-source name="@10.153.19.150" uuid="1becdbe6-0c8e-40b3-a9c0-8b2c968172ca"> <database-info product="MySQL" version="8.0.19" jdbc-version="4.2" driver-name="MySQL Connector/J" driver-version="mysql-connector-java-8.0.25 (Revision: 08be9e9b4cba6aa115f9b27b215887af40b159e0)" dbms="MYSQL" exact-version="8.0.19" exact-driver-version="8.0"> <extra-name-characters>#@</extra-name-characters> <identifier-quote-string>`</identifier-quote-string> @@ -32,7 +30,6 @@ <schema-mapping> <introspection-scope> <node kind="schema"> <name qname="@" /> <name qname="erp_user_info" /> <name qname="mm" /> <name qname="pp" /> north-glass-erp/.idea/dataSources.xml
@@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="DataSourceManagerImpl" format="xml" multifile-model="true"> <data-source source="LOCAL" name="@localhost" uuid="521b6701-da00-48a8-bf4f-cf6bbb7d685d"> <data-source source="LOCAL" name="@localhost [2]" uuid="165c5447-d19a-4aaf-af5f-cee92ae696c2"> <driver-ref>mysql.8</driver-ref> <synchronize>true</synchronize> <jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver> <jdbc-url>jdbc:mysql://localhost:3306</jdbc-url> <working-dir>$ProjectFileDir$</working-dir> </data-source> <data-source source="LOCAL" name="@10.153.19.150" uuid="2f24a638-142d-4401-9e71-359f1be8d502"> <data-source source="LOCAL" name="@10.153.19.150" uuid="1becdbe6-0c8e-40b3-a9c0-8b2c968172ca"> <driver-ref>mysql.8</driver-ref> <synchronize>true</synchronize> <jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver> north-glass-erp/northglass-erp/src/views/sd/product/SelectProduct.vue
@@ -14,20 +14,32 @@ let router=useRouter() //监听玻璃类型改变 let productList = ref([]) let date=ref(['','']) let glassType = ref([]) watch(productGlassTypeStore,(newVal,oldVal) => { request.post("/product/1/100/"+productGlassTypeStore.GlassType,filterData.value).then((res) => { }) const getProduct = () => { request.post(`/product/1/100/${productGlassTypeStore.GlassType}`,filterData.value).then((res) => { if(res.code==200){ xGrid.value.loadData(res.data) pageTotal.value=res.data.total xGrid.value.loadData(res.data.data) gridOptions.loading=false }else{ ElMessage.warning(res.msg) } }) } }) //定义滚动条高度 let scrollTop =ref(null) let scrollHeight =ref(null) let clientHeight =ref(null) @@ -37,13 +49,17 @@ scrollHeight.value = row.$event.target.scrollHeight clientHeight.value = row.$event.target.clientHeight } //筛选条件,有外键需要先定义明细里面的数据 let filterData = ref({ basicGlassType:{ typeName:'' } }) //定义页面总页数 let pageTotal=ref('') //定义数据返回结果 let produceList = ref([]) //定义当前页数 let pageNum=$ref(1) let pageState = null //监听产品滚动条状态,滚动到底部向后端请求数据 @@ -63,7 +79,13 @@ if(produceList.length===500 && pageNum<(produceList.length/100)){ pageNum=pageNum+5 }else{ //判断是否是最大页面 if (pageNum>=pageTotal.value){ //ElMessage.warning("没有更多数据了") return } pageNum=pageNum+1 } pageState=true } @@ -84,12 +106,12 @@ try{ if(res.code==200){ if(pageState){ produceList = produceList.concat(res.data) produceList = produceList.concat(res.data.data) if(produceList.length>500){ produceList=produceList.slice(100,600) } }else{ produceList = res.data.concat(produceList) produceList = res.data.data.concat(produceList) if(produceList.length>500){ produceList=produceList.slice(0,500) } @@ -109,9 +131,14 @@ }) //第一次加载数据 request.post("/product/1/100/"+productGlassTypeStore.GlassType,filterData.value).then((res) => { if(res.code==200){ produceList = produceList.value.concat(deepClone(res.data)) console.log(res.data.data) pageTotal.value=res.data.total produceList = produceList.value.concat(deepClone(res.data.data)) xGrid.value.reloadData(produceList) gridOptions.loading=false }else{ @@ -123,7 +150,7 @@ const getTableRow = (row,type) =>{ /*const getTableRow = (row,type) =>{ switch (type) { case 'edit' : { router.push({path: '/main/product/createProduct', query: { id: row.id }}) @@ -134,7 +161,7 @@ break } } } }*/ // const getCheckList = (row) =>{ // alert('我接收到子组件传送的确认复选框信息可在控制台查看') @@ -197,8 +224,9 @@ return[ columns.map((column, columnIndex) => { if (columnIndex === 0) { return '页数:' return `页数:${pageNum}/${pageTotal.value}` } return '' }) ] @@ -206,7 +234,50 @@ }) //表格拖拽 /*使用筛选,后端获取数据*/ const changeFilterEvent = (event, option, $panel,) => { // 手动触发筛选 $panel.changeOption(event, !!option.data, option) } function filterChanged(column){ gridOptions.loading=true //筛选条件发生变化条件发生变化 let value = column.datas[0]!=undefined?column.datas[0]:'' value = value.trim() //判断是否存在外键 if (column.property.indexOf('.')>-1){ const columnArr = column.property.split('.') filterData.value[columnArr[0]] = { [columnArr[1]]:value } }else{ filterData.value[column.property] = value } request.post("/product/1/100/"+productGlassTypeStore.GlassType,filterData.value).then((res) => { if(res.code==200){ pageTotal.value=res.data.total pageNum=1 produceList = deepClone(res.data.data) xGrid.value.loadData(produceList) gridOptions.loading=false }else{ ElMessage.warning(res.msg) } }) } /*后端返回结果多层嵌套展示*/ const hasDecimal = (value) => { const regex = /\./; // 定义正则表达式,查找小数点 return regex.test(value); // 返回true/false } /*表格拖拽*/ let sortable2: any const columnDrop2 = () => { @@ -257,39 +328,6 @@ } }) const changeFilterEvent = (event, option, $panel,) => { // 手动触发筛选 $panel.changeOption(event, !!option.data, option) } function filterChanged(column){ gridOptions.loading=true //筛选条件发生变化条件发生变化 let value = column.datas[0]!=undefined?column.datas[0]:'' value = value.trim() //判断是否存在外键 if (column.property.indexOf('.')>-1){ const columnArr = column.property.split('.') filterData.value[columnArr[0]] = { [columnArr[1]]:value } }else{ filterData.value[column.property] = value } request.post("/product/1/100/"+productGlassTypeStore.GlassType,filterData.value).then((res) => { if(res.code==200){ produceList = deepClone(res.data) xGrid.value.loadData(produceList) gridOptions.loading=false }else{ ElMessage.warning(res.msg) } }) } const hasDecimal = (value) => { const regex = /\./; // 定义正则表达式,查找小数点 return regex.test(value); // 返回true/false } </script> @@ -298,6 +336,7 @@ <div style="width: 100%;height: 100%"> <glass-type style="float: left" /> <el-button @click="getProduct" id="select" type="primary" :icon="Search">查询</el-button> north-glass-erp/src/main/java/com/example/erp/ErpApplication.java
@@ -4,10 +4,14 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cache.annotation.EnableCaching; import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.Transactional; //springboot 启动入口 @SpringBootApplication @EnableCaching @EnableTransactionManagement//事务注解 //@Transactional//在service里面有多表操作,开启事务注解 public class ErpApplication { public static void main(String[] args) { SpringApplication.run(ErpApplication.class, args); north-glass-erp/src/main/java/com/example/erp/controller/sd/ProductController.java
@@ -17,7 +17,6 @@ @PostMapping ("/{pageNum}/{pageSize}/{glassType}") public Result defaultDateProduct(@PathVariable Integer pageNum, @PathVariable Integer pageSize, @PathVariable List<String> glassType, @RequestBody Product product){ return Result.seccess(productService.defaultDateProduct(pageNum,pageSize,glassType,product)); } } north-glass-erp/src/main/java/com/example/erp/mapper/sd/ProductMapper.java
@@ -12,4 +12,6 @@ @Param("pageSize") Integer pageSiz, @Param("glassTypeId") String glassTypeId, @Param("product") Product product); Integer getPageTotal(Integer offset, Integer pageSize, String glassTypeId, Product product); } north-glass-erp/src/main/java/com/example/erp/service/sd/ProductService.java
@@ -22,9 +22,10 @@ glassTypeId = glassType.get(1); } Map<String,Object> map = new HashMap<>(); map.put("list",productMapper.defaultProduct(offset,pageSize,glassTypeId,product)); map.put("pageNum",pageNum); map.put("data",productMapper.defaultProduct(offset,pageSize,glassTypeId,product)); map.put("total",productMapper.getPageTotal(offset,pageSize,glassTypeId,product)); return map; } } north-glass-erp/src/main/java/com/example/erp/service/userInfo/UserService.java
@@ -13,6 +13,7 @@ import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; @@ -54,7 +55,7 @@ return userMapper.getUserByID(userId); } @Transactional public User register(User user) { User returnUser = new User(); if(userMapper.register(user)){ north-glass-erp/src/main/resources/mapper/sd/Product.xml
@@ -3,13 +3,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.example.erp.mapper.sd.ProductMapper"> <resultMap id="productmap" type="com.example.erp.entity.sd.Product" > <resultMap id="productMap" type="com.example.erp.entity.sd.Product" > <id column="id" property="id"/> <<<<<<< HEAD <result column="product_name" property="productName"/> ======= <result column="product" property="product"/> >>>>>>> 2bf272a9d41a2b6c67910b23371af9537a9153a5 <result column="product" property="productName"/> <result column="total_thickness" property="totalThickness"/> <result column="thickness" property="thickness"/> <result column="query" property="query"/> @@ -18,22 +15,19 @@ <result column="creator" property="creator"/> <result column="create_time" property="createTime"/> <result column="update_time" property="updateTime"/> <<<<<<< HEAD <!--接收其他外键实体类数据--> <association property="basicGlassType" javaType="com.example.erp.entity.sd.BasicGlassType"> <result column="type_id" property="typeID"/> ======= <association property="glassType" javaType="com.example.erp.entity.sd.GlassType"> <result column="type_id" property="typeId"/> >>>>>>> 2bf272a9d41a2b6c67910b23371af9537a9153a5 <result column="type_name" property="typeName"/> </association> <!--<result column="g_typeId" property="glassTypes.typeId"/> <result column="g_type" property="glassTypes.type"/>--> </resultMap> <select id="defaultProduct" resultMap="productmap"> select a.id as id, <select id="defaultProduct" resultMap="productMap"> select a.id , a.product_name, a.total_thickness, a.thickness, @@ -75,4 +69,38 @@ limit #{offset},#{pageSize} ; </select> <select id="getPageTotal" > select CEILING(count(a.id)/#{pageSize}) from product as a left join basic_glass_type bgt on bgt.type_id = a.type_id <where> <if test="glassTypeId != null and glassTypeId != ''"> and a.type_id regexp #{glassTypeId} </if> <if test="product.id != null and product.id != ''"> and a.id regexp #{product.id} </if> <if test="product.productName != null and product.productName != ''"> and a.product_name regexp #{product.productName} </if> <if test="product.basicGlassType.typeName != null and product.basicGlassType.typeName!= ''"> and bgt.type_name regexp #{product.basicGlassType.typeName} </if> <if test="product.query != null and product.query != ''"> and a.query regexp #{product.query} </if> <if test="product.creator != null and product.creator != ''"> and a.creator regexp #{product.creator} </if> <if test="product.createTime != null and product.createTime != ''"> and date(a.create_time) regexp #{product.createTime} </if> </where> order by a.id desc limit #{offset},#{pageSize} ; </select> </mapper> north-glass-erp/target/classes/mapper/mm/FinishedGoodsInventory.xml
north-glass-erp/target/classes/mapper/mm/FinishedOperateLog.xml
north-glass-erp/target/classes/mapper/sd/Product.xml
@@ -3,13 +3,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.example.erp.mapper.sd.ProductMapper"> <resultMap id="productmap" type="com.example.erp.entity.sd.Product" > <resultMap id="productMap" type="com.example.erp.entity.sd.Product" > <id column="id" property="id"/> <<<<<<< HEAD <result column="product_name" property="productName"/> ======= <result column="product" property="product"/> >>>>>>> 2bf272a9d41a2b6c67910b23371af9537a9153a5 <result column="product" property="productName"/> <result column="total_thickness" property="totalThickness"/> <result column="thickness" property="thickness"/> <result column="query" property="query"/> @@ -18,13 +15,8 @@ <result column="creator" property="creator"/> <result column="create_time" property="createTime"/> <result column="update_time" property="updateTime"/> <<<<<<< HEAD <association property="basicGlassType" javaType="com.example.erp.entity.sd.BasicGlassType"> <result column="type_id" property="typeID"/> ======= <association property="glassType" javaType="com.example.erp.entity.sd.GlassType"> <result column="type_id" property="typeId"/> >>>>>>> 2bf272a9d41a2b6c67910b23371af9537a9153a5 <result column="type_name" property="typeName"/> </association> <!--<result column="g_typeId" property="glassTypes.typeId"/> @@ -32,8 +24,8 @@ </resultMap> <select id="defaultProduct" resultMap="productmap"> select a.id as id, <select id="defaultProduct" resultMap="productMap"> select a.id , a.product_name, a.total_thickness, a.thickness, @@ -75,4 +67,38 @@ limit #{offset},#{pageSize} ; </select> <select id="getPageTotal" > select CEILING(count(a.id)/#{pageSize}) from product as a left join basic_glass_type bgt on bgt.type_id = a.type_id <where> <if test="glassTypeId != null and glassTypeId != ''"> and a.type_id regexp #{glassTypeId} </if> <if test="product.id != null and product.id != ''"> and a.id regexp #{product.id} </if> <if test="product.productName != null and product.productName != ''"> and a.product_name regexp #{product.productName} </if> <if test="product.basicGlassType.typeName != null and product.basicGlassType.typeName!= ''"> and bgt.type_name regexp #{product.basicGlassType.typeName} </if> <if test="product.query != null and product.query != ''"> and a.query regexp #{product.query} </if> <if test="product.creator != null and product.creator != ''"> and a.creator regexp #{product.creator} </if> <if test="product.createTime != null and product.createTime != ''"> and date(a.create_time) regexp #{product.createTime} </if> </where> order by a.id desc limit #{offset},#{pageSize} ; </select> </mapper>