记账本

This commit is contained in:
shuo.wang
2025-03-31 10:14:10 +08:00
parent 4e919f0172
commit ae381ea81a
14 changed files with 512 additions and 3 deletions

View File

@@ -0,0 +1,36 @@
package com.cool.store.dao;
import com.cool.store.entity.TallyBookDO;
import com.cool.store.mapper.TallyBookMapper;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.entity.Example;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author: WangShuo
* @Date: 2025/03/28/09:50
* @Version 1.0
* @注释:
*/
@Repository
public class TallyBookDAO {
@Resource
private TallyBookMapper tallyBookMapper;
public Long insertSelective(TallyBookDO tallyBookDO) {
tallyBookMapper.insertSelective(tallyBookDO);
return tallyBookDO.getId();
}
public Long updateByPrimaryKeySelective(TallyBookDO tallyBookDO) {
tallyBookMapper.updateByPrimaryKeySelective(tallyBookDO);
return tallyBookDO.getId();
}
public List<TallyBookDO> getTallyBookListByShopIdAndYear(Long shopId,Integer year) {
Example example = new Example(TallyBookDO.class);
example.createCriteria().andEqualTo("shopId",shopId).andEqualTo("year",year);
return tallyBookMapper.selectByExample(example);
}
}

View File

@@ -0,0 +1,13 @@
package com.cool.store.mapper;
import com.cool.store.entity.TallyBookDO;
import tk.mybatis.mapper.common.Mapper;
/**
* @Author: WangShuo
* @Date: 2025/03/28/09:45
* @Version 1.0
* @注释:
*/
public interface TallyBookMapper extends Mapper<TallyBookDO> {
}

View File

@@ -28,6 +28,8 @@
<result column="district" jdbcType="VARCHAR" property="district" />
<result column="township" jdbcType="VARCHAR" property="township" />
<result column="storage_status" jdbcType="TINYINT" property="storageStatus" />
<result column="opportunity_point_code" jdbcType="VARCHAR" property="opportunityPointCode" />
<result column="opportunity_point_name" jdbcType="VARCHAR" property="opportunityPointName" />
</resultMap>
<sql id="allColumn">

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!--mybatis-3-mapper.dtd:约束文件的名称限制和检查在当前文件中出现的标签和属性符合mybatis的要求-->
<!--namespace命名空间要有唯一的值要求使用dao接口的权限定名称一个dao接口对应一个mappernamespace指明对应哪个dao接口-->
<mapper namespace="com.cool.store.mapper.TallyBookMapper">
<!-- 所有的数据库操作都要写在mapper标签中可以使用特定的标签表示数据库中的特定操作 -->
<resultMap id="BaseResultMap" type="com.cool.store.entity.TallyBookDO">
<!-- 主键字段 -->
<id property="id" column="id" jdbcType="BIGINT" />
<!-- 普通字段 -->
<result property="partnerId" column="partner_id" jdbcType="VARCHAR" />
<result property="shopId" column="shop_id" jdbcType="BIGINT" />
<result property="year" column="year" jdbcType="INTEGER" />
<result property="month" column="month" jdbcType="INTEGER" />
<result property="employeeSalary" column="employee_salary" jdbcType="DECIMAL" />
<result property="administrativeExpenses" column="administrative_expenses" jdbcType="DECIMAL" />
<result property="travelExpense" column="travel_expense" jdbcType="DECIMAL" />
<result property="promotionExpense" column="promotion_expense" jdbcType="DECIMAL" />
<result property="utilities" column="utilities" jdbcType="DECIMAL" />
<result property="socialInsurancePremium" column="social_insurance_premium" jdbcType="DECIMAL" />
<result property="staffDormitoryFee" column="staff_dormitory_fee" jdbcType="DECIMAL" />
<result property="consumablesCost" column="consumables_cost" jdbcType="DECIMAL" />
<result property="totalCost" column="total_cost" jdbcType="DECIMAL" />
<result property="createTime" column="create_time" jdbcType="TIMESTAMP" />
<result property="createUser" column="create_user" jdbcType="VARCHAR" />
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP" />
<result property="updateUser" column="update_user" jdbcType="VARCHAR" />
<result property="status" column="status" jdbcType="TINYINT"/>
</resultMap>
</mapper>